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['magellan-expedition'] = {
5
5
  name : 'magellan-expedition',
6
6
 
7
- version : '5.2.3',
7
+ version : '5.4.3',
8
8
 
9
9
  settings : {
10
10
  active_class: 'active',
@@ -12,7 +12,7 @@
12
12
  destination_threshold: 20, // pixels from the top of destination for it to be considered active
13
13
  throttle_delay: 30, // calculation throttling to increase framerate
14
14
  fixed_top: 0 // top distance in pixels assigend to the fixed element on scroll
15
- },
15
+ },
16
16
 
17
17
  init : function (scope, method, options) {
18
18
  Foundation.inherit(this, 'throttle');
@@ -35,13 +35,15 @@
35
35
  settings = expedition.data('magellan-expedition-init'),
36
36
  hash = this.hash.split('#').join(''),
37
37
  target = $("a[name='"+hash+"']");
38
-
38
+
39
39
  if (target.length === 0) {
40
40
  target = $('#'+hash);
41
+
41
42
  }
42
43
 
44
+
43
45
  // Account for expedition height if fixed position
44
- var scroll_top = target.offset().top;
46
+ var scroll_top = target.offset().top - settings.destination_threshold + 1;
45
47
  scroll_top = scroll_top - expedition.outerHeight();
46
48
 
47
49
  $('html, body').stop().animate({
@@ -56,7 +58,7 @@
56
58
  });
57
59
  })
58
60
  .on('scroll.fndtn.magellan', self.throttle(this.check_for_arrivals.bind(this), settings.throttle_delay));
59
-
61
+
60
62
  $(window)
61
63
  .on('resize.fndtn.magellan', self.throttle(this.set_expedition_position.bind(this), settings.throttle_delay));
62
64
  },
@@ -71,11 +73,17 @@
71
73
  var self = this;
72
74
  $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
73
75
  var expedition = $(this),
76
+ settings = expedition.data('magellan-expedition-init'),
74
77
  styles = expedition.attr('styles'), // save styles
75
- top_offset;
78
+ top_offset, fixed_top;
76
79
 
77
80
  expedition.attr('style', '');
78
- top_offset = expedition.offset().top + self.settings.threshold;
81
+ top_offset = expedition.offset().top + settings.threshold;
82
+
83
+ //set fixed-top by attribute
84
+ fixed_top = parseInt(expedition.data('magellan-fixed-top'));
85
+ if(!isNaN(fixed_top))
86
+ self.settings.fixed_top = fixed_top;
79
87
 
80
88
  expedition.data(self.data_attr('magellan-top-offset'), top_offset);
81
89
  expedition.attr('style', styles);
@@ -88,9 +96,12 @@
88
96
 
89
97
  $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
90
98
  var expedition = $(this),
99
+ settings = expedition.data('magellan-expedition-init'),
100
+ styles = expedition.attr('style'), // save styles
91
101
  top_offset = expedition.data('magellan-top-offset');
92
102
 
93
- if (window_top_offset >= top_offset) {
103
+ //scroll to the top distance
104
+ if (window_top_offset+self.settings.fixed_top >= top_offset) {
94
105
  // Placeholder allows height calculations to be consistent even when
95
106
  // appearing to switch between fixed/non-fixed placement
96
107
  var placeholder = expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']');
@@ -100,10 +111,10 @@
100
111
  placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
101
112
  expedition.before(placeholder);
102
113
  }
103
- expedition.css({position:'fixed', top: self.settings.fixed_top});
114
+ expedition.css({position:'fixed', top: settings.fixed_top}).addClass('fixed');
104
115
  } else {
105
116
  expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
106
- expedition.attr('style','').removeClass('fixed');
117
+ expedition.attr('style',styles).css('position','').css('top','').removeClass('fixed');
107
118
  }
108
119
  });
109
120
  },
@@ -141,7 +152,7 @@
141
152
  var name = $(this).data(self.data_attr('magellan-arrival')),
142
153
  dest = $('[' + self.add_namespace('data-magellan-destination') + '=' + name + ']');
