xooie 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -73,13 +73,13 @@ define('xooie/helpers', [], function () {
73
73
 
74
74
  var helpers = {
75
75
  /**
76
- * Xooie.helpers.toAry(str) -> Array
76
+ * Xooie.helpers.toArray(str) -> Array
77
77
  * - str (String | Array): The string to be converted to an array, or an array.
78
78
  *
79
79
  * Converts a string to an array, or returns the passed argument if it is already an array. Used
80
80
  * when parsing data attributes that can be either a space-delineated string or an array.
81
81
  **/
82
- toAry: function (str) {
82
+ toArray: function (str) {
83
83
  if (typeof str === 'string') {
84
84
  return str.split(/\s+/);
85
85
  }
@@ -89,8 +89,8 @@ define('xooie/helpers', [], function () {
89
89
  }
90
90
  },
91
91
 
92
- toInt: function (int) {
93
- return parseInt(int, 10);
92
+ toInteger: function (integer) {
93
+ return parseInt(integer, 10);
94
94
  },
95
95
 
96
96
  isArray: (function () {
@@ -132,16 +132,16 @@ define('xooie/shared', ['jquery', 'xooie/helpers'], function ($, helpers) {
132
132
  return function Child() {
133
133
  var i, result;
134
134
 
135
- for (i = 0; i < Child._constructors.length; i += 1) {
136
- result = Child._constructors[i].apply(this, arguments);
135
+ for (i = 0; i < newModule._constructors.length; i += 1) {
136
+ result = newModule._constructors[i].apply(this, arguments);
137
137
 
138
138
  if (!helpers.isUndefined(result)) {
139
139
  return result;
140
140
  }
141
141
  }
142
142
 
143
- for (i = 0; i < Child._postConstructors.length; i += 1) {
144
- Child._postConstructors[i].apply(this, arguments);
143
+ for (i = 0; i < newModule._postConstructors.length; i += 1) {
144
+ newModule._postConstructors[i].apply(this, arguments);
145
145
  }
146
146
  };
147
147
  }());
File without changes
@@ -127,13 +127,13 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
127
127
 
128
128
  items = this.items();
129
129
 
130
- quantity = helpers.toInt(quantity);
130
+ quantity = helpers.toInteger(quantity);
131
131
 
132
132
  if (isNaN(quantity)) {
133
133
  return;
134
134
  }
135
135
 
136
- if (direction === 'goto' && quantity > 1 && quantity <= items.length) {
136
+ if (direction === 'goto' && quantity > 0 && quantity <= items.length) {
137
137
  pos = Math.round(items.eq(quantity - 1).position().left) - this.contents().position().left;
138
138
  } else {
139
139
  i = this.currentItem(direction === 'right');
@@ -155,7 +155,7 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
155
155
  pixel: function (direction, quantity) {
156
156
  var pos;
157
157
 
158
- quantity = helpers.toInt(quantity);
158
+ quantity = helpers.toInteger(quantity);
159
159
 
160
160
  if (isNaN(quantity)) {
161
161
  return;
@@ -157,7 +157,7 @@ define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function
157
157
  node = $(nodes[i]);
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
+ moduleNames = helpers.toArray(node.data(widgetDataAttr));
161
161
 
162
162
  // For each widget we check to see if the url is already in our
163
163
  // list of urls to require:
@@ -170,7 +170,7 @@ define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function
170
170
  }
171
171
 
172
172
  // Do the same with each addon name:
173
- moduleNames = helpers.toAry(node.data(addonDataAttr)) || [];
173
+ moduleNames = helpers.toArray(node.data(addonDataAttr)) || [];
174
174
 
175
175
  for (j = 0; j < moduleNames.length; j += 1) {
176
176
  url = $X._mapName(moduleNames[j], 'addons');
@@ -192,8 +192,8 @@ define('xooie/xooie', ['jquery', 'xooie/helpers', 'xooie/stylesheet'], function
192
192
  node = $(nodes[i]);
193
193
 
194
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)) || [];
195
+ widgets = helpers.toArray(node.data(widgetDataAttr));
196
+ addons = helpers.toArray(node.data(addonDataAttr)) || [];
197
197
 
198
198
  // Iterate through each widget type:
199
199
  for (j = 0; j < widgets.length; j += 1) {
metadata CHANGED
@@ -1,70 +1,75 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xooie
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.5
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.6
5
6
  platform: ruby
6
- authors:
7
- - Andrew Larkin
7
+ authors:
8
+ - Andrew Larkin
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-11-30 00:00:00.000000000 Z
12
+
13
+ date: 2013-12-02 00:00:00 Z
12
14
  dependencies: []
15
+
13
16
  description: A highly modular, extensible JavaScript UI framework.
14
17
  email: andrewlarkin2@gmail.com
15
18
  executables: []
19
+
16
20
  extensions: []
21
+
17
22
  extra_rdoc_files: []
18
- files:
19
- - vendor/assets/javascripts/xooie.js
20
- - vendor/assets/javascripts/xooie/addons/base.js
21
- - vendor/assets/javascripts/xooie/addons/carousel_lentils.js
22
- - vendor/assets/javascripts/xooie/addons/carousel_pagination.js
23
- - vendor/assets/javascripts/xooie/addons/dropdown_accordion.js
24
- - vendor/assets/javascripts/xooie/addons/tab_animation.js
25
- - vendor/assets/javascripts/xooie/addons/tab_automation.js
26
- - vendor/assets/javascripts/xooie/base.js
27
- - vendor/assets/javascripts/xooie/carousel.js
28
- - vendor/assets/javascripts/xooie/dialog.js
29
- - vendor/assets/javascripts/xooie/dropdown.js
30
- - vendor/assets/javascripts/xooie/event_handler.js
31
- - vendor/assets/javascripts/xooie/helpers.js
32
- - vendor/assets/javascripts/xooie/keyboard_navigation.js
33
- - vendor/assets/javascripts/xooie/shared.js
34
- - vendor/assets/javascripts/xooie/stylesheet.js
35
- - vendor/assets/javascripts/xooie/tab.js
36
- - vendor/assets/javascripts/xooie/widgets/accordion.js
37
- - vendor/assets/javascripts/xooie/widgets/base.js
38
- - vendor/assets/javascripts/xooie/widgets/carousel.js
39
- - vendor/assets/javascripts/xooie/widgets/dialog.js
40
- - vendor/assets/javascripts/xooie/widgets/dropdown.js
41
- - vendor/assets/javascripts/xooie/widgets/tab.js
42
- - vendor/assets/javascripts/xooie/xooie.js
43
- - lib/xooie.rb
44
- - README.md
45
- - License.txt
23
+
24
+ files:
25
+ - vendor/assets/javascripts/xooie/event_handler.js
26
+ - vendor/assets/javascripts/xooie/helpers.js
27
+ - vendor/assets/javascripts/xooie/keyboard_navigation.js
28
+ - vendor/assets/javascripts/xooie/shared.js
29
+ - vendor/assets/javascripts/xooie/stylesheet.js
30
+ - vendor/assets/javascripts/xooie/xooie.js
31
+ - vendor/assets/javascripts/xooie/addons/base.js
32
+ - vendor/assets/javascripts/xooie/addons/carousel_lentils.js
33
+ - vendor/assets/javascripts/xooie/addons/carousel_pagination.js
34
+ - vendor/assets/javascripts/xooie/addons/tab_animation.js
35
+ - vendor/assets/javascripts/xooie/widgets/accordion.js
36
+ - vendor/assets/javascripts/xooie/widgets/base.js
37
+ - vendor/assets/javascripts/xooie/widgets/carousel.js
38
+ - vendor/assets/javascripts/xooie/widgets/dialog.js
39
+ - vendor/assets/javascripts/xooie/widgets/dropdown.js
40
+ - vendor/assets/javascripts/xooie/widgets/tab.js
41
+ - lib/xooie.rb
42
+ - README.md
43
+ - License.txt
46
44
  homepage: http://www.xooie.net
47
- licenses:
48
- - Apache
49
- metadata: {}
45
+ licenses:
46
+ - Apache
50
47
  post_install_message:
51
48
  rdoc_options: []
52
- require_paths:
53
- - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
55
- requirements:
56
- - - '>='
57
- - !ruby/object:Gem::Version
58
- version: '0'
59
- required_rubygems_version: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - '>='
62
- - !ruby/object:Gem::Version
63
- version: '0'
49
+
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 2
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
64
67
  requirements: []
68
+
65
69
  rubyforge_project:
66
- rubygems_version: 2.1.9
70
+ rubygems_version: 1.8.9
67
71
  signing_key:
68
- specification_version: 4
72
+ specification_version: 3
69
73
  summary: A highly modular, extensible JavaScript UI framework.
70
74
  test_files: []
75
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c87aa1306202800647994b0d91fbfe16cd4992cd
4
- data.tar.gz: 2a42d82815fbe8b38ba052542bdae07c1003e2a2
5
- SHA512:
6
- metadata.gz: d95038096ccde4ec760e5519d10e37b338ecd9010432859af1b1240cf56ec9b0183c8e510ad024a225a1736b2497cf4e3e137434837f7081bb598f36d4959e6b
7
- data.tar.gz: d9f4abf26f3c44e47b263658e1eee195bc016a1279902b0433a9e694544a38265b898f8de93e3c129c47ca4864004ca09c09a02c169f46bccbc43ee636359663
@@ -1,38 +0,0 @@
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
- });
@@ -1,150 +0,0 @@
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/tab_automation', ['jquery', 'xooie/addons/base'], function($, Base) {
18
- var outOfRange = function(lower, upper, point, normalize) {
19
- var n = ( Math.min(lower, point) - lower ) || ( Math.max(upper, point) - upper );
20
- var denominator = (normalize) ? Math.max(Math.abs(n),1) : 1;
21
- return n/denominator;
22
- };
23
-
24
-
25
- var Automation = Base('automation', function(){
26
- var self = this,
27
- focusTable = {},
28
- setFocus;
29
-
30
- this._tabChangeTimer = 0;
31
-
32
- this._canRotate = true;
33
-
34
- //automationInstances.push(this);
35
-
36
- setFocus = function(method, state) {
37
- var prop;
38
-
39
- focusTable[method] = state;
40
-
41
- if (state) {
42
- for (prop in focusTable) {
43
- state = state && focusTable[prop];
44
- }
45
- }
46
-
47
- self._canRotate = state;
48
- };
49
-
50
- this.module.root.on({
51
- 'mouseenter': function(){
52
- setFocus('mouse', false);
53
- self.stop();
54
- },
55
- 'focus': function(){
56
- setFocus('keyboard', false);
57
- self.stop();
58
- },
59
- 'mouseleave': function(){
60
- setFocus('mouse', true);
61
- self.start();
62
- },
63
- 'blur': function(){
64
- setFocus('mouse', true);
65
- self.start();
66
- },
67
- 'tabChange': function(){
68
- self.start();
69
- }
70
- });
71
-
72
- this.module.root.find('*').on({
73
- 'focus': function(){
74
- setFocus('keyboard', false);
75
- self.stop();
76
- },
77
- 'blur': function(){
78
- setFocus('keyboard', true);
79
- self.start();
80
- }
81
- });
82
-
83
- this.start();
84
- });
85
-
86
- Automation.setDefaultOptions({
87
- direction: 1,
88
- delay: 10000
89
- });
90
-
91
- $.extend(Automation.prototype, {
92
- start: function(){
93
- var self = this;
94
-
95
- if (this._tabChangeTimer) {
96
- this.stop();
97
- }
98
-
99
- this._tabChangeTimer = setTimeout(function(){
100
- self.stop();
101
-
102
- if (!self._canRotate){
103
- return;
104
- }
105
-
106
- if (self.outOfRange()) {
107
- $(window).on('scroll', function(event){
108
- if (!self.outOfRange()) {
109
- self.start();
110
- $(window).off(event);
111
- }
112
- //TODO: add logic to remove scroll event if the elementis no longer in the DOM
113
- });
114
- return;
115
- }
116
-
117
- var newTab;
118
-
119
- if (self.module._currentTab + self.options.direction >= self.module.getPanel().length) {
120
- newTab = 0;
121
- } else if (self.module._currentTab + self.options.direction < 0) {
122
- newTab = self.module.getPanel().length - 1;
123
- } else {
124
- newTab = self.module._currentTab + self.options.direction;
125
- }
126
-
127
- self.module.switchToTab(newTab);
128
- }, this.options.delay);
129
-
130
- },
131
-
132
- stop: function() {
133
- this._tabChangeTimer = clearTimeout(this._tabChangeTimer);
134
- },
135
-
136
- //Will return true if the tab module is out of range (ie, both the top and bottom are out of range)
137
- outOfRange: function(){
138
- var lower, upper, top, bottom;
139
-
140
- lower = $(window).scrollTop();
141
- upper = lower + $(window).height();
142
- top = this.module.root.offset().top;
143
- bottom = top + this.module.root.outerHeight(true);
144
-
145
- return !!(outOfRange(lower, upper, top, true) && outOfRange(lower, upper, bottom, true));
146
- }
147
- });
148
-
149
- return Automation;
150
- });
@@ -1,214 +0,0 @@
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/base', ['jquery', 'xooie', 'xooie/stylesheet'], function($, $X, Stylesheet) {
18
- $.event.special['xooie-init'] = {
19
- add: function(handleObj) {
20
- var control = $(this).data(handleObj.namespace + '-instance');
21
- if (control) {
22
- var event = $.Event('xooie-init');
23
- event.namespace = handleObj.namespace;
24
- event.data = handleObj.data;
25
-
26
- handleObj.handler.call(this, event);
27
- }
28
- }
29
- };
30
-
31
- var Base = function(name, constructor) {
32
- var instances, defaultOptions, instanceCounter, initEvent, instanceName, cssRules, stylesInstance, className, Xooie;
33
-
34
- instances = [];
35
-
36
- defaultOptions = {};
37
-
38
- name = name.toLowerCase();
39
- initEvent = 'xooie-init.' + name;
40
- refreshEvent = 'xooie-refresh.' + name;
41
- instanceName = name + '-instance';
42
- instanceCounter = 0;
43
- className = 'is-' + name + '-instantiated';
44
-
45
- cssRules = {};
46
- stylesInstance = new Stylesheet('Xooie');
47
-
48
- Xooie = function(root) {
49
- this.root = $(root);
50
- this._name = name;
51
-
52
- if (this.root.data(instanceName)) {
53
- this.root.trigger(refreshEvent);
54
- return instances[this.root.data(instanceName)];
55
- }
56
- instanceCounter+=1;
57
- instances[instanceCounter] = this;
58
- this.root.data(instanceName, instanceCounter);
59
-
60
- this.instanceClass = this._name + '-' + instanceCounter;
61
- this.root.addClass(this.instanceClass);
62
-
63
- this.options = $.extend({}, Xooie.getDefaultOptions(), this.root.data());
64
-
65
- //expose the stylesheet for this widget to each instance
66
- this.stylesheet = stylesInstance;
67
-
68
- //expose the common css rules
69
- this.cssRules = $.extend({}, cssRules);
70
-
71
- var addons, i, self = this;
72
-
73
- constructor.apply(this, arguments);
74
-
75
- this.root.addClass(className);
76
-
77
- if(this.options.addons) {
78
- addons = this.options.addons.split(' ');
79
-
80
- for (i = 0; i < addons.length; i += 1) {
81
- this.loadAddon(addons[i]);
82
- }
83
- }
84
-
85
- this.root.trigger(initEvent);
86
- };
87
-
88
- Xooie.prototype = {
89
- loadAddon: function(addon){
90
- var self = this,
91
- addon_name = $X.mapName(addon, 'addons', 'xooie/addons/');
92
-
93
- if (typeof this.addons === 'undefined') {
94
- this.addons = {};
95
- }
96
-
97
- try {
98
- $X._requireShim(addon_name, function(Addon){
99
- if (typeof Addon === 'function') {
100
- new Addon(self);
101
- }
102
- });
103
- } catch (e) {
104
- //need to determine how to handle missing addons
105
- }
106
- },
107
-
108
- render: function(template, view) {
109
- var language = template.data('templateLanguage') || Base.default_template_language,
110
- result = Base.render[language](template, view);
111
-
112
- if (result === false) {
113
- return $('<span>Error rendering template</span>');
114
- } else {
115
- return result;
116
- }
117
- },
118
-
119
- cleanup: function() {
120
- var name;
121
-
122
- for (name in this.addons) {
123
- if (this.addons.hasOwnProperty(name)) {
124
- this.addons[name].cleanup();
125
- }
126
- }
127
-
128
- this.root.removeClass(className);
129
- this.root.removeClass(this.instanceClass);
130
- this.root.data(instanceName, false);
131
- }
132
-
133
- };
134
-
135
- Xooie.setCSSRules = function(rules){
136
- var rule;
137
-
138
- if(typeof stylesInstance.addRule === 'undefined'){
139
- return;
140
- }
141
-
142
- for (rule in rules){
143
- cssRules[rule] = stylesInstance.addRule(rule, rules[rule]);
144
- }
145
- };
146
-
147
- Xooie.getDefaultOptions = function(){
148
- return defaultOptions || {};
149
- };
150
-
151
- Xooie.setDefaultOptions = function(options) {
152
- if (typeof options !== 'undefined') {
153
- $.extend(defaultOptions, options);
154
- }
155
- };
156
-
157
- Xooie.garbageCollect = function() {
158
- var id, instance;
159
-
160
- for (id in instances) {
161
- if (instances.hasOwnProperty(id)) {
162
- instance = instances[id];
163
-
164
- if (instance.root.parents('body').length === 0) {
165
- instance.cleanup();
166
- delete instances[id];
167
- }
168
- }
169
- }
170
- };
171
-
172
- $X.registeredClasses.push(Xooie);
173
-
174
- return Xooie;
175
- };
176
-
177
- Base.default_template_language = 'micro_template';
178
-
179
- Base.render = {
180
- 'micro_template': function(template, view) {
181
- if (typeof template.micro_render !== 'undefined') {
182
- return $(template.micro_render(view));
183
- } else {
184
- return false;
185
- }
186
- },
187
-
188
- 'mustache': function(template, view) {
189
- if (typeof Mustache !== 'undefined' && typeof Mustache.render !== 'undefined') {
190
- return $(Mustache.render(template.html(), view));
191
- } else {
192
- return false;
193
- }
194
- },
195
-
196
- 'jsrender': function(template, view) {
197
- if (typeof template.render !== 'undefined') {
198
- return $(template.render(view));
199
- } else {
200
- return false;
201
- }
202
- },
203
-
204
- 'underscore': function(template, view) {
205
- if (typeof _ !== 'undefined' && typeof _.template !== 'undefined') {
206
- return $(_.template(template.html())(view).trim());
207
- } else {
208
- return false;
209
- }
210
- }
211
- };
212
-
213
- return Base;
214
- });