uikit2-rails 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/uikit2/rails/version.rb +1 -1
  4. data/vendor/assets/fonts/FontAwesome.otf +0 -0
  5. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  6. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  8. data/vendor/assets/javascripts/uikit.js +512 -425
  9. data/vendor/assets/javascripts/uikit/components/accordion.js +19 -13
  10. data/vendor/assets/javascripts/uikit/components/autocomplete.js +23 -17
  11. data/vendor/assets/javascripts/uikit/components/datepicker.js +25 -24
  12. data/vendor/assets/javascripts/uikit/components/form-password.js +16 -16
  13. data/vendor/assets/javascripts/uikit/components/form-select.js +33 -25
  14. data/vendor/assets/javascripts/uikit/components/grid-parallax.js +12 -12
  15. data/vendor/assets/javascripts/uikit/components/grid.js +47 -34
  16. data/vendor/assets/javascripts/uikit/components/htmleditor.js +47 -3
  17. data/vendor/assets/javascripts/uikit/components/lightbox.js +68 -70
  18. data/vendor/assets/javascripts/uikit/components/nestable.js +6 -6
  19. data/vendor/assets/javascripts/uikit/components/notify.js +9 -9
  20. data/vendor/assets/javascripts/uikit/components/pagination.js +8 -8
  21. data/vendor/assets/javascripts/uikit/components/parallax.js +13 -13
  22. data/vendor/assets/javascripts/uikit/components/search.js +11 -11
  23. data/vendor/assets/javascripts/uikit/components/slider.js +27 -15
  24. data/vendor/assets/javascripts/uikit/components/slideset.js +21 -12
  25. data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +35 -28
  26. data/vendor/assets/javascripts/uikit/components/slideshow.js +129 -95
  27. data/vendor/assets/javascripts/uikit/components/sortable.js +45 -36
  28. data/vendor/assets/javascripts/uikit/components/sticky.js +19 -13
  29. data/vendor/assets/javascripts/uikit/components/timepicker.js +6 -6
  30. data/vendor/assets/javascripts/uikit/components/tooltip.js +47 -46
  31. data/vendor/assets/javascripts/uikit/components/upload.js +46 -44
  32. data/vendor/assets/javascripts/uikit/core/alert.js +17 -17
  33. data/vendor/assets/javascripts/uikit/core/button.js +25 -26
  34. data/vendor/assets/javascripts/uikit/core/core.js +58 -23
  35. data/vendor/assets/javascripts/uikit/core/cover.js +9 -17
  36. data/vendor/assets/javascripts/uikit/core/dropdown.js +108 -99
  37. data/vendor/assets/javascripts/uikit/core/grid.js +16 -16
  38. data/vendor/assets/javascripts/uikit/core/modal.js +35 -41
  39. data/vendor/assets/javascripts/uikit/core/nav.js +35 -18
  40. data/vendor/assets/javascripts/uikit/core/offcanvas.js +50 -33
  41. data/vendor/assets/javascripts/uikit/core/scrollspy.js +33 -33
  42. data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +8 -8
  43. data/vendor/assets/javascripts/uikit/core/switcher.js +54 -52
  44. data/vendor/assets/javascripts/uikit/core/tab.js +27 -25
  45. data/vendor/assets/javascripts/uikit/core/toggle.js +12 -8
  46. data/vendor/assets/javascripts/uikit/core/touch.js +3 -3
  47. data/vendor/assets/javascripts/uikit/core/utility.js +35 -19
  48. data/vendor/assets/stylesheets/uikit.almost-flat.css +299 -242
  49. data/vendor/assets/stylesheets/uikit.css +280 -223
  50. data/vendor/assets/stylesheets/uikit.gradient.css +309 -252
  51. data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.css +2 -2
  52. data/vendor/assets/stylesheets/uikit/components/accordion.css +2 -2
  53. data/vendor/assets/stylesheets/uikit/components/accordion.gradient.css +2 -2
  54. data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.css +5 -5
  55. data/vendor/assets/stylesheets/uikit/components/autocomplete.css +5 -5
  56. data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.css +5 -5
  57. data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.css +10 -10
  58. data/vendor/assets/stylesheets/uikit/components/datepicker.css +10 -10
  59. data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.css +9 -9
  60. data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.css +1 -1
  61. data/vendor/assets/stylesheets/uikit/components/dotnav.css +1 -1
  62. data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.css +1 -1
  63. data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.css +5 -5
  64. data/vendor/assets/stylesheets/uikit/components/form-advanced.css +5 -5
  65. data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.css +5 -5
  66. data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.css +1 -1
  67. data/vendor/assets/stylesheets/uikit/components/form-file.css +1 -1
  68. data/vendor/assets/stylesheets/uikit/components/form-file.gradient.css +1 -1
  69. data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.css +3 -3
  70. data/vendor/assets/stylesheets/uikit/components/form-password.css +3 -3
  71. data/vendor/assets/stylesheets/uikit/components/form-password.gradient.css +3 -3
  72. data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.css +1 -1
  73. data/vendor/assets/stylesheets/uikit/components/form-select.css +1 -1
  74. data/vendor/assets/stylesheets/uikit/components/form-select.gradient.css +1 -1
  75. data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.css +12 -12
  76. data/vendor/assets/stylesheets/uikit/components/htmleditor.css +12 -12
  77. data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.css +13 -13
  78. data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.css +7 -3
  79. data/vendor/assets/stylesheets/uikit/components/nestable.css +6 -2
  80. data/vendor/assets/stylesheets/uikit/components/nestable.gradient.css +9 -5
  81. data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.css +4 -4
  82. data/vendor/assets/stylesheets/uikit/components/notify.css +3 -3
  83. data/vendor/assets/stylesheets/uikit/components/notify.gradient.css +4 -4
  84. data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.css +3 -3
  85. data/vendor/assets/stylesheets/uikit/components/placeholder.css +3 -3
  86. data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.css +3 -3
  87. data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.css +2 -2
  88. data/vendor/assets/stylesheets/uikit/components/progress.css +3 -3
  89. data/vendor/assets/stylesheets/uikit/components/progress.gradient.css +2 -2
  90. data/vendor/assets/stylesheets/uikit/components/search.almost-flat.css +18 -18
  91. data/vendor/assets/stylesheets/uikit/components/search.css +17 -17
  92. data/vendor/assets/stylesheets/uikit/components/search.gradient.css +18 -18
  93. data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.css +1 -1
  94. data/vendor/assets/stylesheets/uikit/components/slidenav.css +1 -1
  95. data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.css +1 -1
  96. data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.css +10 -1
  97. data/vendor/assets/stylesheets/uikit/components/slider.css +10 -1
  98. data/vendor/assets/stylesheets/uikit/components/slider.gradient.css +10 -1
  99. data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.css +1 -1
  100. data/vendor/assets/stylesheets/uikit/components/slideshow.css +1 -1
  101. data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.css +1 -1
  102. data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.css +5 -1
  103. data/vendor/assets/stylesheets/uikit/components/sortable.css +5 -1
  104. data/vendor/assets/stylesheets/uikit/components/sortable.gradient.css +5 -1
  105. data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.css +4 -1
  106. data/vendor/assets/stylesheets/uikit/components/sticky.css +4 -1
  107. data/vendor/assets/stylesheets/uikit/components/sticky.gradient.css +4 -1
  108. data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.css +8 -7
  109. data/vendor/assets/stylesheets/uikit/components/tooltip.css +8 -7
  110. data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.css +8 -7
  111. data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.css +1 -1
  112. data/vendor/assets/stylesheets/uikit/components/upload.css +1 -1
  113. data/vendor/assets/stylesheets/uikit/components/upload.gradient.css +1 -1
  114. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ad30b900e9ea5d892e994647a2efd4a8cd29c93
4
- data.tar.gz: c30a6f6f21aeb33d562491b35c03af05899fe3bb
3
+ metadata.gz: 6cde5925eb3d2de013b089a4f90201f251ffdf6b
4
+ data.tar.gz: 6ede33e4e42510db3f9120acac820b934742fdb3
5
5
  SHA512:
6
- metadata.gz: 82974b4f82883909ab7c8b460d9caac1ee2f3b75182457199ad2d0148a3fd5616d4f9377a377b009b451b1c8cfb7f987a8817490e3e83147aeafcb25cf7b3f30
7
- data.tar.gz: 2b1968f73bc7b3d2522ed1932a031ec81e58ac0609e31116cf821bfda61afa96370419cb14ab2caa95b36cf9edb3eb0c832073fea0d687181e3e32afce841cc0
6
+ metadata.gz: 5759ec04e75cf2010e1ec0f81920b12900248a6b50e2ae21e87f9c68cb79b8c074d246f806fa5862369e897a8ceeeb37dc6e92b65c164b864a4e5f1a1e8b827b
7
+ data.tar.gz: a3936cb8128b93287393a4a4ea4f1a652703f9329df39c026043f68fcdf03ce555b544e6eddc7811771f43bcb068a4521628674db29f5f00a43cc051c5cd28fd
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/uikit2-rails.svg)](http://badge.fury.io/rb/uikit2-rails)
4
4
 
5
- UIkit 2.26.1
5
+ UIkit 2.27.2
6
6
 
7
7
  ## Installation
8
8
 
@@ -33,7 +33,7 @@ In your application.css:
33
33
  *= require uikit
34
34
  * or
35
35
  *= require uikit.gradient
36
- * or
36
+ * or
37
37
  *= require uikit.almost-flat
38
38
  *
39
39
  * Example including components:
@@ -1,5 +1,5 @@
1
1
  module Uikit2
2
2
  module Rails
3
- VERSION = "0.1.9"
3
+ VERSION = "0.1.10"
4
4
  end
5
5
  end
@@ -1,18 +1,18 @@
1
- /*! UIkit 2.26.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
1
+ /*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
2
  (function(core) {
3
3
 
4
- if (typeof define == "function" && define.amd) { // AMD
4
+ if (typeof define == 'function' && define.amd) { // AMD
5
5
 
6
- define("uikit", function(){
6
+ define('uikit', function(){
7
7
 
8
8
  var uikit = window.UIkit || core(window, window.jQuery, window.document);
9
9
 
10
10
  uikit.load = function(res, req, onload, config) {
11
11
 
12
- var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : "").replace(/\/+$/g, "");
12
+ var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : '').replace(/\/+$/g, '');
13
13
 
14
14
  if (!base) {
15
- throw new Error( "Please define base path to UIkit in the requirejs config." );
15
+ throw new Error('Please define base path to UIkit in the requirejs config.');
16
16
  }
17
17
 
18
18
  for (i = 0; i < resources.length; i += 1) {
@@ -30,7 +30,7 @@
30
30
  }
31
31
 
32
32
  if (!window.jQuery) {
33
- throw new Error( "UIkit requires jQuery" );
33
+ throw new Error('UIkit requires jQuery');
34
34
  }
35
35
 
36
36
  if (window && window.jQuery) {
@@ -44,7 +44,7 @@
44
44
 
45
45
  var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined;
46
46
 
47
- UI.version = '2.26.3';
47
+ UI.version = '2.27.2';
48
48
 
49
49
  UI.noConflict = function() {
50
50
  // restore UIkit version
@@ -161,7 +161,7 @@
161
161
  .replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';})
162
162
  );
163
163
  } else {
164
- return (new Function("", "var json = " + str + "; return JSON.parse(JSON.stringify(json));"))();
164
+ return (new Function('', 'var json = ' + str + '; return JSON.parse(JSON.stringify(json));'))();
165
165
  }
166
166
  } catch(e) { return false; }
167
167
  };
@@ -260,7 +260,7 @@
260
260
 
261
261
  var ele = UI.$(this),
262
262
  cls = ele.attr('class'),
263
- anim = cls.match(/uk\-animation\-(.+)/);
263
+ anim = cls.match(/uk-animation-(.+)/);
264
264
 
265
265
  ele.removeClass(anim[0]).width();
266
266
 
@@ -327,30 +327,30 @@
327
327
 
328
328
  switch(cmd) {
329
329
  case '~':
330
- output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];");
330
+ output.push('for(var $i=0;$i<'+prop+'.length;$i++) { var $item = '+prop+'[$i];');
331
331
  openblocks++;
332
332
  break;
333
333
  case ':':
334
- output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];");
334
+ output.push('for(var $key in '+prop+') { var $val = '+prop+'[$key];');
335
335
  openblocks++;
336
336
  break;
337
337
  case '#':
338
- output.push("if("+prop+") {");
338
+ output.push('if('+prop+') {');
339
339
  openblocks++;
340
340
  break;
341
341
  case '^':
342
- output.push("if(!"+prop+") {");
342
+ output.push('if(!'+prop+') {');
343
343
  openblocks++;
344
344
  break;
345
345
  case '/':
346
- output.push("}");
346
+ output.push('}');
347
347
  openblocks--;
348
348
  break;
349
349
  case '!':
350
- output.push("__ret.push("+prop+");");
350
+ output.push('__ret.push('+prop+');');
351
351
  break;
352
352
  default:
353
- output.push("__ret.push(escape("+prop+"));");
353
+ output.push('__ret.push(escape('+prop+'));');
354
354
  break;
355
355
  }
356
356
  } else {
@@ -371,6 +371,40 @@
371
371
  return data ? fn(data) : fn;
372
372
  };
373
373
 
374
+ UI.Utils.focus = function(element, extra) {
375
+
376
+ element = $(element);
377
+
378
+ if (!element.length) {
379
+ return element;
380
+ }
381
+
382
+ var autofocus = element.find('[autofocus]:first'), tabidx;
383
+
384
+ if (autofocus.length) {
385
+ return autofocus.focus();
386
+ }
387
+
388
+ autofocus = element.find(':input'+(extra && (','+extra) || '')).first();
389
+
390
+ if (autofocus.length) {
391
+ return autofocus.focus();
392
+ }
393
+
394
+ if (!element.attr('tabindex')) {
395
+ tabidx = 1000;
396
+ element.attr('tabindex', tabidx);
397
+ }
398
+
399
+ element[0].focus();
400
+
401
+ if (tabidx) {
402
+ element.attr('tabindex', '');
403
+ }
404
+
405
+ return element;
406
+ }
407
+
374
408
  UI.Utils.events = {};
375
409
  UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
376
410
 
@@ -383,7 +417,7 @@
383
417
  var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
384
418
 
385
419
  if (!UI[component]) {
386
- $.error("UIkit component [" + component + "] does not exist.");
420
+ $.error('UIkit component [' + component + '] does not exist.');
387
421
  return this;
388
422
  }
389
423
 
@@ -501,7 +535,7 @@
501
535
  switch(arguments.length) {
502
536
  case 1:
503
537
 
504
- if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) {
538
+ if (typeof arguments[0] === 'string' || arguments[0].nodeType || arguments[0] instanceof jQuery) {
505
539
  element = $(arguments[0]);
506
540
  } else {
507
541
  options = arguments[0];
@@ -605,7 +639,7 @@
605
639
  try {
606
640
 
607
641
  var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
608
- fn.apply(element, []);
642
+ fn.apply(element, [$element]);
609
643
  $element.trigger('changed.uk.dom');
610
644
  }, 50), {childList: true, subtree: true});
611
645
 
@@ -645,7 +679,7 @@
645
679
  UI.component.bootComponents();
646
680
 
647
681
  // custom scroll observer
648
- requestAnimationFrame((function(){
682
+ var rafToken = requestAnimationFrame((function(){
649
683
 
650
684
  var memory = {dir: {x:0, y:0}, x: window.pageXOffset, y:window.pageYOffset};
651
685
 
@@ -668,11 +702,12 @@
668
702
  // Trigger the scroll event, this could probably be sent using memory.clone() but this is
669
703
  // more explicit and easier to see exactly what is being sent in the event.
670
704
  UI.$doc.trigger('scrolling.uk.document', [{
671
- "dir": {"x": memory.dir.x, "y": memory.dir.y}, "x": wpxo, "y": wpyo
705
+ dir: {x: memory.dir.x, y: memory.dir.y}, x: wpxo, y: wpyo
672
706
  }]);
673
707
  }
674
708
 
675
- requestAnimationFrame(fn);
709
+ cancelAnimationFrame(rafToken);
710
+ rafToken = requestAnimationFrame(fn);
676
711
  };
677
712
 
678
713
  if (UI.support.touch) {
@@ -755,7 +790,7 @@
755
790
  }());
756
791
 
757
792
  // add touch identifier class
758
- UI.$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
793
+ UI.$html.addClass(UI.support.touch ? 'uk-touch' : 'uk-notouch');
759
794
 
760
795
  // add uk-hover class on tap to support overlays on touch devices
761
796
  if (UI.support.touch) {
@@ -868,7 +903,7 @@
868
903
  longTapTimeout = setTimeout(longTap, longTapDelay);
869
904
 
870
905
  // adds the current touch contact for IE gesture recognition
871
- if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
906
+ if (e.originalEvent && e.originalEvent.pointerId && gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
872
907
  gesture.addPointer(e.originalEvent.pointerId);
873
908
  }
874
909
 
@@ -947,7 +982,7 @@
947
982
  // when the browser window loses focus,
948
983
  // for example when a modal dialog is shown,
949
984
  // cancel all ongoing events
950
- .on('touchcancel MSPointerCancel', cancelAll);
985
+ .on('touchcancel MSPointerCancel pointercancel', cancelAll);
951
986
 
952
987
  // scrolling the window indicates intention of the user
953
988
  // to scroll, not tap or swipe, so cancel all ongoing events
@@ -978,12 +1013,12 @@
978
1013
  // init code
979
1014
  UI.ready(function(context) {
980
1015
 
981
- UI.$("[data-uk-margin]", context).each(function() {
1016
+ UI.$('[data-uk-margin]', context).each(function() {
982
1017
 
983
1018
  var ele = UI.$(this);
984
1019
 
985
- if (!ele.data("stackMargin")) {
986
- UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
1020
+ if (!ele.data('stackMargin')) {
1021
+ UI.stackMargin(ele, UI.Utils.options(ele.attr('data-uk-margin')));
987
1022
  }
988
1023
  });
989
1024
  });
@@ -1001,20 +1036,20 @@
1001
1036
 
1002
1037
  UI.$(function() {
1003
1038
  fn();
1004
- UI.$win.on("load", fn);
1039
+ UI.$win.on('load', fn);
1005
1040
  });
1006
1041
 
1007
1042
  return UI.Utils.debounce(fn, 20);
1008
1043
  })());
1009
1044
 
1010
- this.on("display.uk.check", function(e) {
1011
- if (this.element.is(":visible")) this.process();
1045
+ this.on('display.uk.check', function(e) {
1046
+ if (this.element.is(':visible')) this.process();
1012
1047
  }.bind(this));
1013
1048
 
1014
1049
  if (this.options.observe) {
1015
1050
 
1016
1051
  UI.domObserve(this.element, function(e) {
1017
- if ($this.element.is(":visible")) $this.process();
1052
+ if ($this.element.is(':visible')) $this.process();
1018
1053
  });
1019
1054
  }
1020
1055
 
@@ -1066,7 +1101,7 @@
1066
1101
  ratio = (width / iwidth),
1067
1102
  height = Math.floor(ratio * ele.data('height'));
1068
1103
 
1069
- ele.css({'height': (width < iwidth) ? height : ele.data('height')});
1104
+ ele.css({height: (width < iwidth) ? height : ele.data('height')});
1070
1105
  };
1071
1106
 
1072
1107
  UI.component('responsiveElement', {
@@ -1078,11 +1113,11 @@
1078
1113
  // init code
1079
1114
  UI.ready(function(context) {
1080
1115
 
1081
- UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() {
1116
+ UI.$('iframe.uk-responsive-width, [data-uk-responsive]', context).each(function() {
1082
1117
 
1083
1118
  var ele = UI.$(this), obj;
1084
1119
 
1085
- if (!ele.data("responsiveElement")) {
1120
+ if (!ele.data('responsiveElement')) {
1086
1121
  obj = UI.responsiveElement(ele, {});
1087
1122
  }
1088
1123
  });
@@ -1096,10 +1131,8 @@
1096
1131
  if (ele.attr('width') && ele.attr('height')) {
1097
1132
 
1098
1133
  ele.data({
1099
-
1100
- 'width' : ele.attr('width'),
1101
- 'height': ele.attr('height')
1102
-
1134
+ width : ele.attr('width'),
1135
+ height: ele.attr('height')
1103
1136
  }).on('display.uk.check', function(){
1104
1137
  check(ele);
1105
1138
  });
@@ -1122,13 +1155,12 @@
1122
1155
  })();
1123
1156
 
1124
1157
 
1125
-
1126
1158
  // helper
1127
1159
 
1128
1160
  UI.Utils.stackMargin = function(elements, options) {
1129
1161
 
1130
1162
  options = UI.$.extend({
1131
- 'cls': 'uk-margin-small-top'
1163
+ cls: 'uk-margin-small-top'
1132
1164
  }, options);
1133
1165
 
1134
1166
  elements = UI.$(elements).removeClass(options.cls);
@@ -1146,8 +1178,8 @@
1146
1178
  pos = offset.top + height;
1147
1179
 
1148
1180
  $ele.data({
1149
- 'ukMarginPos': pos,
1150
- 'ukMarginTop': offset.top
1181
+ ukMarginPos: pos,
1182
+ ukMarginTop: offset.top
1151
1183
  });
1152
1184
 
1153
1185
  if (min === false || (offset.top < min.top) ) {
@@ -1276,6 +1308,25 @@
1276
1308
 
1277
1309
  })({});
1278
1310
 
1311
+ UI.Utils.getCssVar = function(name) {
1312
+
1313
+ /* usage in css: .var-name:before { content:"xyz" } */
1314
+
1315
+ var val, doc = document.documentElement, element = doc.appendChild(document.createElement('div'));
1316
+
1317
+ element.classList.add('var-'+name);
1318
+
1319
+ try {
1320
+ val = JSON.parse(val = getComputedStyle(element, ':before').content.replace(/^["'](.*)["']$/, '$1'));
1321
+ } catch (e) {
1322
+ val = undefined;
1323
+ }
1324
+
1325
+ doc.removeChild(element);
1326
+
1327
+ return val;
1328
+ }
1329
+
1279
1330
  })(UIkit);
1280
1331
 
1281
1332
  (function(UI) {
@@ -1287,12 +1338,12 @@
1287
1338
  boot: function() {
1288
1339
 
1289
1340
  // init code
1290
- UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
1341
+ UI.$html.on('click.smooth-scroll.uikit', '[data-uk-smooth-scroll]', function(e) {
1291
1342
  var ele = UI.$(this);
1292
1343
 
1293
- if (!ele.data("smoothScroll")) {
1294
- var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
1295
- ele.trigger("click");
1344
+ if (!ele.data('smoothScroll')) {
1345
+ var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr('data-uk-smooth-scroll')));
1346
+ ele.trigger('click');
1296
1347
  }
1297
1348
 
1298
1349
  return false;
@@ -1303,9 +1354,9 @@
1303
1354
 
1304
1355
  var $this = this;
1305
1356
 
1306
- this.on("click", function(e) {
1357
+ this.on('click', function(e) {
1307
1358
  e.preventDefault();
1308
- scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
1359
+ scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$('body'), $this.options);
1309
1360
  });
1310
1361
  }
1311
1362
  });
@@ -1329,7 +1380,7 @@
1329
1380
  }
1330
1381
 
1331
1382
  // animate to target, fire callback when done
1332
- UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
1383
+ UI.$('html,body').stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
1333
1384
  }
1334
1385
 
1335
1386
  UI.Utils.scrollToElement = scrollToElement;
@@ -1356,30 +1407,30 @@
1356
1407
  UI.component('scrollspy', {
1357
1408
 
1358
1409
  defaults: {
1359
- "target" : false,
1360
- "cls" : "uk-scrollspy-inview",
1361
- "initcls" : "uk-scrollspy-init-inview",
1362
- "topoffset" : 0,
1363
- "leftoffset" : 0,
1364
- "repeat" : false,
1365
- "delay" : 0
1410
+ target : false,
1411
+ cls : 'uk-scrollspy-inview',
1412
+ initcls : 'uk-scrollspy-init-inview',
1413
+ topoffset : 0,
1414
+ leftoffset : 0,
1415
+ repeat : false,
1416
+ delay : 0
1366
1417
  },
1367
1418
 
1368
1419
  boot: function() {
1369
1420
 
1370
1421
  // listen to scroll and resize
1371
- $doc.on("scrolling.uk.document", checkScrollSpy);
1372
- $win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
1422
+ $doc.on('scrolling.uk.document', checkScrollSpy);
1423
+ $win.on('load resize orientationchange', UI.Utils.debounce(checkScrollSpy, 50));
1373
1424
 
1374
1425
  // init code
1375
1426
  UI.ready(function(context) {
1376
1427
 
1377
- UI.$("[data-uk-scrollspy]", context).each(function() {
1428
+ UI.$('[data-uk-scrollspy]', context).each(function() {
1378
1429
 
1379
1430
  var element = UI.$(this);
1380
1431
 
1381
- if (!element.data("scrollspy")) {
1382
- var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
1432
+ if (!element.data('scrollspy')) {
1433
+ var obj = UI.scrollspy(element, UI.Utils.options(element.attr('data-uk-scrollspy')));
1383
1434
  }
1384
1435
  });
1385
1436
  });
@@ -1407,13 +1458,13 @@
1407
1458
  $this.offset = element.offset();
1408
1459
  initinview = true;
1409
1460
 
1410
- element.trigger("init.uk.scrollspy");
1461
+ element.trigger('init.uk.scrollspy');
1411
1462
  }
1412
1463
 
1413
1464
  element.data('scrollspy-idle', setTimeout(function(){
1414
1465
 
1415
- element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
1416
- element.trigger("inview.uk.scrollspy");
1466
+ element.addClass('uk-scrollspy-inview').toggleClass(toggle).width();
1467
+ element.trigger('inview.uk.scrollspy');
1417
1468
 
1418
1469
  element.data('scrollspy-idle', false);
1419
1470
  element.data('inviewstate', true);
@@ -1430,10 +1481,10 @@
1430
1481
  element.data('scrollspy-idle', false);
1431
1482
  }
1432
1483
 
1433
- element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
1484
+ element.removeClass('uk-scrollspy-inview').toggleClass(toggle);
1434
1485
  element.data('inviewstate', false);
1435
1486
 
1436
- element.trigger("outview.uk.scrollspy");
1487
+ element.trigger('outview.uk.scrollspy');
1437
1488
  }
1438
1489
 
1439
1490
  toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
@@ -1460,28 +1511,28 @@
1460
1511
  UI.component('scrollspynav', {
1461
1512
 
1462
1513
  defaults: {
1463
- "cls" : 'uk-active',
1464
- "closest" : false,
1465
- "topoffset" : 0,
1466
- "leftoffset" : 0,
1467
- "smoothscroll" : false
1514
+ cls : 'uk-active',
1515
+ closest : false,
1516
+ topoffset : 0,
1517
+ leftoffset : 0,
1518
+ smoothscroll : false
1468
1519
  },
1469
1520
 
1470
1521
  boot: function() {
1471
1522
 
1472
1523
  // listen to scroll and resize
1473
- $doc.on("scrolling.uk.document", checkScrollSpyNavs);
1474
- $win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
1524
+ $doc.on('scrolling.uk.document', checkScrollSpyNavs);
1525
+ $win.on('resize orientationchange', UI.Utils.debounce(checkScrollSpyNavs, 50));
1475
1526
 
1476
1527
  // init code
1477
1528
  UI.ready(function(context) {
1478
1529
 
1479
- UI.$("[data-uk-scrollspy-nav]", context).each(function() {
1530
+ UI.$('[data-uk-scrollspy-nav]', context).each(function() {
1480
1531
 
1481
1532
  var element = UI.$(this);
1482
1533
 
1483
- if (!element.data("scrollspynav")) {
1484
- var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
1534
+ if (!element.data('scrollspynav')) {
1535
+ var obj = UI.scrollspynav(element, UI.Utils.options(element.attr('data-uk-scrollspy-nav')));
1485
1536
  }
1486
1537
  });
1487
1538
  });
@@ -1490,7 +1541,7 @@
1490
1541
  init: function() {
1491
1542
 
1492
1543
  var ids = [],
1493
- links = this.find("a[href^='#']").each(function(){ if(this.getAttribute("href").trim()!=='#') ids.push(this.getAttribute("href")); }),
1544
+ links = this.find("a[href^='#']").each(function(){ if(this.getAttribute('href').trim()!=='#') ids.push(this.getAttribute('href')); }),
1494
1545
  targets = UI.$(ids.join(",")),
1495
1546
 
1496
1547
  clsActive = this.options.cls,
@@ -1512,7 +1563,7 @@
1512
1563
  scrollTop = $win.scrollTop(),
1513
1564
  target = (function(){
1514
1565
  for(var i=0; i< inviews.length;i++){
1515
- if(inviews[i].offset().top >= scrollTop){
1566
+ if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){
1516
1567
  return inviews[i];
1517
1568
  }
1518
1569
  }
@@ -1522,12 +1573,12 @@
1522
1573
 
1523
1574
  if ($this.options.closest) {
1524
1575
  links.blur().closest(clsClosest).removeClass(clsActive);
1525
- navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
1576
+ navitems = links.filter("a[href='#"+target.attr('id')+"']").closest(clsClosest).addClass(clsActive);
1526
1577
  } else {
1527
1578
  navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
1528
1579
  }
1529
1580
 
1530
- $this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
1581
+ $this.element.trigger('inview.uk.scrollspynav', [target, navitems]);
1531
1582
  }
1532
1583
  };
1533
1584
 
@@ -1539,7 +1590,7 @@
1539
1590
 
1540
1591
  fn();
1541
1592
 
1542
- this.element.data("scrollspynav", this);
1593
+ this.element.data('scrollspynav', this);
1543
1594
 
1544
1595
  this.check = fn;
1545
1596
  scrollspynavs.push(this);
@@ -1569,11 +1620,11 @@
1569
1620
  // init code
1570
1621
  UI.ready(function(context) {
1571
1622
 
1572
- UI.$("[data-uk-toggle]", context).each(function() {
1623
+ UI.$('[data-uk-toggle]', context).each(function() {
1573
1624
  var ele = UI.$(this);
1574
1625
 
1575
- if (!ele.data("toggle")) {
1576
- var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
1626
+ if (!ele.data('toggle')) {
1627
+ var obj = UI.toggle(ele, UI.Utils.options(ele.attr('data-uk-toggle')));
1577
1628
  }
1578
1629
  });
1579
1630
 
@@ -1593,10 +1644,12 @@
1593
1644
 
1594
1645
  this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
1595
1646
 
1596
- this.getToggles();
1647
+ this.on('click', function(e) {
1648
+
1649
+ if ($this.element.is('a[href="#"]')) {
1650
+ e.preventDefault();
1651
+ }
1597
1652
 
1598
- this.on("click", function(e) {
1599
- if ($this.element.is('a[href="#"]')) e.preventDefault();
1600
1653
  $this.toggle();
1601
1654
  });
1602
1655
 
@@ -1605,6 +1658,8 @@
1605
1658
 
1606
1659
  toggle: function() {
1607
1660
 
1661
+ this.getToggles();
1662
+
1608
1663
  if(!this.totoggle.length) return;
1609
1664
 
1610
1665
  if (this.options.animation && UI.support.animation) {
@@ -1660,7 +1715,7 @@
1660
1715
 
1661
1716
  updateAria: function() {
1662
1717
  if (this.aria && this.totoggle.length) {
1663
- this.totoggle.each(function(){
1718
+ this.totoggle.not('[aria-hidden]').each(function(){
1664
1719
  UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
1665
1720
  });
1666
1721
  }
@@ -1676,21 +1731,21 @@
1676
1731
  UI.component('alert', {
1677
1732
 
1678
1733
  defaults: {
1679
- "fade": true,
1680
- "duration": 200,
1681
- "trigger": ".uk-alert-close"
1734
+ fade: true,
1735
+ duration: 200,
1736
+ trigger: '.uk-alert-close'
1682
1737
  },
1683
1738
 
1684
1739
  boot: function() {
1685
1740
 
1686
1741
  // init code
1687
- UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
1742
+ UI.$html.on('click.alert.uikit', '[data-uk-alert]', function(e) {
1688
1743
 
1689
1744
  var ele = UI.$(this);
1690
1745
 
1691
- if (!ele.data("alert")) {
1746
+ if (!ele.data('alert')) {
1692
1747
 
1693
- var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert")));
1748
+ var alert = UI.alert(ele, UI.Utils.options(ele.attr('data-uk-alert')));
1694
1749
 
1695
1750
  if (UI.$(e.target).is(alert.options.trigger)) {
1696
1751
  e.preventDefault();
@@ -1704,7 +1759,7 @@
1704
1759
 
1705
1760
  var $this = this;
1706
1761
 
1707
- this.on("click", this.options.trigger, function(e) {
1762
+ this.on('click', this.options.trigger, function(e) {
1708
1763
  e.preventDefault();
1709
1764
  $this.close();
1710
1765
  });
@@ -1712,19 +1767,19 @@
1712
1767
 
1713
1768
  close: function() {
1714
1769
 
1715
- var element = this.trigger("close.uk.alert"),
1770
+ var element = this.trigger('close.uk.alert'),
1716
1771
  removeElement = function () {
1717
- this.trigger("closed.uk.alert").remove();
1772
+ this.trigger('closed.uk.alert').remove();
1718
1773
  }.bind(this);
1719
1774
 
1720
1775
  if (this.options.fade) {
1721
- element.css("overflow", "hidden").css("max-height", element.height()).animate({
1722
- "height" : 0,
1723
- "opacity" : 0,
1724
- "padding-top" : 0,
1725
- "padding-bottom" : 0,
1726
- "margin-top" : 0,
1727
- "margin-bottom" : 0
1776
+ element.css('overflow', 'hidden').css("max-height", element.height()).animate({
1777
+ height : 0,
1778
+ opacity : 0,
1779
+ paddingTop : 0,
1780
+ paddingBottom : 0,
1781
+ marginTop : 0,
1782
+ marginBottom : 0
1728
1783
  }, this.options.duration, removeElement);
1729
1784
  } else {
1730
1785
  removeElement();
@@ -1742,24 +1797,24 @@
1742
1797
  UI.component('buttonRadio', {
1743
1798
 
1744
1799
  defaults: {
1745
- "activeClass": 'uk-active',
1746
- "target": ".uk-button"
1800
+ activeClass: 'uk-active',
1801
+ target: '.uk-button'
1747
1802
  },
1748
1803
 
1749
1804
  boot: function() {
1750
1805
 
1751
1806
  // init code
1752
- UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
1807
+ UI.$html.on('click.buttonradio.uikit', '[data-uk-button-radio]', function(e) {
1753
1808
 
1754
1809
  var ele = UI.$(this);
1755
1810
 
1756
- if (!ele.data("buttonRadio")) {
1811
+ if (!ele.data('buttonRadio')) {
1757
1812
 
1758
- var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
1813
+ var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr('data-uk-button-radio'))),
1759
1814
  target = UI.$(e.target);
1760
1815
 
1761
1816
  if (target.is(obj.options.target)) {
1762
- target.trigger("click");
1817
+ target.trigger('click');
1763
1818
  }
1764
1819
  }
1765
1820
  });
@@ -1772,7 +1827,7 @@
1772
1827
  // Init ARIA
1773
1828
  this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1774
1829
 
1775
- this.on("click", this.options.target, function(e) {
1830
+ this.on('click', this.options.target, function(e) {
1776
1831
 
1777
1832
  var ele = UI.$(this);
1778
1833
 
@@ -1785,7 +1840,7 @@
1785
1840
  $this.find($this.options.target).not(ele).attr('aria-checked', 'false');
1786
1841
  ele.attr('aria-checked', 'true');
1787
1842
 
1788
- $this.trigger("change.uk.button", [ele]);
1843
+ $this.trigger('change.uk.button', [ele]);
1789
1844
  });
1790
1845
 
1791
1846
  },
@@ -1798,22 +1853,22 @@
1798
1853
  UI.component('buttonCheckbox', {
1799
1854
 
1800
1855
  defaults: {
1801
- "activeClass": 'uk-active',
1802
- "target": ".uk-button"
1856
+ activeClass: 'uk-active',
1857
+ target: '.uk-button'
1803
1858
  },
1804
1859
 
1805
1860
  boot: function() {
1806
1861
 
1807
- UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
1862
+ UI.$html.on('click.buttoncheckbox.uikit', '[data-uk-button-checkbox]', function(e) {
1808
1863
  var ele = UI.$(this);
1809
1864
 
1810
- if (!ele.data("buttonCheckbox")) {
1865
+ if (!ele.data('buttonCheckbox')) {
1811
1866
 
1812
- var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
1867
+ var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr('data-uk-button-checkbox'))),
1813
1868
  target = UI.$(e.target);
1814
1869
 
1815
1870
  if (target.is(obj.options.target)) {
1816
- target.trigger("click");
1871
+ target.trigger('click');
1817
1872
  }
1818
1873
  }
1819
1874
  });
@@ -1826,7 +1881,7 @@
1826
1881
  // Init ARIA
1827
1882
  this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1828
1883
 
1829
- this.on("click", this.options.target, function(e) {
1884
+ this.on('click', this.options.target, function(e) {
1830
1885
  var ele = UI.$(this);
1831
1886
 
1832
1887
  if (ele.is('a[href="#"]')) e.preventDefault();
@@ -1836,7 +1891,7 @@
1836
1891
  // Update ARIA
1837
1892
  ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
1838
1893
 
1839
- $this.trigger("change.uk.button", [ele]);
1894
+ $this.trigger('change.uk.button', [ele]);
1840
1895
  });
1841
1896
 
1842
1897
  },
@@ -1853,13 +1908,13 @@
1853
1908
 
1854
1909
  boot: function() {
1855
1910
 
1856
- UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
1911
+ UI.$html.on('click.button.uikit', '[data-uk-button]', function(e) {
1857
1912
  var ele = UI.$(this);
1858
1913
 
1859
- if (!ele.data("button")) {
1914
+ if (!ele.data('button')) {
1860
1915
 
1861
- var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
1862
- ele.trigger("click");
1916
+ var obj = UI.button(ele, UI.Utils.options(ele.attr('data-uk-button')));
1917
+ ele.trigger('click');
1863
1918
  }
1864
1919
  });
1865
1920
  },
@@ -1871,111 +1926,110 @@
1871
1926
  // Init ARIA
1872
1927
  this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1873
1928
 
1874
- this.on("click", function(e) {
1929
+ this.on('click', function(e) {
1875
1930
 
1876
1931
  if ($this.element.is('a[href="#"]')) e.preventDefault();
1877
1932
 
1878
1933
  $this.toggle();
1879
- $this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
1934
+ $this.trigger('change.uk.button', [$this.element.blur().hasClass('uk-active')]);
1880
1935
  });
1881
1936
 
1882
1937
  },
1883
1938
 
1884
1939
  toggle: function() {
1885
- this.element.toggleClass("uk-active");
1940
+ this.element.toggleClass('uk-active');
1886
1941
 
1887
1942
  // Update ARIA
1888
- this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1943
+ this.element.attr('aria-pressed', this.element.hasClass('uk-active'));
1889
1944
  }
1890
1945
  });
1891
1946
 
1892
1947
  })(UIkit);
1893
1948
 
1894
-
1895
1949
  (function(UI) {
1896
1950
 
1897
1951
  "use strict";
1898
1952
 
1899
1953
  var active = false, hoverIdle, flips = {
1900
- 'x': {
1901
- "bottom-left" : 'bottom-right',
1902
- "bottom-right" : 'bottom-left',
1903
- "bottom-center" : 'bottom-center',
1904
- "top-left" : 'top-right',
1905
- "top-right" : 'top-left',
1906
- "top-center" : 'top-center',
1907
- "left-top" : 'right-top',
1908
- "left-bottom" : 'right-bottom',
1909
- "left-center" : 'right-center',
1910
- "right-top" : 'left-top',
1911
- "right-bottom" : 'left-bottom',
1912
- "right-center" : 'left-center'
1913
- },
1914
- 'y': {
1915
- "bottom-left" : 'top-left',
1916
- "bottom-right" : 'top-right',
1917
- "bottom-center" : 'top-center',
1918
- "top-left" : 'bottom-left',
1919
- "top-right" : 'bottom-right',
1920
- "top-center" : 'bottom-center',
1921
- "left-top" : 'left-bottom',
1922
- "left-bottom" : 'left-top',
1923
- "left-center" : 'left-center',
1924
- "right-top" : 'right-bottom',
1925
- "right-bottom" : 'right-top',
1926
- "right-center" : 'right-center'
1927
- },
1928
- 'xy': {
1929
- "bottom-left" : 'top-right',
1930
- "bottom-right" : 'top-left',
1931
- "bottom-center" : 'top-center',
1932
- "top-left" : 'bottom-right',
1933
- "top-right" : 'bottom-left',
1934
- "top-center" : 'bottom-center',
1935
- "left-top" : 'right-bottom',
1936
- "left-bottom" : 'right-top',
1937
- "left-center" : 'right-center',
1938
- "right-top" : 'left-bottom',
1939
- "right-bottom" : 'left-top',
1940
- "right-center" : 'left-center'
1954
+ x: {
1955
+ 'bottom-left' : 'bottom-right',
1956
+ 'bottom-right' : 'bottom-left',
1957
+ 'bottom-center' : 'bottom-center',
1958
+ 'top-left' : 'top-right',
1959
+ 'top-right' : 'top-left',
1960
+ 'top-center' : 'top-center',
1961
+ 'left-top' : 'right-top',
1962
+ 'left-bottom' : 'right-bottom',
1963
+ 'left-center' : 'right-center',
1964
+ 'right-top' : 'left-top',
1965
+ 'right-bottom' : 'left-bottom',
1966
+ 'right-center' : 'left-center'
1967
+ },
1968
+ y: {
1969
+ 'bottom-left' : 'top-left',
1970
+ 'bottom-right' : 'top-right',
1971
+ 'bottom-center' : 'top-center',
1972
+ 'top-left' : 'bottom-left',
1973
+ 'top-right' : 'bottom-right',
1974
+ 'top-center' : 'bottom-center',
1975
+ 'left-top' : 'left-bottom',
1976
+ 'left-bottom' : 'left-top',
1977
+ 'left-center' : 'left-center',
1978
+ 'right-top' : 'right-bottom',
1979
+ 'right-bottom' : 'right-top',
1980
+ 'right-center' : 'right-center'
1981
+ },
1982
+ xy: {
1983
+ 'bottom-left' : 'top-right',
1984
+ 'bottom-right' : 'top-left',
1985
+ 'bottom-center' : 'top-center',
1986
+ 'top-left' : 'bottom-right',
1987
+ 'top-right' : 'bottom-left',
1988
+ 'top-center' : 'bottom-center',
1989
+ 'left-top' : 'right-bottom',
1990
+ 'left-bottom' : 'right-top',
1991
+ 'left-center' : 'right-center',
1992
+ 'right-top' : 'left-bottom',
1993
+ 'right-bottom' : 'left-top',
1994
+ 'right-center' : 'left-center'
1941
1995
  }
1942
1996
  };
1943
1997
 
1944
1998
  UI.component('dropdown', {
1945
1999
 
1946
2000
  defaults: {
1947
- 'mode' : 'hover',
1948
- 'pos' : 'bottom-left',
1949
- 'offset' : 0,
1950
- 'remaintime' : 800,
1951
- 'justify' : false,
1952
- 'boundary' : UI.$win,
1953
- 'delay' : 0,
1954
- 'dropdownSelector': '.uk-dropdown,.uk-dropdown-blank',
1955
- 'hoverDelayIdle' : 250,
1956
- 'preventflip' : false
2001
+ mode : 'hover',
2002
+ pos : 'bottom-left',
2003
+ offset : 0,
2004
+ remaintime : 800,
2005
+ justify : false,
2006
+ boundary : UI.$win,
2007
+ delay : 0,
2008
+ dropdownSelector: '.uk-dropdown,.uk-dropdown-blank',
2009
+ hoverDelayIdle : 250,
2010
+ preventflip : false
1957
2011
  },
1958
2012
 
1959
2013
  remainIdle: false,
1960
2014
 
1961
2015
  boot: function() {
1962
2016
 
1963
- var triggerevent = UI.support.touch ? "click" : "mouseenter";
2017
+ var triggerevent = UI.support.touch ? 'click' : 'mouseenter';
1964
2018
 
1965
2019
  // init code
1966
- UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
2020
+ UI.$html.on(triggerevent+'.dropdown.uikit focus pointerdown', '[data-uk-dropdown]', function(e) {
1967
2021
 
1968
2022
  var ele = UI.$(this);
1969
2023
 
1970
- if (!ele.data("dropdown")) {
2024
+ if (!ele.data('dropdown')) {
1971
2025
 
1972
- var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
2026
+ var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr('data-uk-dropdown')));
1973
2027
 
1974
- if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
2028
+ if (e.type=='click' || (e.type=='mouseenter' && dropdown.options.mode=='hover')) {
1975
2029
  dropdown.element.trigger(triggerevent);
1976
2030
  }
1977
2031
 
1978
- if (dropdown.element.find(dropdown.options.dropdownSelector).length) {
2032
+ if (dropdown.dropdown.length) {
1979
2033
  e.preventDefault();
1980
2034
  }
1981
2035
  }
@@ -1991,6 +2045,10 @@
1991
2045
  return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
1992
2046
  }).slice(0,1);
1993
2047
 
2048
+ if (!this.offsetParent.length) {
2049
+ this.offsetParent = this.element;
2050
+ }
2051
+
1994
2052
  this.centered = this.dropdown.hasClass('uk-dropdown-center');
1995
2053
  this.justified = this.options.justify ? UI.$(this.options.justify) : false;
1996
2054
 
@@ -2014,17 +2072,18 @@
2014
2072
 
2015
2073
  // Init ARIA
2016
2074
  this.element.attr('aria-haspopup', 'true');
2017
- this.element.attr('aria-expanded', this.element.hasClass("uk-open"));
2075
+ this.element.attr('aria-expanded', this.element.hasClass('uk-open'));
2076
+ this.dropdown.attr('aria-hidden', 'true');
2018
2077
 
2019
- if (this.options.mode == "click" || UI.support.touch) {
2078
+ if (this.options.mode == 'click' || UI.support.touch) {
2020
2079
 
2021
- this.on("click.uk.dropdown", function(e) {
2080
+ this.on('click.uk.dropdown', function(e) {
2022
2081
 
2023
2082
  var $target = UI.$(e.target);
2024
2083
 
2025
2084
  if (!$target.parents($this.options.dropdownSelector).length) {
2026
2085
 
2027
- if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
2086
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(':visible')) ){
2028
2087
  e.preventDefault();
2029
2088
  }
2030
2089
 
@@ -2037,7 +2096,7 @@
2037
2096
 
2038
2097
  } else {
2039
2098
 
2040
- if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
2099
+ if (!$this.dropdown.find(e.target).length || $target.is('.uk-dropdown-close') || $target.parents('.uk-dropdown-close').length) {
2041
2100
  $this.hide();
2042
2101
  }
2043
2102
  }
@@ -2045,7 +2104,7 @@
2045
2104
 
2046
2105
  } else {
2047
2106
 
2048
- this.on("mouseenter", function(e) {
2107
+ this.on('mouseenter', function(e) {
2049
2108
 
2050
2109
  $this.trigger('pointerenter.uk.dropdown', [$this]);
2051
2110
 
@@ -2073,7 +2132,7 @@
2073
2132
  hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2074
2133
  }
2075
2134
 
2076
- }).on("mouseleave", function() {
2135
+ }).on('mouseleave', function() {
2077
2136
 
2078
2137
  if (hoverIdle) {
2079
2138
  clearTimeout(hoverIdle);
@@ -2085,7 +2144,7 @@
2085
2144
 
2086
2145
  $this.trigger('pointerleave.uk.dropdown', [$this]);
2087
2146
 
2088
- }).on("click", function(e){
2147
+ }).on('click', function(e){
2089
2148
 
2090
2149
  var $target = UI.$(e.target);
2091
2150
 
@@ -2094,7 +2153,7 @@
2094
2153
  }
2095
2154
 
2096
2155
  if (active && active == $this) {
2097
- if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
2156
+ if (!$this.dropdown.find(e.target).length || $target.is('.uk-dropdown-close') || $target.parents('.uk-dropdown-close').length) {
2098
2157
  $this.hide();
2099
2158
  }
2100
2159
  return;
@@ -2111,7 +2170,7 @@
2111
2170
 
2112
2171
  show: function(){
2113
2172
 
2114
- UI.$html.off("click.outer.dropdown");
2173
+ UI.$html.off('click.outer.dropdown');
2115
2174
 
2116
2175
  if (active && active != this) {
2117
2176
  active.hide(true);
@@ -2128,10 +2187,12 @@
2128
2187
 
2129
2188
  // Update ARIA
2130
2189
  this.element.attr('aria-expanded', 'true');
2190
+ this.dropdown.attr('aria-hidden', 'false');
2131
2191
 
2132
2192
  this.trigger('show.uk.dropdown', [this]);
2133
2193
 
2134
2194
  UI.Utils.checkDisplay(this.dropdown, true);
2195
+ UI.Utils.focus(this.dropdown);
2135
2196
  active = this;
2136
2197
 
2137
2198
  this.registerOuterClick();
@@ -2151,6 +2212,7 @@
2151
2212
 
2152
2213
  // Update ARIA
2153
2214
  this.element.attr('aria-expanded', 'false');
2215
+ this.dropdown.attr('aria-hidden', 'true');
2154
2216
 
2155
2217
  this.trigger('hide.uk.dropdown', [this, force]);
2156
2218
 
@@ -2161,11 +2223,11 @@
2161
2223
 
2162
2224
  var $this = this;
2163
2225
 
2164
- UI.$html.off("click.outer.dropdown");
2226
+ UI.$html.off('click.outer.dropdown');
2165
2227
 
2166
2228
  setTimeout(function() {
2167
2229
 
2168
- UI.$html.on("click.outer.dropdown", function(e) {
2230
+ UI.$html.on('click.outer.dropdown', function(e) {
2169
2231
 
2170
2232
  if (hoverIdle) {
2171
2233
  clearTimeout(hoverIdle);
@@ -2175,7 +2237,7 @@
2175
2237
 
2176
2238
  if (active == $this && !$this.element.find(e.target).length) {
2177
2239
  $this.hide(true);
2178
- UI.$html.off("click.outer.dropdown");
2240
+ UI.$html.off('click.outer.dropdown');
2179
2241
  }
2180
2242
  });
2181
2243
  }, 10);
@@ -2186,15 +2248,15 @@
2186
2248
  if (!this.dropdown.length) return;
2187
2249
 
2188
2250
  // reset
2189
- this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({
2190
- 'top-left':'',
2191
- 'left':'',
2192
- 'margin-left' :'',
2193
- 'margin-right':''
2251
+ this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack uk-dropdown-autoflip').css({
2252
+ topLeft :'',
2253
+ left :'',
2254
+ marginLeft :'',
2255
+ marginRight :''
2194
2256
  });
2195
2257
 
2196
2258
  if (this.justified && this.justified.length) {
2197
- this.dropdown.css("min-width", "");
2259
+ this.dropdown.css('min-width', '');
2198
2260
  }
2199
2261
 
2200
2262
  var $this = this,
@@ -2209,18 +2271,18 @@
2209
2271
  dpos = this.options.pos;
2210
2272
 
2211
2273
  var variants = {
2212
- "bottom-left" : {top: 0 + pos.height + posoffset, left: 0},
2213
- "bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
2214
- "bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
2215
- "top-left" : {top: 0 - height - posoffset, left: 0},
2216
- "top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width},
2217
- "top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
2218
- "left-top" : {top: 0, left: 0 - width - posoffset},
2219
- "left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset},
2220
- "left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
2221
- "right-top" : {top: 0, left: 0 + pos.width + posoffset},
2222
- "right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
2223
- "right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
2274
+ 'bottom-left' : {top: 0 + pos.height + posoffset, left: 0},
2275
+ 'bottom-right' : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
2276
+ 'bottom-center' : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
2277
+ 'top-left' : {top: 0 - height - posoffset, left: 0},
2278
+ 'top-right' : {top: 0 - height - posoffset, left: 0 + pos.width - width},
2279
+ 'top-center' : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
2280
+ 'left-top' : {top: 0, left: 0 - width - posoffset},
2281
+ 'left-bottom' : {top: 0 + pos.height - height, left: 0 - width - posoffset},
2282
+ 'left-center' : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
2283
+ 'right-top' : {top: 0, left: 0 + pos.width + posoffset},
2284
+ 'right-bottom' : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
2285
+ 'right-center' : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
2224
2286
  },
2225
2287
  css = {},
2226
2288
  pp;
@@ -2253,6 +2315,7 @@
2253
2315
 
2254
2316
  pp = fdpos.split('-');
2255
2317
  css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
2318
+ dropdown.addClass('uk-dropdown-autoflip');
2256
2319
 
2257
2320
  // check flipped
2258
2321
  if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
@@ -2264,11 +2327,11 @@
2264
2327
  }
2265
2328
 
2266
2329
  if (width > boundarywidth) {
2267
- dropdown.addClass("uk-dropdown-stack");
2330
+ dropdown.addClass('uk-dropdown-stack');
2268
2331
  this.trigger('stack.uk.dropdown', [this]);
2269
2332
  }
2270
2333
 
2271
- dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]);
2334
+ dropdown.css(css).css('display', '').addClass('uk-dropdown-'+pp[0]);
2272
2335
  },
2273
2336
 
2274
2337
  checkBoundary: function(left, top, width, height, boundarywidth) {
@@ -2291,9 +2354,9 @@
2291
2354
  UI.component('dropdownOverlay', {
2292
2355
 
2293
2356
  defaults: {
2294
- 'justify' : false,
2295
- 'cls' : '',
2296
- 'duration': 200
2357
+ justify : false,
2358
+ cls : '',
2359
+ duration: 200
2297
2360
  },
2298
2361
 
2299
2362
  boot: function() {
@@ -2301,11 +2364,11 @@
2301
2364
  // init code
2302
2365
  UI.ready(function(context) {
2303
2366
 
2304
- UI.$("[data-uk-dropdown-overlay]", context).each(function() {
2367
+ UI.$('[data-uk-dropdown-overlay]', context).each(function() {
2305
2368
  var ele = UI.$(this);
2306
2369
 
2307
- if (!ele.data("dropdownOverlay")) {
2308
- UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay")));
2370
+ if (!ele.data('dropdownOverlay')) {
2371
+ UI.dropdownOverlay(ele, UI.Utils.options(ele.attr('data-uk-dropdown-overlay')));
2309
2372
  }
2310
2373
  });
2311
2374
  });
@@ -2330,7 +2393,7 @@
2330
2393
  $this.dropdown = dropdown;
2331
2394
 
2332
2395
  if ($this.justified && $this.justified.length) {
2333
- justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth());
2396
+ justify($this.overlay.css({display:'block', marginLeft:'', marginRight:''}), $this.justified, $this.justified.outerWidth());
2334
2397
  }
2335
2398
  },
2336
2399
 
@@ -2400,17 +2463,17 @@
2400
2463
 
2401
2464
  var jwidth = justifyTo.outerWidth();
2402
2465
 
2403
- ele.css("min-width", jwidth);
2466
+ ele.css('min-width', jwidth);
2404
2467
 
2405
2468
  if (UI.langdirection == 'right') {
2406
2469
 
2407
2470
  var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
2408
2471
  right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
2409
2472
 
2410
- ele.css("margin-right", right1 - right2);
2473
+ ele.css('margin-right', right1 - right2);
2411
2474
 
2412
2475
  } else {
2413
- ele.css("margin-left", justifyTo.offset().left - offset.left);
2476
+ ele.css('margin-left', justifyTo.offset().left - offset.left);
2414
2477
  }
2415
2478
  }
2416
2479
  }
@@ -2426,10 +2489,10 @@
2426
2489
  UI.component('gridMatchHeight', {
2427
2490
 
2428
2491
  defaults: {
2429
- "target" : false,
2430
- "row" : true,
2431
- "ignorestacked" : false,
2432
- "observe" : false
2492
+ target : false,
2493
+ row : true,
2494
+ ignorestacked : false,
2495
+ observe : false
2433
2496
  },
2434
2497
 
2435
2498
  boot: function() {
@@ -2437,11 +2500,11 @@
2437
2500
  // init code
2438
2501
  UI.ready(function(context) {
2439
2502
 
2440
- UI.$("[data-uk-grid-match]", context).each(function() {
2503
+ UI.$('[data-uk-grid-match]', context).each(function() {
2441
2504
  var grid = UI.$(this), obj;
2442
2505
 
2443
- if (!grid.data("gridMatchHeight")) {
2444
- obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
2506
+ if (!grid.data('gridMatchHeight')) {
2507
+ obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr('data-uk-grid-match')));
2445
2508
  }
2446
2509
  });
2447
2510
  });
@@ -2459,7 +2522,7 @@
2459
2522
  UI.$win.on('load resize orientationchange', (function() {
2460
2523
 
2461
2524
  var fn = function() {
2462
- if ($this.element.is(":visible")) $this.match();
2525
+ if ($this.element.is(':visible')) $this.match();
2463
2526
  };
2464
2527
 
2465
2528
  UI.$(function() { fn(); });
@@ -2470,12 +2533,12 @@
2470
2533
  if (this.options.observe) {
2471
2534
 
2472
2535
  UI.domObserve(this.element, function(e) {
2473
- if ($this.element.is(":visible")) $this.match();
2536
+ if ($this.element.is(':visible')) $this.match();
2474
2537
  });
2475
2538
  }
2476
2539
 
2477
- this.on("display.uk.check", function(e) {
2478
- if(this.element.is(":visible")) this.match();
2540
+ this.on('display.uk.check', function(e) {
2541
+ if(this.element.is(':visible')) this.match();
2479
2542
  }.bind(this));
2480
2543
 
2481
2544
  grids.push(this);
@@ -2483,7 +2546,7 @@
2483
2546
 
2484
2547
  match: function() {
2485
2548
 
2486
- var firstvisible = this.columns.filter(":visible:first");
2549
+ var firstvisible = this.columns.filter(':visible:first');
2487
2550
 
2488
2551
  if (!firstvisible.length) return;
2489
2552
 
@@ -2516,11 +2579,11 @@
2516
2579
  // init code
2517
2580
  UI.ready(function(context) {
2518
2581
 
2519
- UI.$("[data-uk-grid-margin]", context).each(function() {
2582
+ UI.$('[data-uk-grid-margin]', context).each(function() {
2520
2583
  var grid = UI.$(this), obj;
2521
2584
 
2522
- if (!grid.data("gridMargin")) {
2523
- obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
2585
+ if (!grid.data('gridMargin')) {
2586
+ obj = UI.gridMargin(grid, UI.Utils.options(grid.attr('data-uk-grid-margin')));
2524
2587
  }
2525
2588
  });
2526
2589
  });
@@ -2540,9 +2603,9 @@
2540
2603
 
2541
2604
  var active = false, activeCount = 0, $html = UI.$html, body;
2542
2605
 
2543
- UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
2606
+ UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
2544
2607
  UI.$('.uk-modal.uk-open').each(function(){
2545
- UI.$(this).data('modal').resize();
2608
+ return UI.$(this).data('modal') && UI.$(this).data('modal').resize();
2546
2609
  });
2547
2610
  }, 150));
2548
2611
 
@@ -2568,18 +2631,18 @@
2568
2631
 
2569
2632
  var $this = this;
2570
2633
 
2571
- this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
2572
- this.dialog = this.find(".uk-modal-dialog");
2634
+ this.paddingdir = 'padding-' + (UI.langdirection == 'left' ? 'right':'left');
2635
+ this.dialog = this.find('.uk-modal-dialog');
2573
2636
 
2574
2637
  this.active = false;
2575
2638
 
2576
2639
  // Update ARIA
2577
- this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
2640
+ this.element.attr('aria-hidden', this.element.hasClass('uk-open'));
2578
2641
 
2579
- this.on("click", ".uk-modal-close", function(e) {
2642
+ this.on('click', '.uk-modal-close', function(e) {
2580
2643
  e.preventDefault();
2581
2644
  $this.hide();
2582
- }).on("click", function(e) {
2645
+ }).on('click', function(e) {
2583
2646
 
2584
2647
  var target = UI.$(e.target);
2585
2648
 
@@ -2592,7 +2655,7 @@
2592
2655
  },
2593
2656
 
2594
2657
  toggle: function() {
2595
- return this[this.isActive() ? "hide" : "show"]();
2658
+ return this[this.isActive() ? 'hide' : 'show']();
2596
2659
  },
2597
2660
 
2598
2661
  show: function() {
@@ -2607,7 +2670,7 @@
2607
2670
  active.hide(true);
2608
2671
  }
2609
2672
 
2610
- this.element.removeClass("uk-open").show();
2673
+ this.element.removeClass('uk-open').show();
2611
2674
  this.resize(true);
2612
2675
 
2613
2676
  if (this.options.modal) {
@@ -2622,17 +2685,19 @@
2622
2685
  this.hasTransitioned = false;
2623
2686
  this.element.one(UI.support.transition.end, function(){
2624
2687
  $this.hasTransitioned = true;
2625
- }).addClass("uk-open");
2688
+ UI.Utils.focus($this.dialog, 'a[href]');
2689
+ }).addClass('uk-open');
2626
2690
  } else {
2627
- this.element.addClass("uk-open");
2691
+ this.element.addClass('uk-open');
2692
+ UI.Utils.focus(this.dialog, 'a[href]');
2628
2693
  }
2629
2694
 
2630
- $html.addClass("uk-modal-page").height(); // force browser engine redraw
2695
+ $html.addClass('uk-modal-page').height(); // force browser engine redraw
2631
2696
 
2632
2697
  // Update ARIA
2633
2698
  this.element.attr('aria-hidden', 'false');
2634
2699
 
2635
- this.element.trigger("show.uk.modal");
2700
+ this.element.trigger('show.uk.modal');
2636
2701
 
2637
2702
  UI.Utils.checkDisplay(this.dialog, true);
2638
2703
 
@@ -2647,7 +2712,7 @@
2647
2712
 
2648
2713
  this.one(UI.support.transition.end, function() {
2649
2714
  $this._hide();
2650
- }).removeClass("uk-open");
2715
+ }).removeClass('uk-open');
2651
2716
 
2652
2717
  } else {
2653
2718
 
@@ -2675,9 +2740,9 @@
2675
2740
  pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
2676
2741
 
2677
2742
  if ((dh + pad) < window.innerHeight) {
2678
- this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
2743
+ this.dialog.css({top: (window.innerHeight/2 - dh/2) - pad });
2679
2744
  } else {
2680
- this.dialog.css({'top': ''});
2745
+ this.dialog.css({top: ''});
2681
2746
  }
2682
2747
  }
2683
2748
  },
@@ -2697,8 +2762,8 @@
2697
2762
  h = wh - 2*(offset < 20 ? 20:offset) - dh;
2698
2763
 
2699
2764
  scrollable.css({
2700
- 'max-height': (h < this.options.minScrollHeight ? '':h),
2701
- 'height':''
2765
+ maxHeight: (h < this.options.minScrollHeight ? '':h),
2766
+ height:''
2702
2767
  });
2703
2768
 
2704
2769
  return true;
@@ -2739,16 +2804,16 @@
2739
2804
  boot: function() {
2740
2805
 
2741
2806
  // init code
2742
- UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
2807
+ UI.$html.on('click.modal.uikit', '[data-uk-modal]', function(e) {
2743
2808
 
2744
2809
  var ele = UI.$(this);
2745
2810
 
2746
- if (ele.is("a")) {
2811
+ if (ele.is('a')) {
2747
2812
  e.preventDefault();
2748
2813
  }
2749
2814
 
2750
- if (!ele.data("modalTrigger")) {
2751
- var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
2815
+ if (!ele.data('modalTrigger')) {
2816
+ var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr('data-uk-modal')));
2752
2817
  modal.show();
2753
2818
  }
2754
2819
 
@@ -2769,7 +2834,7 @@
2769
2834
  var $this = this;
2770
2835
 
2771
2836
  this.options = UI.$.extend({
2772
- "target": $this.element.is("a") ? $this.element.attr("href") : false
2837
+ target: $this.element.is('a') ? $this.element.attr('href') : false
2773
2838
  }, this.options);
2774
2839
 
2775
2840
  this.modal = UI.modal(this.options.target, this.options);
@@ -2780,17 +2845,17 @@
2780
2845
  });
2781
2846
 
2782
2847
  //methods
2783
- this.proxy(this.modal, "show hide isActive");
2848
+ this.proxy(this.modal, 'show hide isActive');
2784
2849
  }
2785
2850
  });
2786
2851
 
2787
2852
  UI.modal.dialog = function(content, options) {
2788
2853
 
2789
- var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
2854
+ var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo('body'), options);
2790
2855
 
2791
- modal.on("hide.uk.modal", function(){
2856
+ modal.on('hide.uk.modal', function(){
2792
2857
  if (modal.persist) {
2793
- modal.persist.appendTo(modal.persist.data("modalPersistParent"));
2858
+ modal.persist.appendTo(modal.persist.data('modalPersistParent'));
2794
2859
  modal.persist = false;
2795
2860
  }
2796
2861
  modal.element.remove();
@@ -2861,22 +2926,16 @@
2861
2926
 
2862
2927
  input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
2863
2928
  if (e.keyCode == 13) {
2864
- modal.element.find(".js-modal-ok").trigger('click');
2929
+ modal.element.find('.js-modal-ok').trigger('click');
2865
2930
  }
2866
2931
  });
2867
2932
 
2868
- modal.element.find(".js-modal-ok").on("click", function(){
2933
+ modal.element.find('.js-modal-ok').on('click', function(){
2869
2934
  if (onsubmit(input.val())!==false){
2870
2935
  modal.hide();
2871
2936
  }
2872
2937
  });
2873
2938
 
2874
- modal.on('show.uk.modal', function(){
2875
- setTimeout(function(){
2876
- input.focus();
2877
- }, 50);
2878
- });
2879
-
2880
2939
  return modal.show();
2881
2940
  };
2882
2941
 
@@ -2891,13 +2950,11 @@
2891
2950
  return modal.show();
2892
2951
  };
2893
2952
 
2894
-
2895
2953
  UI.modal.labels = {
2896
- 'Ok': 'Ok',
2897
- 'Cancel': 'Cancel'
2954
+ Ok: 'Ok',
2955
+ Cancel: 'Cancel'
2898
2956
  };
2899
2957
 
2900
-
2901
2958
  // helper functions
2902
2959
  function setContent(content, modal){
2903
2960
 
@@ -2910,7 +2967,7 @@
2910
2967
 
2911
2968
  if(content.parent().length) {
2912
2969
  modal.persist = content;
2913
- modal.persist.data("modalPersistParent", content.parent());
2970
+ modal.persist.data('modalPersistParent', content.parent());
2914
2971
  }
2915
2972
  }else if (typeof content === 'string' || typeof content === 'number') {
2916
2973
  // just insert the data as innerHTML
@@ -2934,9 +2991,9 @@
2934
2991
  UI.component('nav', {
2935
2992
 
2936
2993
  defaults: {
2937
- "toggle": ">li.uk-parent > a[href='#']",
2938
- "lists": ">li.uk-parent > ul",
2939
- "multiple": false
2994
+ toggle: '>li.uk-parent > a[href="#"]',
2995
+ lists: '>li.uk-parent > ul',
2996
+ multiple: false
2940
2997
  },
2941
2998
 
2942
2999
  boot: function() {
@@ -2944,11 +3001,11 @@
2944
3001
  // init code
2945
3002
  UI.ready(function(context) {
2946
3003
 
2947
- UI.$("[data-uk-nav]", context).each(function() {
3004
+ UI.$('[data-uk-nav]', context).each(function() {
2948
3005
  var nav = UI.$(this);
2949
3006
 
2950
- if (!nav.data("nav")) {
2951
- var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
3007
+ if (!nav.data('nav')) {
3008
+ var obj = UI.nav(nav, UI.Utils.options(nav.attr('data-uk-nav')));
2952
3009
  }
2953
3010
  });
2954
3011
  });
@@ -2958,26 +3015,41 @@
2958
3015
 
2959
3016
  var $this = this;
2960
3017
 
2961
- this.on("click.uk.nav", this.options.toggle, function(e) {
3018
+ this.on('click.uk.nav', this.options.toggle, function(e) {
2962
3019
  e.preventDefault();
2963
3020
  var ele = UI.$(this);
2964
3021
  $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
2965
3022
  });
2966
3023
 
3024
+ this.update();
3025
+
3026
+ UI.domObserve(this.element, function(e) {
3027
+ if ($this.element.find($this.options.lists).not('[role]').length) {
3028
+ $this.update();
3029
+ }
3030
+ });
3031
+ },
3032
+
3033
+ update: function() {
3034
+
3035
+ var $this = this;
3036
+
2967
3037
  this.find(this.options.lists).each(function() {
2968
- var $ele = UI.$(this),
2969
- parent = $ele.parent(),
3038
+
3039
+ var $ele = UI.$(this).attr('role', 'menu'),
3040
+ parent = $ele.closest('li'),
2970
3041
  active = parent.hasClass("uk-active");
2971
3042
 
2972
- $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
2973
- parent.data("list-container", $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
3043
+ if (!parent.data('list-container')) {
3044
+ $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
3045
+ parent.data('list-container', $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
3046
+ }
2974
3047
 
2975
3048
  // Init ARIA
2976
3049
  parent.attr('aria-expanded', parent.hasClass("uk-open"));
2977
3050
 
2978
3051
  if (active) $this.open(parent, true);
2979
3052
  });
2980
-
2981
3053
  },
2982
3054
 
2983
3055
  open: function(li, noanimation) {
@@ -3042,15 +3114,17 @@
3042
3114
  // helper
3043
3115
 
3044
3116
  function getHeight(ele) {
3045
- var $ele = UI.$(ele), height = "auto";
3046
3117
 
3047
- if ($ele.is(":visible")) {
3118
+ var $ele = UI.$(ele), height = 'auto';
3119
+
3120
+ if ($ele.is(':visible')) {
3048
3121
  height = $ele.outerHeight();
3049
3122
  } else {
3123
+
3050
3124
  var tmp = {
3051
- position: $ele.css("position"),
3052
- visibility: $ele.css("visibility"),
3053
- display: $ele.css("display")
3125
+ position: $ele.css('position'),
3126
+ visibility: $ele.css('visibility'),
3127
+ display: $ele.css('display')
3054
3128
  };
3055
3129
 
3056
3130
  height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
@@ -3073,30 +3147,41 @@
3073
3147
  $html = UI.$html,
3074
3148
  Offcanvas = {
3075
3149
 
3076
- show: function(element) {
3150
+ show: function(element, options) {
3077
3151
 
3078
3152
  element = UI.$(element);
3079
3153
 
3080
3154
  if (!element.length) return;
3081
3155
 
3156
+ options = UI.$.extend({mode: 'push'}, options);
3157
+
3082
3158
  var $body = UI.$('body'),
3083
- bar = element.find(".uk-offcanvas-bar:first"),
3084
- rtl = (UI.langdirection == "right"),
3085
- flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
3159
+ bar = element.find('.uk-offcanvas-bar:first'),
3160
+ rtl = (UI.langdirection == 'right'),
3161
+ flip = bar.hasClass('uk-offcanvas-bar-flip') ? -1:1,
3086
3162
  dir = flip * (rtl ? -1 : 1),
3087
3163
 
3088
3164
  scrollbarwidth = window.innerWidth - $body.width();
3089
3165
 
3090
3166
  scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
3091
3167
 
3092
- element.addClass("uk-active");
3168
+ bar.attr('mode', options.mode);
3169
+ element.addClass('uk-active');
3170
+
3171
+ $body.css({width: window.innerWidth - scrollbarwidth, height: window.innerHeight}).addClass('uk-offcanvas-page');
3093
3172
 
3094
- $body.css({"width": window.innerWidth - scrollbarwidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
3095
- $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
3173
+ if (options.mode == 'push' || options.mode == 'reveal') {
3174
+ $body.css((rtl ? 'margin-right' : 'margin-left'), (rtl ? -1 : 1) * (bar.outerWidth() * dir));
3175
+ }
3096
3176
 
3097
- $html.css('margin-top', scrollpos.y * -1);
3177
+ if (options.mode == 'reveal') {
3178
+ bar.css('clip', 'rect(0, '+bar.outerWidth()+'px, 100vh, 0)');
3179
+ }
3098
3180
 
3099
- bar.addClass("uk-offcanvas-bar-show");
3181
+ $html.css('margin-top', scrollpos.y * -1).width(); // .width() - force redraw
3182
+
3183
+
3184
+ bar.addClass('uk-offcanvas-bar-show');
3100
3185
 
3101
3186
  this._initElement(element);
3102
3187
 
@@ -3109,14 +3194,14 @@
3109
3194
  hide: function(force) {
3110
3195
 
3111
3196
  var $body = UI.$('body'),
3112
- panel = UI.$(".uk-offcanvas.uk-active"),
3113
- rtl = (UI.langdirection == "right"),
3114
- bar = panel.find(".uk-offcanvas-bar:first"),
3197
+ panel = UI.$('.uk-offcanvas.uk-active'),
3198
+ rtl = (UI.langdirection == 'right'),
3199
+ bar = panel.find('.uk-offcanvas-bar:first'),
3115
3200
  finalize = function() {
3116
- $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
3117
- panel.removeClass("uk-active");
3201
+ $body.removeClass('uk-offcanvas-page').css({width: '', height: '', marginLeft: '', marginRight: ''});
3202
+ panel.removeClass('uk-active');
3118
3203
 
3119
- bar.removeClass("uk-offcanvas-bar-show");
3204
+ bar.removeClass('uk-offcanvas-bar-show');
3120
3205
  $html.css('margin-top', '');
3121
3206
  window.scrollTo(scrollpos.x, scrollpos.y);
3122
3207
  bar.trigger('hide.uk.offcanvas', [panel, bar]);
@@ -3126,15 +3211,20 @@
3126
3211
  };
3127
3212
 
3128
3213
  if (!panel.length) return;
3214
+ if (bar.attr('mode') == 'none') force = true;
3129
3215
 
3130
3216
  if (UI.support.transition && !force) {
3131
3217
 
3132
3218
  $body.one(UI.support.transition.end, function() {
3133
3219
  finalize();
3134
- }).css((rtl ? "margin-right" : "margin-left"), "");
3220
+ }).css((rtl ? 'margin-right' : 'margin-left'), '');
3221
+
3222
+ if (bar.attr('mode') == 'reveal') {
3223
+ bar.css('clip', '');
3224
+ }
3135
3225
 
3136
3226
  setTimeout(function(){
3137
- bar.removeClass("uk-offcanvas-bar-show");
3227
+ bar.removeClass('uk-offcanvas-bar-show');
3138
3228
  }, 0);
3139
3229
 
3140
3230
  } else {
@@ -3144,17 +3234,17 @@
3144
3234
 
3145
3235
  _initElement: function(element) {
3146
3236
 
3147
- if (element.data("OffcanvasInit")) return;
3237
+ if (element.data('OffcanvasInit')) return;
3148
3238
 
3149
- element.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas", function(e) {
3239
+ element.on('click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas', function(e) {
3150
3240
 
3151
3241
  var target = UI.$(e.target);
3152
3242
 
3153
3243
  if (!e.type.match(/swipe/)) {
3154
3244
 
3155
- if (!target.hasClass("uk-offcanvas-close")) {
3156
- if (target.hasClass("uk-offcanvas-bar")) return;
3157
- if (target.parents(".uk-offcanvas-bar:first").length) return;
3245
+ if (!target.hasClass('uk-offcanvas-close')) {
3246
+ if (target.hasClass('uk-offcanvas-bar')) return;
3247
+ if (target.parents('.uk-offcanvas-bar:first').length) return;
3158
3248
  }
3159
3249
  }
3160
3250
 
@@ -3162,12 +3252,12 @@
3162
3252
  Offcanvas.hide();
3163
3253
  });
3164
3254
 
3165
- element.on("click", "a[href*='#']", function(e){
3255
+ element.on('click', 'a[href*="#"]', function(e){
3166
3256
 
3167
3257
  var link = UI.$(this),
3168
- href = link.attr("href");
3258
+ href = link.attr('href');
3169
3259
 
3170
- if (href == "#") {
3260
+ if (href == '#') {
3171
3261
  return;
3172
3262
  }
3173
3263
 
@@ -3195,7 +3285,7 @@
3195
3285
  Offcanvas.hide();
3196
3286
  });
3197
3287
 
3198
- element.data("OffcanvasInit", true);
3288
+ element.data('OffcanvasInit', true);
3199
3289
  }
3200
3290
  };
3201
3291
 
@@ -3204,14 +3294,14 @@
3204
3294
  boot: function() {
3205
3295
 
3206
3296
  // init code
3207
- $html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
3297
+ $html.on('click.offcanvas.uikit', '[data-uk-offcanvas]', function(e) {
3208
3298
 
3209
3299
  e.preventDefault();
3210
3300
 
3211
3301
  var ele = UI.$(this);
3212
3302
 
3213
- if (!ele.data("offcanvasTrigger")) {
3214
- var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
3303
+ if (!ele.data('offcanvasTrigger')) {
3304
+ var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr('data-uk-offcanvas')));
3215
3305
  ele.trigger("click");
3216
3306
  }
3217
3307
  });
@@ -3229,12 +3319,13 @@
3229
3319
  var $this = this;
3230
3320
 
3231
3321
  this.options = UI.$.extend({
3232
- "target": $this.element.is("a") ? $this.element.attr("href") : false
3322
+ target: $this.element.is('a') ? $this.element.attr('href') : false,
3323
+ mode: 'push'
3233
3324
  }, this.options);
3234
3325
 
3235
- this.on("click", function(e) {
3326
+ this.on('click', function(e) {
3236
3327
  e.preventDefault();
3237
- Offcanvas.show($this.options.target);
3328
+ Offcanvas.show($this.options.target, $this.options);
3238
3329
  });
3239
3330
  }
3240
3331
  });
@@ -3253,7 +3344,7 @@
3253
3344
 
3254
3345
  defaults: {
3255
3346
  connect : false,
3256
- toggle : ">*",
3347
+ toggle : '>*',
3257
3348
  active : 0,
3258
3349
  animation : false,
3259
3350
  duration : 200,
@@ -3267,11 +3358,11 @@
3267
3358
  // init code
3268
3359
  UI.ready(function(context) {
3269
3360
 
3270
- UI.$("[data-uk-switcher]", context).each(function() {
3361
+ UI.$('[data-uk-switcher]', context).each(function() {
3271
3362
  var switcher = UI.$(this);
3272
3363
 
3273
- if (!switcher.data("switcher")) {
3274
- var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
3364
+ if (!switcher.data('switcher')) {
3365
+ var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr('data-uk-switcher')));
3275
3366
  }
3276
3367
  });
3277
3368
  });
@@ -3281,70 +3372,72 @@
3281
3372
 
3282
3373
  var $this = this;
3283
3374
 
3284
- this.on("click.uk.switcher", this.options.toggle, function(e) {
3375
+ this.on('click.uk.switcher', this.options.toggle, function(e) {
3285
3376
  e.preventDefault();
3286
3377
  $this.show(this);
3287
3378
  });
3288
3379
 
3289
- if (this.options.connect) {
3380
+ if (!this.options.connect) {
3381
+ return;
3382
+ }
3290
3383
 
3291
- this.connect = UI.$(this.options.connect);
3384
+ this.connect = UI.$(this.options.connect);
3292
3385
 
3293
- this.connect.children().removeClass("uk-active");
3386
+ if (!this.connect.length) {
3387
+ return;
3388
+ }
3294
3389
 
3295
- // delegate switch commands within container content
3296
- if (this.connect.length) {
3390
+ this.connect.on('click.uk.switcher', '[data-uk-switcher-item]', function(e) {
3297
3391
 
3298
- // Init ARIA for connect
3299
- this.connect.children().attr('aria-hidden', 'true');
3392
+ e.preventDefault();
3300
3393
 
3301
- this.connect.on("click", '[data-uk-switcher-item]', function(e) {
3394
+ var item = UI.$(this).attr('data-uk-switcher-item');
3302
3395
 
3303
- e.preventDefault();
3396
+ if ($this.index == item) return;
3304
3397
 
3305
- var item = UI.$(this).attr('data-uk-switcher-item');
3398
+ switch(item) {
3399
+ case 'next':
3400
+ case 'previous':
3401
+ $this.show($this.index + (item=='next' ? 1:-1));
3402
+ break;
3403
+ default:
3404
+ $this.show(parseInt(item, 10));
3405
+ }
3406
+ });
3306
3407
 
3307
- if ($this.index == item) return;
3408
+ if (this.options.swiping) {
3308
3409
 
3309
- switch(item) {
3310
- case 'next':
3311
- case 'previous':
3312
- $this.show($this.index + (item=='next' ? 1:-1));
3313
- break;
3314
- default:
3315
- $this.show(parseInt(item, 10));
3316
- }
3317
- });
3410
+ this.connect.on('swipeRight swipeLeft', function(e) {
3411
+ e.preventDefault();
3412
+ if (!window.getSelection().toString()) {
3413
+ $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
3414
+ }
3415
+ });
3416
+ }
3318
3417
 
3319
- if (this.options.swiping) {
3418
+ this.update();
3419
+ },
3320
3420
 
3321
- this.connect.on('swipeRight swipeLeft', function(e) {
3322
- e.preventDefault();
3323
- if(!window.getSelection().toString()) {
3324
- $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
3325
- }
3326
- });
3327
- }
3328
- }
3421
+ update: function() {
3329
3422
 
3330
- var toggles = this.find(this.options.toggle),
3331
- active = toggles.filter(".uk-active");
3423
+ this.connect.children().removeClass('uk-active').attr('aria-hidden', 'true');
3332
3424
 
3333
- if (active.length) {
3334
- this.show(active, false);
3335
- } else {
3425
+ var toggles = this.find(this.options.toggle),
3426
+ active = toggles.filter('.uk-active');
3336
3427
 
3337
- if (this.options.active===false) return;
3428
+ if (active.length) {
3429
+ this.show(active, false);
3430
+ } else {
3338
3431
 
3339
- active = toggles.eq(this.options.active);
3340
- this.show(active.length ? active : toggles.eq(0), false);
3341
- }
3432
+ if (this.options.active===false) return;
3342
3433
 
3343
- // Init ARIA for toggles
3344
- toggles.not(active).attr('aria-expanded', 'false');
3345
- active.attr('aria-expanded', 'true');
3434
+ active = toggles.eq(this.options.active);
3435
+ this.show(active.length ? active : toggles.eq(0), false);
3346
3436
  }
3347
3437
 
3438
+ // Init ARIA for toggles
3439
+ toggles.not(active).attr('aria-expanded', 'false');
3440
+ active.attr('aria-expanded', 'true');
3348
3441
  },
3349
3442
 
3350
3443
  show: function(tab, animate) {
@@ -3353,18 +3446,16 @@
3353
3446
  return;
3354
3447
  }
3355
3448
 
3449
+ var toggles = this.find(this.options.toggle);
3450
+
3356
3451
  if (isNaN(tab)) {
3357
3452
  tab = UI.$(tab);
3358
3453
  } else {
3359
-
3360
- var toggles = this.find(this.options.toggle);
3361
-
3362
3454
  tab = tab < 0 ? toggles.length-1 : tab;
3363
3455
  tab = toggles.eq(toggles[tab] ? tab : 0);
3364
3456
  }
3365
3457
 
3366
3458
  var $this = this,
3367
- toggles = this.find(this.options.toggle),
3368
3459
  active = UI.$(tab),
3369
3460
  animation = Animations[this.options.animation] || function(current, next) {
3370
3461
 
@@ -3517,7 +3608,9 @@
3517
3608
 
3518
3609
  next.addClass(clsIn).one(UI.support.animation.end, function() {
3519
3610
 
3520
- next.removeClass(''+clsIn+'').css({opacity:'', display:''});
3611
+ setTimeout(function () {
3612
+ next.removeClass(''+clsIn+'').css({opacity:'', display:''});
3613
+ }, 0);
3521
3614
 
3522
3615
  d.resolve();
3523
3616
 
@@ -3555,12 +3648,12 @@
3555
3648
  UI.component('tab', {
3556
3649
 
3557
3650
  defaults: {
3558
- 'target' : '>li:not(.uk-tab-responsive, .uk-disabled)',
3559
- 'connect' : false,
3560
- 'active' : 0,
3561
- 'animation' : false,
3562
- 'duration' : 200,
3563
- 'swiping' : true
3651
+ target : '>li:not(.uk-tab-responsive, .uk-disabled)',
3652
+ connect : false,
3653
+ active : 0,
3654
+ animation : false,
3655
+ duration : 200,
3656
+ swiping : true
3564
3657
  },
3565
3658
 
3566
3659
  boot: function() {
@@ -3568,12 +3661,12 @@
3568
3661
  // init code
3569
3662
  UI.ready(function(context) {
3570
3663
 
3571
- UI.$("[data-uk-tab]", context).each(function() {
3664
+ UI.$('[data-uk-tab]', context).each(function() {
3572
3665
 
3573
3666
  var tab = UI.$(this);
3574
3667
 
3575
- if (!tab.data("tab")) {
3576
- var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
3668
+ if (!tab.data('tab')) {
3669
+ var obj = UI.tab(tab, UI.Utils.options(tab.attr('data-uk-tab')));
3577
3670
  }
3578
3671
  });
3579
3672
  });
@@ -3585,7 +3678,7 @@
3585
3678
 
3586
3679
  this.current = false;
3587
3680
 
3588
- this.on("click.uk.tab", this.options.target, function(e) {
3681
+ this.on('click.uk.tab', this.options.target, function(e) {
3589
3682
 
3590
3683
  e.preventDefault();
3591
3684
 
@@ -3595,9 +3688,9 @@
3595
3688
 
3596
3689
  var current = $this.find($this.options.target).not(this);
3597
3690
 
3598
- current.removeClass("uk-active").blur();
3691
+ current.removeClass('uk-active').blur();
3599
3692
 
3600
- $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
3693
+ $this.trigger('change.uk.tab', [UI.$(this).addClass('uk-active'), $this.current]);
3601
3694
 
3602
3695
  $this.current = UI.$(this);
3603
3696
 
@@ -3619,7 +3712,7 @@
3619
3712
  this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
3620
3713
  this.responsivetab.caption = this.responsivetab.find('a:first');
3621
3714
 
3622
- if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
3715
+ if (this.element.hasClass('uk-tab-bottom')) this.responsivetab.dropdown.addClass('uk-dropdown-up');
3623
3716
 
3624
3717
  // handle click
3625
3718
  this.responsivetab.lst.on('click.uk.tab', 'a', function(e) {
@@ -3640,29 +3733,30 @@
3640
3733
 
3641
3734
  // init UIkit components
3642
3735
  if (this.options.connect) {
3736
+
3643
3737
  this.switcher = UI.switcher(this.element, {
3644
- 'toggle' : '>li:not(.uk-tab-responsive)',
3645
- 'connect' : this.options.connect,
3646
- 'active' : this.options.active,
3647
- 'animation' : this.options.animation,
3648
- 'duration' : this.options.duration,
3649
- 'swiping' : this.options.swiping
3738
+ toggle : '>li:not(.uk-tab-responsive)',
3739
+ connect : this.options.connect,
3740
+ active : this.options.active,
3741
+ animation : this.options.animation,
3742
+ duration : this.options.duration,
3743
+ swiping : this.options.swiping
3650
3744
  });
3651
3745
  }
3652
3746
 
3653
- UI.dropdown(this.responsivetab, {"mode": "click", "preventflip": "y"});
3747
+ UI.dropdown(this.responsivetab, {mode: 'click', preventflip: 'y'});
3654
3748
 
3655
3749
  // init
3656
- $this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
3750
+ $this.trigger('change.uk.tab', [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
3657
3751
 
3658
3752
  this.check();
3659
3753
 
3660
3754
  UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
3661
- if ($this.element.is(":visible")) $this.check();
3755
+ if ($this.element.is(':visible')) $this.check();
3662
3756
  }, 100));
3663
3757
 
3664
3758
  this.on('display.uk.check', function(){
3665
- if ($this.element.is(":visible")) $this.check();
3759
+ if ($this.element.is(':visible')) $this.check();
3666
3760
  });
3667
3761
  },
3668
3762
 
@@ -3699,7 +3793,8 @@
3699
3793
 
3700
3794
  if (!item.hasClass('uk-disabled')) {
3701
3795
 
3702
- clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" ');
3796
+ clone = UI.$(item[0].outerHTML);
3797
+ clone.find('a').data('index', i);
3703
3798
 
3704
3799
  this.responsivetab.lst.append(clone);
3705
3800
  }
@@ -3730,12 +3825,12 @@
3730
3825
  // auto init
3731
3826
  UI.ready(function(context) {
3732
3827
 
3733
- UI.$("[data-uk-cover]", context).each(function(){
3828
+ UI.$('[data-uk-cover]', context).each(function(){
3734
3829
 
3735
3830
  var ele = UI.$(this);
3736
3831
 
3737
- if(!ele.data("cover")) {
3738
- var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
3832
+ if(!ele.data('cover')) {
3833
+ var plugin = UI.cover(ele, UI.Utils.options(ele.attr('data-uk-cover')));
3739
3834
  }
3740
3835
  });
3741
3836
  });
@@ -3749,8 +3844,8 @@
3749
3844
  this.check();
3750
3845
  }.bind(this), 100));
3751
3846
 
3752
- this.on("display.uk.check", function(e) {
3753
- if(this.element.is(":visible")) this.check();
3847
+ this.on('display.uk.check', function(e) {
3848
+ if (this.element.is(':visible')) this.check();
3754
3849
  }.bind(this));
3755
3850
 
3756
3851
  this.check();
@@ -3760,19 +3855,14 @@
3760
3855
  var src = this.element.attr('src');
3761
3856
 
3762
3857
  this.element.attr('src', '').on('load', function(){
3763
-
3764
3858
  this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
3765
-
3766
3859
  }).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
3767
3860
  }
3768
3861
  },
3769
3862
 
3770
3863
  check: function() {
3771
3864
 
3772
- this.element.css({
3773
- 'width' : '',
3774
- 'height' : ''
3775
- });
3865
+ this.element.css({ width : '', height : '' });
3776
3866
 
3777
3867
  this.dimension = {w: this.element.width(), h: this.element.height()};
3778
3868
 
@@ -3784,7 +3874,7 @@
3784
3874
  this.dimension.h = this.element.attr('height');
3785
3875
  }
3786
3876
 
3787
- this.ratio = this.dimension.w / this.dimension.h;
3877
+ this.ratio = this.dimension.w / this.dimension.h;
3788
3878
 
3789
3879
  var w = this.parent.width(), h = this.parent.height(), width, height;
3790
3880
 
@@ -3801,10 +3891,7 @@
3801
3891
  height = Math.ceil(w / this.ratio);
3802
3892
  }
3803
3893
 
3804
- this.element.css({
3805
- 'width' : width,
3806
- 'height' : height
3807
- });
3894
+ this.element.css({ width : width, height : height });
3808
3895
  }
3809
3896
  });
3810
3897