143
154
  if (dest.length > 0) {
144
- var top_offset = dest.offset().top - settings.destination_threshold - expedition.outerHeight();
155
+ var top_offset = Math.floor(dest.offset().top - settings.destination_threshold - expedition.outerHeight());
145
156
  return {
146
157
  destination : dest,
147
158
  arrival : $(this),
@@ -4,11 +4,11 @@
4
4
  Foundation.libs.offcanvas = {
5
5
  name : 'offcanvas',
6
6
 
7
- version : '5.2.3',
7
+ version : '5.4.3',
8
8
 
9
9
  settings : {
10
10
  open_method: 'move',
11
- close_on_click: true
11
+ close_on_click: false
12
12
  },
13
13
 
14
14
  init : function (scope, method, options) {
@@ -26,6 +26,10 @@
26
26
  move_class = 'move-';
27
27
  right_postfix = 'right';
28
28
  left_postfix = 'left';
29
+ } else if (this.settings.open_method === 'overlap_single') {
30
+ move_class = 'offcanvas-overlap-';
31
+ right_postfix = 'right';
32
+ left_postfix = 'left';
29
33
  } else if (this.settings.open_method === 'overlap') {
30
34
  move_class = 'offcanvas-overlap';
31
35
  }
@@ -33,27 +37,67 @@
33
37
  S(this.scope).off('.offcanvas')
34
38
  .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
35
39
  self.click_toggle_class(e, move_class + right_postfix);
40
+ if (self.settings.open_method !== 'overlap'){
41
+ S(".left-submenu").removeClass(move_class + right_postfix);
42
+ }
43
+ $('.left-off-canvas-toggle').attr('aria-expanded', 'true');
36
44
  })
37
45
  .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) {
38
46
  var settings = self.get_settings(e);
39
- if (settings.close_on_click) {
47
+ var parent = S(this).parent();
48
+
49
+ if(settings.close_on_click && !parent.hasClass("has-submenu") && !parent.hasClass("back")){
40
50
  self.hide.call(self, move_class + right_postfix, self.get_wrapper(e));
51
+ parent.parent().removeClass(move_class + right_postfix);
52
+ }else if(S(this).parent().hasClass("has-submenu")){
53
+ e.preventDefault();
54
+ S(this).siblings(".left-submenu").toggleClass(move_class + right_postfix);
55
+ }else if(parent.hasClass("back")){
56
+ e.preventDefault();
57
+ parent.parent().removeClass(move_class + right_postfix);
41
58
  }
59
+ $('.left-off-canvas-toggle').attr('aria-expanded', 'true');
42
60
  })
43
61
  .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
44
62
  self.click_toggle_class(e, move_class + left_postfix);
63
+ if (self.settings.open_method !== 'overlap'){
64
+ S(".right-submenu").removeClass(move_class + left_postfix);
65
+ }
66
+ $('.right-off-canvas-toggle').attr('aria-expanded', 'true');
45
67
  })
46
68
  .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) {
47
69
  var settings = self.get_settings(e);
48
- if (settings.close_on_click) {
70
+ var parent = S(this).parent();
71
+
72
+ if(settings.close_on_click && !parent.hasClass("has-submenu") && !parent.hasClass("back")){
49
73
  self.hide.call(self, move_class + left_postfix, self.get_wrapper(e));
74
+ parent.parent().removeClass(move_class + left_postfix);
75
+ }else if(S(this).parent().hasClass("has-submenu")){
76
+ e.preventDefault();
77
+ S(this).siblings(".right-submenu").toggleClass(move_class + left_postfix);
78
+ }else if(parent.hasClass("back")){
79
+ e.preventDefault();
80
+ parent.parent().removeClass(move_class + left_postfix);
50
81
  }
82
+ $('.right-off-canvas-toggle').attr('aria-expanded', 'true');
51
83
  })
52
84
  .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
53
85
  self.click_remove_class(e, move_class + left_postfix);
54
- if (right_postfix) self.click_remove_class(e, move_class + right_postfix);
86
+ S(".right-submenu").removeClass(move_class + left_postfix);
87
+ if (right_postfix){
88
+ self.click_remove_class(e, move_class + right_postfix);
89
+ S(".left-submenu").removeClass(move_class + left_postfix);
90
+ }
91
+ $('.right-off-canvas-toggle').attr('aria-expanded', 'true');
92
+ })
93
+ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
94
+ self.click_remove_class(e, move_class + left_postfix);
95
+ $('.left-off-canvas-toggle').attr('aria-expanded', 'false');
96
+ if (right_postfix) {
97
+ self.click_remove_class(e, move_class + right_postfix);
98
+ $('.right-off-canvas-toggle').attr('aria-expanded', "false");
99
+ }
55
100
  });
