xooie 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/vendor/assets/javascripts/xooie/addons/base.js +61 -74
- data/vendor/assets/javascripts/xooie/addons/carousel_lentils.js +79 -78
- data/vendor/assets/javascripts/xooie/addons/carousel_pagination.js +140 -137
- data/vendor/assets/javascripts/xooie/addons/dropdown_accordion.js +38 -0
- data/vendor/assets/javascripts/xooie/addons/tab_animation.js +228 -227
- data/vendor/assets/javascripts/xooie/addons/tab_automation.js +150 -0
- data/vendor/assets/javascripts/xooie/base.js +214 -0
- data/vendor/assets/javascripts/xooie/carousel.js +400 -0
- data/vendor/assets/javascripts/xooie/dialog.js +132 -0
- data/vendor/assets/javascripts/xooie/dropdown.js +273 -0
- data/vendor/assets/javascripts/xooie/event_handler.js +14 -16
- data/vendor/assets/javascripts/xooie/helpers.js +45 -35
- data/vendor/assets/javascripts/xooie/shared.js +65 -37
- data/vendor/assets/javascripts/xooie/stylesheet.js +95 -90
- data/vendor/assets/javascripts/xooie/tab.js +125 -0
- data/vendor/assets/javascripts/xooie/widgets/accordion.js +7 -7
- data/vendor/assets/javascripts/xooie/widgets/base.js +73 -97
- data/vendor/assets/javascripts/xooie/widgets/carousel.js +95 -101
- data/vendor/assets/javascripts/xooie/widgets/dialog.js +84 -85
- data/vendor/assets/javascripts/xooie/widgets/dropdown.js +223 -188
- data/vendor/assets/javascripts/xooie/widgets/tab.js +36 -36
- data/vendor/assets/javascripts/xooie/xooie.js +151 -148
- data/vendor/assets/javascripts/xooie.js +169 -0
- metadata +53 -58
@@ -24,16 +24,17 @@
|
|
24
24
|
* The Tab widget should be used as a way to organize how content is displayed
|
25
25
|
* visually. Content is hidden until the associated tab is activated.
|
26
26
|
**/
|
27
|
-
define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'xooie/event_handler'], function($, helpers, Base, EventHandler) {
|
27
|
+
define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'xooie/event_handler'], function ($, helpers, Base, EventHandler) {
|
28
|
+
'use strict';
|
28
29
|
|
29
30
|
function setSelection(widget, selectedTabs) {
|
30
31
|
var activeTabs = widget.getActiveTabs();
|
31
32
|
|
32
|
-
activeTabs.not(selectedTabs).each(function() {
|
33
|
+
activeTabs.not(selectedTabs).each(function () {
|
33
34
|
widget.deactivateTab($(this));
|
34
35
|
});
|
35
36
|
|
36
|
-
selectedTabs.not(activeTabs).each(function() {
|
37
|
+
selectedTabs.not(activeTabs).each(function () {
|
37
38
|
widget.activateTab($(this));
|
38
39
|
});
|
39
40
|
}
|
@@ -64,31 +65,31 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
64
65
|
*
|
65
66
|
* Instantiates a new Tab instance. See [[Xooie.Widget]] for more functionality.
|
66
67
|
**/
|
67
|
-
var Tab = Base.extend(function(){
|
68
|
+
var Tab = Base.extend(function () {
|
68
69
|
var self = this;
|
69
70
|
|
70
71
|
this._tabEvents = new EventHandler(this.namespace());
|
71
72
|
|
72
73
|
this._tabEvents.add({
|
73
|
-
keyup: function(event){
|
74
|
-
if ([13,32].indexOf(event.which) !== -1){
|
75
|
-
setSelection(self, self.selectTabs(
|
74
|
+
keyup: function (event) {
|
75
|
+
if ([13, 32].indexOf(event.which) !== -1) {
|
76
|
+
setSelection(self, self.selectTabs($(this), event));
|
76
77
|
|
77
78
|
event.preventDefault();
|
78
79
|
}
|
79
80
|
},
|
80
81
|
|
81
|
-
mouseup: function(event){
|
82
|
-
setSelection(self, self.selectTabs(
|
82
|
+
mouseup: function (event) {
|
83
|
+
setSelection(self, self.selectTabs($(this), event));
|
83
84
|
},
|
84
85
|
|
85
|
-
click: function(event){
|
86
|
+
click: function (event) {
|
86
87
|
event.preventDefault();
|
87
88
|
}
|
88
89
|
});
|
89
90
|
|
90
91
|
// TODO: Test and document this. Also, create a property for data-activate
|
91
|
-
this.root().on(this.initEvent(), function(){
|
92
|
+
this.root().on(this.initEvent(), function () {
|
92
93
|
self.activateTab(self.tabs().filter('[data-activate="true"]'));
|
93
94
|
});
|
94
95
|
|
@@ -173,7 +174,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
173
174
|
* The method also activates the [[Xooie.Tab#tabpanels]] that is indicated by the tab's `aria-controls` attribute,
|
174
175
|
* adding the [[Xooie.Tab#activeClass]] class and setting `aria-expanded` to 'true'.
|
175
176
|
**/
|
176
|
-
Tab.prototype.activateTab = function(tab) {
|
177
|
+
Tab.prototype.activateTab = function (tab) {
|
177
178
|
tab.addClass(this.activeClass())
|
178
179
|
.attr('aria-selected', true);
|
179
180
|
|
@@ -196,7 +197,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
196
197
|
* The method also deactivates the [[Xooie.Tab#tabpanels]] that is indicated by the tab's `aria-controls` attribute,
|
197
198
|
* removing the [[Xooie.Tab#activeClass]] class and setting `aria-expanded` to 'false'.
|
198
199
|
**/
|
199
|
-
Tab.prototype.deactivateTab = function(tab) {
|
200
|
+
Tab.prototype.deactivateTab = function (tab) {
|
200
201
|
tab.removeClass(this.activeClass())
|
201
202
|
.attr('aria-selected', false);
|
202
203
|
|
@@ -211,9 +212,9 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
211
212
|
};
|
212
213
|
|
213
214
|
/**
|
214
|
-
* Xooie.Tab#selectTabs(
|
215
|
-
* - event (Event): Browser event that triggered selectTabs call
|
215
|
+
* Xooie.Tab#selectTabs(selectedTab, event)
|
216
216
|
* - selectedTab (Element): Tab that was selected by a mouse or keyboard event
|
217
|
+
* - event (Event): The jQuery event that triggered the selection
|
217
218
|
*
|
218
219
|
* Only called by mouse/keyboard event handlers to generate the list of
|
219
220
|
* currently active tabs. Should return a jQuery collection of tabs that are
|
@@ -223,7 +224,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
223
224
|
*
|
224
225
|
* Override this method to alter the behavior of the Tab widget.
|
225
226
|
**/
|
226
|
-
Tab.prototype.selectTabs = function(
|
227
|
+
Tab.prototype.selectTabs = function (selectedTab) {
|
227
228
|
return selectedTab;
|
228
229
|
};
|
229
230
|
|
@@ -233,7 +234,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
233
234
|
* Returns a jQuery-selected collection of all [[Xooie.Tab#tabs]] that currently have the
|
234
235
|
* [[Xooie.Tab#activeClass]] class.
|
235
236
|
**/
|
236
|
-
Tab.prototype.getActiveTabs = function() {
|
237
|
+
Tab.prototype.getActiveTabs = function () {
|
237
238
|
return this.tabs().filter('.' + this.activeClass());
|
238
239
|
};
|
239
240
|
|
@@ -245,28 +246,30 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
245
246
|
* the `data-x-role="tab"` attribute. Tabs are given the [`role="tab"`](http://www.w3.org/TR/wai-aria/roles#tab) and [`aria-selected="false"`](http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected)
|
246
247
|
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes.
|
247
248
|
**/
|
248
|
-
Tab.prototype._process_role_tab = function(tabs){
|
249
|
-
var tabpanels
|
250
|
-
|
251
|
-
|
249
|
+
Tab.prototype._process_role_tab = function (tabs) {
|
250
|
+
var tabpanels;
|
251
|
+
|
252
|
+
tabpanels = this.tabpanels();
|
252
253
|
|
253
254
|
tabs.attr('role', 'tab')
|
254
255
|
.attr('aria-selected', false);
|
255
256
|
|
256
|
-
tabs.each(function(index) {
|
257
|
+
tabs.each(function (index) {
|
258
|
+
var tab, panelId;
|
259
|
+
|
257
260
|
tab = $(this);
|
258
261
|
panelId = tabpanels.eq(index).attr('id');
|
259
262
|
|
260
|
-
|
263
|
+
tab.attr('aria-controls', panelId);
|
261
264
|
|
262
|
-
if (
|
263
|
-
|
265
|
+
if (tab.is('a')) {
|
266
|
+
tab.attr('href', '#' + panelId);
|
264
267
|
}
|
265
268
|
|
266
269
|
});
|
267
270
|
|
268
271
|
tabs.on(this._tabEvents.handlers);
|
269
|
-
|
272
|
+
|
270
273
|
return tabs;
|
271
274
|
};
|
272
275
|
|
@@ -277,12 +280,11 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
277
280
|
* defined then its value will be used to select from the DOM. Otherwise, tabs will be selected from decendants of
|
278
281
|
* the root using the `[data-x-role="tab"]` selector.
|
279
282
|
**/
|
280
|
-
Tab.prototype._get_role_tab = function(){
|
283
|
+
Tab.prototype._get_role_tab = function () {
|
281
284
|
if (!helpers.isUndefined(this.tabSelector())) {
|
282
285
|
return $(this.tabSelector());
|
283
|
-
} else {
|
284
|
-
return this.root().find('[data-x-role="tab"]');
|
285
286
|
}
|
287
|
+
return this.root().find('[data-x-role="tab"]');
|
286
288
|
};
|
287
289
|
|
288
290
|
/** internal
|
@@ -290,9 +292,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
290
292
|
*
|
291
293
|
* TODO: Create this method to keep parity with the existing tab functionality
|
292
294
|
**/
|
293
|
-
Tab.prototype._render_role_tab = function(){
|
294
|
-
|
295
|
-
};
|
295
|
+
Tab.prototype._render_role_tab = function () { return false; };
|
296
296
|
|
297
297
|
/** internal
|
298
298
|
* Xooie.Tab#_process_role_tablist(tablist) -> Element
|
@@ -303,12 +303,12 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
303
303
|
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes. If any [[Xooie.Tab#tabs]] are not decendants of the tab list, the ids of those
|
304
304
|
* tabs are added to the [`aria-owns`](http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns) attribute.
|
305
305
|
**/
|
306
|
-
Tab.prototype._process_role_tablist = function(tablist) {
|
306
|
+
Tab.prototype._process_role_tablist = function (tablist) {
|
307
307
|
var tabs = this.tabs();
|
308
308
|
|
309
309
|
tablist.attr('role', 'tablist');
|
310
310
|
|
311
|
-
tabs.each(function(
|
311
|
+
tabs.each(function () {
|
312
312
|
var owns, id;
|
313
313
|
if (tablist.has(this).length === 0) {
|
314
314
|
owns = tablist.attr('aria-owns') || '';
|
@@ -332,7 +332,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
332
332
|
*
|
333
333
|
* TODO: Add this method to render the tablist if it is not included.
|
334
334
|
**/
|
335
|
-
Tab.prototype._render_role_tablist = function(){
|
335
|
+
Tab.prototype._render_role_tablist = function () {
|
336
336
|
return $('<ul data-x-role="tablist"></ul>');
|
337
337
|
};
|
338
338
|
|
@@ -344,7 +344,7 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
|
|
344
344
|
* the `data-x-role="tabpanel"` attribute. Tabs are given the [`role="tabpanel"`](http://www.w3.org/TR/wai-aria/roles#tab) and [`aria-expanded="false"`](http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected)
|
345
345
|
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes.
|
346
346
|
**/
|
347
|
-
Tab.prototype._process_role_tabpanel = function(tabpanels) {
|
347
|
+
Tab.prototype._process_role_tabpanel = function (tabpanels) {
|
348
348
|
tabpanels.attr('role', 'tabpanel')
|
349
349
|
.attr('aria-expanded', false);
|
350
350
|
|
@@ -31,31 +31,32 @@ var $X, Xooie;
|
|
31
31
|
* widget for every element that has a data-widget-type attribute.
|
32
32
|
**/
|
33
33
|
|
34
|
-
$X = Xooie = (function(static_config) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
34
|
+
$X = Xooie = (function (static_config) {
|
35
|
+
'use strict';
|
36
|
+
var config = {
|
37
|
+
widgets: {},
|
38
|
+
addons: {}
|
39
|
+
},
|
40
|
+
obj = function () {
|
41
|
+
return false;
|
42
|
+
},
|
43
|
+
gcTimer = null;
|
44
|
+
|
45
|
+
function copyObj(dst, src) {
|
46
|
+
var name;
|
47
|
+
|
48
|
+
for (name in src) {
|
49
|
+
if (src.hasOwnProperty(name)) {
|
50
|
+
dst[name] = src[name];
|
51
|
+
}
|
52
52
|
}
|
53
|
+
}
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
55
|
+
function gcCallback() {
|
56
|
+
if (Xooie.cleanup !== undefined) {
|
57
|
+
Xooie.cleanup();
|
58
58
|
}
|
59
|
+
}
|
59
60
|
|
60
61
|
/**
|
61
62
|
* $X.config(options)
|
@@ -76,27 +77,27 @@ $X = Xooie = (function(static_config) {
|
|
76
77
|
* Default: `0`.
|
77
78
|
**/
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
}
|
89
|
-
}
|
80
|
+
obj.config = function (options) {
|
81
|
+
var name;
|
82
|
+
|
83
|
+
for (name in options) {
|
84
|
+
if (options.hasOwnProperty(name)) {
|
85
|
+
if (name === 'widgets' || name === 'addons') {
|
86
|
+
copyObj(config[name], options[name]);
|
87
|
+
} else {
|
88
|
+
config[name] = options[name];
|
90
89
|
}
|
90
|
+
}
|
91
|
+
}
|
91
92
|
|
92
|
-
|
93
|
-
|
93
|
+
if (options.cleanupInterval !== undefined) {
|
94
|
+
gcTimer = clearInterval(gcTimer);
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
if (config.cleanupInterval > 0) {
|
97
|
+
gcTimer = setInterval(gcCallback, config.cleanupInterval);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
};
|
100
101
|
|
101
102
|
/** internal
|
102
103
|
* $X._mapName(name, type) -> String
|
@@ -106,143 +107,143 @@ $X = Xooie = (function(static_config) {
|
|
106
107
|
* Maps the name of the widget or addon to the correct url string where the module file is located.
|
107
108
|
**/
|
108
109
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
};
|
110
|
+
obj._mapName = function (name, type) {
|
111
|
+
if (config[type][name] === undefined) {
|
112
|
+
return [config.root, '/', type, '/', name].join('');
|
113
|
+
}
|
114
|
+
return config[type][name];
|
115
|
+
};
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
117
|
+
obj.config({
|
118
|
+
root: 'xooie',
|
119
|
+
cleanupInterval: 0
|
120
|
+
});
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
if (static_config) {
|
123
|
+
obj.config(static_config);
|
124
|
+
}
|
125
125
|
|
126
|
-
|
126
|
+
return obj;
|
127
127
|
}(Xooie));
|
128
128
|
|
129
|
-
define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function($, helpers, Stylesheet){
|
130
|
-
|
131
|
-
|
132
|
-
widgetSelector = '[data-widget-type]';
|
133
|
-
widgetDataAttr = 'widgetType';
|
134
|
-
addonDataAttr = 'addons';
|
129
|
+
define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function ($, helpers, Stylesheet) {
|
130
|
+
'use strict';
|
131
|
+
var config, _mapName, widgetSelector, widgetDataAttr, addonDataAttr;
|
135
132
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
133
|
+
config = Xooie.config;
|
134
|
+
_mapName = Xooie._mapName;
|
135
|
+
widgetSelector = '[data-widget-type]';
|
136
|
+
widgetDataAttr = 'widgetType';
|
137
|
+
addonDataAttr = 'addons';
|
140
138
|
|
141
|
-
|
139
|
+
$X = Xooie = function (element) {
|
140
|
+
var node, nodes, moduleNames, moduleUrls, url, i, j;
|
142
141
|
|
143
|
-
|
144
|
-
nodes = element.find(widgetSelector);
|
142
|
+
element = $(element);
|
145
143
|
|
146
|
-
|
147
|
-
|
148
|
-
nodes = nodes.add(element);
|
149
|
-
}
|
144
|
+
// Find all elements labeled as widgets:
|
145
|
+
nodes = element.find(widgetSelector);
|
150
146
|
|
151
|
-
|
152
|
-
|
147
|
+
// If the element is also tagged, add it to the collection:
|
148
|
+
if (element.is(widgetSelector)) {
|
149
|
+
nodes = nodes.add(element);
|
150
|
+
}
|
151
|
+
|
152
|
+
// This array will be the list of unique modules to load:
|
153
|
+
moduleUrls = [];
|
153
154
|
|
154
|
-
|
155
|
-
|
156
|
-
|
155
|
+
// Iterate through each item in the collection:
|
156
|
+
for (i = 0; i < nodes.length; i += 1) {
|
157
|
+
node = $(nodes[i]);
|
157
158
|
|
158
|
-
|
159
|
-
|
159
|
+
// Add all of the widget types to the list of modules we need:
|
160
|
+
moduleNames = helpers.toAry(node.data(widgetDataAttr));
|
160
161
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
// For each widget we check to see if the url is already in our
|
163
|
+
// list of urls to require:
|
164
|
+
for (j = 0; j < moduleNames.length; j += 1) {
|
165
|
+
url = $X._mapName(moduleNames[j], 'widgets');
|
165
166
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
167
|
+
if (moduleUrls.indexOf(url) === -1) {
|
168
|
+
moduleUrls.push(url);
|
169
|
+
}
|
170
|
+
}
|
170
171
|
|
171
|
-
|
172
|
-
|
172
|
+
// Do the same with each addon name:
|
173
|
+
moduleNames = helpers.toAry(node.data(addonDataAttr)) || [];
|
173
174
|
|
174
|
-
|
175
|
-
|
175
|
+
for (j = 0; j < moduleNames.length; j += 1) {
|
176
|
+
url = $X._mapName(moduleNames[j], 'addons');
|
176
177
|
|
177
|
-
|
178
|
-
|
179
|
-
}
|
180
|
-
}
|
178
|
+
if (moduleUrls.indexOf(url) === -1) {
|
179
|
+
moduleUrls.push(url);
|
181
180
|
}
|
181
|
+
}
|
182
|
+
}
|
182
183
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
addonMods, widgetMod, argIndex,
|
187
|
-
i, j, k;
|
184
|
+
// Now that we have a list of urls to load, let's load them:
|
185
|
+
require(moduleUrls, function () {
|
186
|
+
var widgets, addons, addonMods, WidgetMod, argIndex, instances, k;
|
188
187
|
|
189
|
-
|
190
|
-
for (i = 0; i < nodes.length; i+=1) {
|
191
|
-
node = $(nodes[i]);
|
188
|
+
instances = [];
|
192
189
|
|
193
|
-
|
194
|
-
|
195
|
-
|
190
|
+
// We need to iterate through our collection of nodes again:
|
191
|
+
for (i = 0; i < nodes.length; i += 1) {
|
192
|
+
node = $(nodes[i]);
|
196
193
|
|
197
|
-
|
198
|
-
|
194
|
+
// This time, we're keeping track of our addons and widges separately:
|
195
|
+
widgets = helpers.toAry(node.data(widgetDataAttr));
|
196
|
+
addons = helpers.toAry(node.data(addonDataAttr)) || [];
|
199
197
|
|
200
|
-
|
201
|
-
|
198
|
+
// Iterate through each widget type:
|
199
|
+
for (j = 0; j < widgets.length; j += 1) {
|
202
200
|
|
203
|
-
|
204
|
-
|
201
|
+
// Get the index of this module from the moduleUrls:
|
202
|
+
argIndex = moduleUrls.indexOf($X._mapName(widgets[j], 'widgets'));
|
205
203
|
|
206
|
-
|
204
|
+
//Get the widget that we'll be instantiating:
|
205
|
+
WidgetMod = arguments[argIndex];
|
207
206
|
|
208
|
-
|
209
|
-
for (k = 0; k < addons.length; k+=1) {
|
210
|
-
// Get the index of the addon module from moduleUrls:
|
211
|
-
argIndex = moduleUrls.indexOf($X._mapName(addons[k], 'addons'));
|
207
|
+
addonMods = [];
|
212
208
|
|
213
|
-
|
214
|
-
|
209
|
+
// Now get each addon that we'll instantiate with the widget:
|
210
|
+
for (k = 0; k < addons.length; k += 1) {
|
211
|
+
// Get the index of the addon module from moduleUrls:
|
212
|
+
argIndex = moduleUrls.indexOf($X._mapName(addons[k], 'addons'));
|
215
213
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
214
|
+
addonMods.push(arguments[argIndex]);
|
215
|
+
}
|
216
|
+
|
217
|
+
// Instantiate the new instance using the argIndex to find the right module:
|
218
|
+
instances.push(new WidgetMod(node, addonMods));
|
219
|
+
}
|
220
|
+
}
|
221
|
+
});
|
222
|
+
};
|
222
223
|
|
223
|
-
|
224
|
-
|
224
|
+
Xooie.config = config;
|
225
|
+
Xooie._mapName = _mapName;
|
225
226
|
|
226
227
|
/** internal, read-only
|
227
228
|
* $X._stylesheet -> Object
|
228
229
|
*
|
229
230
|
* An instance of the [[Stylesheet]] class used to manipluate a dynamically created Xooie stylesheet
|
230
231
|
**/
|
231
|
-
|
232
|
+
Xooie._stylesheet = new Stylesheet('Xooie');
|
232
233
|
|
233
234
|
/** internal
|
234
235
|
* $X._styleRules -> Object
|
235
236
|
*
|
236
237
|
* A cache of css rules defined by the [[Xooie.Widget.createStyleRule]] method.
|
237
238
|
**/
|
238
|
-
|
239
|
+
Xooie._styleRules = {};
|
239
240
|
|
240
241
|
/** internal
|
241
242
|
* $X._instanceCache -> Array
|
242
243
|
*
|
243
244
|
* A collection of currently instantiated widgets.
|
244
245
|
**/
|
245
|
-
|
246
|
+
Xooie._instanceCache = [];
|
246
247
|
|
247
248
|
/** internal
|
248
249
|
* $X._instanceIndex -> Integer
|
@@ -250,8 +251,8 @@ define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function(
|
|
250
251
|
* Tracks the next available instance index in the cache. This value also serves as the id of the
|
251
252
|
* next instantiated widget.
|
252
253
|
**/
|
253
|
-
|
254
|
-
|
254
|
+
Xooie._instanceIndex = 0;
|
255
|
+
|
255
256
|
/**
|
256
257
|
* $X.cleanup()
|
257
258
|
*
|
@@ -259,24 +260,26 @@ define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function(
|
|
259
260
|
* root element is no longer in the DOM, the module is garbage collected.
|
260
261
|
**/
|
261
262
|
|
262
|
-
|
263
|
-
|
263
|
+
Xooie.cleanup = function () {
|
264
|
+
var i, instance;
|
264
265
|
|
265
|
-
|
266
|
-
|
266
|
+
for (i = 0; i < $X._instanceCache.length; i += 1) {
|
267
|
+
instance = $X._instanceCache[i];
|
267
268
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
269
|
+
if (instance.root() && instance.root().parents('body').length === 0) {
|
270
|
+
instance.cleanup();
|
271
|
+
delete $X._instanceCache[i];
|
272
|
+
}
|
273
|
+
}
|
274
|
+
};
|
274
275
|
|
275
|
-
|
276
|
+
return Xooie;
|
276
277
|
});
|
277
278
|
|
278
|
-
require(['jquery', 'xooie/xooie'], function($, $X){
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
279
|
+
require(['jquery', 'xooie/xooie'], function ($, $X) {
|
280
|
+
'use strict';
|
281
|
+
|
282
|
+
$(document).ready(function () {
|
283
|
+
$X($(this));
|
284
|
+
});
|
285
|
+
});
|