4 function getQueryParam(name, queryString)
6 var match = RegExp(name +
'=([^&]*)').exec(queryString || location.search);
7 return match && decodeURIComponent(match[1]);
10 function hasOption(opt)
12 var s = window.location.search;
13 var re =
new RegExp(
'(?:^|[&?])' + opt +
'(?:[=]([^&]*))?(?:$|[&])',
'i');
15 return m ? (m[1] === undefined ?
true : m[1]) :
false;
18 var scriptTags = document.getElementsByTagName(
'script'),
19 defaultTheme =
'triton',
21 i = scriptTags.length,
23 'Ext.window.MessageBox',
24 'Ext.toolbar.Toolbar',
25 'Ext.form.field.ComboBox',
26 'Ext.form.FieldContainer',
27 'Ext.form.field.Radio'
55 src = scriptTags[i].src;
56 if (src.indexOf(
'include-ext.js') !== -1)
58 defaultQueryString = src.split(
'?')[1];
59 if (defaultQueryString)
61 defaultTheme = getQueryParam(
'theme', defaultQueryString) || defaultTheme;
62 defaultRtl = getQueryParam(
'rtl' , defaultQueryString) || defaultRtl;
68 Ext.themeName = theme = getQueryParam(
'theme') || defaultTheme;
70 rtl = getQueryParam(
'rtl') || defaultRtl;
72 if (rtl.toString() ===
'true')
74 requires.unshift(
'Ext.rtl.*');
75 Ext.define(
'Ext.examples.RtlComponent',
77 override:
'Ext.Component',
82 Ext.require(requires);
84 Ext.onReady(
function()
87 Ext.getBody().addCls(Ext.baseCSSPrefix +
'theme-' + Ext.themeName);
90 if (Ext.supports.TouchEvents)
93 touchmove:
function(e)
96 if (Ext.scroll.Scroller.isTouching)
106 if (hasOption(
'nocss3'))
108 Ext.supports.CSS3BorderRadius =
false;
109 Ext.getBody().addCls(
'x-nbr x-nlg');
112 if (hasOption(
'nlg'))
114 Ext.getBody().addCls(
'x-nlg');
117 function setParam(param)
119 var queryString = Ext.Object.toQueryString(Ext.apply(Ext.Object.fromQueryString(location.search), param));
120 console.log(
"queryString: "+queryString) ;
121 location.search = queryString;
122 console.log(
"Done ") ;
125 function removeParam(paramName)
127 var params = Ext.Object.fromQueryString(location.search);
128 delete params[paramName];
129 location.search = Ext.Object.toQueryString(params);
132 if (hasOption(
'no-toolbar') || /no-toolbar/.test(document.cookie))
137 setTimeout(
function()
139 toolbar = Ext.widget(
145 id :
'options-toolbar' ,
148 defaultAlign : Ext.optionsToolbarAlign ||
'tr-tr' ,
149 alignOffset : [-(Ext.getScrollbarSize().width + 5), 0],
150 preventFocusOnActivate:
true ,
154 defaults : { rtl :
false },
158 width : comboWidth[Ext.themeName],
159 labelWidth : labelWidth[Ext.themeName],
160 fieldLabel :
'Theme' ,
161 displayField:
'name' ,
162 valueField :
'value' ,
163 labelStyle :
'cursor:move;' ,
165 queryMode :
'local' ,
169 fields: [
'value',
'name'],
171 {value:
'triton' , name:
'Triton' },
172 {value:
'neptune' , name:
'Neptune' },
173 {value:
'neptune-touch', name:
'Neptune Touch'},
174 {value:
'crisp' , name:
'Crisp' },
175 {value:
'crisp-touch' , name:
'Crisp Touch' },
176 {value:
'classic' , name:
'Classic' },
177 {value:
'gray' , name:
'Gray' },
178 {value:
'aria' , name:
'ARIA' }
184 select:
function(combo)
186 var theme = combo.getValue();
187 console.log(
"Select") ;
188 if (theme !== defaultTheme)
190 setParam({ theme: theme });
192 removeParam(
'theme');
202 hidden : !(Ext.devMode === 2 ||
203 location.href.indexOf(
'qa.sencha.com') !== -1),
209 toggle:
function(btn, pressed)
212 setParam({ rtl:
true });