1 | define([ |
---|
2 | "dojo/_base/declare", |
---|
3 | "./common", |
---|
4 | "dojo/dom-style" |
---|
5 | ], function(declare,common, domStyle){ |
---|
6 | |
---|
7 | // module: |
---|
8 | // dojox/mobile/bidi/Carousel |
---|
9 | |
---|
10 | return declare(null, { |
---|
11 | // summary: |
---|
12 | // Support for control over text direction for mobile Carousel widget, using Unicode Control Characters to control text direction. |
---|
13 | // description: |
---|
14 | // Implementation for text direction support for Title. |
---|
15 | // This class should not be used directly. |
---|
16 | // Mobile Carousel widget loads this module when user sets "has: {'dojo-bidi': true }" in data-dojo-config. |
---|
17 | |
---|
18 | buildRendering: function(){ |
---|
19 | this.inherited(arguments); |
---|
20 | // dojox.mobile mirroring support |
---|
21 | if(!this.isLeftToRight()){ |
---|
22 | if(this.navButton){ |
---|
23 | domStyle.set(this.btnContainerNode, "float", "left"); // workaround for webkit rendering problem |
---|
24 | this.disconnect(this._prevHandle); |
---|
25 | this.disconnect(this._nextHandle); |
---|
26 | this._prevHandle = this.connect(this.prevBtnNode, "onclick", "onNextBtnClick"); |
---|
27 | this._nextHandle = this.connect(this.nextBtnNode, "onclick", "onPrevBtnClick"); |
---|
28 | } |
---|
29 | |
---|
30 | if(this.pageIndicator){ |
---|
31 | domStyle.set(this.piw, "float", "left"); // workaround for webkit rendering problem |
---|
32 | } |
---|
33 | } |
---|
34 | }, |
---|
35 | _setTitleAttr: function(title){ |
---|
36 | this.titleNode.innerHTML = this._cv ? this._cv(title) : title; |
---|
37 | this._set("title", title); |
---|
38 | if(this.textDir){ |
---|
39 | this.titleNode.innerHTML = common.enforceTextDirWithUcc(this.titleNode.innerHTML, this.textDir); |
---|
40 | this.titleNode.style.textAlign = (this.dir.toLowerCase() === "rtl") ? "right" : "left"; |
---|
41 | } |
---|
42 | }, |
---|
43 | _setTextDirAttr: function(textDir){ |
---|
44 | if(textDir && this.textDir !== textDir){ |
---|
45 | this.textDir = textDir; |
---|
46 | this.titleNode.innerHTML = common.removeUCCFromText(this.titleNode.innerHTML); |
---|
47 | this.titleNode.innerHTML = common.enforceTextDirWithUcc(this.titleNode.innerHTML, this.textDir); |
---|
48 | if(this.items.length > 0) |
---|
49 | this.onComplete(this.items); |
---|
50 | } |
---|
51 | } |
---|
52 | }); |
---|
53 | }); |
---|