TokiCLI 0.2.1 → 0.3.0

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +9 -17
  4. data/.rspec +3 -0
  5. data/.travis.yml +3 -0
  6. data/CHANGELOG.md +4 -0
  7. data/README.md +99 -163
  8. data/Rakefile +5 -0
  9. data/TokiCLI.gemspec +5 -4
  10. data/bin/toki +2 -2
  11. data/lib/API/helpers.rb +27 -170
  12. data/lib/API/toki_api.rb +227 -0
  13. data/lib/API/toki_db.rb +67 -0
  14. data/lib/TokiCLI.rb +270 -5
  15. data/lib/TokiCLI/adnimport.rb +202 -0
  16. data/lib/TokiCLI/fileops.rb +187 -0
  17. data/lib/TokiCLI/status.rb +49 -37
  18. data/lib/TokiCLI/version.rb +1 -1
  19. data/lib/TokiCLI/view.rb +133 -86
  20. data/lib/TokiServer/.bowerrc +3 -0
  21. data/lib/TokiServer/.gitignore +2 -0
  22. data/lib/TokiServer/Gemfile +1 -0
  23. data/lib/TokiServer/bower.json +0 -0
  24. data/lib/TokiServer/bower_components/fastclick/.bower.json +4 -4
  25. data/lib/TokiServer/bower_components/fastclick/bower.json +1 -1
  26. data/lib/TokiServer/bower_components/fastclick/lib/fastclick.js +33 -2
  27. data/lib/TokiServer/bower_components/foundation/.bower.json +5 -4
  28. data/lib/TokiServer/bower_components/foundation/bower.json +2 -1
  29. data/lib/TokiServer/bower_components/foundation/css/foundation.css +2173 -922
  30. data/lib/TokiServer/bower_components/foundation/css/foundation.css.map +7 -0
  31. data/lib/TokiServer/bower_components/foundation/css/normalize.css +53 -16
  32. data/lib/TokiServer/bower_components/foundation/css/normalize.css.map +7 -0
  33. data/lib/TokiServer/bower_components/foundation/js/foundation.js +782 -542
  34. data/lib/TokiServer/bower_components/foundation/js/foundation.min.js +4 -3
  35. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.abide.js +45 -31
  36. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.accordion.js +12 -6
  37. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.alert.js +5 -5
  38. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.clearing.js +34 -10
  39. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.dropdown.js +83 -29
  40. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.equalizer.js +3 -3
  41. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.interchange.js +25 -12
  42. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.joyride.js +112 -40
  43. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.js +19 -5
  44. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.magellan.js +22 -11
  45. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.offcanvas.js +52 -8
  46. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.orbit.js +133 -271
  47. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.reveal.js +27 -20
  48. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.slider.js +73 -33
  49. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.tab.js +88 -31
  50. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.tooltip.js +7 -5
  51. data/lib/TokiServer/bower_components/foundation/js/foundation/foundation.topbar.js +44 -24
  52. data/lib/TokiServer/bower_components/foundation/js/vendor/fastclick.js +2 -2
  53. data/lib/TokiServer/bower_components/foundation/js/vendor/modernizr.js +2 -2
  54. data/lib/TokiServer/bower_components/foundation/scss/foundation.scss +38 -38
  55. data/lib/TokiServer/bower_components/foundation/scss/foundation/_functions.scss +3 -3
  56. data/lib/TokiServer/bower_components/foundation/scss/foundation/_settings.scss +417 -271
  57. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_accordion.scss +110 -6
  58. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_alert-boxes.scss +2 -2
  59. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_block-grid.scss +2 -2
  60. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_breadcrumbs.scss +8 -3
  61. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_button-groups.scss +99 -9
  62. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_buttons.scss +66 -28
  63. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_clearing.scss +5 -5
  64. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_dropdown-buttons.scss +4 -4
  65. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_dropdown.scss +48 -35
  66. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_forms.scss +104 -32
  67. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_global.scss +48 -30
  68. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_grid.scss +19 -4
  69. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_icon-bar.scss +293 -0
  70. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_joyride.scss +11 -9
  71. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_keystrokes.scss +4 -4
  72. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_labels.scss +4 -2
  73. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_magellan.scss +1 -1
  74. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_offcanvas.scss +193 -35
  75. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_orbit.scss +92 -147
  76. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_pagination.scss +22 -10
  77. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_panels.scss +10 -7
  78. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_pricing-tables.scss +11 -11
  79. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_progress-bars.scss +2 -2
  80. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_range-slider.scss +29 -9
  81. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_reveal.scss +60 -56
  82. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_side-nav.scss +3 -2
  83. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_split-buttons.scss +2 -2
  84. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_sub-nav.scss +2 -2
  85. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_switches.scss +226 -0
  86. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tables.scss +13 -7
  87. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tabs.scss +22 -8
  88. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_thumbs.scss +2 -4
  89. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_toolbar.scss +70 -0
  90. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_tooltips.scss +9 -7
  91. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_top-bar.scss +77 -44
  92. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_type.scss +21 -9
  93. data/lib/TokiServer/bower_components/modernizr/.bower.json +4 -4
  94. data/lib/TokiServer/bower_components/modernizr/feature-detects/workers-blobworkers.js +2 -2
  95. data/lib/TokiServer/bower_components/modernizr/grunt.js +1 -1
  96. data/lib/TokiServer/bower_components/modernizr/modernizr.js +2 -2
  97. data/lib/TokiServer/config.rb +0 -0
  98. data/lib/TokiServer/humans.txt +0 -0
  99. data/lib/TokiServer/{itunesicon.rb → itunesicons.rb} +25 -23
  100. data/lib/TokiServer/js/app.js +0 -0
  101. data/lib/TokiServer/public/stylesheets/app.css +2636 -1610
  102. data/lib/TokiServer/robots.txt +0 -0
  103. data/lib/TokiServer/scss/_settings.scss +0 -0
  104. data/lib/TokiServer/scss/app.scss +7 -1
  105. data/lib/TokiServer/tokiserver.rb +239 -244
  106. data/lib/TokiServer/views/activity.erb +42 -0
  107. data/lib/TokiServer/views/apps_total.erb +8 -2
  108. data/lib/TokiServer/views/error.erb +13 -4
  109. data/lib/TokiServer/views/index.erb +36 -27
  110. data/lib/TokiServer/views/logs_total.erb +34 -0
  111. data/spec/TokiCLI_spec.rb +354 -0
  112. data/spec/mock/mock.sqlite3 +0 -0
  113. data/spec/spec_helper.rb +26 -0
  114. metadata +78 -23
  115. data/lib/API/dbapi.rb +0 -488
  116. data/lib/TokiCLI/app.rb +0 -389
  117. data/lib/TokiCLI/authorize.rb +0 -77
  118. data/lib/TokiCLI/export.rb +0 -81
  119. data/lib/TokiCLI/get_channels.rb +0 -22
  120. data/lib/TokiCLI/get_messages.rb +0 -32
  121. data/lib/TokiCLI/import.rb +0 -122
  122. data/lib/TokiCLI/scan.rb +0 -19
  123. data/lib/TokiCLI/search_messages.rb +0 -23
  124. data/lib/TokiServer/README.md +0 -37
  125. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_reveal-new.scss +0 -0
  126. data/lib/TokiServer/bower_components/foundation/scss/foundation/components/_switch.scss +0 -294
  127. data/lib/TokiServer/views/name_log.erb +0 -50
  128. data/lib/TokiServer/views/name_split.erb +0 -37
  129. data/lib/TokiServer/views/name_total.erb +0 -34
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.reveal = {
5
5
  name : 'reveal',
6
6
 
7
- version : '5.2.3',
7
+ version : '5.4.3',
8
8
 
9
9
  locked : false,
10
10
 
@@ -15,6 +15,7 @@
15
15
  close_on_esc: true,
16
16
  dismiss_modal_class: 'close-reveal-modal',
17
17
  bg_class: 'reveal-modal-bg',
18
+ root_element: 'body',
18
19
  open: function(){},
19
20
  opened: function(){},
20
21
  close: function(){},
@@ -45,9 +46,9 @@
45
46
 
46
47
  S(this.scope)
47
48
  .off('.reveal')
48
- .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']', function (e) {
49
+ .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
49
50
  e.preventDefault();
50
-
51
+
51
52
  if (!self.locked) {
52
53
  var element = S(this),
53
54
  ajax = element.data(self.data_attr('reveal-ajax'));
@@ -65,7 +66,7 @@
65
66
  });
66
67
 
67
68
  S(document)
68
- .on('touchend.fndtn.reveal click.fndtn.reveal', this.close_targets(), function (e) {
69
+ .on('click.fndtn.reveal', this.close_targets(), function (e) {
69
70
 
70
71
  e.preventDefault();
71
72
 
@@ -116,7 +117,7 @@
116
117
  // PATCH #1: fixing multiple keyup event trigger from single key press
117
118
  self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
118
119
  var open_modal = self.S('[' + self.attr_name() + '].open'),
119
- settings = open_modal.data(self.attr_name(true) + '-init');
120
+ settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ;
120
121
  // PATCH #2: making sure that the close event can be called only while unlocked,
121
122
  // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
122
123
  if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
@@ -133,6 +134,7 @@
133
134
  return true;
134
135
  },
135
136
 
137
+
136
138
  open : function (target, ajax_settings) {
137
139
  var self = this,
138
140
  modal;
@@ -153,6 +155,11 @@
153
155
  var settings = modal.data(self.attr_name(true) + '-init');
154
156
  settings = settings || this.settings;
155
157
 
158
+
159
+ if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
160
+ return self.close(modal);
161
+ }
162
+
156
163
  if (!modal.hasClass('open')) {
157
164
  var open_modal = self.S('[' + self.attr_name() + '].open');
158
165
 
@@ -162,7 +169,7 @@
162
169
  }
163
170
 
164
171
  this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
165
- modal.trigger('open');
172
+ modal.trigger('open').trigger('open.fndtn.reveal');
166
173
 
167
174
  if (open_modal.length < 1) {
168
175
  this.toggle_bg(modal, true);
@@ -203,6 +210,7 @@
203
210
  $.ajax(ajax_settings);
204
211
  }
205
212
  }
213
+ self.S(window).trigger('resize');
206
214
  },
207
215
 
208
216
  close : function (modal) {
@@ -213,7 +221,7 @@
213
221
  if (open_modals.length > 0) {
214
222
  this.locked = true;
215
223
  this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
216
- modal.trigger('close');
224
+ modal.trigger('close').trigger('close.fndtn.reveal');
217
225
  this.toggle_bg(modal, false);
218
226
  this.hide(open_modals, settings.css.close, settings);
219
227
  }
@@ -248,19 +256,18 @@
248
256
  show : function (el, css) {
249
257
  // is modal
250
258
  if (css) {
251
- var settings = el.data(this.attr_name(true) + '-init');
252
- settings = settings || this.settings;
259
+ var settings = el.data(this.attr_name(true) + '-init') || this.settings,
260
+ root_element = settings.root_element;
253
261
 
254
- if (el.parent('body').length === 0) {
255
- var placeholder = el.wrap('<div style="display: none;" />').parent(),
256
- rootElement = this.settings.rootElement || 'body';
262
+ if (el.parent(root_element).length === 0) {
263
+ var placeholder = el.wrap('<div style="display: none;" />').parent();
257
264
 
258
265
  el.on('closed.fndtn.reveal.wrapped', function() {
259
266
  el.detach().appendTo(placeholder);
260
267
  el.unwrap().unbind('closed.fndtn.reveal.wrapped');
261
268
  });
262
269
 
263
- el.detach().appendTo(rootElement);
270
+ el.detach().appendTo(root_element);
264
271
  }
265
272
 
266
273
  var animData = getAnimationData(settings.animation);
@@ -279,7 +286,7 @@
279
286
  .css(css)
280
287
  .animate(end_css, settings.animation_speed, 'linear', function () {
281
288
  this.locked = false;
282
- el.trigger('opened');
289
+ el.trigger('opened').trigger('opened.fndtn.reveal');
283
290
  }.bind(this))
284
291
  .addClass('open');
285
292
  }.bind(this), settings.animation_speed / 2);
@@ -294,13 +301,13 @@
294
301
  .css(css)
295
302
  .animate(end_css, settings.animation_speed, 'linear', function () {
296
303
  this.locked = false;
297
- el.trigger('opened');
304
+ el.trigger('opened').trigger('opened.fndtn.reveal');
298
305
  }.bind(this))
299
306
  .addClass('open');
300
307
  }.bind(this), settings.animation_speed / 2);
301
308
  }
302
309
 
303
- return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
310
+ return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
304
311
  }
