catscope 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/bower.json +1 -0
- data/assets/bower_components/foundation/LICENSE +22 -0
- data/assets/bower_components/foundation/README.md +46 -0
- data/assets/bower_components/foundation/bower.json +2 -4
- data/assets/bower_components/foundation/css/foundation.css +1695 -1230
- data/assets/bower_components/foundation/css/foundation.css.map +1 -1
- data/assets/bower_components/foundation/css/foundation.min.css +1 -0
- data/assets/bower_components/foundation/css/normalize.css +9 -12
- data/assets/bower_components/foundation/css/normalize.css.map +1 -1
- data/assets/bower_components/foundation/css/normalize.min.css +1 -0
- data/assets/bower_components/foundation/js/foundation/foundation.abide.js +171 -75
- data/assets/bower_components/foundation/js/foundation/foundation.accordion.js +70 -12
- data/assets/bower_components/foundation/js/foundation/foundation.alert.js +5 -5
- data/assets/bower_components/foundation/js/foundation/foundation.clearing.js +84 -40
- data/assets/bower_components/foundation/js/foundation/foundation.dropdown.js +104 -79
- data/assets/bower_components/foundation/js/foundation/foundation.equalizer.js +57 -26
- data/assets/bower_components/foundation/js/foundation/foundation.interchange.js +50 -38
- data/assets/bower_components/foundation/js/foundation/foundation.joyride.js +121 -110
- data/assets/bower_components/foundation/js/foundation/foundation.js +121 -79
- data/assets/bower_components/foundation/js/foundation/foundation.magellan.js +75 -59
- data/assets/bower_components/foundation/js/foundation/foundation.offcanvas.js +95 -22
- data/assets/bower_components/foundation/js/foundation/foundation.orbit.js +127 -123
- data/assets/bower_components/foundation/js/foundation/foundation.reveal.js +147 -69
- data/assets/bower_components/foundation/js/foundation/foundation.slider.js +101 -72
- data/assets/bower_components/foundation/js/foundation/foundation.tab.js +52 -39
- data/assets/bower_components/foundation/js/foundation/foundation.tooltip.js +97 -49
- data/assets/bower_components/foundation/js/foundation/foundation.topbar.js +70 -57
- data/assets/bower_components/foundation/js/foundation.js +1544 -951
- data/assets/bower_components/foundation/js/foundation.min.js +5 -4
- data/assets/bower_components/foundation/js/vendor/fastclick.js +8 -9
- data/assets/bower_components/foundation/js/vendor/jquery.js +6 -6
- data/assets/bower_components/foundation/js/vendor/modernizr.js +1 -1
- data/assets/bower_components/foundation/package.json +57 -0
- data/assets/bower_components/foundation/scss/foundation/_functions.scss +53 -43
- data/assets/bower_components/foundation/scss/foundation/_settings.scss +59 -37
- data/assets/bower_components/foundation/scss/foundation/components/_accordion.scss +12 -8
- data/assets/bower_components/foundation/scss/foundation/components/_alert-boxes.scss +12 -12
- data/assets/bower_components/foundation/scss/foundation/components/_block-grid.scss +14 -13
- data/assets/bower_components/foundation/scss/foundation/components/_breadcrumbs.scss +19 -19
- data/assets/bower_components/foundation/scss/foundation/components/_button-groups.scss +33 -25
- data/assets/bower_components/foundation/scss/foundation/components/_buttons.scss +30 -28
- data/assets/bower_components/foundation/scss/foundation/components/_clearing.scss +51 -47
- data/assets/bower_components/foundation/scss/foundation/components/_dropdown-buttons.scss +10 -11
- data/assets/bower_components/foundation/scss/foundation/components/_dropdown.scss +45 -38
- data/assets/bower_components/foundation/scss/foundation/components/_flex-video.scss +7 -7
- data/assets/bower_components/foundation/scss/foundation/components/_forms.scss +99 -62
- data/assets/bower_components/foundation/scss/foundation/components/_global.scss +152 -67
- data/assets/bower_components/foundation/scss/foundation/components/_grid.scss +39 -36
- data/assets/bower_components/foundation/scss/foundation/components/_icon-bar.scss +337 -235
- data/assets/bower_components/foundation/scss/foundation/components/_inline-lists.scss +9 -8
- data/assets/bower_components/foundation/scss/foundation/components/_joyride.scss +40 -42
- data/assets/bower_components/foundation/scss/foundation/components/_keystrokes.scss +2 -3
- data/assets/bower_components/foundation/scss/foundation/components/_labels.scss +6 -6
- data/assets/bower_components/foundation/scss/foundation/components/_magellan.scss +2 -2
- data/assets/bower_components/foundation/scss/foundation/components/_offcanvas.scss +259 -168
- data/assets/bower_components/foundation/scss/foundation/components/_orbit.scss +82 -62
- data/assets/bower_components/foundation/scss/foundation/components/_pagination.scss +16 -15
- data/assets/bower_components/foundation/scss/foundation/components/_panels.scss +21 -15
- data/assets/bower_components/foundation/scss/foundation/components/_pricing-tables.scss +16 -16
- data/assets/bower_components/foundation/scss/foundation/components/_progress-bars.scss +10 -4
- data/assets/bower_components/foundation/scss/foundation/components/_range-slider.scss +28 -20
- data/assets/bower_components/foundation/scss/foundation/components/_reveal.scss +38 -28
- data/assets/bower_components/foundation/scss/foundation/components/_side-nav.scss +15 -11
- data/assets/bower_components/foundation/scss/foundation/components/_split-buttons.scss +22 -18
- data/assets/bower_components/foundation/scss/foundation/components/_sub-nav.scss +14 -12
- data/assets/bower_components/foundation/scss/foundation/components/_switches.scss +22 -19
- data/assets/bower_components/foundation/scss/foundation/components/_tables.scss +8 -8
- data/assets/bower_components/foundation/scss/foundation/components/_tabs.scss +50 -31
- data/assets/bower_components/foundation/scss/foundation/components/_thumbs.scss +8 -8
- data/assets/bower_components/foundation/scss/foundation/components/_tooltips.scss +25 -25
- data/assets/bower_components/foundation/scss/foundation/components/_top-bar.scss +176 -122
- data/assets/bower_components/foundation/scss/foundation/components/_type.scss +38 -38
- data/assets/bower_components/foundation/scss/foundation/components/_visibility.scss +33 -16
- data/assets/bower_components/foundation/scss/foundation.scss +37 -40
- data/assets/bower_components/foundation/scss/normalize.scss +8 -11
- data/assets/bower_components/jquery/bower.json +2 -1
- data/assets/bower_components/jquery/dist/jquery.js +9 -4
- data/assets/bower_components/jquery/dist/jquery.min.js +4 -4
- data/assets/bower_components/jquery/dist/jquery.min.map +1 -1
- data/assets/bower_components/jquery/src/core.js +6 -1
- data/assets/scss/_settings.scss +2 -0
- data/assets/stylesheets/app.css +3066 -2429
- data/lib/catscope/version.rb +1 -1
- data/lib/catscope/views/layout.erb +6 -2
- metadata +8 -4
- data/assets/bower_components/foundation/scss/foundation/components/_toolbar.scss +0 -70
@@ -4,41 +4,40 @@
|
|
4
4
|
Foundation.libs.slider = {
|
5
5
|
name : 'slider',
|
6
6
|
|
7
|
-
version : '5.5.
|
8
|
-
|
9
|
-
settings: {
|
10
|
-
start: 0,
|
11
|
-
end: 100,
|
12
|
-
step: 1,
|
13
|
-
precision:
|
14
|
-
initial: null,
|
15
|
-
display_selector: '',
|
16
|
-
vertical: false,
|
17
|
-
trigger_input_change: false,
|
18
|
-
on_change: function(){}
|
7
|
+
version : '5.5.3',
|
8
|
+
|
9
|
+
settings : {
|
10
|
+
start : 0,
|
11
|
+
end : 100,
|
12
|
+
step : 1,
|
13
|
+
precision : 2,
|
14
|
+
initial : null,
|
15
|
+
display_selector : '',
|
16
|
+
vertical : false,
|
17
|
+
trigger_input_change : false,
|
18
|
+
on_change : function () {}
|
19
19
|
},
|
20
20
|
|
21
21
|
cache : {},
|
22
22
|
|
23
23
|
init : function (scope, method, options) {
|
24
|
-
Foundation.inherit(this,'throttle');
|
24
|
+
Foundation.inherit(this, 'throttle');
|
25
25
|
this.bindings(method, options);
|
26
26
|
this.reflow();
|
27
27
|
},
|
28
28
|
|
29
|
-
events : function() {
|
29
|
+
events : function () {
|
30
30
|
var self = this;
|
31
|
-
|
32
31
|
$(this.scope)
|
33
32
|
.off('.slider')
|
34
33
|
.on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
|
35
|
-
'[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function(e) {
|
34
|
+
'[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function (e) {
|
36
35
|
if (!self.cache.active) {
|
37
36
|
e.preventDefault();
|
38
37
|
self.set_active_slider($(e.target));
|
39
38
|
}
|
40
39
|
})
|
41
|
-
.on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function(e) {
|
40
|
+
.on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function (e) {
|
42
41
|
if (!!self.cache.active) {
|
43
42
|
e.preventDefault();
|
44
43
|
if ($.data(self.cache.active[0], 'settings').vertical) {
|
@@ -52,48 +51,80 @@
|
|
52
51
|
}
|
53
52
|
}
|
54
53
|
})
|
55
|
-
.on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) {
|
54
|
+
.on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function (e) {
|
55
|
+
if(!self.cache.active) {
|
56
|
+
// if the user has just clicked into the slider without starting to drag the handle
|
57
|
+
var slider = $(e.target).attr('role') === 'slider' ? $(e.target) : $(e.target).closest('.range-slider').find("[role='slider']");
|
58
|
+
|
59
|
+
if (slider.length && (!slider.parent().hasClass('disabled') && !slider.parent().attr('disabled'))) {
|
60
|
+
self.set_active_slider(slider);
|
61
|
+
if ($.data(self.cache.active[0], 'settings').vertical) {
|
62
|
+
var scroll_offset = 0;
|
63
|
+
if (!e.pageY) {
|
64
|
+
scroll_offset = window.scrollY;
|
65
|
+
}
|
66
|
+
self.calculate_position(self.cache.active, self.get_cursor_position(e, 'y') + scroll_offset);
|
67
|
+
} else {
|
68
|
+
self.calculate_position(self.cache.active, self.get_cursor_position(e, 'x'));
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
56
72
|
self.remove_active_slider();
|
57
73
|
})
|
58
|
-
.on('change.fndtn.slider', function(e) {
|
74
|
+
.on('change.fndtn.slider', function (e) {
|
59
75
|
self.settings.on_change();
|
60
76
|
});
|
61
77
|
|
62
78
|
self.S(window)
|
63
|
-
.on('resize.fndtn.slider', self.throttle(function(e) {
|
79
|
+
.on('resize.fndtn.slider', self.throttle(function (e) {
|
64
80
|
self.reflow();
|
65
81
|
}, 300));
|
82
|
+
|
83
|
+
// update slider value as users change input value
|
84
|
+
this.S('[' + this.attr_name() + ']').each(function () {
|
85
|
+
var slider = $(this),
|
86
|
+
handle = slider.children('.range-slider-handle')[0],
|
87
|
+
settings = self.initialize_settings(handle);
|
88
|
+
|
89
|
+
if (settings.display_selector != '') {
|
90
|
+
$(settings.display_selector).each(function(){
|
91
|
+
if ($(this).attr('value')) {
|
92
|
+
$(this).off('change').on('change', function () {
|
93
|
+
slider.foundation("slider", "set_value", $(this).val());
|
94
|
+
});
|
95
|
+
}
|
96
|
+
});
|
97
|
+
}
|
98
|
+
});
|
66
99
|
},
|
67
100
|
|
68
|
-
get_cursor_position : function(e, xy) {
|
101
|
+
get_cursor_position : function (e, xy) {
|
69
102
|
var pageXY = 'page' + xy.toUpperCase(),
|
70
103
|
clientXY = 'client' + xy.toUpperCase(),
|
71
104
|
position;
|
72
105
|
|
73
106
|
if (typeof e[pageXY] !== 'undefined') {
|
74
107
|
position = e[pageXY];
|
75
|
-
}
|
76
|
-
else if (typeof e.originalEvent[clientXY] !== 'undefined') {
|
108
|
+
} else if (typeof e.originalEvent[clientXY] !== 'undefined') {
|
77
109
|
position = e.originalEvent[clientXY];
|
78
|
-
}
|
79
|
-
else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][clientXY] !== 'undefined') {
|
110
|
+
} else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][clientXY] !== 'undefined') {
|
80
111
|
position = e.originalEvent.touches[0][clientXY];
|
81
|
-
}
|
82
|
-
else if(e.currentPoint && typeof e.currentPoint[xy] !== 'undefined') {
|
112
|
+
} else if (e.currentPoint && typeof e.currentPoint[xy] !== 'undefined') {
|
83
113
|
position = e.currentPoint[xy];
|
84
114
|
}
|
115
|
+
|
85
116
|
return position;
|
86
117
|
},
|
87
118
|
|
88
|
-
set_active_slider : function($handle) {
|
119
|
+
set_active_slider : function ($handle) {
|
89
120
|
this.cache.active = $handle;
|
90
121
|
},
|
91
122
|
|
92
|
-
remove_active_slider : function() {
|
123
|
+
remove_active_slider : function () {
|
93
124
|
this.cache.active = null;
|
94
125
|
},
|
95
126
|
|
96
|
-
calculate_position : function($handle, cursor_x) {
|
127
|
+
calculate_position : function ($handle, cursor_x) {
|
97
128
|
var self = this,
|
98
129
|
settings = $.data($handle[0], 'settings'),
|
99
130
|
handle_l = $.data($handle[0], 'handle_l'),
|
@@ -101,16 +132,16 @@
|
|
101
132
|
bar_l = $.data($handle[0], 'bar_l'),
|
102
133
|
bar_o = $.data($handle[0], 'bar_o');
|
103
134
|
|
104
|
-
requestAnimationFrame(function(){
|
135
|
+
requestAnimationFrame(function () {
|
105
136
|
var pct;
|
106
137
|
|
107
138
|
if (Foundation.rtl && !settings.vertical) {
|
108
|
-
pct = self.limit_to(((bar_o+bar_l-cursor_x)/bar_l),0,1);
|
139
|
+
pct = self.limit_to(((bar_o + bar_l - cursor_x) / bar_l), 0, 1);
|
109
140
|
} else {
|
110
|
-
pct = self.limit_to(((cursor_x-bar_o)/bar_l),0,1);
|
141
|
+
pct = self.limit_to(((cursor_x - bar_o) / bar_l), 0, 1);
|
111
142
|
}
|
112
143
|
|
113
|
-
pct = settings.vertical ? 1-pct : pct;
|
144
|
+
pct = settings.vertical ? 1 - pct : pct;
|
114
145
|
|
115
146
|
var norm = self.normalized_value(pct, settings.start, settings.end, settings.step, settings.precision);
|
116
147
|
|
@@ -118,13 +149,13 @@
|
|
118
149
|
});
|
119
150
|
},
|
120
151
|
|
121
|
-
set_ui : function($handle, value) {
|
152
|
+
set_ui : function ($handle, value) {
|
122
153
|
var settings = $.data($handle[0], 'settings'),
|
123
154
|
handle_l = $.data($handle[0], 'handle_l'),
|
124
155
|
bar_l = $.data($handle[0], 'bar_l'),
|
125
156
|
norm_pct = this.normalized_percentage(value, settings.start, settings.end),
|
126
|
-
handle_offset = norm_pct*(bar_l-handle_l)-1,
|
127
|
-
progress_bar_length = norm_pct*100,
|
157
|
+
handle_offset = norm_pct * (bar_l - handle_l) - 1,
|
158
|
+
progress_bar_length = norm_pct * 100,
|
128
159
|
$handle_parent = $handle.parent(),
|
129
160
|
$hidden_inputs = $handle.parent().children('input[type=hidden]');
|
130
161
|
|
@@ -141,24 +172,24 @@
|
|
141
172
|
$handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
|
142
173
|
}
|
143
174
|
|
144
|
-
$handle_parent.attr(this.attr_name(), value).trigger('change
|
175
|
+
$handle_parent.attr(this.attr_name(), value).trigger('change.fndtn.slider');
|
145
176
|
|
146
177
|
$hidden_inputs.val(value);
|
147
178
|
if (settings.trigger_input_change) {
|
148
|
-
$hidden_inputs.trigger('change');
|
179
|
+
$hidden_inputs.trigger('change.fndtn.slider');
|
149
180
|
}
|
150
181
|
|
151
182
|
if (!$handle[0].hasAttribute('aria-valuemin')) {
|
152
183
|
$handle.attr({
|
153
|
-
'aria-valuemin': settings.start,
|
154
|
-
'aria-valuemax': settings.end
|
184
|
+
'aria-valuemin' : settings.start,
|
185
|
+
'aria-valuemax' : settings.end
|
155
186
|
});
|
156
187
|
}
|
157
188
|
$handle.attr('aria-valuenow', value);
|
158
189
|
|
159
190
|
if (settings.display_selector != '') {
|
160
|
-
$(settings.display_selector).each(function(){
|
161
|
-
if (this.
|
191
|
+
$(settings.display_selector).each(function () {
|
192
|
+
if (this.hasAttribute('value')) {
|
162
193
|
$(this).val(value);
|
163
194
|
} else {
|
164
195
|
$(this).text(value);
|
@@ -168,44 +199,42 @@
|
|
168
199
|
|
169
200
|
},
|
170
201
|
|
171
|
-
normalized_percentage : function(val, start, end) {
|
172
|
-
return Math.min(1, (val - start)/(end - start));
|
202
|
+
normalized_percentage : function (val, start, end) {
|
203
|
+
return Math.min(1, (val - start) / (end - start));
|
173
204
|
},
|
174
205
|
|
175
|
-
normalized_value : function(val, start, end, step, precision) {
|
206
|
+
normalized_value : function (val, start, end, step, precision) {
|
176
207
|
var range = end - start,
|
177
|
-
point = val*range,
|
178
|
-
mod = (point-(point%step)) / step,
|
208
|
+
point = val * range,
|
209
|
+
mod = (point - (point % step)) / step,
|
179
210
|
rem = point % step,
|
180
|
-
round = ( rem >= step*0.5 ? step : 0);
|
181
|
-
return ((mod*step + round) + start).toFixed(precision);
|
211
|
+
round = ( rem >= step * 0.5 ? step : 0);
|
212
|
+
return ((mod * step + round) + start).toFixed(precision);
|
182
213
|
},
|
183
214
|
|
184
|
-
set_translate : function(ele, offset, vertical) {
|
215
|
+
set_translate : function (ele, offset, vertical) {
|
185
216
|
if (vertical) {
|
186
217
|
$(ele)
|
187
|
-
.css('-webkit-transform', 'translateY('+offset+'px)')
|
188
|
-
.css('-moz-transform', 'translateY('+offset+'px)')
|
189
|
-
.css('-ms-transform', 'translateY('+offset+'px)')
|
190
|
-
.css('-o-transform', 'translateY('+offset+'px)')
|
191
|
-
.css('transform', 'translateY('+offset+'px)');
|
218
|
+
.css('-webkit-transform', 'translateY(' + offset + 'px)')
|
219
|
+
.css('-moz-transform', 'translateY(' + offset + 'px)')
|
220
|
+
.css('-ms-transform', 'translateY(' + offset + 'px)')
|
221
|
+
.css('-o-transform', 'translateY(' + offset + 'px)')
|
222
|
+
.css('transform', 'translateY(' + offset + 'px)');
|
192
223
|
} else {
|
193
224
|
$(ele)
|
194
|
-
.css('-webkit-transform', 'translateX('+offset+'px)')
|
195
|
-
.css('-moz-transform', 'translateX('+offset+'px)')
|
196
|
-
.css('-ms-transform', 'translateX('+offset+'px)')
|
197
|
-
.css('-o-transform', 'translateX('+offset+'px)')
|
198
|
-
.css('transform', 'translateX('+offset+'px)');
|
225
|
+
.css('-webkit-transform', 'translateX(' + offset + 'px)')
|
226
|
+
.css('-moz-transform', 'translateX(' + offset + 'px)')
|
227
|
+
.css('-ms-transform', 'translateX(' + offset + 'px)')
|
228
|
+
.css('-o-transform', 'translateX(' + offset + 'px)')
|
229
|
+
.css('transform', 'translateX(' + offset + 'px)');
|
199
230
|
}
|
200
231
|
},
|
201
232
|
|
202
|
-
limit_to : function(val, min, max) {
|
233
|
+
limit_to : function (val, min, max) {
|
203
234
|
return Math.min(Math.max(val, min), max);
|
204
235
|
},
|
205
236
|
|
206
|
-
|
207
|
-
|
208
|
-
initialize_settings : function(handle) {
|
237
|
+
initialize_settings : function (handle) {
|
209
238
|
var settings = $.extend({}, this.settings, this.data_options($(handle).parent())),
|
210
239
|
decimal_places_match_result;
|
211
240
|
|
@@ -227,19 +256,19 @@
|
|
227
256
|
}
|
228
257
|
|
229
258
|
$.data(handle, 'bar', $(handle).parent());
|
230
|
-
$.data(handle, 'settings', settings);
|
259
|
+
return $.data(handle, 'settings', settings);
|
231
260
|
},
|
232
261
|
|
233
|
-
set_initial_position : function($ele) {
|
262
|
+
set_initial_position : function ($ele) {
|
234
263
|
var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'),
|
235
|
-
initial = ((typeof settings.initial == 'number' && !isNaN(settings.initial)) ? settings.initial : Math.floor((settings.end-settings.start)*0.5/settings.step)*settings.step+settings.start),
|
264
|
+
initial = ((typeof settings.initial == 'number' && !isNaN(settings.initial)) ? settings.initial : Math.floor((settings.end - settings.start) * 0.5 / settings.step) * settings.step + settings.start),
|
236
265
|
$handle = $ele.children('.range-slider-handle');
|
237
266
|
this.set_ui($handle, initial);
|
238
267
|
},
|
239
268
|
|
240
|
-
set_value : function(value) {
|
269
|
+
set_value : function (value) {
|
241
270
|
var self = this;
|
242
|
-
$('[' + self.attr_name() + ']', this.scope).each(function(){
|
271
|
+
$('[' + self.attr_name() + ']', this.scope).each(function () {
|
243
272
|
$(this).attr(self.attr_name(), value);
|
244
273
|
});
|
245
274
|
if (!!$(this.scope).attr(self.attr_name())) {
|
@@ -248,9 +277,9 @@
|
|
248
277
|
self.reflow();
|
249
278
|
},
|
250
279
|
|
251
|
-
reflow : function() {
|
280
|
+
reflow : function () {
|
252
281
|
var self = this;
|
253
|
-
self.S('[' + this.attr_name() + ']').each(function() {
|
282
|
+
self.S('[' + this.attr_name() + ']').each(function () {
|
254
283
|
var handle = $(this).children('.range-slider-handle')[0],
|
255
284
|
val = $(this).attr(self.attr_name());
|
256
285
|
self.initialize_settings(handle);
|
@@ -4,59 +4,73 @@
|
|
4
4
|
Foundation.libs.tab = {
|
5
5
|
name : 'tab',
|
6
6
|
|
7
|
-
version : '5.5.
|
7
|
+
version : '5.5.3',
|
8
8
|
|
9
9
|
settings : {
|
10
|
-
active_class: 'active',
|
10
|
+
active_class : 'active',
|
11
11
|
callback : function () {},
|
12
|
-
deep_linking: false,
|
13
|
-
scroll_to_content: true,
|
14
|
-
is_hover: false
|
12
|
+
deep_linking : false,
|
13
|
+
scroll_to_content : true,
|
14
|
+
is_hover : false
|
15
15
|
},
|
16
16
|
|
17
|
-
default_tab_hashes: [],
|
17
|
+
default_tab_hashes : [],
|
18
18
|
|
19
19
|
init : function (scope, method, options) {
|
20
20
|
var self = this,
|
21
21
|
S = this.S;
|
22
22
|
|
23
|
+
// Store the default active tabs which will be referenced when the
|
24
|
+
// location hash is absent, as in the case of navigating the tabs and
|
25
|
+
// returning to the first viewing via the browser Back button.
|
26
|
+
S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
|
27
|
+
self.default_tab_hashes.push(this.hash);
|
28
|
+
});
|
29
|
+
|
23
30
|
this.bindings(method, options);
|
24
31
|
this.handle_location_hash_change();
|
25
|
-
|
26
|
-
// Store the default active tabs which will be referenced when the
|
27
|
-
// location hash is absent, as in the case of navigating the tabs and
|
28
|
-
// returning to the first viewing via the browser Back button.
|
29
|
-
S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
|
30
|
-
self.default_tab_hashes.push(this.hash);
|
31
|
-
});
|
32
|
-
|
33
|
-
// store the initial href, which is used to allow correct behaviour of the
|
34
|
-
// browser back button when deep linking is turned on.
|
35
|
-
self.entry_location = window.location.href;
|
36
32
|
},
|
37
33
|
|
38
34
|
events : function () {
|
39
35
|
var self = this,
|
40
36
|
S = this.S;
|
41
37
|
|
42
|
-
var usual_tab_behavior = function (e) {
|
43
|
-
|
44
|
-
|
38
|
+
var usual_tab_behavior = function (e, target) {
|
39
|
+
var settings = S(target).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
|
40
|
+
if (!settings.is_hover || Modernizr.touch) {
|
41
|
+
// if user did not pressed tab key, prevent default action
|
42
|
+
var keyCode = e.keyCode || e.which;
|
43
|
+
if (keyCode !== 9) {
|
45
44
|
e.preventDefault();
|
46
45
|
e.stopPropagation();
|
47
|
-
self.toggle_active_tab(S(this).parent());
|
48
46
|
}
|
49
|
-
|
47
|
+
self.toggle_active_tab(S(target).parent());
|
48
|
+
|
49
|
+
}
|
50
|
+
};
|
50
51
|
|
51
52
|
S(this.scope)
|
52
53
|
.off('.tab')
|
54
|
+
// Key event: focus/tab key
|
55
|
+
.on('keydown.fndtn.tab', '[' + this.attr_name() + '] > * > a', function(e) {
|
56
|
+
var keyCode = e.keyCode || e.which;
|
57
|
+
// if user pressed tab key
|
58
|
+
if (keyCode === 13 || keyCode === 32) { // enter or space
|
59
|
+
var el = this;
|
60
|
+
usual_tab_behavior(e, el);
|
61
|
+
}
|
62
|
+
})
|
53
63
|
// Click event: tab title
|
54
|
-
.on('
|
55
|
-
|
64
|
+
.on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', function(e) {
|
65
|
+
var el = this;
|
66
|
+
usual_tab_behavior(e, el);
|
67
|
+
})
|
56
68
|
// Hover event: tab title
|
57
69
|
.on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
|
58
|
-
var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
|
59
|
-
if (settings.is_hover)
|
70
|
+
var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
|
71
|
+
if (settings.is_hover) {
|
72
|
+
self.toggle_active_tab(S(this).parent());
|
73
|
+
}
|
60
74
|
});
|
61
75
|
|
62
76
|
// Location hash change event
|
@@ -107,7 +121,7 @@
|
|
107
121
|
});
|
108
122
|
},
|
109
123
|
|
110
|
-
toggle_active_tab: function (tab, location_hash) {
|
124
|
+
toggle_active_tab : function (tab, location_hash) {
|
111
125
|
var self = this,
|
112
126
|
S = self.S,
|
113
127
|
tabs = tab.closest('[' + this.attr_name() + ']'),
|
@@ -117,7 +131,7 @@
|
|
117
131
|
target = S(target_hash),
|
118
132
|
siblings = tab.siblings(),
|
119
133
|
settings = tabs.data(this.attr_name(true) + '-init'),
|
120
|
-
interpret_keyup_action = function(e) {
|
134
|
+
interpret_keyup_action = function (e) {
|
121
135
|
// Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
|
122
136
|
|
123
137
|
// define current, previous and next (possible) tabs
|
@@ -166,17 +180,16 @@
|
|
166
180
|
go_to_hash = function(hash) {
|
167
181
|
// This function allows correct behaviour of the browser's back button when deep linking is enabled. Without it
|
168
182
|
// the user would get continually redirected to the default hash.
|
169
|
-
var
|
170
|
-
default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : 'fndtn-' + self.default_tab_hashes[0].replace('#', '')
|
183
|
+
var default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : 'fndtn-' + self.default_tab_hashes[0].replace('#', '');
|
171
184
|
|
172
|
-
if (
|
185
|
+
if (hash !== default_hash || window.location.hash) {
|
173
186
|
window.location.hash = hash;
|
174
187
|
}
|
175
188
|
};
|
176
189
|
|
177
190
|
// allow usage of data-tab-content attribute instead of href
|
178
|
-
if (
|
179
|
-
target_hash = '#' +
|
191
|
+
if (anchor.data('tab-content')) {
|
192
|
+
target_hash = '#' + anchor.data('tab-content').split('#')[1];
|
180
193
|
target = S(target_hash);
|
181
194
|
}
|
182
195
|
|
@@ -207,19 +220,19 @@
|
|
207
220
|
// window (notably in Chrome).
|
208
221
|
// Clean up multiple attr instances to done once
|
209
222
|
tab.addClass(settings.active_class).triggerHandler('opened');
|
210
|
-
tab_link.attr({'aria-selected': 'true', tabindex: 0});
|
223
|
+
tab_link.attr({'aria-selected' : 'true', tabindex : 0});
|
211
224
|
siblings.removeClass(settings.active_class)
|
212
|
-
siblings.find('a').attr({'aria-selected': 'false'
|
213
|
-
target.siblings().removeClass(settings.active_class).attr({'aria-hidden': 'true'
|
225
|
+
siblings.find('a').attr({'aria-selected' : 'false'/*, tabindex : -1*/});
|
226
|
+
target.siblings().removeClass(settings.active_class).attr({'aria-hidden' : 'true'/*, tabindex : -1*/});
|
214
227
|
target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
|
215
228
|
settings.callback(tab);
|
216
|
-
target.triggerHandler('toggled', [
|
217
|
-
tabs.triggerHandler('toggled', [
|
229
|
+
target.triggerHandler('toggled', [target]);
|
230
|
+
tabs.triggerHandler('toggled', [tab]);
|
218
231
|
|
219
232
|
tab_link.off('keydown').on('keydown', interpret_keyup_action );
|
220
233
|
},
|
221
234
|
|
222
|
-
data_attr: function (str) {
|
235
|
+
data_attr : function (str) {
|
223
236
|
if (this.namespace.length > 0) {
|
224
237
|
return this.namespace + '-' + str;
|
225
238
|
}
|