56
-
57
101
  },
58
102
 
59
103
  toggle: function(class_name, $off_canvas) {
@@ -67,13 +111,13 @@
67
111
 
68
112
  show: function(class_name, $off_canvas) {
69
113
  $off_canvas = $off_canvas || this.get_wrapper();
70
- $off_canvas.trigger('open');
114
+ $off_canvas.trigger('open').trigger('open.fndtn.offcanvas');
71
115
  $off_canvas.addClass(class_name);
72
116
  },
73
117
 
74
118
  hide: function(class_name, $off_canvas) {
75
119
  $off_canvas = $off_canvas || this.get_wrapper();
76
- $off_canvas.trigger('close');
120
+ $off_canvas.trigger('close').trigger('close.fndtn.offcanvas');
77
121
  $off_canvas.removeClass(class_name);
78
122
  },
79
123
 
@@ -17,16 +17,16 @@
17
17
  timer_container,
18
18
  idx = 0,
19
19
  animate,
20
- adjust_height_after = false,
21
- has_init_active = slides_container.find("." + settings.active_slide_class).length > 0;
20
+ timer,
21
+ locked = false,
22
+ adjust_height_after = false;
22
23
 
23
- self.cache = {};
24
24
 
25
25
  self.slides = function() {
26
26
  return slides_container.children(settings.slide_selector);
27
27
  };
28
28
 
29
- if (!has_init_active) {self.slides().first().addClass(settings.active_slide_class)};
29
+ self.slides().first().addClass(settings.active_slide_class);
30
30
 
31
31
  self.update_slide_number = function(index) {
32
32
  if (settings.slide_number) {
@@ -49,8 +49,7 @@
49
49
  slides_container.wrap('<div class="'+settings.container_class+'"></div>');
50
50
  container = slides_container.parent();
51
51
  slides_container.addClass(settings.slides_container_class);
52
- slides_container.addClass(settings.animation);
53
-
52
+
54
53
  if (settings.stack_on_small) {
55
54
  container.addClass(settings.stack_on_small_class);
56
55
  }
@@ -63,9 +62,7 @@
63
62
  if (settings.timer) {
64
63
  timer_container = $('<div>').addClass(settings.timer_container_class);
65
64
  timer_container.append('<span>');
66
- if (settings.timer_show_progress_bar) {
67
- timer_container.append($('<div>').addClass(settings.timer_progress_class));
68
- }
65
+ timer_container.append($('<div>').addClass(settings.timer_progress_class));
69
66
  timer_container.addClass(settings.timer_paused_class);
70
67
  container.append(timer_container);
71
68
  }
@@ -81,27 +78,22 @@
81
78
  container.append(bullets_container);
82
79
  bullets_container.wrap('<div class="orbit-bullets-container"></div>');
83
80
  self.slides().each(function(idx, el) {
84
- var bullet = $('<li>').attr('data-orbit-slide', idx)
85
- .on('click', self.link_bullet);
81
+ var bullet = $('<li>').attr('data-orbit-slide', idx).on('click', self.link_bullet);;
86
82
  bullets_container.append(bullet);
87
83
  });
88
84
  }
89
85
 
90
86
  };
91
87
 
92
- self._prepare_direction = function(next_idx, current_direction) {
93
- var dir = 'next';
94
- if (next_idx <= idx) { dir = 'prev'; }
95
-
96
- if (settings.animation === 'slide') {
97
- setTimeout(function(){
98
- slides_container.removeClass("swipe-prev swipe-next");
99
- if (dir === 'next') {slides_container.addClass("swipe-next");}
100
- else if (dir === 'prev') {slides_container.addClass("swipe-prev");}
101
- },0);
102
- }
103
-
88
+ self._goto = function(next_idx, start_timer) {
89
+ // if (locked) {return false;}
90
+ if (next_idx === idx) {return false;}
91
+ if (typeof timer === 'object') {timer.restart();}
104
92
  var slides = self.slides();
93
+
94
+ var dir = 'next';
95
+ locked = true;
96
+ if (next_idx < idx) {dir = 'prev';}
105
97
  if (next_idx >= slides.length) {
106
98
  if (!settings.circular) return false;
107
99
  next_idx = 0;
@@ -109,53 +101,29 @@
109
101
  if (!settings.circular) return false;
110
102
  next_idx = slides.length - 1;
111
103
  }
112
- var current = $(slides.get(idx))
113
- , next = $(slides.get(next_idx));
114
-
115
- return [dir, current, next, next_idx];
116
- };
117
104
 
118
- self._goto = function(next_idx, start_timer) {
119
- if (next_idx === null) {return false;}
120
- if (self.cache.animating) {return false;}
121
- if (next_idx === idx) {return false;}
122
- if (typeof self.cache.timer === 'object') {self.cache.timer.restart();}
123
-
124
- var slides = self.slides();
125
- self.cache.animating = true;
126
- var res = self._prepare_direction(next_idx)
127
- , dir = res[0]
128
- , current = res[1]
129
- , next = res[2]
130
- , next_idx = res[3];
105
+ var current = $(slides.get(idx));
106
+ var next = $(slides.get(next_idx));
131
107
 
132
- // This means that circular is disabled and we most likely reached the last slide.
133
- if (res === false) return false;
108
+ current.css('zIndex', 2);
109
+ current.removeClass(settings.active_slide_class);
110
+ next.css('zIndex', 4).addClass(settings.active_slide_class);
134
111
 
135
112
  slides_container.trigger('before-slide-change.fndtn.orbit');
136
113
  settings.before_slide_change();
137
- idx = next_idx;
114
+ self.update_active_link(next_idx);
138
115
 
139
- current.css("transitionDuration", settings.animation_speed+"ms");
140
- next.css("transitionDuration", settings.animation_speed+"ms");
141
-
142
116
  var callback = function() {
143
117
  var unlock = function() {
144
- if (start_timer === true) {self.cache.timer.restart();}
118
+ idx = next_idx;
119
+ locked = false;
120
+ if (start_timer === true) {timer = self.create_timer(); timer.start();}
145
121
  self.update_slide_number(idx);
146
- // Remove "animate-in" class as late as possible to avoid "flickering" (especially with variable_height).
147
- next.removeClass("animate-in");
148
- next.addClass(settings.active_slide_class);
149
- self.update_active_link(next_idx);
150
122
  slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
151
123
  settings.after_slide_change(idx, slides.length);
152
- setTimeout(function(){
153
- self.cache.animating = false;
154
- }, 100);
155
-
156
124
  };
157
125
  if (slides_container.height() != next.height() && settings.variable_height) {
158
- slides_container.animate({'min-height': next.height()}, 250, 'linear', unlock);
126
+ slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
159
127
  } else {
160
128
  unlock();
161
129
  }
@@ -165,32 +133,26 @@
165
133
 
166
134
  var start_animation = function() {
167
135
  if (dir === 'next') {animate.next(current, next, callback);}
168
- if (dir === 'prev') {animate.prev(current, next, callback);}
136
+ if (dir === 'prev') {animate.prev(current, next, callback);}
169
137
  };
170
138
 
171
139
  if (next.height() > slides_container.height() && settings.variable_height) {
172
- slides_container.animate({'min-height': next.height()}, 250, 'linear', start_animation);
140
+ slides_container.animate({'height': next.height()}, 250, 'linear', start_animation);
173
141
  } else {
174
142
  start_animation();
175
143
  }
176
144
  };
177
-
145
+
178
146
  self.next = function(e) {
179
147
  e.stopImmediatePropagation();
180
148
  e.preventDefault();
181
- self._prepare_direction(idx + 1);
182
- setTimeout(function(){
183
- self._goto(idx + 1);
184
- }, 100);
149
+ self._goto(idx + 1);
185
150
  };
186
-
151
+
187
152
  self.prev = function(e) {
188
153
  e.stopImmediatePropagation();
189
154
  e.preventDefault();
190
- self._prepare_direction(idx - 1);
191
- setTimeout(function(){
192
- self._goto(idx - 1)
193
- }, 100);
155
+ self._goto(idx - 1);
194
156
  };
195
157
 
196
158
  self.link_custom = function(e) {
@@ -198,44 +160,30 @@
198
160
  var link = $(this).attr('data-orbit-link');
199
161
  if ((typeof link === 'string') && (link = $.trim(link)) != "") {
200
162
  var slide = container.find('[data-orbit-slide='+link+']');
201
- if (slide.index() != -1) {
202
- setTimeout(function(){
203
- self._goto(slide.index());
204
- },100);
205
- }
163
+ if (slide.index() != -1) {self._goto(slide.index());}
206
164
  }
207
165
  };
208
166
 
209
- // Click handler for slides and bullets.
210
- self.link_bullet = function(e) {
167
+ self.link_bullet = function(e) {
211
168
  var index = $(this).attr('data-orbit-slide');
212
169
  if ((typeof index === 'string') && (index = $.trim(index)) != "") {
213
170
  if(isNaN(parseInt(index)))
214
171
  {
215
172
  var slide = container.find('[data-orbit-slide='+index+']');
216
- if (slide.index() != -1) {
217
- index = slide.index() + 1;
218
- self._prepare_direction(index);
219
- setTimeout(function(){
220
- self._goto(index);
221
- },100);
222
- }
173
+ if (slide.index() != -1) {self._goto(slide.index() + 1);}
223
174
  }
224
175
  else
225
176
  {
226
- index = parseInt(index);
227
- self._prepare_direction(index);
228
- setTimeout(function(){
229
- self._goto(index);
230
- },100);
177
+ self._goto(parseInt(index));
231
178
  }
232
179
  }
180
+
233
181
  }
234
182
 
235
183
  self.timer_callback = function() {
236
184
  self._goto(idx + 1, true);
237
185
  }
238
-
186
+
239
187
  self.compute_dimensions = function() {
240
188
  var current = $(self.slides().get(idx));
241
189
  var h = current.height();
@@ -244,50 +192,42 @@
244
192
  if ($(this).height() > h) { h = $(this).height(); }
245
193
  });
246
194
  }
247
- slides_container.css('minHeight', String(h)+'px');
195
+ slides_container.height(h);
248
196
  };
249
197
 
250
198
  self.create_timer = function() {
251
199
  var t = new Timer(
252
- container.find('.'+settings.timer_container_class),
253
- settings,
200
+ container.find('.'+settings.timer_container_class),
201
+ settings,
254
202
  self.timer_callback
255
203
  );
256
204
  return t;
257
205
  };
258
206
 
259
207
  self.stop_timer = function() {
260
- if (typeof self.cache.timer === 'object') self.cache.timer.stop();
208
+ if (typeof timer === 'object') timer.stop();
261
209
  };
262
210
 
263
211
  self.toggle_timer = function() {
264
212
  var t = container.find('.'+settings.timer_container_class);
265
213
  if (t.hasClass(settings.timer_paused_class)) {
266
- if (typeof self.cache.timer === 'undefined') {self.cache.timer = self.create_timer();}
267
- self.cache.timer.start();
214
+ if (typeof timer === 'undefined') {timer = self.create_timer();}
215
+ timer.start();
268
216
  }
269
217
  else {
270
- if (typeof self.cache.timer === 'object') {self.cache.timer.stop();}
218
+ if (typeof timer === 'object') {timer.stop();}
271
219
  }
272
220
  };
273
221
 
274
222
  self.init = function() {
275
223
  self.build_markup();
276
224
  if (settings.timer) {
277
- self.cache.timer = self.create_timer();
278
- Foundation.utils.image_loaded(this.slides().find('img'), self.cache.timer.start);
279
- }
280
-
281
- animate = new CSSAnimation(settings, slides_container);
282
-
283
- if (has_init_active) {
284
- var $init_target = slides_container.find("." + settings.active_slide_class),
285
- animation_speed = settings.animation_speed;
286
- settings.animation_speed = 1;
287
- $init_target.removeClass('active');
288
- self._goto($init_target.index());
289
- settings.animation_speed = animation_speed;
225
+ timer = self.create_timer();
226
+ Foundation.utils.image_loaded(this.slides().children('img'), timer.start);
290
227
  }
228
+ animate = new FadeAnimation(settings, slides_container);
229
+ if (settings.animation === 'slide')
230
+ animate = new SlideAnimation(settings, slides_container);
291
231
 
292
232
  container.on('click', '.'+settings.next_class, self.next);
293
233
  container.on('click', '.'+settings.prev_class, self.prev);
@@ -295,76 +235,46 @@
295
235
  if (settings.next_on_click) {
296
236
  container.on('click', '.'+settings.slides_container_class+' [data-orbit-slide]', self.link_bullet);
297
237
  }
298
-
238
+
299
239
  container.on('click', self.toggle_timer);
300
240
  if (settings.swipe) {
301
- slides_container.on('touchstart.fndtn.orbit',function(e) {
302
- if (self.cache.animating) {return;}
241
+ container.on('touchstart.fndtn.orbit', function(e) {
303
242
  if (!e.touches) {e = e.originalEvent;}
304
- e.preventDefault();
243
+ var data = {
244
+ start_page_x: e.touches[0].pageX,
245
+ start_page_y: e.touches[0].pageY,
246
+ start_time: (new Date()).getTime(),
247
+ delta_x: 0,
248
+ is_scrolling: undefined
249
+ };
250
+ container.data('swipe-transition', data);
305
251
  e.stopPropagation();
306
-
307
- self.cache.start_page_x = e.touches[0].pageX;
308
- self.cache.start_page_y = e.touches[0].pageY;
309
- self.cache.start_time = (new Date()).getTime();
310
- self.cache.delta_x = 0;
311
- self.cache.is_scrolling = null;
312
- self.cache.direction = null;
313
-
314
- self.stop_timer(); // does not appear to prevent callback from occurring
315
252
  })
316
- .on('touchmove.fndtn.orbit',function(e) {
317
- if (Math.abs(self.cache.delta_x) > 5) {
318
- e.preventDefault();
319
- e.stopPropagation();
253
+ .on('touchmove.fndtn.orbit', function(e) {
254
+ if (!e.touches) { e = e.originalEvent; }
255
+ // Ignore pinch/zoom events
256
+ if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
257
+
258
+ var data = container.data('swipe-transition');
259
+ if (typeof data === 'undefined') {data = {};}
260
+
261
+ data.delta_x = e.touches[0].pageX - data.start_page_x;
262
+
263
+ if ( typeof data.is_scrolling === 'undefined') {
264
+ data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
320
265
  }
321
266
 
322
- if (self.cache.animating) {return;}
323
- requestAnimationFrame(function(){
324
- if (!e.touches) { e = e.originalEvent; }
325
-
326
- // Ignore pinch/zoom events
327
- if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
328
-
329
- self.cache.delta_x = e.touches[0].pageX - self.cache.start_page_x;
330
-
331
- if (self.cache.is_scrolling === null) {
332
- self.cache.is_scrolling = !!( self.cache.is_scrolling || Math.abs(self.cache.delta_x) < Math.abs(e.touches[0].pageY - self.cache.start_page_y) );
333
- }
334
-
335
- if (self.cache.is_scrolling) {
336
- return;
337
- }
338
-
339
- var direction = (self.cache.delta_x < 0) ? (idx+1) : (idx-1);
340
- if (self.cache.direction !== direction) {
341
- var res = self._prepare_direction(direction);
342
- self.cache.direction = direction;
343
- self.cache.dir = res[0];
344
- self.cache.current = res[1];
345
- self.cache.next = res[2];
346
- }
347
-
348
- if (settings.animation === 'slide') {
349
- var offset, next_offset;
350
-
351
- offset = (self.cache.delta_x / container.width()) * 100;
352
- if (offset >= 0) {next_offset = -(100 - offset);}
353
- else {next_offset = 100 + offset;}
354
-
355
- self.cache.current.css("transform","translate3d("+offset+"%,0,0)");
356
- self.cache.next.css("transform","translate3d("+next_offset+"%,0,0)");
357
- }
358
- });
267
+ if (!data.is_scrolling && !data.active) {
268
+ e.preventDefault();
269
+ var direction = (data.delta_x < 0) ? (idx+1) : (idx-1);
270
+ data.active = true;
271
+ self._goto(direction);
272
+ }
359
273
  })
360
274
  .on('touchend.fndtn.orbit', function(e) {
361
- if (self.cache.animating) {return;}
362
- e.preventDefault();
275
+ container.data('swipe-transition', {});
363
276
  e.stopPropagation();
364
- setTimeout(function(){
365
- self._goto(self.cache.direction);
366
- }, 50);
367
- });
277
+ })
368
278
  }
369
279
  container.on('mouseenter.fndtn.orbit', function(e) {
370
280
  if (settings.timer && settings.pause_on_hover) {
@@ -373,18 +283,17 @@
373
283
  })
374
284
  .on('mouseleave.fndtn.orbit', function(e) {
375
285
  if (settings.timer && settings.resume_on_mouseout) {
376
- self.cache.timer.start();
286
+ timer.start();
377
287
  }
378
288
  });
379
-
289
+
380
290
  $(document).on('click', '[data-orbit-link]', self.link_custom);
381
291
  $(window).on('load resize', self.compute_dimensions);
382
- var children = this.slides().find('img');
383
- Foundation.utils.image_loaded(children, self.compute_dimensions);
384
- Foundation.utils.image_loaded(children, function() {
292
+ Foundation.utils.image_loaded(this.slides().children('img'), self.compute_dimensions);
293
+ Foundation.utils.image_loaded(this.slides().children('img'), function() {
385
294
  container.prev('.'+settings.preloader_class).css('display', 'none');
386
- self.update_slide_number(idx);
387
- self.update_active_link(idx);
295
+ self.update_slide_number(0);
296
+ self.update_active_link(0);
388
297
  slides_container.trigger('ready.fndtn.orbit');
389
298
  });
390
299
  };
@@ -396,8 +305,7 @@
396
305
  var self = this,
397
306
  duration = settings.timer_speed,
398
307
  progress = el.find('.'+settings.timer_progress_class),
399
- do_progress = progress && progress.css('display') != 'none',
400
- start,
308
+ start,
401
309
  timeout,
402
310
  left = -1;
403
311
 
@@ -413,18 +321,15 @@
413
321
  clearTimeout(timeout);
414
322
  el.addClass(settings.timer_paused_class);
415
323
  left = -1;
416
- if (do_progress) {self.update_progress(0);}
417
- self.start();
324
+ self.update_progress(0);
418
325
  };
419
326
 
420
327
  this.start = function() {
421
328
  if (!el.hasClass(settings.timer_paused_class)) {return true;}
422
329
  left = (left === -1) ? duration : left;
423
330
  el.removeClass(settings.timer_paused_class);
424
- if (do_progress) {
425
- start = new Date().getTime();
426
- progress.animate({'width': '100%'}, left, 'linear');
427
- }
331
+ start = new Date().getTime();
332
+ progress.animate({'width': '100%'}, left, 'linear');
428
333
  timeout = setTimeout(function() {
429
334
  self.restart();
430
335
  callback();
@@ -436,99 +341,58 @@
436
341
  if (el.hasClass(settings.timer_paused_class)) {return true;}
437
342
  clearTimeout(timeout);
438
343
  el.addClass(settings.timer_paused_class);
439
- if (do_progress) {
440
- var end = new Date().getTime();
441
- left = left - (end - start);
442
- var w = 100 - ((left / duration) * 100);
443
- self.update_progress(w);
444
- }
344
+ var end = new Date().getTime();
345
+ left = left - (end - start);
346
+ var w = 100 - ((left / duration) * 100);
347
+ self.update_progress(w);
445
348
  el.trigger('timer-stopped.fndtn.orbit');
446
349
  };
447
350
  };
448
351
 
449
- var CSSAnimation = function(settings, container) {
450
- var animation_end = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend";
352
+ var SlideAnimation = function(settings, container) {
353
+ var duration = settings.animation_speed;
354
+ var is_rtl = ($('html[dir=rtl]').length === 1);
355
+ var margin = is_rtl ? 'marginRight' : 'marginLeft';
356
+ var animMargin = {};
357
+ animMargin[margin] = '0%';
451
358
 
452
359
  this.next = function(current, next, callback) {
453
- if (Modernizr.csstransitions) {
454
- next.on(animation_end, function(e){
455
- next.unbind(animation_end);
456
- current.removeClass("active animate-out");
457
- container.children().css({
458
- "transform":"",
459
- "-ms-transform":"",
460
- "-webkit-transition-duration":"",
461
- "-moz-transition-duration": "",
462
- "-o-transition-duration": "",
463
- "transition-duration":""
464
- });
465
- callback();
466
- });
467
- } else {
468
- setTimeout(function(){
469
- current.removeClass("active animate-out");
470
- container.children().css({
471
- "transform":"",
472
- "-ms-transform":"",
473
- "-webkit-transition-duration":"",
474
- "-moz-transition-duration": "",
475
- "-o-transition-duration": "",
476
- "transition-duration":""
477
- });
478
- callback();
479
- }, settings.animation_speed);
480
- }
481
- container.children().css({
482
- "transform":"",
483
- "-ms-transform":"",
484
- "-webkit-transition-duration":"",
485
- "-moz-transition-duration": "",
486
- "-o-transition-duration": "",
487
- "transition-duration":""
360
+ current.animate({marginLeft:'-100%'}, duration);
361
+ next.animate(animMargin, duration, function() {
362
+ current.css(margin, '100%');
363
+ callback();
488
364
  });
489
- current.addClass("animate-out");
490
- next.addClass("animate-in");
491
365
  };
492
366
 
493
367
  this.prev = function(current, prev, callback) {
494
- if (Modernizr.csstransitions) {
495
- prev.on(animation_end, function(e){
496
- prev.unbind(animation_end);
497
- current.removeClass("active animate-out");
498
- container.children().css({
499
- "transform":"",
500
- "-ms-transform":"",
501
- "-webkit-transition-duration":"",
502
- "-moz-transition-duration": "",
503
- "-o-transition-duration": "",
504
- "transition-duration":""
505
- });
506
- callback();
507
- });
508
- } else {
509
- setTimeout(function(){
510
- current.removeClass("active animate-out");
511
- container.children().css({
512
- "transform":"",
513
- "-ms-transform":"",
514
- "-webkit-transition-duration":"",
515
- "-moz-transition-duration": "",
516
- "-o-transition-duration": "",
517
- "transition-duration":""
518
- });
519
- callback();
520
- }, settings.animation_speed);
521
- }
522
- container.children().css({
523
- "transform":"",
524
- "-ms-transform":"",
525
- "-webkit-transition-duration":"",
526
- "-moz-transition-duration": "",
527
- "-o-transition-duration": "",
528
- "transition-duration":""
368
+ current.animate({marginLeft:'100%'}, duration);
369
+ prev.css(margin, '-100%');
370
+ prev.animate(animMargin, duration, function() {
371
+ current.css(margin, '100%');
372
+ callback();
373
+ });
374
+ };
375
+ };
376
+
377
+ var FadeAnimation = function(settings, container) {
378
+ var duration = settings.animation_speed;
379
+ var is_rtl = ($('html[dir=rtl]').length === 1);
380
+ var margin = is_rtl ? 'marginRight' : 'marginLeft';
381
+
382
+ this.next = function(current, next, callback) {
383
+ next.css({'margin':'0%', 'opacity':'0.01'});
384
+ next.animate({'opacity':'1'}, duration, 'linear', function() {
385
+ current.css('margin', '100%');
386
+ callback();
387
+ });
388
+ };
389
+
390
+ this.prev = function(current, prev, callback) {
391
+ prev.css({'margin':'0%', 'opacity':'0.01'});
392
+ prev.animate({'opacity':'1'}, duration, 'linear', function() {
393
+ current.css('margin', '100%');
394
+ callback();
529
395
  });
530
- current.addClass("animate-out");
531
- prev.addClass("animate-in");
532
396
  };
533
397
  };
534
398
 
@@ -538,7 +402,7 @@
538
402
  Foundation.libs.orbit = {
539
403
  name: 'orbit',
540
404
 
541
- version: '5.2.3',
405
+ version: '5.4.3',
542
406
 
543
407
  settings: {
544
408
  animation: 'slide',
@@ -558,7 +422,6 @@
558
422
  timer_container_class: 'orbit-timer',
559
423
  timer_paused_class: 'paused',
560
424
  timer_progress_class: 'orbit-progress',
561
- timer_show_progress_bar: true,
562
425
  slides_container_class: 'orbit-slides-container',
563
426
  preloader_class: 'preloader',
564
427
  slide_selector: '*',
@@ -583,9 +446,8 @@
583
446
  },
584
447
 
585
448
  events : function (instance) {
586
- var self = this;
587
449
  var orbit_instance = new Orbit(this.S(instance), this.S(instance).data('orbit-init'));
588
- this.S(instance).data(self.name + '-instance', orbit_instance);
450
+ this.S(instance).data(this.name + '-instance', orbit_instance);
589
451
  },
590
452
 
591
453
  reflow : function () {
@@ -606,5 +468,5 @@
606
468
  }
607
469
  };
608
470
 
609
-
471
+
610
472
  }(jQuery, window, window.document));