305
312
 
306
313
  var settings = this.settings;
@@ -335,7 +342,7 @@
335
342
  return el
336
343
  .animate(end_css, settings.animation_speed, 'linear', function () {
337
344
  this.locked = false;
338
- el.css(css).trigger('closed');
345
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
339
346
  }.bind(this))
340
347
  .removeClass('open');
341
348
  }.bind(this), settings.animation_speed / 2);
@@ -348,13 +355,13 @@
348
355
  return el
349
356
  .animate(end_css, settings.animation_speed, 'linear', function () {
350
357
  this.locked = false;
351
- el.css(css).trigger('closed');
358
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
352
359
  }.bind(this))
353
360
  .removeClass('open');
354
361
  }.bind(this), settings.animation_speed / 2);
355
362
  }
356
363
 
357
- return el.hide().css(css).removeClass('open').trigger('closed');
364
+ return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
358
365
  }
359
366
 
360
367
  var settings = this.settings;
@@ -373,7 +380,7 @@
373
380
 
374
381
  if (iframe.length > 0) {
375
382
  iframe.attr('data-src', iframe[0].src);
376
- iframe.attr('src', 'about:blank');
383
+ iframe.attr('src', iframe.attr('src'));
377
384
  video.hide();
378
385
  }
379
386
  },
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.slider = {
5
5
  name : 'slider',
6
6
 
7
- version : '5.2.3',
7
+ version : '5.4.3',
8
8
 
9
9
  settings: {
10
10
  start: 0,
@@ -12,6 +12,7 @@
12
12
  step: 1,
13
13
  initial: null,
14
14
  display_selector: '',
15
+ vertical: false,
15
16
  on_change: function(){}
16
17
  },
17
18
 
@@ -29,7 +30,7 @@
29
30
  $(this.scope)
30
31
  .off('.slider')
31
32
  .on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
32
- '[' + self.attr_name() + '] .range-slider-handle', function(e) {
33
+ '[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function(e) {
33
34
  if (!self.cache.active) {
34
35
  e.preventDefault();
35
36
  self.set_active_slider($(e.target));
@@ -38,7 +39,22 @@
38
39
  .on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function(e) {
39
40
  if (!!self.cache.active) {
40
41
  e.preventDefault();
41
- self.calculate_position(self.cache.active, e.pageX || e.originalEvent.clientX || e.originalEvent.touches[0].clientX || e.currentPoint.x);
42
+ if ($.data(self.cache.active[0], 'settings').vertical) {
43
+ var scroll_offset = 0;
44
+ if (!e.pageY) {
45
+ scroll_offset = window.scrollY;
46
+ }
47
+ self.calculate_position(self.cache.active, (e.pageY ||
48
+ e.originalEvent.clientY ||
49
+ e.originalEvent.touches[0].clientY ||
50
+ e.currentPoint.y)
51
+ + scroll_offset);
52
+ } else {
53
+ self.calculate_position(self.cache.active, e.pageX ||
54
+ e.originalEvent.clientX ||
55
+ e.originalEvent.touches[0].clientX ||
56
+ e.currentPoint.x);
57
+ }
42
58
  }
43
59
  })
44
60
  .on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) {
@@ -64,21 +80,23 @@
64
80
 
65
81
  calculate_position : function($handle, cursor_x) {
66
82
  var self = this,
67
- settings = $.extend({}, self.settings, self.data_options($handle.parent())),
68
- handle_w = $.data($handle[0], 'handle_w'),
83
+ settings = $.data($handle[0], 'settings'),
84
+ handle_l = $.data($handle[0], 'handle_l'),
69
85
  handle_o = $.data($handle[0], 'handle_o'),
70
- bar_w = $.data($handle[0], 'bar_w'),
86
+ bar_l = $.data($handle[0], 'bar_l'),
71
87
  bar_o = $.data($handle[0], 'bar_o');
72
88
 
73
89
  requestAnimationFrame(function(){
74
90
  var pct;
75
91
 
76
- if (Foundation.rtl) {
77
- pct = self.limit_to(((bar_o+bar_w-cursor_x)/bar_w),0,1);
92
+ if (Foundation.rtl && !settings.vertical) {
93
+ pct = self.limit_to(((bar_o+bar_l-cursor_x)/bar_l),0,1);
78
94
  } else {
79
- pct = self.limit_to(((cursor_x-bar_o)/bar_w),0,1);
95
+ pct = self.limit_to(((cursor_x-bar_o)/bar_l),0,1);
80
96
  }
81
97
 
98
+ pct = settings.vertical ? 1-pct : pct;
99
+
82
100
  var norm = self.normalized_value(pct, settings.start, settings.end, settings.step);
83
101
 
84
102
  self.set_ui($handle, norm);
@@ -86,39 +104,52 @@
86
104
  },
87
105
 
88
106
  set_ui : function($handle, value) {
89
- var settings = $.extend({}, this.settings, this.data_options($handle.parent())),
90
- handle_w = $.data($handle[0], 'handle_w'),
91
- bar_w = $.data($handle[0], 'bar_w'),
107
+ var settings = $.data($handle[0], 'settings'),
108
+ handle_l = $.data($handle[0], 'handle_l'),
109
+ bar_l = $.data($handle[0], 'bar_l'),
92
110
  norm_pct = this.normalized_percentage(value, settings.start, settings.end),
93
- handle_offset = norm_pct*(bar_w-handle_w)-1,
94
- progress_bar_width = norm_pct*100;
111
+ handle_offset = norm_pct*(bar_l-handle_l)-1,
112
+ progress_bar_length = norm_pct*100;
95
113
 
96
- if (Foundation.rtl) {
114
+ if (Foundation.rtl && !settings.vertical) {
97
115
  handle_offset = -handle_offset;
98
116
  }
99
117
 
100
- this.set_translate($handle, handle_offset);
101
- $handle.siblings('.range-slider-active-segment').css('width', progress_bar_width+'%');
118
+ handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset;
119
+ this.set_translate($handle, handle_offset, settings.vertical);
102
120
 
103
- $handle.parent().attr(this.attr_name(), value);
104
- $handle.parent().trigger('change');
121
+ if (settings.vertical) {
122
+ $handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%');
123
+ } else {
124
+ $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
125
+ }
126
+
127
+ $handle.parent().attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
105
128
 
106
129
  $handle.parent().children('input[type=hidden]').val(value);
107
130
 
108
- if (settings.input_id != '') {
109
- $(settings.display_selector).each(function(){
110
- if (this.hasOwnProperty('value')) {
111
- $(this).val(value);
112
- } else {
113
- $(this).text(value);
114
- }
131
+ if (!$handle[0].hasAttribute('aria-valuemin')) {
132
+ $handle.attr({
133
+ 'aria-valuemin': settings.start,
134
+ 'aria-valuemax': settings.end,
115
135
  });
116
136
  }
137
+ $handle.attr('aria-valuenow', value);
138
+
139
+ // if (settings.input_id != '') {
140
+ // $(settings.display_selector).each(function(){
141
+ // if (this.hasOwnProperty('value')) {
142
+ // $(this).val(value);
143
+ // } else {
144
+ // $(this).text(value);
145
+ // }
146
+ // });
147
+ // }
117
148
 
118
149
  },
119
150
 
120
151
  normalized_percentage : function(val, start, end) {
121
- return (val - start)/(end - start);
152
+ return Math.min(1, (val - start)/(end - start));
122
153
  },
123
154
 
124
155
  normalized_value : function(val, start, end, step) {
@@ -153,12 +184,22 @@
153
184
  },
154
185
 
155
186
  initialize_settings : function(handle) {
187
+ var settings = $.extend({}, this.settings, this.data_options($(handle).parent()));
188
+
189
+ if (settings.vertical) {
190
+ $.data(handle, 'bar_o', $(handle).parent().offset().top);
191
+ $.data(handle, 'bar_l', $(handle).parent().outerHeight());
192
+ $.data(handle, 'handle_o', $(handle).offset().top);
193
+ $.data(handle, 'handle_l', $(handle).outerHeight());
194
+ } else {
195
+ $.data(handle, 'bar_o', $(handle).parent().offset().left);
196
+ $.data(handle, 'bar_l', $(handle).parent().outerWidth());
197
+ $.data(handle, 'handle_o', $(handle).offset().left);
198
+ $.data(handle, 'handle_l', $(handle).outerWidth());
199
+ }
200
+
156
201
  $.data(handle, 'bar', $(handle).parent());
157
- $.data(handle, 'bar_o', $(handle).parent().offset().left);
158
- $.data(handle, 'bar_w', $(handle).parent().outerWidth());
159
- $.data(handle, 'handle_o', $(handle).offset().left);
160
- $.data(handle, 'handle_w', $(handle).outerWidth());
161
- $.data(handle, 'settings', $.extend({}, this.settings, this.data_options($(handle).parent())));
202
+ $.data(handle, 'settings', settings);
162
203
  },
163
204
 
164
205
  set_initial_position : function($ele) {
@@ -193,7 +234,6 @@
193
234
  }
194
235
  });
195
236
  }
196
-
197
237
  };
198
238
 
199
239
  }(jQuery, window, window.document));
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.tab = {
5
5
  name : 'tab',
6
6
 
7
- version : '5.2.3',
7
+ version : '5.4.3',
8
8
 
9
9
  settings : {
10
10
  active_class: 'active',
@@ -35,17 +35,20 @@
35
35
  var self = this,
36
36
  S = this.S;
37
37
 
38
- S(this.scope)
39
- .off('.tab')
40
- // Click event: tab title
41
- .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
38
+ var usual_tab_behavior = function (e) {
42
39
  var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
43
40
  if (!settings.is_hover || Modernizr.touch) {
44
41
  e.preventDefault();
45
42
  e.stopPropagation();
46
43
  self.toggle_active_tab(S(this).parent());
47
44
  }
48
- })
45
+ };
46
+
47
+ S(this.scope)
48
+ .off('.tab')
49
+ // Click event: tab title
50
+ .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
51
+ .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
49
52
  // Hover event: tab title
50
53
  .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
51
54
  var settings = S(this).closest('[' + self.attr_name() +']').data(self.attr_name(true) + '-init');
@@ -56,10 +59,18 @@
56
59
  S(window).on('hashchange.fndtn.tab', function (e) {
57
60
  e.preventDefault();
58
61
  self.handle_location_hash_change();
59
- });
62
+
63
+ }).on('keyup', function (e) {
64
+         if (e.keyword == 9) {
65
+           // active tab
66
+           console.log(document.querySelector('[data-tab] .tab-title :focus'))
67
+         }
68
+       });
69
+ ;
60
70
  },
