xooie 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -30,6 +30,12 @@ Xooie will work by just loading xooie.js on your page; all other files will be l
30
30
 
31
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
32
 
33
+ 1.x vs 0.1.x:
34
+ ---
35
+ v1.0 is our official release of Xooie. All new feature development & bug fixes occur on [master](https://github.com/Comcast/Xooie) & are released from a release_1_x branch (e.g. [release_1_1](https://github.com/Comcast/Xooie/tree/release_1_1)). So if you're just getting started with Xooie, be sure to grab the latest 1.x version.
36
+
37
+ If you were already using a pre-1.0 release of Xooie, there is a [release_0_1_x branch](https://github.com/Comcast/Xooie/tree/release_0_1_x) that is updated with bug fixes only. Any 0.1.x release is from the pre-1.0 Xooie development work.
38
+
33
39
  Documentation:
34
40
  ---
35
41
  Carousel
File without changes
@@ -25,7 +25,7 @@ define('xooie/event_handler', ['jquery', 'xooie/helpers'], function($, helpers)
25
25
  };
26
26
 
27
27
  function format(type, namespace) {
28
- if (typeof namespace === 'undefined') {
28
+ if (!namespace) {
29
29
  return type;
30
30
  } else {
31
31
  return type + '.' + namespace;
@@ -80,4 +80,4 @@ define('xooie/event_handler', ['jquery', 'xooie/helpers'], function($, helpers)
80
80
  };
81
81
 
82
82
  return EventHandler;
83
- });
83
+ });
File without changes
@@ -1,35 +1,5 @@
1
1
  define('xooie/widgets/accordion', ['jquery', 'xooie/widgets/tab'], function($, Tab){
2
2
  var Accordion = Tab.extend(function() {
3
- var self = this;
4
-
5
- this._tabEvents.clear('keyup');
6
- this._tabEvents.clear('mouseup');
7
-
8
- this._tabEvents.add({
9
- keyup: function(event){
10
- var activeTab = self.getActiveTabs();
11
-
12
- if ([13,32].indexOf(event.which) !== -1){
13
- if (activeTab.is(this)) {
14
- self.deactivateTab($(this));
15
- } else {
16
- self.activateTab($(this));
17
- }
18
-
19
- event.preventDefault();
20
- }
21
- },
22
-
23
- mouseup: function(){
24
- var activeTab = self.getActiveTabs();
25
-
26
- if (activeTab.is(this)) {
27
- self.deactivateTab($(this));
28
- } else {
29
- self.activateTab($(this));
30
- }
31
- }
32
- });
33
3
  });
34
4
 
35
5
  Accordion.define('namespace', 'accordion');
@@ -48,5 +18,15 @@ define('xooie/widgets/accordion', ['jquery', 'xooie/widgets/tab'], function($, T
48
18
  return tablist;
49
19
  };
50
20
 
21
+ Accordion.prototype.selectTabs = function(event, selectedTab) {
22
+ var activeTabs = this.getActiveTabs();
23
+
24
+ if (activeTabs.is(selectedTab)) {
25
+ return activeTabs.not(selectedTab);
26
+ } else {
27
+ return activeTabs.add(selectedTab);
28
+ }
29
+ };
30
+
51
31
  return Accordion;
52
- });
32
+ });
@@ -132,8 +132,12 @@ define('xooie/widgets/carousel', ['jquery', 'xooie/helpers', 'xooie/widgets/base
132
132
  return;
133
133
  }
134
134
 
135
- if (direction === 'goto' && quantity < 1 && quantity <= items.length) {
135
+ if (direction === 'goto' && quantity > 1 && quantity <= items.length) {
136
136
  pos = Math.round(items.eq(quantity - 1).position().left);
137
+
138
+ if (pos === 0) {
139
+ return;
140
+ }
137
141
  } else {
138
142
  i = this.currentItem(direction === 'right');
139
143
 
@@ -25,6 +25,18 @@
25
25
  * visually. Content is hidden until the associated tab is activated.
26
26
  **/
27
27
  define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'xooie/event_handler'], function($, helpers, Base, EventHandler) {
28
+
29
+ function setSelection(widget, selectedTabs) {
30
+ var activeTabs = widget.getActiveTabs();
31
+
32
+ activeTabs.not(selectedTabs).each(function() {
33
+ widget.deactivateTab($(this));
34
+ });
35
+
36
+ selectedTabs.not(activeTabs).each(function() {
37
+ widget.activateTab($(this));
38
+ });
39
+ }
28
40
  /**
29
41
  * Xooie.Tab@xooie-tab-active(event)
30
42
  * - event (Event): A jQuery event object
@@ -59,25 +71,19 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
59
71
 
60
72
  this._tabEvents.add({
61
73
  keyup: function(event){
62
- var activeTab = self.getActiveTabs();
63
-
64
- if ([13,32].indexOf(event.which) !== -1 && !activeTab.is(this)){
65
- self.deactivateTab(activeTab);
66
-
67
- self.activateTab($(this));
74
+ if ([13,32].indexOf(event.which) !== -1){
75
+ setSelection(self, self.selectTabs(event, $(this)));
68
76
 
69
77
  event.preventDefault();
70
78
  }
71
79
  },
72
80
 
73
- mouseup: function(){
74
- var activeTab = self.getActiveTabs();
75
-
76
- if (!activeTab.is(this)) {
77
- self.deactivateTab(activeTab);
81
+ mouseup: function(event){
82
+ setSelection(self, self.selectTabs(event, $(this)));
83
+ },
78
84
 
79
- self.activateTab($(this));
80
- }
85
+ click: function(event){
86
+ event.preventDefault();
81
87
  }
82
88
  });
83
89
 
@@ -204,6 +210,23 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
204
210
  this.root().trigger(e);
205
211
  };
206
212
 
213
+ /**
214
+ * Xooie.Tab#selectTabs(event, selectedTab)
215
+ * - event (Event): Browser event that triggered selectTabs call
216
+ * - selectedTab (Element): Tab that was selected by a mouse or keyboard event
217
+ *
218
+ * Only called by mouse/keyboard event handlers to generate the list of
219
+ * currently active tabs. Should return a jQuery collection of tabs that are
220
+ * to be active. Any tabs which are currently active and not in the
221
+ * collection will be deactivated, and likewise any tabs not currently active
222
+ * and in the collection will be activated.
223
+ *
224
+ * Override this method to alter the behavior of the Tab widget.
225
+ **/
226
+ Tab.prototype.selectTabs = function(event, selectedTab) {
227
+ return selectedTab;
228
+ };
229
+
207
230
  /**
208
231
  * Xooie.Tab#getActiveTabs() -> Elements
209
232
  *
@@ -329,4 +352,4 @@ define('xooie/widgets/tab', ['jquery', 'xooie/helpers', 'xooie/widgets/base', 'x
329
352
  };
330
353
 
331
354
  return Tab;
332
- });
355
+ });
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.1
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.2
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-10-05 00:00:00.000000000 Z
12
+
13
+ date: 2013-11-11 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://github.com/Comcast/Xooie
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.0.3
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: 5bfa0215451441d23096e198c657f95002a8d646
4
- data.tar.gz: f6a47ae7db3b4133f1ee0e704048b4e03a6c712c
5
- SHA512:
6
- metadata.gz: f481dcef343b05cb64051d8ea384c306bff9b52b4174c155a4fb8ba8b55e805687aa5c307026af13dc48e2b2f15cac594d133c3789a43dd635b79a56a83a6381
7
- data.tar.gz: c733687187db37e5c6d6a5beea8cfb2f6ae0fae51b9b2a943f2acc1926ea03e89901f534008f95ae260f63d0e620a8c9002484f670fd05aed902a7f51c99b5ee
@@ -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
- });