xooie 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
data/License.txt ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ [![Build Status](https://travis-ci.org/Comcast/Xooie.png?branch=master)](http://travis-ci.org/Comcast/Xooie)
2
+
3
+ Xooie
4
+ ===
5
+
6
+ Xooie is a library of JavaScript UI widgets designed to be extremely modular and agnostic of markup and styles. With Xooie, you can create almost any interface you want. Key components are tagged with data attributes, informing Xooie to bind the associated widget functionality.
7
+
8
+ In addition to being flexible, Xooie also:
9
+
10
+ * Allows developers to automatically instantiate UI widgets without writing additional JavaScript; simply add the appropriate data attributes to your HTML markup and you're good to go!
11
+
12
+ * Allows developers to define custom functionality by creating new Addons. Addons can be loaded for specific instances of a widget by creating a file to house your Addon code and specifying the Addon file's path in a data-addons="" attribute on the associated HTML element.
13
+
14
+ * Designed for responsive layouts. You want a flexible-width carousel? No problem!
15
+
16
+ * Designed with accessabilty in mind, including focus control.
17
+
18
+ To see Xooie in action visit [Xfinity.comcast.net](http://xfinity.comcast.net).
19
+
20
+ Installation:
21
+ ---
22
+ Setting up Xooie is as easy as dropping the Xooie directory into your codebase.
23
+
24
+ Xooie requires the following libraries:
25
+ * [RequireJS](http://www.requirejs.com)
26
+ * [jQuery](http://www.jquery.com)
27
+ * micro_tmpl.js (found in the lib directory of this project)
28
+
29
+ Xooie will work by just loading xooie.js on your page; all other files will be loaded asynchronously as needed. However, if you would rather not load the scripts asynchronously, the modules can be loaded at page load.
30
+
31
+ Instantiation happens automatically when the page is loaded. All HTML elements tagged with the "data-widget-type" attribute will offer the associated Xooie widget functionality.
32
+
33
+ Documentation:
34
+ ---
35
+ Carousel
36
+ (documentation coming soon!)
37
+
38
+ Tab
39
+ (documentation coming soon!)
40
+
41
+ Dropdown
42
+ (documentation coming soon!)
data/lib/xooie.rb ADDED
@@ -0,0 +1,6 @@
1
+ module Xooie
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,76 @@
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/addons/base', ['jquery'], function($) {
18
+ var Base = function(name, constructor){
19
+ var defaultOptions, initEvent, className, wrapper;
20
+
21
+ defaultOptions = {};
22
+ initEvent = 'xooie-addon-init.' + name.toLowerCase();
23
+ className = 'has-' + name.toLowerCase() + '-addon';
24
+
25
+ wrapper = function(module) {
26
+ //Let's check to see if module is defined...
27
+ //TODO: intelligently check if module is an instance of the base ui class
28
+ if (typeof module === 'undefined') {
29
+ return false;
30
+ }
31
+
32
+ //if we've already instantiated an instance of this addon for this module, return it
33
+ if (module.addons && typeof module.addons[name] !== 'undefined') {
34
+ return module.addons[name];
35
+ }
36
+
37
+ //module is the module we are extending.
38
+ this.module = module;
39
+
40
+ //track this addon on the parent module
41
+ this.module.addons[name] = this;
42
+
43
+ //We'll need to extend the module's base properties
44
+ this.options = $.extend({}, wrapper.getDefaultOptions(), this.module.options);
45
+
46
+ this.module.root.addClass(className);
47
+
48
+ constructor.apply(this, arguments);
49
+
50
+ this.module.root.trigger(initEvent);
51
+
52
+ };
53
+
54
+ wrapper.prototype.cleanup = function() {
55
+ this.module.root.removeClass(className);
56
+ };
57
+
58
+ wrapper.prototype.cleanup = function() {
59
+ this.module.root.removeClass(className);
60
+ };
61
+
62
+ wrapper.getDefaultOptions = function(){
63
+ return defaultOptions;
64
+ };
65
+
66
+ wrapper.setDefaultOptions = function(options){
67
+ if (typeof options !== 'undefined') {
68
+ $.extend(defaultOptions, options);
69
+ }
70
+ };
71
+
72
+ return wrapper;
73
+ };
74
+
75
+ return Base;
76
+ });
@@ -0,0 +1,122 @@
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/addons/carousel_lentils', ['jquery', 'xooie/addons/base'], function($, Base) {
18
+
19
+ var Lentils = Base('lentils', function(){
20
+ var self = this;
21
+
22
+ this.lentilBuilders = {
23
+ "item": function(container, template){
24
+ var items = self.module.content.children(),
25
+ element, i;
26
+
27
+ for (i = 0; i < items.length; i += 1) {
28
+
29
+ element = self.module.render(template, {
30
+ number: i + 1,
31
+ scroll_mode: "item",
32
+ lentil_is_last: (i === items.length - 1)
33
+ });
34
+ container.append(element);
35
+ }
36
+ },
37
+
38
+ "page": function(container, template){
39
+ if (typeof self.module.addons.pagination === 'undefined') {
40
+ return;
41
+ }
42
+
43
+ var element, i;
44
+
45
+ for (i = 0; i < self.module.addons.pagination._breaks.length; i += 1) {
46
+ element = self.module.render(template, {
47
+ number: i + 1,
48
+ scroll_mode: "page",
49
+ lentil_is_last: (i === self.module.addons.pagination._breaks.length - 1)
50
+ });
51
+
52
+ container.append(element);
53
+ }
54
+
55
+ }
56
+
57
+ };
58
+
59
+ this.module.root.addClass('is-carousel-lentiled');
60
+
61
+ this.module.root.on('carouselUpdated', function(){
62
+ self.updateLentils();
63
+ });
64
+
65
+ this.module.root.on('carouselScrollComplete', function(){
66
+ self.currentLentil();
67
+ });
68
+
69
+ this.updateLentils();
70
+
71
+ this.currentLentil();
72
+
73
+ });
74
+
75
+ Lentils.setDefaultOptions({
76
+ lentilMode: 'item',
77
+ lentilSelector: '[data-role="carousel-lentils"]',
78
+ lentilTemplateSelector: '[data-role="carousel-lentils-template"]',
79
+
80
+ activeLentilClass: 'is-active-lentil'
81
+ });
82
+
83
+ Lentils.prototype.currentLentil = function(){
84
+ var container = this.module.root.find(this.options.lentilSelector),
85
+ lentils = container.children(),
86
+ index;
87
+
88
+ if (this.options.lentilMode === 'page' && typeof this.module.addons.pagination !== 'undefined') {
89
+ index = this.module.addons.pagination.currentPage();
90
+ } else {
91
+ index = this.module.currentItem();
92
+ }
93
+
94
+ lentils.filter('.' + this.options.activeLentilClass).removeClass(this.options.activeLentilClass);
95
+
96
+ lentils.eq(index).addClass(this.options.activeLentilClass);
97
+ };
98
+
99
+ Lentils.prototype.updateLentils = function() {
100
+ var container = this.module.root.find(this.options.lentilSelector),
101
+ template = this.module.root.find(this.options.lentilTemplateSelector),
102
+ self = this;
103
+
104
+ if (container.length > 0 && template.length > 0) {
105
+ container.html('');
106
+
107
+ if (typeof this.lentilBuilders[this.options.lentilMode] === 'function') {
108
+ this.lentilBuilders[this.options.lentilMode](container, template);
109
+
110
+ container.children().on('click', function(event) {
111
+ event.preventDefault();
112
+ self.module.updatePosition($(this).data('scroll'));
113
+ });
114
+
115
+ this.currentLentil();
116
+
117
+ }
118
+ }
119
+ };
120
+
121
+ return Lentils;
122
+ });
@@ -0,0 +1,180 @@
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/addons/carousel_pagination', ['jquery', 'xooie/addons/base'], function($, Base){
18
+
19
+ var Pagination = Base('pagination', function() {
20
+ var self = this;
21
+
22
+ this._breaks = [];
23
+
24
+ this.module.positionUpdaters = $.extend({}, this.module.positionUpdaters, {
25
+ "page": function(quantity, direction) {
26
+ var items = self.module.content.children(),
27
+ bias = 1,
28
+ offset = 0,
29
+ position = self.module.wrapper.scrollLeft(),
30
+ i;
31
+
32
+ if (typeof direction === 'undefined') {
33
+ if (quantity > 0 && quantity <= self._breaks.length) {
34
+ offset = Math.round(items.eq(self._breaks[quantity - 1]).position().left);
35
+ }
36
+ } else {
37
+ direction = direction === -1 ? -1 : 1;
38
+
39
+ bias = -direction;
40
+
41
+ if (!quantity || typeof quantity !== 'number') {
42
+ quantity = 1;
43
+ }
44
+
45
+ i = self.currentPage(bias) + direction * quantity;
46
+ i = Math.max(0, Math.min(self._breaks.length - 1, i));
47
+ offset = Math.round(items.eq(self._breaks[i]).position().left);
48
+ }
49
+
50
+ return position + offset;
51
+ }
52
+ });
53
+
54
+ this.module.snapMethods = $.extend({}, this.module.snapMethods, {
55
+ "page": function() {
56
+ var items = self.module.content.children(),
57
+ offset, p1, p2,
58
+ i = self.currentPage();
59
+
60
+ p1 = items.eq(self._breaks[i]).position().left;
61
+ if (Math.abs(p1) < 1) {
62
+ p1 = p1 < 0 ? Math.ceil(p1) : Math.floor(p1);
63
+ } else {
64
+ p1 = Math.round(p1);
65
+ }
66
+
67
+ if (p1 !== 0 && i > 0) {
68
+ p2 = items.eq(self._breaks[i - 1]).position().left;
69
+
70
+ if (Math.abs(p2) < 1) {
71
+ p2 = p2 < 0 ? Math.ceil(p2) : Math.floor(p2);
72
+ } else {
73
+ p2 = Math.round(p2);
74
+ }
75
+
76
+ if (Math.abs(p1) < Math.abs(p2)) {
77
+ offset = p1 + self.module.wrapper.scrollLeft();
78
+ } else {
79
+ offset = p2 + self.module.wrapper.scrollLeft();
80
+ }
81
+
82
+ self.module.wrapper.animate({ scrollLeft: offset });
83
+ }
84
+ }
85
+ });
86
+
87
+ this.module.displayMethods = $.extend({}, this.module.displayMethods, {
88
+ "page": function(container, template){
89
+
90
+ var element = self.module.render(template, {
91
+ current_page: self.currentPage() + 1,
92
+ total_pages: self._breaks.length
93
+ });
94
+
95
+ container.append(element);
96
+ }
97
+ });
98
+
99
+ this.module.root.on('carouselUpdated', function(){
100
+ self.updateBreaks();
101
+ });
102
+
103
+ this.updateBreaks();
104
+ });
105
+
106
+ Pagination.prototype.currentPage = function(bias) {
107
+ var i, k, items = this.module.content.children(),
108
+ position, itemWidth, lastItem;
109
+
110
+ if (typeof bias === 'undefined') {
111
+ bias = 1;
112
+ }
113
+
114
+ if (bias === 1) {
115
+ position = this.module.content.position().left;
116
+
117
+ for (i = 0; i < this._breaks.length; i += 1) {
118
+ itemWidth = 0;
119
+ lastItem = (i === this._breaks.length - 1) ? items.length : this._breaks[i + 1];
120
+
121
+ for (k = this._breaks[i]; k < lastItem; k += 1) {
122
+ itemWidth += items.eq(k).outerWidth(true);
123
+ }
124
+
125
+ if (position + (this.module.options.visibleThreshold * itemWidth) >= 0){
126
+ return i;
127
+ } else {
128
+ position += itemWidth;
129
+ }
130
+ }
131
+ return items.length - 1;
132
+ } else {
133
+ position = this.module.content.outerWidth(true) + this.module.content.position().left;
134
+
135
+ for (i = this._breaks.length - 1; i >= 0; i--) {
136
+ itemWidth = 0;
137
+ lastItem = (i === this._breaks.length - 1) ? items.length : this._breaks[i + 1];
138
+
139
+ for (k = this._breaks[i]; k < lastItem; k += 1) {
140
+ itemWidth += items.eq(k).outerWidth(true);
141
+ }
142
+ position -= itemWidth;
143
+
144
+ if (position <= this.module.options.visibleThreshold * itemWidth) {
145
+ return i;
146
+ }
147
+ }
148
+ return 0;
149
+ }
150
+ };
151
+
152
+ Pagination.prototype.updateBreaks = function() {
153
+ var items = this.module.content.children(),
154
+ width = 0,
155
+ breakPoint = this.module.wrapper.innerWidth(),
156
+ breaks = [0];
157
+
158
+ items.each(function(i) {
159
+ var node = $(this),
160
+ w = node.outerWidth(true);
161
+
162
+ width += w;
163
+
164
+ if (width > breakPoint) {
165
+ if (width - (w - node.innerWidth()) > breakPoint) {
166
+ width = w;
167
+ breaks.push(i);
168
+ }
169
+ }
170
+ });
171
+
172
+ this.module.root.toggleClass('is-carousel-paginated', breaks.length > 1);
173
+
174
+ this._breaks = breaks;
175
+
176
+ this.module.updateDisplay();
177
+ };
178
+
179
+ return Pagination;
180
+ });
@@ -0,0 +1,38 @@
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/addons/dropdown_accordion', ['jquery', 'xooie/addons/base'], function($, Base){
18
+
19
+ var Accordion = Base('accordion', function() {
20
+ var self = this;
21
+
22
+ this.module.getHandle().on('dropdownExpand', function(event){
23
+ var activeHandles = self.module.getHandle().not($(this)).filter('.' + self.module.options.activeDropdownClass),
24
+ i = 0,
25
+ index;
26
+
27
+ for (; i < activeHandles.length; i += 1) {
28
+ index = parseInt($(activeHandles[i]).attr('data-dropdown-index'), 10);
29
+
30
+ self.module.collapse(index, 0);
31
+ }
32
+
33
+ });
34
+ });
35
+
36
+ return Accordion;
37
+
38
+ });