compat.js.uncompressed.js 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. /*
  7. This is an optimized version of Dojo, built for deployment and not for
  8. development. To get sources and documentation, please visit:
  9. http://dojotoolkit.org
  10. */
  11. if(!dojo._hasResource["dojo.uacss"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  12. dojo._hasResource["dojo.uacss"] = true;
  13. dojo.provide("dojo.uacss");
  14. (function(){
  15. // summary:
  16. // Applies pre-set CSS classes to the top-level HTML node, based on:
  17. // - browser (ex: dj_ie)
  18. // - browser version (ex: dj_ie6)
  19. // - box model (ex: dj_contentBox)
  20. // - text direction (ex: dijitRtl)
  21. //
  22. // In addition, browser, browser version, and box model are
  23. // combined with an RTL flag when browser text is RTL. ex: dj_ie-rtl.
  24. var d = dojo,
  25. html = d.doc.documentElement,
  26. ie = d.isIE,
  27. opera = d.isOpera,
  28. maj = Math.floor,
  29. ff = d.isFF,
  30. boxModel = d.boxModel.replace(/-/,''),
  31. classes = {
  32. dj_quirks: d.isQuirks,
  33. // NOTE: Opera not supported by dijit
  34. dj_opera: opera,
  35. dj_khtml: d.isKhtml,
  36. dj_webkit: d.isWebKit,
  37. dj_safari: d.isSafari,
  38. dj_chrome: d.isChrome,
  39. dj_gecko: d.isMozilla
  40. }; // no dojo unsupported browsers
  41. if(ie){
  42. classes["dj_ie"] = true;
  43. classes["dj_ie" + maj(ie)] = true;
  44. classes["dj_iequirks"] = d.isQuirks;
  45. }
  46. if(ff){
  47. classes["dj_ff" + maj(ff)] = true;
  48. }
  49. classes["dj_" + boxModel] = true;
  50. // apply browser, browser version, and box model class names
  51. var classStr = "";
  52. for(var clz in classes){
  53. if(classes[clz]){
  54. classStr += clz + " ";
  55. }
  56. }
  57. html.className = d.trim(html.className + " " + classStr);
  58. // If RTL mode, then add dj_rtl flag plus repeat existing classes with -rtl extension.
  59. // We can't run the code below until the <body> tag has loaded (so we can check for dir=rtl).
  60. // Unshift() is to run sniff code before the parser.
  61. dojo._loaders.unshift(function(){
  62. if(!dojo._isBodyLtr()){
  63. var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ")
  64. html.className = d.trim(html.className + " " + rtlClassStr);
  65. }
  66. });
  67. })();
  68. }
  69. if(!dojo._hasResource["dijit._base.sniff"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  70. dojo._hasResource["dijit._base.sniff"] = true;
  71. dojo.provide("dijit._base.sniff");
  72. // summary:
  73. // Applies pre-set CSS classes to the top-level HTML node, see
  74. // `dojo.uacss` for details.
  75. //
  76. // Simply doing a require on this module will
  77. // establish this CSS. Modified version of Morris' CSS hack.
  78. }
  79. if(!dojo._hasResource["dojo.fx.Toggler"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  80. dojo._hasResource["dojo.fx.Toggler"] = true;
  81. dojo.provide("dojo.fx.Toggler");
  82. dojo.declare("dojo.fx.Toggler", null, {
  83. // summary:
  84. // A simple `dojo.Animation` toggler API.
  85. //
  86. // description:
  87. // class constructor for an animation toggler. It accepts a packed
  88. // set of arguments about what type of animation to use in each
  89. // direction, duration, etc. All available members are mixed into
  90. // these animations from the constructor (for example, `node`,
  91. // `showDuration`, `hideDuration`).
  92. //
  93. // example:
  94. // | var t = new dojo.fx.Toggler({
  95. // | node: "nodeId",
  96. // | showDuration: 500,
  97. // | // hideDuration will default to "200"
  98. // | showFunc: dojo.fx.wipeIn,
  99. // | // hideFunc will default to "fadeOut"
  100. // | });
  101. // | t.show(100); // delay showing for 100ms
  102. // | // ...time passes...
  103. // | t.hide();
  104. // node: DomNode
  105. // the node to target for the showing and hiding animations
  106. node: null,
  107. // showFunc: Function
  108. // The function that returns the `dojo.Animation` to show the node
  109. showFunc: dojo.fadeIn,
  110. // hideFunc: Function
  111. // The function that returns the `dojo.Animation` to hide the node
  112. hideFunc: dojo.fadeOut,
  113. // showDuration:
  114. // Time in milliseconds to run the show Animation
  115. showDuration: 200,
  116. // hideDuration:
  117. // Time in milliseconds to run the hide Animation
  118. hideDuration: 200,
  119. // FIXME: need a policy for where the toggler should "be" the next
  120. // time show/hide are called if we're stopped somewhere in the
  121. // middle.
  122. // FIXME: also would be nice to specify individual showArgs/hideArgs mixed into
  123. // each animation individually.
  124. // FIXME: also would be nice to have events from the animations exposed/bridged
  125. /*=====
  126. _showArgs: null,
  127. _showAnim: null,
  128. _hideArgs: null,
  129. _hideAnim: null,
  130. _isShowing: false,
  131. _isHiding: false,
  132. =====*/
  133. constructor: function(args){
  134. var _t = this;
  135. dojo.mixin(_t, args);
  136. _t.node = args.node;
  137. _t._showArgs = dojo.mixin({}, args);
  138. _t._showArgs.node = _t.node;
  139. _t._showArgs.duration = _t.showDuration;
  140. _t.showAnim = _t.showFunc(_t._showArgs);
  141. _t._hideArgs = dojo.mixin({}, args);
  142. _t._hideArgs.node = _t.node;
  143. _t._hideArgs.duration = _t.hideDuration;
  144. _t.hideAnim = _t.hideFunc(_t._hideArgs);
  145. dojo.connect(_t.showAnim, "beforeBegin", dojo.hitch(_t.hideAnim, "stop", true));
  146. dojo.connect(_t.hideAnim, "beforeBegin", dojo.hitch(_t.showAnim, "stop", true));
  147. },
  148. show: function(delay){
  149. // summary: Toggle the node to showing
  150. // delay: Integer?
  151. // Ammount of time to stall playing the show animation
  152. return this.showAnim.play(delay || 0);
  153. },
  154. hide: function(delay){
  155. // summary: Toggle the node to hidden
  156. // delay: Integer?
  157. // Ammount of time to stall playing the hide animation
  158. return this.hideAnim.play(delay || 0);
  159. }
  160. });
  161. }
  162. if(!dojo._hasResource["dojo.fx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  163. dojo._hasResource["dojo.fx"] = true;
  164. dojo.provide("dojo.fx");
  165. /*=====
  166. dojo.fx = {
  167. // summary: Effects library on top of Base animations
  168. };
  169. =====*/
  170. (function(){
  171. var d = dojo,
  172. _baseObj = {
  173. _fire: function(evt, args){
  174. if(this[evt]){
  175. this[evt].apply(this, args||[]);
  176. }
  177. return this;
  178. }
  179. };
  180. var _chain = function(animations){
  181. this._index = -1;
  182. this._animations = animations||[];
  183. this._current = this._onAnimateCtx = this._onEndCtx = null;
  184. this.duration = 0;
  185. d.forEach(this._animations, function(a){
  186. this.duration += a.duration;
  187. if(a.delay){ this.duration += a.delay; }
  188. }, this);
  189. };
  190. d.extend(_chain, {
  191. _onAnimate: function(){
  192. this._fire("onAnimate", arguments);
  193. },
  194. _onEnd: function(){
  195. d.disconnect(this._onAnimateCtx);
  196. d.disconnect(this._onEndCtx);
  197. this._onAnimateCtx = this._onEndCtx = null;
  198. if(this._index + 1 == this._animations.length){
  199. this._fire("onEnd");
  200. }else{
  201. // switch animations
  202. this._current = this._animations[++this._index];
  203. this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
  204. this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
  205. this._current.play(0, true);
  206. }
  207. },
  208. play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
  209. if(!this._current){ this._current = this._animations[this._index = 0]; }
  210. if(!gotoStart && this._current.status() == "playing"){ return this; }
  211. var beforeBegin = d.connect(this._current, "beforeBegin", this, function(){
  212. this._fire("beforeBegin");
  213. }),
  214. onBegin = d.connect(this._current, "onBegin", this, function(arg){
  215. this._fire("onBegin", arguments);
  216. }),
  217. onPlay = d.connect(this._current, "onPlay", this, function(arg){
  218. this._fire("onPlay", arguments);
  219. d.disconnect(beforeBegin);
  220. d.disconnect(onBegin);
  221. d.disconnect(onPlay);
  222. });
  223. if(this._onAnimateCtx){
  224. d.disconnect(this._onAnimateCtx);
  225. }
  226. this._onAnimateCtx = d.connect(this._current, "onAnimate", this, "_onAnimate");
  227. if(this._onEndCtx){
  228. d.disconnect(this._onEndCtx);
  229. }
  230. this._onEndCtx = d.connect(this._current, "onEnd", this, "_onEnd");
  231. this._current.play.apply(this._current, arguments);
  232. return this;
  233. },
  234. pause: function(){
  235. if(this._current){
  236. var e = d.connect(this._current, "onPause", this, function(arg){
  237. this._fire("onPause", arguments);
  238. d.disconnect(e);
  239. });
  240. this._current.pause();
  241. }
  242. return this;
  243. },
  244. gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
  245. this.pause();
  246. var offset = this.duration * percent;
  247. this._current = null;
  248. d.some(this._animations, function(a){
  249. if(a.duration <= offset){
  250. this._current = a;
  251. return true;
  252. }
  253. offset -= a.duration;
  254. return false;
  255. });
  256. if(this._current){
  257. this._current.gotoPercent(offset / this._current.duration, andPlay);
  258. }
  259. return this;
  260. },
  261. stop: function(/*boolean?*/ gotoEnd){
  262. if(this._current){
  263. if(gotoEnd){
  264. for(; this._index + 1 < this._animations.length; ++this._index){
  265. this._animations[this._index].stop(true);
  266. }
  267. this._current = this._animations[this._index];
  268. }
  269. var e = d.connect(this._current, "onStop", this, function(arg){
  270. this._fire("onStop", arguments);
  271. d.disconnect(e);
  272. });
  273. this._current.stop();
  274. }
  275. return this;
  276. },
  277. status: function(){
  278. return this._current ? this._current.status() : "stopped";
  279. },
  280. destroy: function(){
  281. if(this._onAnimateCtx){ d.disconnect(this._onAnimateCtx); }
  282. if(this._onEndCtx){ d.disconnect(this._onEndCtx); }
  283. }
  284. });
  285. d.extend(_chain, _baseObj);
  286. dojo.fx.chain = function(/*dojo.Animation[]*/ animations){
  287. // summary:
  288. // Chain a list of `dojo.Animation`s to run in sequence
  289. //
  290. // description:
  291. // Return a `dojo.Animation` which will play all passed
  292. // `dojo.Animation` instances in sequence, firing its own
  293. // synthesized events simulating a single animation. (eg:
  294. // onEnd of this animation means the end of the chain,
  295. // not the individual animations within)
  296. //
  297. // example:
  298. // Once `node` is faded out, fade in `otherNode`
  299. // | dojo.fx.chain([
  300. // | dojo.fadeIn({ node:node }),
  301. // | dojo.fadeOut({ node:otherNode })
  302. // | ]).play();
  303. //
  304. return new _chain(animations) // dojo.Animation
  305. };
  306. var _combine = function(animations){
  307. this._animations = animations||[];
  308. this._connects = [];
  309. this._finished = 0;
  310. this.duration = 0;
  311. d.forEach(animations, function(a){
  312. var duration = a.duration;
  313. if(a.delay){ duration += a.delay; }
  314. if(this.duration < duration){ this.duration = duration; }
  315. this._connects.push(d.connect(a, "onEnd", this, "_onEnd"));
  316. }, this);
  317. this._pseudoAnimation = new d.Animation({curve: [0, 1], duration: this.duration});
  318. var self = this;
  319. d.forEach(["beforeBegin", "onBegin", "onPlay", "onAnimate", "onPause", "onStop", "onEnd"],
  320. function(evt){
  321. self._connects.push(d.connect(self._pseudoAnimation, evt,
  322. function(){ self._fire(evt, arguments); }
  323. ));
  324. }
  325. );
  326. };
  327. d.extend(_combine, {
  328. _doAction: function(action, args){
  329. d.forEach(this._animations, function(a){
  330. a[action].apply(a, args);
  331. });
  332. return this;
  333. },
  334. _onEnd: function(){
  335. if(++this._finished > this._animations.length){
  336. this._fire("onEnd");
  337. }
  338. },
  339. _call: function(action, args){
  340. var t = this._pseudoAnimation;
  341. t[action].apply(t, args);
  342. },
  343. play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
  344. this._finished = 0;
  345. this._doAction("play", arguments);
  346. this._call("play", arguments);
  347. return this;
  348. },
  349. pause: function(){
  350. this._doAction("pause", arguments);
  351. this._call("pause", arguments);
  352. return this;
  353. },
  354. gotoPercent: function(/*Decimal*/percent, /*Boolean?*/ andPlay){
  355. var ms = this.duration * percent;
  356. d.forEach(this._animations, function(a){
  357. a.gotoPercent(a.duration < ms ? 1 : (ms / a.duration), andPlay);
  358. });
  359. this._call("gotoPercent", arguments);
  360. return this;
  361. },
  362. stop: function(/*boolean?*/ gotoEnd){
  363. this._doAction("stop", arguments);
  364. this._call("stop", arguments);
  365. return this;
  366. },
  367. status: function(){
  368. return this._pseudoAnimation.status();
  369. },
  370. destroy: function(){
  371. d.forEach(this._connects, dojo.disconnect);
  372. }
  373. });
  374. d.extend(_combine, _baseObj);
  375. dojo.fx.combine = function(/*dojo.Animation[]*/ animations){
  376. // summary:
  377. // Combine a list of `dojo.Animation`s to run in parallel
  378. //
  379. // description:
  380. // Combine an array of `dojo.Animation`s to run in parallel,
  381. // providing a new `dojo.Animation` instance encompasing each
  382. // animation, firing standard animation events.
  383. //
  384. // example:
  385. // Fade out `node` while fading in `otherNode` simultaneously
  386. // | dojo.fx.combine([
  387. // | dojo.fadeIn({ node:node }),
  388. // | dojo.fadeOut({ node:otherNode })
  389. // | ]).play();
  390. //
  391. // example:
  392. // When the longest animation ends, execute a function:
  393. // | var anim = dojo.fx.combine([
  394. // | dojo.fadeIn({ node: n, duration:700 }),
  395. // | dojo.fadeOut({ node: otherNode, duration: 300 })
  396. // | ]);
  397. // | dojo.connect(anim, "onEnd", function(){
  398. // | // overall animation is done.
  399. // | });
  400. // | anim.play(); // play the animation
  401. //
  402. return new _combine(animations); // dojo.Animation
  403. };
  404. dojo.fx.wipeIn = function(/*Object*/ args){
  405. // summary:
  406. // Expand a node to it's natural height.
  407. //
  408. // description:
  409. // Returns an animation that will expand the
  410. // node defined in 'args' object from it's current height to
  411. // it's natural height (with no scrollbar).
  412. // Node must have no margin/border/padding.
  413. //
  414. // args: Object
  415. // A hash-map of standard `dojo.Animation` constructor properties
  416. // (such as easing: node: duration: and so on)
  417. //
  418. // example:
  419. // | dojo.fx.wipeIn({
  420. // | node:"someId"
  421. // | }).play()
  422. var node = args.node = d.byId(args.node), s = node.style, o;
  423. var anim = d.animateProperty(d.mixin({
  424. properties: {
  425. height: {
  426. // wrapped in functions so we wait till the last second to query (in case value has changed)
  427. start: function(){
  428. // start at current [computed] height, but use 1px rather than 0
  429. // because 0 causes IE to display the whole panel
  430. o = s.overflow;
  431. s.overflow = "hidden";
  432. if(s.visibility == "hidden" || s.display == "none"){
  433. s.height = "1px";
  434. s.display = "";
  435. s.visibility = "";
  436. return 1;
  437. }else{
  438. var height = d.style(node, "height");
  439. return Math.max(height, 1);
  440. }
  441. },
  442. end: function(){
  443. return node.scrollHeight;
  444. }
  445. }
  446. }
  447. }, args));
  448. d.connect(anim, "onEnd", function(){
  449. s.height = "auto";
  450. s.overflow = o;
  451. });
  452. return anim; // dojo.Animation
  453. };
  454. dojo.fx.wipeOut = function(/*Object*/ args){
  455. // summary:
  456. // Shrink a node to nothing and hide it.
  457. //
  458. // description:
  459. // Returns an animation that will shrink node defined in "args"
  460. // from it's current height to 1px, and then hide it.
  461. //
  462. // args: Object
  463. // A hash-map of standard `dojo.Animation` constructor properties
  464. // (such as easing: node: duration: and so on)
  465. //
  466. // example:
  467. // | dojo.fx.wipeOut({ node:"someId" }).play()
  468. var node = args.node = d.byId(args.node), s = node.style, o;
  469. var anim = d.animateProperty(d.mixin({
  470. properties: {
  471. height: {
  472. end: 1 // 0 causes IE to display the whole panel
  473. }
  474. }
  475. }, args));
  476. d.connect(anim, "beforeBegin", function(){
  477. o = s.overflow;
  478. s.overflow = "hidden";
  479. s.display = "";
  480. });
  481. d.connect(anim, "onEnd", function(){
  482. s.overflow = o;
  483. s.height = "auto";
  484. s.display = "none";
  485. });
  486. return anim; // dojo.Animation
  487. };
  488. dojo.fx.slideTo = function(/*Object*/ args){
  489. // summary:
  490. // Slide a node to a new top/left position
  491. //
  492. // description:
  493. // Returns an animation that will slide "node"
  494. // defined in args Object from its current position to
  495. // the position defined by (args.left, args.top).
  496. //
  497. // args: Object
  498. // A hash-map of standard `dojo.Animation` constructor properties
  499. // (such as easing: node: duration: and so on). Special args members
  500. // are `top` and `left`, which indicate the new position to slide to.
  501. //
  502. // example:
  503. // | dojo.fx.slideTo({ node: node, left:"40", top:"50", units:"px" }).play()
  504. var node = args.node = d.byId(args.node),
  505. top = null, left = null;
  506. var init = (function(n){
  507. return function(){
  508. var cs = d.getComputedStyle(n);
  509. var pos = cs.position;
  510. top = (pos == 'absolute' ? n.offsetTop : parseInt(cs.top) || 0);
  511. left = (pos == 'absolute' ? n.offsetLeft : parseInt(cs.left) || 0);
  512. if(pos != 'absolute' && pos != 'relative'){
  513. var ret = d.position(n, true);
  514. top = ret.y;
  515. left = ret.x;
  516. n.style.position="absolute";
  517. n.style.top=top+"px";
  518. n.style.left=left+"px";
  519. }
  520. };
  521. })(node);
  522. init();
  523. var anim = d.animateProperty(d.mixin({
  524. properties: {
  525. top: args.top || 0,
  526. left: args.left || 0
  527. }
  528. }, args));
  529. d.connect(anim, "beforeBegin", anim, init);
  530. return anim; // dojo.Animation
  531. };
  532. })();
  533. }
  534. if(!dojo._hasResource["dojox.fx.flip"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  535. dojo._hasResource["dojox.fx.flip"] = true;
  536. dojo.provide("dojox.fx.flip");
  537. dojo.experimental("dojox.fx.flip");
  538. // because ShrinkSafe will eat this up:
  539. var borderConst = "border",
  540. widthConst = "Width",
  541. heightConst = "Height",
  542. topConst = "Top",
  543. rightConst = "Right",
  544. leftConst = "Left",
  545. bottomConst = "Bottom"
  546. ;
  547. dojox.fx.flip = function(/*Object*/ args){
  548. // summary: Animate a node flipping following a specific direction
  549. //
  550. // description:
  551. // Returns an animation that will flip the
  552. // node around a central axis:
  553. // if args.dir is "left" or "right" --> y axis
  554. // if args.dir is "top" or "bottom" --> x axis
  555. //
  556. // This effect is obtained using a border distorsion applied to a helper node.
  557. //
  558. // The user can specify three background colors for the helper node:
  559. // darkColor: the darkest color reached during the animation
  560. // lightColor: the brightest color
  561. // endColor: the final backgroundColor for the node
  562. //
  563. // depth: Float
  564. // 0 <= depth <= 1 overrides the computed "depth"
  565. // (0: min distorsion, 1: max distorsion)
  566. //
  567. // whichAnim: String
  568. // "first" : the first half animation
  569. // "last" : the second one
  570. // "both" (default) : both
  571. //
  572. // axis: String
  573. // "center" (default) : the node is flipped around his center
  574. // "shortside" : the node is flipped around his "short" (in perspective) side
  575. // "longside" : the node is flipped around his "long" (in perspective) side
  576. // "cube" : the node flips around the central axis of the cube
  577. //
  578. // shift: Integer
  579. // node translation, perpendicular to the rotation axis
  580. //
  581. // example:
  582. // | var anim = dojox.fx.flip({
  583. // | node: dojo.byId("nodeId"),
  584. // | dir: "top",
  585. // | darkColor: "#555555",
  586. // | lightColor: "#dddddd",
  587. // | endColor: "#666666",
  588. // | depth: .5,
  589. // | shift: 50,
  590. // | duration:300
  591. // | });
  592. var helperNode = dojo.create("div"),
  593. node = args.node = dojo.byId(args.node),
  594. s = node.style,
  595. dims = null,
  596. hs = null,
  597. pn = null,
  598. lightColor = args.lightColor || "#dddddd",
  599. darkColor = args.darkColor || "#555555",
  600. bgColor = dojo.style(node, "backgroundColor"),
  601. endColor = args.endColor || bgColor,
  602. staticProps = {},
  603. anims = [],
  604. duration = args.duration ? args.duration / 2 : 250,
  605. dir = args.dir || "left",
  606. pConst = .9,
  607. transparentColor = "transparent",
  608. whichAnim = args.whichAnim,
  609. axis = args.axis || "center",
  610. depth = args.depth
  611. ;
  612. // IE6 workaround: IE6 doesn't support transparent borders
  613. var convertColor = function(color){
  614. return ((new dojo.Color(color)).toHex() === "#000000") ? "#000001" : color;
  615. };
  616. if(dojo.isIE < 7){
  617. endColor = convertColor(endColor);
  618. lightColor = convertColor(lightColor);
  619. darkColor = convertColor(darkColor);
  620. bgColor = convertColor(bgColor);
  621. transparentColor = "black";
  622. helperNode.style.filter = "chroma(color='#000000')";
  623. }
  624. var init = (function(n){
  625. return function(){
  626. var ret = dojo.coords(n, true);
  627. dims = {
  628. top: ret.y,
  629. left: ret.x,
  630. width: ret.w,
  631. height: ret.h
  632. };
  633. }
  634. })(node);
  635. init();
  636. // helperNode initialization
  637. hs = {
  638. position: "absolute",
  639. top: dims["top"] + "px",
  640. left: dims["left"] + "px",
  641. height: "0",
  642. width: "0",
  643. zIndex: args.zIndex || (s.zIndex || 0),
  644. border: "0 solid " + transparentColor,
  645. fontSize: "0",
  646. visibility: "hidden"
  647. };
  648. var props = [ {},
  649. {
  650. top: dims["top"],
  651. left: dims["left"]
  652. }
  653. ];
  654. var dynProperties = {
  655. left: [leftConst, rightConst, topConst, bottomConst, widthConst, heightConst, "end" + heightConst + "Min", leftConst, "end" + heightConst + "Max"],
  656. right: [rightConst, leftConst, topConst, bottomConst, widthConst, heightConst, "end" + heightConst + "Min", leftConst, "end" + heightConst + "Max"],
  657. top: [topConst, bottomConst, leftConst, rightConst, heightConst, widthConst, "end" + widthConst + "Min", topConst, "end" + widthConst + "Max"],
  658. bottom: [bottomConst, topConst, leftConst, rightConst, heightConst, widthConst, "end" + widthConst + "Min", topConst, "end" + widthConst + "Max"]
  659. };
  660. // property names
  661. pn = dynProperties[dir];
  662. // .4 <= pConst <= .9
  663. if(typeof depth != "undefined"){
  664. depth = Math.max(0, Math.min(1, depth)) / 2;
  665. pConst = .4 + (.5 - depth);
  666. }else{
  667. pConst = Math.min(.9, Math.max(.4, dims[pn[5].toLowerCase()] / dims[pn[4].toLowerCase()]));
  668. }
  669. var p0 = props[0];
  670. for(var i = 4; i < 6; i++){
  671. if(axis == "center" || axis == "cube"){ // find a better name for "cube"
  672. dims["end" + pn[i] + "Min"] = dims[pn[i].toLowerCase()] * pConst;
  673. dims["end" + pn[i] + "Max"] = dims[pn[i].toLowerCase()] / pConst;
  674. }else if(axis == "shortside"){
  675. dims["end" + pn[i] + "Min"] = dims[pn[i].toLowerCase()];
  676. dims["end" + pn[i] + "Max"] = dims[pn[i].toLowerCase()] / pConst;
  677. }else if(axis == "longside"){
  678. dims["end" + pn[i] + "Min"] = dims[pn[i].toLowerCase()] * pConst;
  679. dims["end" + pn[i] + "Max"] = dims[pn[i].toLowerCase()];
  680. }
  681. }
  682. if(axis == "center"){
  683. p0[pn[2].toLowerCase()] = dims[pn[2].toLowerCase()] - (dims[pn[8]] - dims[pn[6]]) / 4;
  684. }else if(axis == "shortside"){
  685. p0[pn[2].toLowerCase()] = dims[pn[2].toLowerCase()] - (dims[pn[8]] - dims[pn[6]]) / 2;
  686. }
  687. staticProps[pn[5].toLowerCase()] = dims[pn[5].toLowerCase()] + "px";
  688. staticProps[pn[4].toLowerCase()] = "0";
  689. staticProps[borderConst + pn[1] + widthConst] = dims[pn[4].toLowerCase()] + "px";
  690. staticProps[borderConst + pn[1] + "Color"] = bgColor;
  691. p0[borderConst + pn[1] + widthConst] = 0;
  692. p0[borderConst + pn[1] + "Color"] = darkColor;
  693. p0[borderConst + pn[2] + widthConst] = p0[borderConst + pn[3] + widthConst] = axis != "cube"
  694. ? (dims["end" + pn[5] + "Max"] - dims["end" + pn[5] + "Min"]) / 2
  695. : dims[pn[6]] / 2
  696. ;
  697. p0[pn[7].toLowerCase()] = dims[pn[7].toLowerCase()] + dims[pn[4].toLowerCase()] / 2 + (args.shift || 0);
  698. p0[pn[5].toLowerCase()] = dims[pn[6]];
  699. var p1 = props[1];
  700. p1[borderConst + pn[0] + "Color"] = { start: lightColor, end: endColor };
  701. p1[borderConst + pn[0] + widthConst] = dims[pn[4].toLowerCase()];
  702. p1[borderConst + pn[2] + widthConst] = 0;
  703. p1[borderConst + pn[3] + widthConst] = 0;
  704. p1[pn[5].toLowerCase()] = { start: dims[pn[6]], end: dims[pn[5].toLowerCase()] };
  705. dojo.mixin(hs, staticProps);
  706. dojo.style(helperNode, hs);
  707. dojo.body().appendChild(helperNode);
  708. var finalize = function(){
  709. // helperNode.parentNode.removeChild(helperNode);
  710. dojo.destroy(helperNode);
  711. // fixes a flicker when the animation ends
  712. s.backgroundColor = endColor;
  713. s.visibility = "visible";
  714. };
  715. if(whichAnim == "last"){
  716. for(i in p0){
  717. p0[i] = { start: p0[i] };
  718. }
  719. p0[borderConst + pn[1] + "Color"] = { start: darkColor, end: endColor };
  720. p1 = p0;
  721. }
  722. if(!whichAnim || whichAnim == "first"){
  723. anims.push(dojo.animateProperty({
  724. node: helperNode,
  725. duration: duration,
  726. properties: p0
  727. }));
  728. }
  729. if(!whichAnim || whichAnim == "last"){
  730. anims.push(dojo.animateProperty({
  731. node: helperNode,
  732. duration: duration,
  733. properties: p1,
  734. onEnd: finalize
  735. }));
  736. }
  737. // hide the original node
  738. dojo.connect(anims[0], "play", function(){
  739. helperNode.style.visibility = "visible";
  740. s.visibility = "hidden";
  741. });
  742. return dojo.fx.chain(anims); // dojo.Animation
  743. }
  744. dojox.fx.flipCube = function(/*Object*/ args){
  745. // summary: An extension to `dojox.fx.flip` providing a more 3d-like rotation
  746. //
  747. // description:
  748. // An extension to `dojox.fx.flip` providing a more 3d-like rotation.
  749. // Behaves the same as `dojox.fx.flip`, using the same attributes and
  750. // other standard `dojo.Animation` properties.
  751. //
  752. // example:
  753. // See `dojox.fx.flip`
  754. var anims = [],
  755. mb = dojo.marginBox(args.node),
  756. shiftX = mb.w / 2,
  757. shiftY = mb.h / 2,
  758. dims = {
  759. top: {
  760. pName: "height",
  761. args:[
  762. {
  763. whichAnim: "first",
  764. dir: "top",
  765. shift: -shiftY
  766. },
  767. {
  768. whichAnim: "last",
  769. dir: "bottom",
  770. shift: shiftY
  771. }
  772. ]
  773. },
  774. right: {
  775. pName: "width",
  776. args:[
  777. {
  778. whichAnim: "first",
  779. dir: "right",
  780. shift: shiftX
  781. },
  782. {
  783. whichAnim: "last",
  784. dir: "left",
  785. shift: -shiftX
  786. }
  787. ]
  788. },
  789. bottom: {
  790. pName: "height",
  791. args:[
  792. {
  793. whichAnim: "first",
  794. dir: "bottom",
  795. shift: shiftY
  796. },
  797. {
  798. whichAnim: "last",
  799. dir: "top",
  800. shift: -shiftY
  801. }
  802. ]
  803. },
  804. left: {
  805. pName: "width",
  806. args:[
  807. {
  808. whichAnim: "first",
  809. dir: "left",
  810. shift: -shiftX
  811. },
  812. {
  813. whichAnim: "last",
  814. dir: "right",
  815. shift: shiftX
  816. }
  817. ]
  818. }
  819. }
  820. ;
  821. var d = dims[args.dir || "left"],
  822. p = d.args
  823. ;
  824. args.duration = args.duration ? args.duration * 2 : 500;
  825. args.depth = .8;
  826. args.axis = "cube";
  827. for(var i = p.length - 1; i >= 0; i--){
  828. dojo.mixin(args, p[i]);
  829. anims.push(dojox.fx.flip(args));
  830. }
  831. return dojo.fx.combine(anims);
  832. };
  833. dojox.fx.flipPage = function(/*Object*/ args){
  834. // summary: An extension to `dojox.fx.flip` providing a page flip like animation.
  835. //
  836. // description:
  837. // An extension to `dojox.fx.flip` providing a page flip effect.
  838. // Behaves the same as `dojox.fx.flip`, using the same attributes and
  839. // other standard `dojo.Animation` properties.
  840. //
  841. // example:
  842. // See `dojox.fx.flip`
  843. var n = args.node,
  844. coords = dojo.coords(n, true),
  845. x = coords.x,
  846. y = coords.y,
  847. w = coords.w,
  848. h = coords.h,
  849. bgColor = dojo.style(n, "backgroundColor"),
  850. lightColor = args.lightColor || "#dddddd",
  851. darkColor = args.darkColor,
  852. helperNode = dojo.create("div"),
  853. anims = [],
  854. hn = [],
  855. dir = args.dir || "right",
  856. pn = {
  857. left: ["left", "right", "x", "w"],
  858. top: ["top", "bottom", "y", "h"],
  859. right: ["left", "left", "x", "w"],
  860. bottom: ["top", "top", "y", "h"]
  861. },
  862. shiftMultiplier = {
  863. right: [1, -1],
  864. left: [-1, 1],
  865. top: [-1, 1],
  866. bottom: [1, -1]
  867. }
  868. ;
  869. dojo.style(helperNode, {
  870. position: "absolute",
  871. width : w + "px",
  872. height : h + "px",
  873. top : y + "px",
  874. left : x + "px",
  875. visibility: "hidden"
  876. });
  877. var hs = [];
  878. for(var i = 0; i < 2; i++){
  879. var r = i % 2,
  880. d = r ? pn[dir][1] : dir,
  881. wa = r ? "last" : "first",
  882. endColor = r ? bgColor : lightColor,
  883. startColor = r ? endColor : args.startColor || n.style.backgroundColor
  884. ;
  885. hn[i] = dojo.clone(helperNode);
  886. var finalize = function(x){
  887. return function(){
  888. dojo.destroy(hn[x]);
  889. }
  890. }(i)
  891. ;
  892. dojo.body().appendChild(hn[i]);
  893. hs[i] = {
  894. backgroundColor: r ? startColor : bgColor
  895. };
  896. hs[i][pn[dir][0]] = coords[pn[dir][2]] + shiftMultiplier[dir][0] * i * coords[pn[dir][3]] + "px";
  897. dojo.style(hn[i], hs[i]);
  898. anims.push(dojox.fx.flip({
  899. node: hn[i],
  900. dir: d,
  901. axis: "shortside",
  902. depth: args.depth,
  903. duration: args.duration / 2,
  904. shift: shiftMultiplier[dir][i] * coords[pn[dir][3]] / 2,
  905. darkColor: darkColor,
  906. lightColor: lightColor,
  907. whichAnim: wa,
  908. endColor: endColor
  909. }));
  910. dojo.connect(anims[i], "onEnd", finalize);
  911. }
  912. return dojo.fx.chain(anims);
  913. };
  914. dojox.fx.flipGrid = function(/*Object*/ args){
  915. // summary: An extension to `dojox.fx.flip` providing a decomposition in rows * cols flipping elements
  916. //
  917. // description:
  918. // An extension to `dojox.fx.flip` providing a page flip effect.
  919. // Behaves the same as `dojox.fx.flip`, using the same attributes and
  920. // other standard `dojo.Animation` properties and
  921. //
  922. // cols: Integer columns
  923. // rows: Integer rows
  924. //
  925. // duration: the single flip duration
  926. //
  927. // example:
  928. // See `dojox.fx.flip`
  929. var rows = args.rows || 4,
  930. cols = args.cols || 4,
  931. anims = [],
  932. helperNode = dojo.create("div"),
  933. n = args.node,
  934. coords = dojo.coords(n, true),
  935. x = coords.x,
  936. y = coords.y,
  937. nw = coords.w,
  938. nh = coords.h,
  939. w = coords.w / cols,
  940. h = coords.h / rows,
  941. cAnims = []
  942. ;
  943. dojo.style(helperNode, {
  944. position: "absolute",
  945. width: w + "px",
  946. height: h + "px",
  947. backgroundColor: dojo.style(n, "backgroundColor")
  948. });
  949. for(var i = 0; i < rows; i++){
  950. var r = i % 2,
  951. d = r ? "right" : "left",
  952. signum = r ? 1 : -1
  953. ;
  954. // cloning
  955. var cn = dojo.clone(n);
  956. dojo.style(cn, {
  957. position: "absolute",
  958. width: nw + "px",
  959. height: nh + "px",
  960. top: y + "px",
  961. left: x + "px",
  962. clip: "rect(" + i * h + "px," + nw + "px," + nh + "px,0)"
  963. });
  964. dojo.body().appendChild(cn);
  965. anims[i] = [];
  966. for(var j = 0; j < cols; j++){
  967. var hn = dojo.clone(helperNode),
  968. l = r ? j : cols - (j + 1)
  969. ;
  970. var adjustClip = function(xn, yCounter, xCounter){
  971. return function(){
  972. if(!(yCounter % 2)){
  973. dojo.style(xn, {
  974. clip: "rect(" + yCounter * h + "px," + (nw - (xCounter + 1) * w ) + "px," + ((yCounter + 1) * h) + "px,0px)"
  975. });
  976. }else{
  977. dojo.style(xn, {
  978. clip: "rect(" + yCounter * h + "px," + nw + "px," + ((yCounter + 1) * h) + "px," + ((xCounter + 1) * w) + "px)"
  979. });
  980. }
  981. }
  982. }(cn, i, j);
  983. dojo.body().appendChild(hn);
  984. dojo.style(hn, {
  985. left: x + l * w + "px",
  986. top: y + i * h + "px",
  987. visibility: "hidden"
  988. });
  989. var a = dojox.fx.flipPage({
  990. node: hn,
  991. dir: d,
  992. duration: args.duration || 900,
  993. shift: signum * w/2,
  994. depth: .2,
  995. darkColor: args.darkColor,
  996. lightColor: args.lightColor,
  997. startColor: args.startColor || args.node.style.backgroundColor
  998. }),
  999. removeHelper = function(xn){
  1000. return function(){
  1001. dojo.destroy(xn);
  1002. }
  1003. }(hn)
  1004. ;
  1005. dojo.connect(a, "play", this, adjustClip);
  1006. dojo.connect(a, "play", this, removeHelper);
  1007. anims[i].push(a);
  1008. }
  1009. cAnims.push(dojo.fx.chain(anims[i]));
  1010. }
  1011. dojo.connect(cAnims[0], "play", function(){
  1012. dojo.style(n, {visibility: "hidden"});
  1013. });
  1014. return dojo.fx.combine(cAnims);
  1015. };
  1016. }
  1017. if(!dojo._hasResource["dojox.mobile.compat"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  1018. dojo._hasResource["dojox.mobile.compat"] = true;
  1019. dojo.provide("dojox.mobile.compat");
  1020. // summary:
  1021. // CSS3 compatibility module
  1022. // description:
  1023. // This module provides support for some of the CSS3 features to dojox.mobile
  1024. // for non-CSS3 browsers, such as IE or Firefox.
  1025. // If you load this module, it directly replaces some of the methods of
  1026. // dojox.mobile instead of subclassing. This way, html pages remains the same
  1027. // regardless of whether this compatibility module is used or not.
  1028. // Recommended usage is as follows. the code below loads dojox.mobile.compat
  1029. // only when isWebKit is true.
  1030. //
  1031. // dojo.require("dojox.mobile");
  1032. //
  1033. //
  1034. // This module also loads compatibility CSS files, which has -compat.css
  1035. // suffix. You can use either the <link> tag or @import to load theme
  1036. // CSS files. Then, this module searches for the loaded CSS files and loads
  1037. // compatibility CSS files. For example, if you load iphone.css in a page,
  1038. // this module automatically loads iphone-compat.css.
  1039. // If you explicitly load iphone-compat.css with <link> or @import,
  1040. // this module will not load the already loaded file.
  1041. if(!dojo.isWebKit){
  1042. dojo.extend(dojox.mobile.View, {
  1043. _doTransition: function(fromNode, toNode, transition, dir){
  1044. var anim;
  1045. this.wakeUp(toNode);
  1046. if(!transition || transition == "none"){
  1047. toNode.style.display = "";
  1048. fromNode.style.display = "none";
  1049. toNode.style.left = "0px";
  1050. this.invokeCallback();
  1051. }else if(transition == "slide"){
  1052. var w = fromNode.offsetWidth;
  1053. var s1 = dojo.fx.slideTo({
  1054. node: fromNode,
  1055. duration: 400,
  1056. left: -w*dir,
  1057. top: fromNode.offsetTop
  1058. });
  1059. var s2 = dojo.fx.slideTo({
  1060. node: toNode,
  1061. duration: 400,
  1062. left: 0
  1063. });
  1064. toNode.style.position = "absolute";
  1065. toNode.style.left = w*dir + "px";
  1066. toNode.style.display = "";
  1067. anim = dojo.fx.combine([s1,s2]);
  1068. dojo.connect(anim, "onEnd", this, function(){
  1069. fromNode.style.display = "none";
  1070. toNode.style.position = "relative";
  1071. this.invokeCallback();
  1072. });
  1073. anim.play();
  1074. }else if(transition == "flip"){
  1075. anim = dojox.fx.flip({
  1076. node: fromNode,
  1077. dir: "right",
  1078. depth: 0.5,
  1079. duration: 400
  1080. });
  1081. toNode.style.position = "absolute";
  1082. toNode.style.left = "0px";
  1083. dojo.connect(anim, "onEnd", this, function(){
  1084. fromNode.style.display = "none";
  1085. toNode.style.position = "relative";
  1086. toNode.style.display = "";
  1087. this.invokeCallback();
  1088. });
  1089. anim.play();
  1090. }else if(transition == "fade"){
  1091. anim = dojo.fx.chain([
  1092. dojo.fadeOut({
  1093. node: fromNode,
  1094. duration: 600
  1095. }),
  1096. dojo.fadeIn({
  1097. node: toNode,
  1098. duration: 600
  1099. })
  1100. ]);
  1101. toNode.style.position = "absolute";
  1102. toNode.style.left = "0px";
  1103. toNode.style.display = "";
  1104. dojo.style(toNode, "opacity", 0);
  1105. dojo.connect(anim, "onEnd", this, function(){
  1106. fromNode.style.display = "none";
  1107. toNode.style.position = "relative";
  1108. dojo.style(fromNode, "opacity", 1);
  1109. this.invokeCallback();
  1110. });
  1111. anim.play();
  1112. }
  1113. },
  1114. wakeUp: function(node){
  1115. // summary:
  1116. // Function to force IE to redraw a node since its layout code tends to misrender
  1117. // in partial draws.
  1118. // node:
  1119. // The node to forcibly redraw.
  1120. // tags:
  1121. // public
  1122. if(dojo.isIE && !node._wokeup){
  1123. node._wokeup = true;
  1124. var disp = node.style.display;
  1125. node.style.display = "";
  1126. var nodes = node.getElementsByTagName("*");
  1127. for(var i = 0, len = nodes.length; i < len; i++){
  1128. var val = nodes[i].style.display;
  1129. nodes[i].style.display = "none";
  1130. nodes[i].style.display = "";
  1131. nodes[i].style.display = val;
  1132. }
  1133. node.style.display = disp;
  1134. }
  1135. }
  1136. });
  1137. dojo.extend(dojox.mobile.Switch, {
  1138. buildRendering: function(){
  1139. // summary:
  1140. // Function to simulate the mobile device style switches on
  1141. // browsers such as IE and FireFox.
  1142. // tags:
  1143. // protected
  1144. this.domNode = this.srcNodeRef || dojo.doc.createElement("DIV");
  1145. this.domNode.className = "mblSwitch";
  1146. this.domNode.innerHTML =
  1147. '<div class="mblSwitchInner">'
  1148. + '<div class="mblSwitchBg mblSwitchBgLeft">'
  1149. + '<div class="mblSwitchCorner mblSwitchCorner1T"></div>'
  1150. + '<div class="mblSwitchCorner mblSwitchCorner2T"></div>'
  1151. + '<div class="mblSwitchCorner mblSwitchCorner3T"></div>'
  1152. + '<div class="mblSwitchText mblSwitchTextLeft">'+this.leftLabel+'</div>'
  1153. + '<div class="mblSwitchCorner mblSwitchCorner1B"></div>'
  1154. + '<div class="mblSwitchCorner mblSwitchCorner2B"></div>'
  1155. + '<div class="mblSwitchCorner mblSwitchCorner3B"></div>'
  1156. + '</div>'
  1157. + '<div class="mblSwitchBg mblSwitchBgRight">'
  1158. + '<div class="mblSwitchCorner mblSwitchCorner1T"></div>'
  1159. + '<div class="mblSwitchCorner mblSwitchCorner2T"></div>'
  1160. + '<div class="mblSwitchCorner mblSwitchCorner3T"></div>'
  1161. + '<div class="mblSwitchText mblSwitchTextRight">'+this.rightLabel+'</div>'
  1162. + '<div class="mblSwitchCorner mblSwitchCorner1B"></div>'
  1163. + '<div class="mblSwitchCorner mblSwitchCorner2B"></div>'
  1164. + '<div class="mblSwitchCorner mblSwitchCorner3B"></div>'
  1165. + '</div>'
  1166. + '<div class="mblSwitchKnobContainer">'
  1167. + '<div class="mblSwitchCorner mblSwitchCorner1T"></div>'
  1168. + '<div class="mblSwitchCorner mblSwitchCorner2T"></div>'
  1169. + '<div class="mblSwitchCorner mblSwitchCorner3T"></div>'
  1170. + '<div class="mblSwitchKnob"></div>'
  1171. + '<div class="mblSwitchCorner mblSwitchCorner1B"></div>'
  1172. + '<div class="mblSwitchCorner mblSwitchCorner2B"></div>'
  1173. + '<div class="mblSwitchCorner mblSwitchCorner3B"></div>'
  1174. + '</div>'
  1175. + '</div>';
  1176. var n = this.inner = this.domNode.firstChild;
  1177. this.left = n.childNodes[0];
  1178. this.right = n.childNodes[1];
  1179. this.knob = n.childNodes[2];
  1180. dojo.addClass(this.domNode, (this.value == "on") ? "mblSwitchOn" : "mblSwitchOff");
  1181. this[this.value == "off" ? "left" : "right"].style.display = "none";
  1182. },
  1183. _changeState: function(/*String*/state){
  1184. // summary:
  1185. // Function to toggle the switch state on the switch
  1186. // state:
  1187. // Thhe state to toggle, switch 'on' or 'off'
  1188. // tags:
  1189. // private
  1190. if(!this.inner.parentNode || !this.inner.parentNode.tagName){
  1191. dojo.addClass(this.domNode, (state == "on") ? "mblSwitchOn" : "mblSwitchOff");
  1192. return;
  1193. }
  1194. var pos;
  1195. if(this.inner.offsetLeft == 0){ // currently ON
  1196. if(state == "on"){ return; }
  1197. pos = -53;
  1198. }else{ // currently OFF
  1199. if(state == "off"){ return; }
  1200. pos = 0;
  1201. }
  1202. var a = dojo.fx.slideTo({
  1203. node: this.inner,
  1204. duration: 500,
  1205. left: pos
  1206. });
  1207. var _this = this;
  1208. dojo.connect(a, "onEnd", function(){
  1209. _this[state == "off" ? "left" : "right"].style.display = "none";
  1210. });
  1211. a.play();
  1212. }
  1213. });
  1214. if(dojo.isIE || dojo.isBB){
  1215. dojo.extend(dojox.mobile.RoundRect, {
  1216. buildRendering: function(){
  1217. // summary:
  1218. // Function to simulate the borderRadius appearance on IE, since
  1219. // IE does not support this CSS style.
  1220. // tags:
  1221. // protected
  1222. dojox.mobile.createRoundRect(this);
  1223. this.domNode.className = "mblRoundRect";
  1224. }
  1225. });
  1226. dojox.mobile.RoundRectList._addChild = dojox.mobile.RoundRectList.prototype.addChild;
  1227. dojo.extend(dojox.mobile.RoundRectList, {
  1228. buildRendering: function(){
  1229. // summary:
  1230. // Function to simulate the borderRadius appearance on IE, since
  1231. // IE does not support this CSS style.
  1232. // tags:
  1233. // protected
  1234. dojox.mobile.createRoundRect(this, true);
  1235. this.domNode.className = "mblRoundRectList";
  1236. },
  1237. postCreate: function(){
  1238. this.redrawBorders();
  1239. },
  1240. addChild: function(widget){
  1241. dojox.mobile.RoundRectList._addChild.apply(this, arguments);
  1242. this.redrawBorders();
  1243. if(dojox.mobile.applyPngFilter){
  1244. dojox.mobile.applyPngFilter(widget.domNode);
  1245. }
  1246. },
  1247. redrawBorders: function(){
  1248. // summary:
  1249. // Function to adjust the creation of RoundRectLists on IE.
  1250. // Removed undesired styles.
  1251. // tags:
  1252. // public
  1253. // Remove a border of the last ListItem.
  1254. // This is for browsers that do not support the last-child CSS pseudo-class.
  1255. var lastChildFound = false;
  1256. for(var i = this.containerNode.childNodes.length - 1; i >= 0; i--){
  1257. var c = this.containerNode.childNodes[i];
  1258. if(c.tagName == "LI"){
  1259. c.style.borderBottomStyle = lastChildFound ? "solid" : "none";
  1260. lastChildFound = true;
  1261. }
  1262. }
  1263. }
  1264. });
  1265. dojo.extend(dojox.mobile.EdgeToEdgeList, {
  1266. buildRendering: function(){
  1267. this.domNode = this.containerNode = this.srcNodeRef || dojo.doc.createElement("UL");
  1268. this.domNode.className = "mblEdgeToEdgeList";
  1269. }
  1270. });
  1271. if(dojox.mobile.IconContainer){
  1272. dojox.mobile.IconContainer._addChild = dojox.mobile.IconContainer.prototype.addChild;
  1273. dojo.extend(dojox.mobile.IconContainer, {
  1274. addChild: function(widget){
  1275. dojox.mobile.IconContainer._addChild.apply(this, arguments);
  1276. if(dojox.mobile.applyPngFilter){
  1277. dojox.mobile.applyPngFilter(widget.domNode);
  1278. }
  1279. }
  1280. });
  1281. } // if(dojox.mobile.IconContainer)
  1282. dojo.mixin(dojox.mobile, {
  1283. createRoundRect: function(_this, isList){
  1284. // summary:
  1285. // Function to adjust the creation of rounded rectangles on IE.
  1286. // Deals with IE's lack of borderRadius support
  1287. // tags:
  1288. // public
  1289. var i;
  1290. _this.domNode = dojo.doc.createElement("DIV");
  1291. _this.domNode.style.padding = "0px";
  1292. _this.domNode.style.backgroundColor = "transparent";
  1293. _this.domNode.style.borderStyle = "none";
  1294. _this.containerNode = dojo.doc.createElement(isList?"UL":"DIV");
  1295. _this.containerNode.className = "mblRoundRectContainer";
  1296. if(_this.srcNodeRef){
  1297. _this.srcNodeRef.parentNode.replaceChild(_this.domNode, _this.srcNodeRef);
  1298. for(i = 0, len = _this.srcNodeRef.childNodes.length; i < len; i++){
  1299. _this.containerNode.appendChild(_this.srcNodeRef.removeChild(_this.srcNodeRef.firstChild));
  1300. }
  1301. _this.srcNodeRef = null;
  1302. }
  1303. _this.domNode.appendChild(_this.containerNode);
  1304. for(i = 0; i <= 5; i++){
  1305. var top = dojo.create("DIV");
  1306. top.className = "mblRoundCorner mblRoundCorner"+i+"T";
  1307. _this.domNode.insertBefore(top, _this.containerNode);
  1308. var bottom = dojo.create("DIV");
  1309. bottom.className = "mblRoundCorner mblRoundCorner"+i+"B";
  1310. _this.domNode.appendChild(bottom);
  1311. }
  1312. }
  1313. });
  1314. if(dojox.mobile.ScrollableView){
  1315. dojo.extend(dojox.mobile.ScrollableView, {
  1316. postCreate: function(){
  1317. // On IE, margin-top of the first child does not seem to be effective,
  1318. // probably because padding-top is specified for containerNode
  1319. // to make room for a fixed header. This dummy node is a workaround for that.
  1320. var dummy = dojo.create("DIV", {className:"mblDummyForIE", innerHTML:"&nbsp;"}, this.containerNode, "first");
  1321. dojo.style(dummy, {
  1322. position: "relative",
  1323. marginBottom: "-2px",
  1324. fontSize: "1px"
  1325. });
  1326. }
  1327. });
  1328. } // if(dojox.mobile.ScrollableView)
  1329. } // if(dojo.isIE)
  1330. if(dojo.isIE <= 6){
  1331. dojox.mobile.applyPngFilter = function(root){
  1332. root = root || dojo.body();
  1333. var nodes = root.getElementsByTagName("IMG");
  1334. var blank = dojo.moduleUrl("dojo", "resources/blank.gif");
  1335. for(var i = 0, len = nodes.length; i < len; i++){
  1336. var img = nodes[i];
  1337. var w = img.offsetWidth;
  1338. var h = img.offsetHeight;
  1339. if(w === 0 || h === 0){
  1340. // The reason why the image has no width/height may be because
  1341. // display is "none". If that is the case, let's change the
  1342. // display to "" temporarily and see if the image returns them.
  1343. if(dojo.style(img, "display") != "none"){ continue; }
  1344. img.style.display = "";
  1345. w = img.offsetWidth;
  1346. h = img.offsetHeight;
  1347. img.style.display = "none";
  1348. if(w === 0 || h === 0){ continue; }
  1349. }
  1350. var src = img.src;
  1351. if(src.indexOf("resources/blank.gif") != -1){ continue; }
  1352. img.src = blank;
  1353. img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src+"')";
  1354. img.style.width = w + "px";
  1355. img.style.height = h + "px";
  1356. }
  1357. };
  1358. } // if(dojo.isIE <= 6)
  1359. dojox.mobile.loadCss = function(/*String|Array*/files){
  1360. // summary:
  1361. // Function to load and register CSS files with the page
  1362. // files: String|Array
  1363. // The CSS files to load and register with the page.
  1364. // tags:
  1365. // private
  1366. if(!dojo.global._loadedCss){
  1367. var obj = {};
  1368. dojo.forEach(dojox.mobile.getCssPaths(), function(path){
  1369. obj[path] = true;
  1370. });
  1371. dojo.global._loadedCss = obj;
  1372. }
  1373. if(!dojo.isArray(files)){ files = [files]; }
  1374. for(var i = 0; i < files.length; i++){
  1375. var file = files[i];
  1376. if(!dojo.global._loadedCss[file]){
  1377. dojo.global._loadedCss[file] = true;
  1378. if(dojo.doc.createStyleSheet){
  1379. // for some reason, IE hangs when you try to load
  1380. // multiple css files almost at once.
  1381. setTimeout(function(file){
  1382. return function(){
  1383. dojo.doc.createStyleSheet(file);
  1384. };
  1385. }(file), 0);
  1386. }else{
  1387. var link = dojo.doc.createElement("link");
  1388. link.href = file;
  1389. link.type = "text/css";
  1390. link.rel = "stylesheet";
  1391. var head = dojo.doc.getElementsByTagName('head')[0];
  1392. head.appendChild(link);
  1393. }
  1394. }
  1395. }
  1396. };
  1397. dojox.mobile.getCssPaths = function(){
  1398. var paths = [];
  1399. var i, j;
  1400. // find @import
  1401. var s = dojo.doc.styleSheets;
  1402. for(i = 0; i < s.length; i++){
  1403. var r = s[i].cssRules || s[i].imports;
  1404. if(!r){ continue; }
  1405. for(j = 0; j < r.length; j++){
  1406. if(r[j].href){
  1407. paths.push(r[j].href);
  1408. }
  1409. }
  1410. }
  1411. // find <link>
  1412. var elems = dojo.doc.getElementsByTagName("link");
  1413. for(i = 0, len = elems.length; i < len; i++){
  1414. if(elems[i].href){
  1415. paths.push(elems[i].href);
  1416. }
  1417. }
  1418. return paths;
  1419. };
  1420. dojox.mobile.loadCompatPattern = /\/themes\/(domButtons|buttons|iphone|android).*\.css$/;
  1421. dojox.mobile.loadCompatCssFiles = function(){
  1422. // summary:
  1423. // Function to perform page-level adjustments on browsers such as
  1424. // IE and firefox. It loads compat specific css files into the
  1425. // page header.
  1426. var paths = dojox.mobile.getCssPaths();
  1427. for(var i = 0; i < paths.length; i++){
  1428. var href = paths[i];
  1429. if(href.match(dojox.mobile.loadCompatPattern) && href.indexOf("-compat.css") == -1){
  1430. var compatCss = href.substring(0, href.length-4)+"-compat.css";
  1431. dojox.mobile.loadCss(compatCss);
  1432. }
  1433. }
  1434. };
  1435. dojox.mobile.hideAddressBar = function(){
  1436. // nop
  1437. };
  1438. dojo.addOnLoad(function(){
  1439. if(dojo.config["mblLoadCompatCssFiles"] !== false){
  1440. dojox.mobile.loadCompatCssFiles();
  1441. }
  1442. if(dojox.mobile.applyPngFilter){
  1443. dojox.mobile.applyPngFilter();
  1444. }
  1445. });
  1446. } // end of if(!dojo.isWebKit){
  1447. }