xooie 1.0.6 → 1.0.7
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.
- data/vendor/assets/javascripts/xooie/addons/dropdown_accordion.js +38 -0
- data/vendor/assets/javascripts/xooie/addons/tab_automation.js +150 -0
- data/vendor/assets/javascripts/xooie/base.js +217 -0
- data/vendor/assets/javascripts/xooie/carousel.js +400 -0
- data/vendor/assets/javascripts/xooie/dialog.js +161 -0
- data/vendor/assets/javascripts/xooie/dropdown.js +285 -0
- data/vendor/assets/javascripts/xooie/event_handler.js +7 -4
- data/vendor/assets/javascripts/xooie/helpers.js +6 -50
- data/vendor/assets/javascripts/xooie/polyfill.js +49 -0
- data/vendor/assets/javascripts/xooie/shared.js +1 -1
- data/vendor/assets/javascripts/xooie/stylesheet.js +9 -32
- data/vendor/assets/javascripts/xooie/tab.js +125 -0
- data/vendor/assets/javascripts/xooie/widgets/carousel.js +1 -1
- data/vendor/assets/javascripts/xooie/xooie.js +1 -1
- data/vendor/assets/javascripts/xooie.js +169 -0
- metadata +11 -2
@@ -0,0 +1,285 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2012 Comcast
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
define('xooie/dropdown', ['jquery', 'xooie/base'], function($, Base) {
|
18
|
+
|
19
|
+
var parseWhich = function(which) {
|
20
|
+
if (typeof which === 'string') {
|
21
|
+
which = which.split(',');
|
22
|
+
return which.map(function(string){ return parseInt(string, 10); });
|
23
|
+
} else if (typeof which === 'number') {
|
24
|
+
return [which];
|
25
|
+
}
|
26
|
+
|
27
|
+
return which;
|
28
|
+
};
|
29
|
+
|
30
|
+
var Dropdown = Base('dropdown', function() {
|
31
|
+
var self = this,
|
32
|
+
handles = self.getHandle(),
|
33
|
+
expanders = self.getExpander();
|
34
|
+
|
35
|
+
this.handlers = {
|
36
|
+
off: function(event){
|
37
|
+
if ((typeof event.data.not !== 'undefined' && ($(event.data.not).is($(this)) || $(event.target).parents(event.data.not).length > 0)) || (typeof event.data.which !== 'undefined' && event.data.which.indexOf(event.which) === -1) || ($(event.target).is(self.getExpander(event.data.index)) || $(event.target).parents(self.options.dropdownExpanderSelector).length > 0) && !$(event.target).is($(this))) {
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
|
41
|
+
event.preventDefault();
|
42
|
+
|
43
|
+
self.collapse(event.data.index, event.data);
|
44
|
+
},
|
45
|
+
|
46
|
+
on: function(event){
|
47
|
+
var index = event.data.index || parseInt($(this).attr('data-dropdown-index'), 10),
|
48
|
+
delay = event.data.delay,
|
49
|
+
handle = $(this);
|
50
|
+
|
51
|
+
if ((typeof event.data.not !== 'undefined' && ($(event.data.not).is($(this)) || $(event.target).parents(event.data.not).length > 0)) || typeof event.data.which !== 'undefined' && event.data.which.indexOf(event.which) === -1) {
|
52
|
+
return true;
|
53
|
+
}
|
54
|
+
|
55
|
+
event.preventDefault();
|
56
|
+
|
57
|
+
self.expand(index, event.data);
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
this.timers = {
|
62
|
+
expand: [],
|
63
|
+
collapse: [],
|
64
|
+
throttle: []
|
65
|
+
};
|
66
|
+
|
67
|
+
this.addHandlers('on');
|
68
|
+
|
69
|
+
this.root.on({
|
70
|
+
dropdownExpand: function(event, index){
|
71
|
+
self.removeHandlers('on', index);
|
72
|
+
|
73
|
+
self.addHandlers('off', index);
|
74
|
+
|
75
|
+
$(this).attr('aria-selected', true);
|
76
|
+
self.getExpander(index).attr('aria-hidden', false);
|
77
|
+
},
|
78
|
+
|
79
|
+
dropdownCollapse: function(event, index){
|
80
|
+
self.removeHandlers('off', index);
|
81
|
+
|
82
|
+
self.addHandlers('on', index);
|
83
|
+
|
84
|
+
$(this).attr('aria-selected', false);
|
85
|
+
self.getExpander(index).attr('aria-hidden', true);
|
86
|
+
},
|
87
|
+
|
88
|
+
forceCollapse: function(event, data) {
|
89
|
+
self.collapse(data.index, data);
|
90
|
+
}
|
91
|
+
}, this.options.dropdownHandleSelector);
|
92
|
+
|
93
|
+
this.root.on('xooie-init.dropdown xooie-refresh.dropdown', function(){
|
94
|
+
handles.each(function(index){
|
95
|
+
var handle = $(this),
|
96
|
+
expander = expanders.eq(index);
|
97
|
+
|
98
|
+
|
99
|
+
handle.attr({
|
100
|
+
'data-dropdown-index': index,
|
101
|
+
'aria-selected': false
|
102
|
+
});
|
103
|
+
expander.attr({
|
104
|
+
'data-dropdown-index': index,
|
105
|
+
'aria-hidden': true
|
106
|
+
});
|
107
|
+
});
|
108
|
+
});
|
109
|
+
|
110
|
+
expanders.on('mouseover focus', function(){
|
111
|
+
var index = parseInt($(this).attr('data-dropdown-index'), 10);
|
112
|
+
|
113
|
+
if (self.timers.collapse[index]){
|
114
|
+
self.timers.collapse[index] = clearTimeout(self.timers.collapse[index]);
|
115
|
+
|
116
|
+
$(this).on('mouseleave blur', {index: index}, function(event){
|
117
|
+
self.collapse(event.data.index, 0);
|
118
|
+
$(this).unbind(event);
|
119
|
+
});
|
120
|
+
}
|
121
|
+
});
|
122
|
+
|
123
|
+
});
|
124
|
+
|
125
|
+
Dropdown.setDefaultOptions({
|
126
|
+
dropdownHandleSelector: '[data-role="dropdown-handle"]',
|
127
|
+
dropdownExpanderSelector: '[data-role="dropdown-content"]',
|
128
|
+
|
129
|
+
activeDropdownClass: 'is-dropdown-active',
|
130
|
+
|
131
|
+
throttleDelay: 300,
|
132
|
+
triggers: {
|
133
|
+
on: {
|
134
|
+
focus: {
|
135
|
+
delay: 0
|
136
|
+
}
|
137
|
+
},
|
138
|
+
off: {
|
139
|
+
blur: {
|
140
|
+
delay: 0
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
});
|
146
|
+
|
147
|
+
Dropdown.prototype.getTriggerHandle = function(triggerData, index){
|
148
|
+
var handles = this.getHandle(index);
|
149
|
+
|
150
|
+
if (triggerData.selector) {
|
151
|
+
return triggerData.selector === 'document' ? $(document) : $(triggerData.selector);
|
152
|
+
} else {
|
153
|
+
return handles;
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
Dropdown.prototype.getNamespacedTrigger = function(trigger, state){
|
158
|
+
return trigger + '.' + state + 'XooieDropdown';
|
159
|
+
};
|
160
|
+
|
161
|
+
Dropdown.prototype.addHandlers = function(state, index){
|
162
|
+
var trigger, nsTrigger, handle, triggerData, countName;
|
163
|
+
|
164
|
+
triggerData = this.options.triggers[state];
|
165
|
+
|
166
|
+
for (trigger in triggerData) {
|
167
|
+
if (typeof triggerData[trigger].which !== 'undefined') {
|
168
|
+
triggerData[trigger].which = parseWhich(triggerData[trigger].which);
|
169
|
+
}
|
170
|
+
|
171
|
+
countName = [trigger,state,'count'].join('-');
|
172
|
+
|
173
|
+
handle = this.getTriggerHandle(triggerData[trigger], index);
|
174
|
+
|
175
|
+
handle.data(countName, handle.data(countName) + 1 || 1);
|
176
|
+
|
177
|
+
nsTrigger = this.getNamespacedTrigger(trigger, state);
|
178
|
+
|
179
|
+
handle.on(nsTrigger, $.extend({delay: 0, index: index}, triggerData[trigger]), this.handlers[state]);
|
180
|
+
}
|
181
|
+
};
|
182
|
+
|
183
|
+
Dropdown.prototype.removeHandlers = function(state, index){
|
184
|
+
var trigger, nsTrigger, handle, triggerData, countName, eventCount;
|
185
|
+
|
186
|
+
triggerData = this.options.triggers[state];
|
187
|
+
|
188
|
+
for (trigger in triggerData) {
|
189
|
+
handle = this.getTriggerHandle(triggerData[trigger], index);
|
190
|
+
|
191
|
+
countName = [trigger,state,'count'].join('-');
|
192
|
+
|
193
|
+
eventCount = handle.data(countName) - 1;
|
194
|
+
|
195
|
+
if (eventCount <= 0) {
|
196
|
+
nsTrigger = this.getNamespacedTrigger(trigger, state);
|
197
|
+
|
198
|
+
handle.unbind(nsTrigger);
|
199
|
+
|
200
|
+
handle.data(countName, 0);
|
201
|
+
} else {
|
202
|
+
handle.data(countName, eventCount);
|
203
|
+
}
|
204
|
+
}
|
205
|
+
};
|
206
|
+
|
207
|
+
Dropdown.prototype.getHandle = function(index){
|
208
|
+
var handles = this.root.find(this.options.dropdownHandleSelector);
|
209
|
+
|
210
|
+
return (typeof index !== 'undefined' && index >= 0) ? handles.eq(index) : handles;
|
211
|
+
};
|
212
|
+
|
213
|
+
Dropdown.prototype.getExpander = function(index){
|
214
|
+
var selectorString;
|
215
|
+
|
216
|
+
if (typeof index === 'undefined' || isNaN(index)) {
|
217
|
+
selectorString = this.options.dropdownExpanderSelector;
|
218
|
+
} else {
|
219
|
+
selectorString = this.options.dropdownExpanderSelector + '[data-dropdown-index="' + index + '"]';
|
220
|
+
}
|
221
|
+
|
222
|
+
return this.root.find(selectorString);
|
223
|
+
};
|
224
|
+
|
225
|
+
Dropdown.prototype.setState = function(index, data, active){
|
226
|
+
if (typeof index === 'undefined' || isNaN(index)) {
|
227
|
+
return;
|
228
|
+
}
|
229
|
+
|
230
|
+
var state = active ? 'expand' : 'collapse',
|
231
|
+
counterState = active ? 'collapse' : 'expand',
|
232
|
+
delay = data.delay;
|
233
|
+
|
234
|
+
this.timers[counterState][index] = clearTimeout(this.timers[counterState][index]);
|
235
|
+
|
236
|
+
if (this.timers.throttle[index] || this.timers[state][index]) {
|
237
|
+
return;
|
238
|
+
}
|
239
|
+
|
240
|
+
this.timers[state][index] = setTimeout(function(i, _state, _active, _data) {
|
241
|
+
var expander = this.getExpander(i),
|
242
|
+
handle = this.getHandle(i),
|
243
|
+
self = this;
|
244
|
+
|
245
|
+
this.timers[_state][i] = clearTimeout(this.timers[_state][i]);
|
246
|
+
|
247
|
+
expander.toggleClass(this.options.activeDropdownClass, _active);
|
248
|
+
this.getHandle(i).toggleClass(this.options.activeDropdownClass, _active);
|
249
|
+
|
250
|
+
if (_active){
|
251
|
+
handle.trigger('dropdownExpand', [i, _data]);
|
252
|
+
//this.setFocus(expander);
|
253
|
+
} else {
|
254
|
+
handle.trigger('dropdownCollapse', [i, _data]);
|
255
|
+
}
|
256
|
+
|
257
|
+
if (this.options.throttleDelay > 0){
|
258
|
+
this.timers.throttle[i] = setTimeout(function(){
|
259
|
+
self.timers.throttle[i] = clearTimeout(self.timers.throttle[i]);
|
260
|
+
}, this.options.throttleDelay);
|
261
|
+
}
|
262
|
+
|
263
|
+
}.bind(this, index, state, active, data), delay);
|
264
|
+
};
|
265
|
+
|
266
|
+
Dropdown.prototype.expand = function(index, data) {
|
267
|
+
if (!this.getHandle(index).hasClass(this.options.activeDropdownClass)) {
|
268
|
+
this.setState(index, data, true);
|
269
|
+
}
|
270
|
+
};
|
271
|
+
|
272
|
+
Dropdown.prototype.collapse = function(index, data) {
|
273
|
+
if (this.getHandle(index).hasClass(this.options.activeDropdownClass)) {
|
274
|
+
this.setState(index, data, false);
|
275
|
+
}
|
276
|
+
};
|
277
|
+
|
278
|
+
Dropdown.prototype.setFocus = function(element){
|
279
|
+
element.find('a,input,textarea,button,select,iframe,[tabindex][tabindex!=-1]')
|
280
|
+
.first()
|
281
|
+
.focus();
|
282
|
+
};
|
283
|
+
|
284
|
+
return Dropdown;
|
285
|
+
});
|
@@ -47,8 +47,9 @@ define('xooie/event_handler', ['jquery', 'xooie/helpers'], function ($, helpers)
|
|
47
47
|
formattedType = format(type, this.namespace);
|
48
48
|
|
49
49
|
if (helpers.isUndefined(this.handlers[formattedType])) {
|
50
|
-
this.handlers[formattedType] = function (
|
51
|
-
|
50
|
+
this.handlers[formattedType] = function () {
|
51
|
+
[].splice.call(arguments, 1, 0, this);
|
52
|
+
self.fire.apply(self, arguments);
|
52
53
|
};
|
53
54
|
}
|
54
55
|
|
@@ -67,13 +68,15 @@ define('xooie/event_handler', ['jquery', 'xooie/helpers'], function ($, helpers)
|
|
67
68
|
}
|
68
69
|
};
|
69
70
|
|
70
|
-
EventHandler.prototype.fire = function (event
|
71
|
+
EventHandler.prototype.fire = function (event) {
|
71
72
|
if (event.namespace && event.namespace !== this.namespace) {
|
72
73
|
return;
|
73
74
|
}
|
74
75
|
|
76
|
+
var args = [].slice.call(arguments, 1);
|
77
|
+
|
75
78
|
if (!helpers.isUndefined(this._callbacks[event.type])) {
|
76
|
-
this._callbacks[event.type].fireWith(
|
79
|
+
this._callbacks[event.type].fireWith.apply(this._callbacks[event.type].fireWith, args);
|
77
80
|
}
|
78
81
|
};
|
79
82
|
|
@@ -14,61 +14,13 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
/* Polyfill methods for Xooie */
|
18
|
-
|
19
|
-
// Adds Array.prototype.indexOf functionality to IE<9 (From MDN)
|
20
|
-
if (!Array.prototype.indexOf) {
|
21
|
-
Array.prototype.indexOf = function (searchElement, fromIndex) {
|
22
|
-
'use strict';
|
23
|
-
var i, pivot, length;
|
24
|
-
|
25
|
-
pivot = fromIndex || 0;
|
26
|
-
|
27
|
-
if (!this) {
|
28
|
-
throw new TypeError();
|
29
|
-
}
|
30
|
-
|
31
|
-
length = this.length;
|
32
|
-
|
33
|
-
if (length === 0 || pivot >= length) {
|
34
|
-
return -1;
|
35
|
-
}
|
36
|
-
|
37
|
-
if (pivot < 0) {
|
38
|
-
pivot = length - Math.abs(pivot);
|
39
|
-
}
|
40
|
-
|
41
|
-
for (i = pivot; i < length; i += 1) {
|
42
|
-
if (this[i] === searchElement) {
|
43
|
-
return i;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
return -1;
|
47
|
-
};
|
48
|
-
}
|
49
|
-
|
50
|
-
// Adds Function.prototype.bind to browsers that do not support it
|
51
|
-
if (!Function.prototype.bind) {
|
52
|
-
Function.prototype.bind = function (context) {
|
53
|
-
'use strict';
|
54
|
-
var f, args;
|
55
|
-
|
56
|
-
f = this;
|
57
|
-
args = Array.prototype.slice.call(arguments, 1);
|
58
|
-
|
59
|
-
return function () {
|
60
|
-
return f.apply(context, args.concat(Array.prototype.slice.call(arguments)));
|
61
|
-
};
|
62
|
-
};
|
63
|
-
}
|
64
|
-
|
65
17
|
/**
|
66
18
|
* class Xooie.helpers
|
67
19
|
*
|
68
20
|
* A collection of helper methods used by Xooie modules.
|
69
21
|
**/
|
70
22
|
|
71
|
-
define('xooie/helpers', [], function () {
|
23
|
+
define('xooie/helpers', ['jquery'], function ($) {
|
72
24
|
'use strict';
|
73
25
|
|
74
26
|
var helpers = {
|
@@ -100,13 +52,17 @@ define('xooie/helpers', [], function () {
|
|
100
52
|
}()),
|
101
53
|
|
102
54
|
isObject: function (obj) {
|
103
|
-
return
|
55
|
+
return $.isPlainObject(obj);
|
104
56
|
},
|
105
57
|
|
106
58
|
isUndefined: function (obj) {
|
107
59
|
return obj === undefined;
|
108
60
|
},
|
109
61
|
|
62
|
+
isDefined: function (obj) {
|
63
|
+
return !this.isUndefined(obj);
|
64
|
+
},
|
65
|
+
|
110
66
|
isFunction: function (func) {
|
111
67
|
return typeof func === 'function';
|
112
68
|
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/* Polyfill methods for Xooie */
|
2
|
+
|
3
|
+
define('xooie/polyfill', [], function () {
|
4
|
+
'use strict';
|
5
|
+
// Adds Array.prototype.indexOf functionality to IE<9 (From MDN)
|
6
|
+
if (!Array.prototype.indexOf) {
|
7
|
+
Array.prototype.indexOf = function (searchElement, fromIndex) {
|
8
|
+
var i, pivot, length;
|
9
|
+
|
10
|
+
pivot = fromIndex || 0;
|
11
|
+
|
12
|
+
if (!this) {
|
13
|
+
throw new TypeError();
|
14
|
+
}
|
15
|
+
|
16
|
+
length = this.length;
|
17
|
+
|
18
|
+
if (length === 0 || pivot >= length) {
|
19
|
+
return -1;
|
20
|
+
}
|
21
|
+
|
22
|
+
if (pivot < 0) {
|
23
|
+
pivot = length - Math.abs(pivot);
|
24
|
+
}
|
25
|
+
|
26
|
+
for (i = pivot; i < length; i += 1) {
|
27
|
+
if (this[i] === searchElement) {
|
28
|
+
return i;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return -1;
|
32
|
+
};
|
33
|
+
}
|
34
|
+
|
35
|
+
// Adds Function.prototype.bind to browsers that do not support it
|
36
|
+
if (!Function.prototype.bind) {
|
37
|
+
Function.prototype.bind = function (context) {
|
38
|
+
var f, args;
|
39
|
+
|
40
|
+
f = this;
|
41
|
+
args = Array.prototype.slice.call(arguments, 1);
|
42
|
+
|
43
|
+
return function () {
|
44
|
+
return f.apply(context, args.concat(Array.prototype.slice.call(arguments)));
|
45
|
+
};
|
46
|
+
};
|
47
|
+
}
|
48
|
+
|
49
|
+
});
|
@@ -209,7 +209,7 @@ define('xooie/shared', ['jquery', 'xooie/helpers'], function ($, helpers) {
|
|
209
209
|
|
210
210
|
for (i = 0; i < instance._definedProps.length; i += 1) {
|
211
211
|
prop = instance._definedProps[i];
|
212
|
-
if (
|
212
|
+
if (helpers.isDefined(data[prop])) {
|
213
213
|
instance.set(prop, data[prop]);
|
214
214
|
}
|
215
215
|
}
|
@@ -14,18 +14,9 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
define('xooie/stylesheet', ['jquery'
|
17
|
+
define('xooie/stylesheet', ['jquery'], function ($) {
|
18
18
|
'use strict';
|
19
19
|
|
20
|
-
function nameCheck(index, name) {
|
21
|
-
var s = document.styleSheets[index];
|
22
|
-
|
23
|
-
if (!helpers.isUndefined(s.ownerNode)) {
|
24
|
-
return s.ownerNode.getAttribute('id') === name;
|
25
|
-
}
|
26
|
-
return s.id === name;
|
27
|
-
}
|
28
|
-
|
29
20
|
var Stylesheet = function (name) {
|
30
21
|
//check to see if a stylesheet already exists with this name
|
31
22
|
this.element = $('style[id=' + name + ']');
|
@@ -43,7 +34,7 @@ define('xooie/stylesheet', ['jquery', 'xooie/helpers'], function ($, helpers) {
|
|
43
34
|
};
|
44
35
|
|
45
36
|
Stylesheet.prototype.get = function () {
|
46
|
-
return
|
37
|
+
return this.element[0].sheet || this.element[0].styleSheet;
|
47
38
|
};
|
48
39
|
|
49
40
|
Stylesheet.prototype.getRule = function (ruleName) {
|
@@ -64,7 +55,7 @@ define('xooie/stylesheet', ['jquery', 'xooie/helpers'], function ($, helpers) {
|
|
64
55
|
};
|
65
56
|
|
66
57
|
Stylesheet.prototype.addRule = function (ruleName, properties) {
|
67
|
-
var rule = this.getRule(ruleName), index, prop, propString = '';
|
58
|
+
var rule = this.getRule(ruleName), index, prop, propString = '', ruleNameArray, i;
|
68
59
|
|
69
60
|
if (!rule) {
|
70
61
|
for (prop in properties) {
|
@@ -81,7 +72,12 @@ define('xooie/stylesheet', ['jquery', 'xooie/helpers'], function ($, helpers) {
|
|
81
72
|
} else {
|
82
73
|
//support for IE < 9
|
83
74
|
index = this.get().rules.length;
|
84
|
-
|
75
|
+
ruleNameArray = ruleName.split(',');
|
76
|
+
// READ: http://msdn.microsoft.com/en-us/library/ie/aa358796%28v=vs.85%29.aspx
|
77
|
+
for (i = 0; i < ruleNameArray.length; i += 1) {
|
78
|
+
this.get().addRule(ruleNameArray[i], propString, index + i);
|
79
|
+
}
|
80
|
+
|
85
81
|
rule = this.get().rules[index];
|
86
82
|
}
|
87
83
|
}
|
@@ -114,25 +110,6 @@ define('xooie/stylesheet', ['jquery', 'xooie/helpers'], function ($, helpers) {
|
|
114
110
|
return false;
|
115
111
|
};
|
116
112
|
|
117
|
-
Stylesheet.prototype.getIndex = function () {
|
118
|
-
var i;
|
119
|
-
|
120
|
-
if (helpers.isUndefined(document.styleSheets)) {
|
121
|
-
return;
|
122
|
-
}
|
123
|
-
|
124
|
-
if (!helpers.isUndefined(this._index) && nameCheck(this._index, this._name)) {
|
125
|
-
return this._index;
|
126
|
-
}
|
127
|
-
|
128
|
-
for (i = 0; i < document.styleSheets.length; i += 1) {
|
129
|
-
if (nameCheck(i, this._name)) {
|
130
|
-
this._index = i;
|
131
|
-
return i;
|
132
|
-
}
|
133
|
-
}
|
134
|
-
};
|
135
|
-
|
136
113
|
return Stylesheet;
|
137
114
|
|
138
115
|
});
|
@@ -0,0 +1,125 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2012 Comcast
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
define('xooie/tab', ['jquery', 'xooie/base'], function($, Base) {
|
18
|
+
|
19
|
+
var Tab = Base('tab', function() {
|
20
|
+
var self = this;
|
21
|
+
|
22
|
+
this.createTabs();
|
23
|
+
});
|
24
|
+
|
25
|
+
Tab.setDefaultOptions({
|
26
|
+
panelSelector: '[data-role="tab-panel"]',
|
27
|
+
stripSelector: '[data-role="tab-strip"]',
|
28
|
+
controlSelector: '[data-role="tab-selector"]',
|
29
|
+
controlButtonSelector: '[data-tab-control]',
|
30
|
+
tabTemplateSelector: '[data-role="tab-template"]',
|
31
|
+
|
32
|
+
activeTabClass: 'is-tab-active'
|
33
|
+
});
|
34
|
+
|
35
|
+
$.extend(Tab.prototype, {
|
36
|
+
switchToTab: function(index, key) {
|
37
|
+
if (index !== this._currentTab && index >= 0 && index < this.getPanel().length) {
|
38
|
+
var e = $.Event('tabChange');
|
39
|
+
e.fromTab = this._currentTab;
|
40
|
+
e.toTab = index;
|
41
|
+
e.which = key;
|
42
|
+
|
43
|
+
this.getPanel(this._currentTab).removeClass(this.options.activeTabClass);
|
44
|
+
this.getTab(this._currentTab).removeClass(this.options.activeTabClass);
|
45
|
+
|
46
|
+
this.getPanel(index).addClass(this.options.activeTabClass);
|
47
|
+
this.getTab(index).addClass(this.options.activeTabClass);
|
48
|
+
|
49
|
+
this._currentTab = index;
|
50
|
+
|
51
|
+
this.root.trigger(e);
|
52
|
+
}
|
53
|
+
},
|
54
|
+
|
55
|
+
getPanel: function(index) {
|
56
|
+
var panels = this.root.find(this.options.panelSelector);
|
57
|
+
|
58
|
+
if (typeof index === 'undefined') {
|
59
|
+
return panels;
|
60
|
+
} else {
|
61
|
+
return panels.eq(index);
|
62
|
+
}
|
63
|
+
},
|
64
|
+
|
65
|
+
getTab: function(index) {
|
66
|
+
var tabs = this.root.find(this.options.controlSelector);
|
67
|
+
if (typeof index === 'undefined') {
|
68
|
+
return tabs;
|
69
|
+
} else {
|
70
|
+
return tabs.eq(index);
|
71
|
+
}
|
72
|
+
},
|
73
|
+
|
74
|
+
createTabs: function() {
|
75
|
+
var tabStrip = this.root.find(this.options.stripSelector),
|
76
|
+
template = this.root.find(this.options.tabTemplateSelector),
|
77
|
+
panels = this.getPanel(),
|
78
|
+
i, element, control,
|
79
|
+
activeTab = 0, handler, self = this;
|
80
|
+
|
81
|
+
if (template.length === 0){
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
|
85
|
+
this.getTab().remove();
|
86
|
+
|
87
|
+
handler = function(event) {
|
88
|
+
var keys = [13,32];
|
89
|
+
|
90
|
+
if ([1,13,32].indexOf(event.which) !== -1){
|
91
|
+
self.switchToTab($(this).data('tab-index'), event.which);
|
92
|
+
}
|
93
|
+
};
|
94
|
+
|
95
|
+
for (i = 0; i < panels.length; i++) {
|
96
|
+
if(tabStrip.length > 0 && template.length > 0) {
|
97
|
+
element = this.render(template, {
|
98
|
+
panel_label: panels.eq(i).attr('data-tab-label'),
|
99
|
+
panel_index: i,
|
100
|
+
panel_has_next: (i < panels.length - 1)
|
101
|
+
});
|
102
|
+
|
103
|
+
if (element.is(this.options.controlButtonSelector)) {
|
104
|
+
control = element;
|
105
|
+
} else {
|
106
|
+
control = element.find(this.options.controlButtonSelector);
|
107
|
+
}
|
108
|
+
|
109
|
+
control.data('tab-index', i)
|
110
|
+
.on('mouseup keyup', handler);
|
111
|
+
|
112
|
+
tabStrip.append(element);
|
113
|
+
}
|
114
|
+
|
115
|
+
if (panels.eq(i).hasClass(this.options.activeTabClass)) {
|
116
|
+
activeTab = i;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
this.switchToTab(activeTab);
|
121
|
+
}
|
122
|
+
});
|
123
|
+
|
124
|
+
return Tab;
|
125
|
+
});
|
@@ -306,7 +306,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
|
|
306
306
|
self._timers.scroll = setTimeout(scrollComplete, 250);
|
307
307
|
});
|
308
308
|
|
309
|
-
this.cropStyle(Carousel.createStyleRule('.' + this.instanceClass() + ' .' + this.cropClass() + ', .' + this.instanceClass() + '.' + this.cropClass()));
|
309
|
+
this.cropStyle(Carousel.createStyleRule('.' + this.instanceClass() + ' .' + this.cropClass() + ', .' + this.instanceClass() + '.' + this.cropClass(), {'height': 'auto'}));
|
310
310
|
|
311
311
|
// TODO: add functionality to remove from cache
|
312
312
|
Carousel._cache = Carousel._cache.add(this.root());
|
@@ -126,7 +126,7 @@ $X = Xooie = (function (static_config) {
|
|
126
126
|
return obj;
|
127
127
|
}(Xooie));
|
128
128
|
|
129
|
-
define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function ($, helpers, Stylesheet) {
|
129
|
+
define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet', 'xooie/polyfill'], function ($, helpers, Stylesheet) {
|
130
130
|
'use strict';
|
131
131
|
var config, _mapName, widgetSelector, widgetDataAttr, addonDataAttr;
|
132
132
|
|