61
71
 
62
72
  handle_location_hash_change : function () {
73
+
63
74
  var self = this,
64
75
  S = this.S;
65
76
 
@@ -67,7 +78,13 @@
67
78
  var settings = S(this).data(self.attr_name(true) + '-init');
68
79
  if (settings.deep_linking) {
69
80
  // Match the location hash to a label
70
- var hash = self.scope.location.hash;
81
+ var hash;
82
+ if (settings.scroll_to_content) {
83
+ hash = self.scope.location.hash;
84
+ } else {
85
+ // prefix the hash to prevent anchor scrolling
86
+ hash = self.scope.location.hash.replace('fndtn-', '');
87
+ }
71
88
  if (hash != '') {
72
89
  // Check whether the location hash references a tab content div or
73
90
  // another element on the page (inside or outside the tab content div)
@@ -96,11 +113,58 @@
96
113
  toggle_active_tab: function (tab, location_hash) {
97
114
  var S = this.S,
98
115
  tabs = tab.closest('[' + this.attr_name() + ']'),
116
+ tab_link = tab.find('a'),
99
117
  anchor = tab.children('a').first(),
100
118
  target_hash = '#' + anchor.attr('href').split('#')[1],
101
119
  target = S(target_hash),
102
120
  siblings = tab.siblings(),
103
- settings = tabs.data(this.attr_name(true) + '-init');
121
+ settings = tabs.data(this.attr_name(true) + '-init'),
122
+ interpret_keyup_action = function(e) {
123
+ // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
124
+
125
+ // define current, previous and next (possible) tabs
126
+
127
+ var $original = $(this);
128
+ var $prev = $(this).parents('li').prev().children('[role="tab"]');
129
+ var $next = $(this).parents('li').next().children('[role="tab"]');
130
+ var $target;
131
+
132
+ // find the direction (prev or next)
133
+
134
+ switch (e.keyCode) {
135
+ case 37:
136
+ $target = $prev;
137
+ break;
138
+ case 39:
139
+ $target = $next;
140
+ break;
141
+ default:
142
+ $target = false
143
+ break;
144
+ }
145
+
146
+ if ($target.length) {
147
+ $original.attr({
148
+ 'tabindex' : '-1',
149
+ 'aria-selected' : null
150
+ });
151
+ $target.attr({
152
+ 'tabindex' : '0',
153
+ 'aria-selected' : true
154
+ }).focus();
155
+ }
156
+
157
+ // Hide panels
158
+
159
+ $('[role="tabpanel"]')
160
+ .attr('aria-hidden', 'true');
161
+
162
+ // Show panel which corresponds to target
163
+
164
+ $('#' + $(document.activeElement).attr('href').substring(1))
165
+ .attr('aria-hidden', null);
166
+
167
+ };
104
168
 
105
169
  // allow usage of data-tab-content attribute instead of href
106
170
  if (S(this).data(this.data_attr('tab-content'))) {
@@ -109,34 +173,21 @@
109
173
  }
110
174
 
111
175
  if (settings.deep_linking) {
112
- // Get the scroll Y position prior to moving to the hash ID
113
- var cur_ypos = $('body,html').scrollTop();
114
-
115
- // Update the location hash to preserve browser history
116
- // Note that the hash does not need to correspond to the
117
- // tab content ID anchor; it can be an ID inside or outside of the tab
118
- // content div.
119
- if (location_hash != undefined) {
120
- window.location.hash = location_hash;
121
- } else {
122
- window.location.hash = target_hash;
123
- }
124
176
 
125
177
  if (settings.scroll_to_content) {
126
- // If the user is requesting the content of a tab, then scroll to the
127
- // top of the title area; otherwise, scroll to the element within
128
- // the content area as defined by the hash value.
178
+ // retain current hash to scroll to content
179
+ window.location.hash = location_hash || target_hash;
129
180
  if (location_hash == undefined || location_hash == target_hash) {
130
181
  tab.parent()[0].scrollIntoView();
131
182
  } else {
132
183
  S(target_hash)[0].scrollIntoView();
133
184
  }
134
185
  } else {
135
- // Adjust the scrollbar to the Y position prior to setting the hash
136
- // Only do this for the tab content anchor, otherwise there will be
137
- // conflicts with in-tab anchor links nested in the tab-content div
138
- if (location_hash == undefined || location_hash == target_hash) {
139
- $('body,html').scrollTop(cur_ypos);
186
+ // prefix the hashes so that the browser doesn't scroll down
187
+ if (location_hash != undefined) {
188
+ window.location.hash = 'fndtn-' + location_hash.replace('#', '');
189
+ } else {
190
+ window.location.hash = 'fndtn-' + target_hash.replace('#', '');
140
191
  }
141
192
  }
142
193
  }
@@ -144,12 +195,18 @@
144
195
  // WARNING: The activation and deactivation of the tab content must
145
196
  // occur after the deep linking in order to properly refresh the browser
146
197
  // window (notably in Chrome).
198
+ // Clean up multiple attr instances to done once
147
199
  tab.addClass(settings.active_class).triggerHandler('opened');
148
- siblings.removeClass(settings.active_class);
149
- target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
200
+ tab_link.attr({"aria-selected": "true", tabindex: 0});
201
+ siblings.removeClass(settings.active_class)
202
+ siblings.find('a').attr({"aria-selected": "false", tabindex: -1});
203
+ target.siblings().removeClass(settings.active_class).attr({"aria-hidden": "true", tabindex: -1}).end().addClass(settings.active_class).attr('aria-hidden', 'false').find(':first-child').attr('tabindex', 0);
150
204
  settings.callback(tab);
205
+ target.children().attr('tab-index', 0);
151
206
  target.triggerHandler('toggled', [tab]);
152
207
  tabs.triggerHandler('toggled', [target]);
208
+
209
+ tab_link.on('keydown', interpret_keyup_action );
153
210
  },
154
211
 
155
212
  data_attr: function (str) {