uikit-sass-rails 1.2.0 → 1.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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +2 -1
  4. data/lib/uikit/sass/rails/engine.rb +1 -1
  5. data/lib/uikit/sass/rails/version.rb +1 -1
  6. data/vendor/assets/javascripts/uikit.js +14 -14
  7. data/vendor/assets/javascripts/uikit/{addons → components}/autocomplete.js +19 -9
  8. data/vendor/assets/javascripts/uikit/{addons → components}/cover.js +1 -2
  9. data/vendor/assets/javascripts/uikit/{addons → components}/datepicker.js +3 -4
  10. data/vendor/assets/javascripts/uikit/{addons → components}/form-password.js +2 -3
  11. data/vendor/assets/javascripts/uikit/{addons → components}/form-select.js +1 -2
  12. data/vendor/assets/javascripts/uikit/{addons → components}/htmleditor.js +2 -3
  13. data/vendor/assets/javascripts/uikit/{addons → components}/nestable.js +28 -8
  14. data/vendor/assets/javascripts/uikit/{addons → components}/notify.js +1 -2
  15. data/vendor/assets/javascripts/uikit/{addons → components}/pagination.js +2 -3
  16. data/vendor/assets/javascripts/uikit/{addons → components}/search.js +4 -5
  17. data/vendor/assets/javascripts/uikit/{addons → components}/sortable.js +26 -15
  18. data/vendor/assets/javascripts/uikit/{addons → components}/sticky.js +1 -2
  19. data/vendor/assets/javascripts/uikit/{addons → components}/timepicker.js +5 -6
  20. data/vendor/assets/javascripts/uikit/{addons → components}/upload.js +1 -2
  21. data/vendor/assets/javascripts/uikit/uikit.js +1281 -1248
  22. data/vendor/assets/stylesheets/uikit.scss +1 -1
  23. data/vendor/assets/stylesheets/uikit/almost-flat.scss +2 -1
  24. data/vendor/assets/stylesheets/uikit/{addons/uikit.almost-flat.addons.scss → components/uikit.components.almost-flat.scss} +459 -443
  25. data/vendor/assets/stylesheets/uikit/{addons/uikit.gradient.addons.scss → components/uikit.components.gradient.scss} +503 -487
  26. data/vendor/assets/stylesheets/uikit/{addons/uikit.addons.scss → components/uikit.components.scss} +451 -435
  27. data/vendor/assets/stylesheets/uikit/gradient.scss +2 -1
  28. data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +5 -6
  29. data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +15 -16
  30. data/vendor/assets/stylesheets/uikit/uikit.scss +5 -6
  31. metadata +19 -19
@@ -1,5 +1,4 @@
1
- /*! UIkit 2.10.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
-
1
+ /*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
3
2
  (function(addon) {
4
3
 
5
4
  var component;
@@ -1,5 +1,4 @@
1
- /*! UIkit 2.10.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
-
1
+ /*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
3
2
  (function(addon) {
4
3
 
5
4
  var component;
@@ -29,7 +28,7 @@
29
28
  times['24h'].push({value: (h+':00')});
30
29
  times['24h'].push({value: (h+':30')});
31
30
 
32
- if (i<13) {
31
+ if (i > 0 && i<13) {
33
32
  times['12h'].push({value: (h+':00 AM')});
34
33
  times['12h'].push({value: (h+':30 AM')});
35
34
  }
@@ -69,7 +68,7 @@
69
68
  this.autocomplete = UI.autocomplete(this.element.parent(), this.options);
70
69
  this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
71
70
 
72
- this.autocomplete.on('autocomplete-show', function() {
71
+ this.autocomplete.on('uk.autocomplete.show', function() {
73
72
 
74
73
  var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
75
74
 
@@ -140,7 +139,7 @@
140
139
  minute = 0;
141
140
  }
142
141
 
143
- this.autocomplete.input.val(this.formatTime(hour, minute, meridian));
142
+ this.autocomplete.input.val(this.formatTime(hour, minute, meridian)).trigger('change');
144
143
  },
145
144
 
146
145
  formatTime: function(hour, minute, meridian) {
@@ -151,7 +150,7 @@
151
150
  });
152
151
 
153
152
  // init code
154
- UI.$doc.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
153
+ UI.$html.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
155
154
  var ele = $(this);
156
155
 
157
156
  if (!ele.data("timepicker")) {
@@ -1,5 +1,4 @@
1
- /*! UIkit 2.10.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
-
1
+ /*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
3
2
  (function(addon) {
4
3
 
5
4
  var component;
@@ -1,5 +1,4 @@
1
- /*! UIkit 2.10.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
-
1
+ /*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
3
2
  (function(core) {
4
3
 
5
4
  if (typeof define == "function" && define.amd) { // AMD
@@ -17,7 +16,7 @@
17
16
 
18
17
  for (i = 0; i < resources.length; i += 1) {
19
18
  var resource = resources[i].replace(/\./g, '/');
20
- load.push(base+'/js/addons/'+resource);
19
+ load.push(base+'/components/'+resource);
21
20
  }
22
21
 
23
22
  req(load, function() {
@@ -48,9 +47,10 @@
48
47
  return UI;
49
48
  }
50
49
 
51
- UI.version = '2.10.0';
50
+ UI.version = '2.11.1';
52
51
  UI.$doc = $doc;
53
52
  UI.$win = $win;
53
+ UI.$html = $html;
54
54
 
55
55
  UI.fn = function(command, options) {
56
56
 
@@ -183,7 +183,7 @@
183
183
  };
184
184
 
185
185
  UI.Utils.checkDisplay = function(context) {
186
- $('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document).trigger('uk-check-display');
186
+ $('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document).trigger('uk.check.display');
187
187
  };
188
188
 
189
189
  UI.Utils.options = function(string) {
@@ -303,99 +303,6 @@
303
303
  UI.domObservers.push(fn);
304
304
  };
305
305
 
306
- $doc.on('uk.domready', function(){
307
- UI.domObservers.forEach(function(fn){
308
- fn(document);
309
- });
310
- $doc.trigger('uk.dom.changed');
311
- });
312
-
313
- $(function(){
314
-
315
- // custom scroll observer
316
- setInterval((function(){
317
-
318
- var memory = {x: window.pageXOffset, y:window.pageYOffset};
319
-
320
- var fn = function(){
321
-
322
- if (memory.x != window.pageXOffset || memory.y != window.pageYOffset) {
323
- memory = {x: window.pageXOffset, y:window.pageYOffset};
324
- $doc.trigger('uk-scroll', [memory]);
325
- }
326
- };
327
-
328
- if ($.UIkit.support.touch) {
329
- $doc.on('touchmove touchend MSPointerMove MSPointerUp', fn);
330
- }
331
-
332
- if(memory.x || memory.y) fn();
333
-
334
- return fn;
335
-
336
- })(), 15);
337
-
338
- // Check for dom modifications
339
- UI.domObserve('[data-uk-observe]', function() {
340
-
341
- var ele = this;
342
-
343
- UI.domObservers.forEach(function(fn){
344
- fn(ele);
345
- });
346
- });
347
-
348
-
349
- if (UI.support.touch) {
350
-
351
- // remove css hover rules for touch devices
352
- // UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
353
-
354
- // viewport unit fix for uk-height-viewport - should be fixed in iOS 8
355
- if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
356
-
357
- UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){
358
-
359
- var fn = function() {
360
- $('.uk-height-viewport').css('height', window.innerHeight);
361
- return fn;
362
- };
363
-
364
- return fn();
365
-
366
- })(), 100));
367
- }
368
- }
369
- });
370
-
371
- // add touch identifier class
372
- $html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
373
-
374
- // add uk-hover class on tap to support overlays on touch devices
375
- if (UI.support.touch) {
376
-
377
- var hoverset = false, selector = '.uk-overlay, .uk-overlay-toggle, .uk-has-hover', exclude;
378
-
379
- $doc.on('touchstart MSPointerDown', selector, function() {
380
-
381
- if(hoverset) $('.uk-hover').removeClass('uk-hover');
382
-
383
- hoverset = $(this).addClass('uk-hover');
384
-
385
- }).on('touchend MSPointerUp', function(e) {
386
-
387
- exclude = $(e.target).parents(selector);
388
-
389
- if (hoverset) hoverset.not(exclude).removeClass('uk-hover');
390
- });
391
- }
392
-
393
- return UI;
394
- });
395
-
396
- (function($, UI) {
397
-
398
- "use strict";
399
306
 
400
307
  UI.components = {};
401
308
 
@@ -514,105 +421,96 @@
514
421
  this.components[component].plugins[name] = def;
515
422
  };
516
423
 
517
- })(jQuery, jQuery.UIkit);
518
-
519
- (function($, UI) {
520
424
 
521
- "use strict";
425
+ $doc.on('uk.domready', function(){
426
+ UI.domObservers.forEach(function(fn){
427
+ fn(document);
428
+ });
429
+ $doc.trigger('uk.dom.changed');
430
+ });
522
431
 
523
- var stacks = [];
432
+ $(function(){
524
433
 
525
- UI.component('stackMargin', {
434
+ // custom scroll observer
435
+ setInterval((function(){
526
436
 
527
- defaults: {
528
- 'cls': 'uk-margin-small-top'
529
- },
437
+ var memory = {x: window.pageXOffset, y:window.pageYOffset};
530
438
 
531
- init: function() {
439
+ var fn = function(){
532
440
 
533
- var $this = this;
441
+ if (memory.x != window.pageXOffset || memory.y != window.pageYOffset) {
442
+ memory = {x: window.pageXOffset, y:window.pageYOffset};
443
+ $doc.trigger('uk-scroll', [memory]);
444
+ }
445
+ };
534
446
 
535
- this.columns = this.element.children();
447
+ if ($.UIkit.support.touch) {
448
+ $doc.on('touchmove touchend MSPointerMove MSPointerUp', fn);
449
+ }
536
450
 
537
- if (!this.columns.length) return;
451
+ if(memory.x || memory.y) fn();
538
452
 
539
- UI.$win.on('resize orientationchange', (function() {
453
+ return fn;
540
454
 
541
- var fn = function() {
542
- $this.process();
543
- };
455
+ })(), 15);
544
456
 
545
- $(function() {
546
- fn();
547
- UI.$win.on("load", fn);
548
- });
457
+ // Check for dom modifications
458
+ UI.domObserve('[data-uk-observe]', function() {
549
459
 
550
- return UI.Utils.debounce(fn, 50);
551
- })());
460
+ var ele = this;
552
461
 
553
- UI.$doc.on("uk.dom.changed", function(e) {
554
- $this.columns = $this.element.children();
555
- $this.process();
462
+ UI.domObservers.forEach(function(fn){
463
+ fn(ele);
556
464
  });
465
+ });
557
466
 
558
- this.on("uk-check-display", function(e) {
559
- if(this.element.is(":visible")) this.process();
560
- }.bind(this));
561
467
 
562
- stacks.push(this);
563
- },
468
+ if (UI.support.touch) {
564
469
 
565
- process: function() {
470
+ // remove css hover rules for touch devices
471
+ // UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
566
472
 
567
- var $this = this;
473
+ // viewport unit fix for uk-height-viewport - should be fixed in iOS 8
474
+ if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
568
475
 
569
- this.revert();
476
+ UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){
570
477
 
571
- var skip = false,
572
- firstvisible = this.columns.filter(":visible:first"),
573
- offset = firstvisible.length ? firstvisible.offset().top : false;
478
+ var fn = function() {
479
+ $('.uk-height-viewport').css('height', window.innerHeight);
480
+ return fn;
481
+ };
574
482
 
575
- if (offset === false) return;
483
+ return fn();
576
484
 
577
- this.columns.each(function() {
485
+ })(), 100));
486
+ }
487
+ }
488
+ });
578
489
 
579
- var column = $(this);
490
+ // add touch identifier class
491
+ $html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
580
492
 
581
- if (column.is(":visible")) {
493
+ // add uk-hover class on tap to support overlays on touch devices
494
+ if (UI.support.touch) {
582
495
 
583
- if (skip) {
584
- column.addClass($this.options.cls);
585
- } else {
586
- if (column.offset().top != offset) {
587
- column.addClass($this.options.cls);
588
- skip = true;
589
- }
590
- }
591
- }
592
- });
496
+ var hoverset = false, selector = '.uk-overlay, .uk-overlay-toggle, .uk-has-hover', exclude;
593
497
 
594
- return this;
595
- },
498
+ $html.on('touchstart MSPointerDown', selector, function() {
596
499
 
597
- revert: function() {
598
- this.columns.removeClass(this.options.cls);
599
- return this;
600
- }
601
- });
500
+ if(hoverset) $('.uk-hover').removeClass('uk-hover');
602
501
 
603
- // init code
604
- UI.ready(function(context) {
502
+ hoverset = $(this).addClass('uk-hover');
605
503
 
606
- $("[data-uk-margin]", context).each(function() {
607
- var ele = $(this), obj;
504
+ }).on('touchend MSPointerUp', function(e) {
608
505
 
609
- if (!ele.data("stackMargin")) {
610
- obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
611
- }
506
+ exclude = $(e.target).parents(selector);
507
+
508
+ if (hoverset) hoverset.not(exclude).removeClass('uk-hover');
612
509
  });
613
- });
510
+ }
614
511
 
615
- })(jQuery, jQuery.UIkit);
512
+ return UI;
513
+ });
616
514
 
617
515
  // Based on Zeptos touch.js
618
516
  // https://raw.github.com/madrobby/zepto/master/src/touch.js
@@ -773,594 +671,574 @@
773
671
  $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
774
672
  });
775
673
  })(jQuery);
776
-
777
674
  (function($, UI) {
778
675
 
779
676
  "use strict";
780
677
 
781
- UI.component('alert', {
678
+ var stacks = [];
679
+
680
+ UI.component('stackMargin', {
782
681
 
783
682
  defaults: {
784
- "fade": true,
785
- "duration": 200,
786
- "trigger": ".uk-alert-close"
683
+ 'cls': 'uk-margin-small-top'
787
684
  },
788
685
 
789
686
  init: function() {
790
687
 
791
688
  var $this = this;
792
689
 
793
- this.on("click", this.options.trigger, function(e) {
794
- e.preventDefault();
795
- $this.close();
796
- });
797
- },
690
+ this.columns = this.element.children();
798
691
 
799
- close: function() {
692
+ if (!this.columns.length) return;
800
693
 
801
- var element = this.trigger("close");
694
+ UI.$win.on('resize orientationchange', (function() {
802
695
 
803
- if (this.options.fade) {
804
- element.css("overflow", "hidden").css("max-height", element.height()).animate({
805
- "height": 0,
806
- "opacity": 0,
807
- "padding-top": 0,
808
- "padding-bottom": 0,
809
- "margin-top": 0,
810
- "margin-bottom": 0
811
- }, this.options.duration, removeElement);
812
- } else {
813
- removeElement();
814
- }
696
+ var fn = function() {
697
+ $this.process();
698
+ };
815
699
 
816
- function removeElement() {
817
- element.trigger("closed").remove();
818
- }
819
- }
700
+ $(function() {
701
+ fn();
702
+ UI.$win.on("load", fn);
703
+ });
820
704
 
821
- });
822
-
823
- // init code
824
- UI.$doc.on("click.alert.uikit", "[data-uk-alert]", function(e) {
825
-
826
- var ele = $(this);
827
-
828
- if (!ele.data("alert")) {
705
+ return UI.Utils.debounce(fn, 50);
706
+ })());
829
707
 
830
- var alert = UI.alert(ele, UI.Utils.options(ele.data("uk-alert")));
708
+ UI.$html.on("uk.dom.changed", function(e) {
709
+ $this.columns = $this.element.children();
710
+ $this.process();
711
+ });
831
712
 
832
- if ($(e.target).is(ele.data("alert").options.trigger)) {
833
- e.preventDefault();
834
- alert.close();
835
- }
836
- }
837
- });
713
+ this.on("uk.check.display", function(e) {
714
+ $this.columns = $this.element.children();
715
+ if(this.element.is(":visible")) this.process();
716
+ }.bind(this));
838
717
 
839
- })(jQuery, jQuery.UIkit);
718
+ stacks.push(this);
719
+ },
840
720
 
841
- (function($, UI) {
721
+ process: function() {
842
722
 
843
- "use strict";
723
+ var $this = this;
844
724
 
845
- UI.component('buttonRadio', {
725
+ this.revert();
846
726
 
847
- defaults: {
848
- "target": ".uk-button"
849
- },
727
+ var skip = false,
728
+ firstvisible = this.columns.filter(":visible:first"),
729
+ offset = firstvisible.length ? firstvisible.offset().top : false;
850
730
 
851
- init: function() {
731
+ if (offset === false) return;
852
732
 
853
- var $this = this;
733
+ this.columns.each(function() {
854
734
 
855
- this.on("click", this.options.target, function(e) {
735
+ var column = $(this);
856
736
 
857
- if ($(this).is('a[href="#"]')) e.preventDefault();
737
+ if (column.is(":visible")) {
858
738
 
859
- $this.find($this.options.target).not(this).removeClass("uk-active").blur();
860
- $this.trigger("change", [$(this).addClass("uk-active")]);
739
+ if (skip) {
740
+ column.addClass($this.options.cls);
741
+ } else {
742
+ if (column.offset().top != offset) {
743
+ column.addClass($this.options.cls);
744
+ skip = true;
745
+ }
746
+ }
747
+ }
861
748
  });
862
749
 
750
+ return this;
863
751
  },
864
752
 
865
- getSelected: function() {
866
- return this.find(".uk-active");
753
+ revert: function() {
754
+ this.columns.removeClass(this.options.cls);
755
+ return this;
867
756
  }
868
757
  });
869
758
 
870
- UI.component('buttonCheckbox', {
871
-
872
- defaults: {
873
- "target": ".uk-button"
874
- },
759
+ // init code
760
+ UI.ready(function(context) {
875
761
 
876
- init: function() {
762
+ $("[data-uk-margin]", context).each(function() {
763
+ var ele = $(this), obj;
877
764
 
878
- var $this = this;
765
+ if (!ele.data("stackMargin")) {
766
+ obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
767
+ }
768
+ });
769
+ });
879
770
 
880
- this.on("click", this.options.target, function(e) {
771
+ })(jQuery, jQuery.UIkit);
772
+ (function($, UI) {
881
773
 
882
- if ($(this).is('a[href="#"]')) e.preventDefault();
774
+ "use strict";
883
775
 
884
- $this.trigger("change", [$(this).toggleClass("uk-active").blur()]);
885
- });
776
+ UI.component('smoothScroll', {
886
777
 
778
+ defaults: {
779
+ duration: 1000,
780
+ transition: 'easeOutExpo',
781
+ offset: 0,
782
+ complete: function(){}
887
783
  },
888
784
 
889
- getSelected: function() {
890
- return this.find(".uk-active");
891
- }
892
- });
893
-
894
-
895
- UI.component('button', {
896
-
897
- defaults: {},
898
-
899
785
  init: function() {
900
786
 
901
787
  var $this = this;
902
788
 
903
789
  this.on("click", function(e) {
904
790
 
905
- if ($this.element.is('a[href="#"]')) e.preventDefault();
906
-
907
- $this.toggle();
908
- $this.trigger("change", [$this.element.blur().hasClass("uk-active")]);
909
- });
910
-
911
- },
912
-
913
- toggle: function() {
914
- this.element.toggleClass("uk-active");
915
- }
916
- });
791
+ // get / set parameters
792
+ var ele = ($(this.hash).length ? $(this.hash) : $("body")),
793
+ target = ele.offset().top - $this.options.offset,
794
+ docheight = UI.$doc.height(),
795
+ winheight = UI.$win.height();
917
796
 
797
+ if ((target + winheight) > docheight) {
798
+ target = docheight - winheight;
799
+ }
918
800
 
919
- // init code
920
- UI.$doc.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
921
- var ele = $(this);
801
+ // animate to target, fire callback when done
802
+ $("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition).promise().done($this.options.complete);
922
803
 
923
- if (!ele.data("buttonRadio")) {
924
- var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio")));
804
+ // cancel default click action
805
+ return false;
806
+ });
925
807
 
926
- if ($(e.target).is(obj.options.target)) {
927
- $(e.target).trigger("click");
928
- }
929
808
  }
930
809
  });
931
810
 
932
- UI.$doc.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
933
- var ele = $(this);
934
-
935
- if (!ele.data("buttonCheckbox")) {
936
-
937
- var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))), target=$(e.target);
938
-
939
- if (target.is(obj.options.target)) {
940
- ele.trigger("change", [target.toggleClass("uk-active").blur()]);
941
- }
942
- }
943
- });
811
+ if (!$.easing['easeOutExpo']) {
812
+ $.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
813
+ }
944
814
 
945
- UI.$doc.on("click.button.uikit", "[data-uk-button]", function(e) {
815
+ // init code
816
+ UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
946
817
  var ele = $(this);
947
818
 
948
- if (!ele.data("button")) {
949
-
950
- var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
819
+ if (!ele.data("smoothScroll")) {
820
+ var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
951
821
  ele.trigger("click");
952
822
  }
823
+
824
+ return false;
953
825
  });
954
826
 
955
827
  })(jQuery, jQuery.UIkit);
956
-
957
-
958
828
  (function($, UI) {
959
829
 
960
830
  "use strict";
961
831
 
962
- var active = false, hoverIdle;
832
+ var $win = UI.$win,
833
+ $doc = UI.$doc,
834
+ scrollspies = [],
835
+ checkScrollSpy = function() {
836
+ for(var i=0; i < scrollspies.length; i++) {
837
+ UI.support.requestAnimationFrame.apply(window, [scrollspies[i].check]);
838
+ }
839
+ };
963
840
 
964
- UI.component('dropdown', {
841
+ UI.component('scrollspy', {
965
842
 
966
843
  defaults: {
967
- 'mode' : 'hover',
968
- 'remaintime' : 800,
969
- 'justify' : false,
970
- 'boundary' : UI.$win,
971
- 'delay' : 0
844
+ "cls" : "uk-scrollspy-inview",
845
+ "initcls" : "uk-scrollspy-init-inview",
846
+ "topoffset" : 0,
847
+ "leftoffset" : 0,
848
+ "repeat" : false,
849
+ "delay" : 0
972
850
  },
973
851
 
974
- remainIdle: false,
975
-
976
852
  init: function() {
977
853
 
978
- var $this = this;
854
+ var $this = this, idle, inviewstate, initinview,
855
+ fn = function(){
979
856
 
980
- this.dropdown = this.find(".uk-dropdown");
857
+ var inview = UI.Utils.isInView($this.element, $this.options);
981
858
 
982
- this.centered = this.dropdown.hasClass("uk-dropdown-center");
983
- this.justified = this.options.justify ? $(this.options.justify) : false;
859
+ if(inview && !inviewstate) {
984
860
 
985
- this.boundary = $(this.options.boundary);
986
- this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
861
+ if(idle) clearTimeout(idle);
987
862
 
988
- if(!this.boundary.length) {
989
- this.boundary = UI.$win;
990
- }
863
+ if(!initinview) {
864
+ $this.element.addClass($this.options.initcls);
865
+ $this.offset = $this.element.offset();
866
+ initinview = true;
991
867
 
992
- if (this.options.mode == "click" || UI.support.touch) {
868
+ $this.trigger("uk.scrollspy.init");
869
+ }
993
870
 
994
- this.on("click", function(e) {
871
+ idle = setTimeout(function(){
995
872
 
996
- var $target = $(e.target);
873
+ if(inview) {
874
+ $this.element.addClass("uk-scrollspy-inview").addClass($this.options.cls).width();
875
+ }
876
+ }, $this.options.delay);
997
877
 
998
- if (!$target.parents(".uk-dropdown").length) {
878
+ inviewstate = true;
879
+ $this.trigger("uk.scrollspy.inview");
880
+ }
999
881
 
1000
- if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
1001
- e.preventDefault();
1002
- }
882
+ if (!inview && inviewstate && $this.options.repeat) {
883
+ $this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
884
+ inviewstate = false;
1003
885
 
1004
- $target.blur();
886
+ $this.trigger("uk.scrollspy.outview");
1005
887
  }
888
+ };
1006
889
 
1007
- if (!$this.element.hasClass("uk-open")) {
890
+ fn();
1008
891
 
1009
- $this.show();
892
+ this.check = fn;
893
+ scrollspies.push(this);
894
+ }
895
+ });
1010
896
 
1011
- } else {
1012
897
 
1013
- if ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length) {
1014
- $this.element.removeClass("uk-open");
1015
- active = false;
1016
- }
1017
- }
1018
- });
898
+ var scrollspynavs = [],
899
+ checkScrollSpyNavs = function() {
900
+ for(var i=0; i < scrollspynavs.length; i++) {
901
+ UI.support.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
902
+ }
903
+ };
1019
904
 
1020
- } else {
905
+ UI.component('scrollspynav', {
1021
906
 
1022
- this.on("mouseenter", function(e) {
907
+ defaults: {
908
+ "cls" : 'uk-active',
909
+ "closest" : false,
910
+ "topoffset" : 0,
911
+ "leftoffset" : 0,
912
+ "smoothscroll" : false
913
+ },
1023
914
 
1024
- if ($this.remainIdle) {
1025
- clearTimeout($this.remainIdle);
1026
- }
915
+ init: function() {
1027
916
 
1028
- if (hoverIdle) {
1029
- clearTimeout(hoverIdle);
1030
- }
917
+ var ids = [],
918
+ links = this.find("a[href^='#']").each(function(){ ids.push($(this).attr("href")); }),
919
+ targets = $(ids.join(","));
1031
920
 
1032
- hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
921
+ var $this = this, inviews, fn = function(){
1033
922
 
1034
- }).on("mouseleave", function() {
923
+ inviews = [];
1035
924
 
1036
- if (hoverIdle) {
1037
- clearTimeout(hoverIdle);
925
+ for(var i=0 ; i < targets.length ; i++) {
926
+ if (UI.Utils.isInView(targets.eq(i), $this.options)) {
927
+ inviews.push(targets.eq(i));
1038
928
  }
929
+ }
1039
930
 
1040
- $this.remainIdle = setTimeout(function() {
1041
-
1042
- $this.element.removeClass("uk-open");
1043
- $this.remainIdle = false;
1044
-
1045
- if (active && active[0] == $this.element[0]) active = false;
1046
-
1047
- }, $this.options.remaintime);
931
+ if (inviews.length) {
1048
932
 
1049
- }).on("click", function(e){
933
+ var navitems,
934
+ scrollTop = $win.scrollTop(),
935
+ target = (function(){
936
+ for(var i=0; i< inviews.length;i++){
937
+ if(inviews[i].offset().top >= scrollTop){
938
+ return inviews[i];
939
+ }
940
+ }
941
+ })();
1050
942
 
1051
- var $target = $(e.target);
943
+ if (!target) return;
1052
944
 
1053
- if ($this.remainIdle) {
1054
- clearTimeout($this.remainIdle);
945
+ if ($this.options.closest) {
946
+ navitems = links.closest($this.options.closest).removeClass($this.options.cls).end().filter("a[href='#"+target.attr("id")+"']").closest($this.options.closest).addClass($this.options.cls);
947
+ } else {
948
+ navitems = links.removeClass($this.options.cls).filter("a[href='#"+target.attr("id")+"']").addClass($this.options.cls);
1055
949
  }
1056
950
 
1057
- if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
1058
- e.preventDefault();
1059
- }
951
+ $this.element.trigger("uk.scrollspynav.inview", [target, navitems]);
952
+ }
953
+ };
1060
954
 
1061
- $this.show();
955
+ if(this.options.smoothscroll && UI["smoothScroll"]) {
956
+ links.each(function(){
957
+ UI.smoothScroll(this, $this.options.smoothscroll);
1062
958
  });
1063
959
  }
1064
- },
1065
960
 
1066
- show: function(){
961
+ fn();
1067
962
 
1068
- if (active && active[0] != this.element[0]) {
1069
- active.removeClass("uk-open");
1070
- }
963
+ this.element.data("scrollspynav", this);
1071
964
 
1072
- if (hoverIdle) {
1073
- clearTimeout(hoverIdle);
1074
- }
965
+ this.check = fn;
966
+ scrollspynavs.push(this);
1075
967
 
1076
- this.checkDimensions();
1077
- this.element.addClass("uk-open");
1078
- this.trigger('uk.dropdown.show', [this]);
968
+ }
969
+ });
1079
970
 
1080
- UI.Utils.checkDisplay(this.dropdown);
1081
- active = this.element;
1082
971
 
1083
- this.registerOuterClick();
1084
- },
972
+ var fnCheck = function(){
973
+ checkScrollSpy();
974
+ checkScrollSpyNavs();
975
+ };
1085
976
 
1086
- registerOuterClick: function(){
977
+ // listen to scroll and resize
978
+ $doc.on("uk-scroll", fnCheck);
979
+ $win.on("resize orientationchange", UI.Utils.debounce(fnCheck, 50));
1087
980
 
1088
- var $this = this;
981
+ // init code
982
+ UI.ready(function(context) {
1089
983
 
1090
- UI.$doc.off("click.outer.dropdown");
984
+ $("[data-uk-scrollspy]", context).each(function() {
1091
985
 
1092
- setTimeout(function() {
1093
- UI.$doc.on("click.outer.dropdown", function(e) {
986
+ var element = $(this);
1094
987
 
1095
- if (hoverIdle) {
1096
- clearTimeout(hoverIdle);
1097
- }
988
+ if (!element.data("scrollspy")) {
989
+ var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
990
+ }
991
+ });
1098
992
 
1099
- var $target = $(e.target);
993
+ $("[data-uk-scrollspy-nav]", context).each(function() {
1100
994
 
1101
- if (active && active[0] == $this.element[0] && ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length)) {
1102
- active.removeClass("uk-open");
1103
- UI.$doc.off("click.outer.dropdown");
1104
- }
1105
- });
1106
- }, 10);
1107
- },
995
+ var element = $(this);
1108
996
 
1109
- checkDimensions: function() {
997
+ if (!element.data("scrollspynav")) {
998
+ var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
999
+ }
1000
+ });
1001
+ });
1110
1002
 
1111
- if(!this.dropdown.length) return;
1003
+ })(jQuery, jQuery.UIkit);
1112
1004
 
1113
- if (this.justified && this.justified.length) {
1114
- this.dropdown.css("min-width", "");
1115
- }
1005
+ (function(global, $, UI){
1116
1006
 
1117
- var $this = this,
1118
- dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, ""),
1119
- offset = dropdown.show().offset(),
1120
- width = dropdown.outerWidth(),
1121
- boundarywidth = this.boundary.width(),
1122
- boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
1007
+ var togglers = [];
1123
1008
 
1124
- // centered dropdown
1125
- if (this.centered) {
1126
- dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
1127
- offset = dropdown.offset();
1009
+ UI.component('toggle', {
1128
1010
 
1129
- // reset dropdown
1130
- if ((width + offset.left) > boundarywidth || offset.left < 0) {
1131
- dropdown.css("margin-" + $.UIkit.langdirection, "");
1132
- offset = dropdown.offset();
1133
- }
1134
- }
1011
+ defaults: {
1012
+ target: false,
1013
+ cls: 'uk-hidden'
1014
+ },
1135
1015
 
1136
- // justify dropdown
1137
- if (this.justified && this.justified.length) {
1016
+ init: function() {
1138
1017
 
1139
- var jwidth = this.justified.outerWidth();
1018
+ var $this = this;
1140
1019
 
1141
- dropdown.css("min-width", jwidth);
1020
+ this.getTogglers();
1142
1021
 
1143
- if ($.UIkit.langdirection == 'right') {
1022
+ this.on("click", function(e) {
1023
+ if ($this.element.is('a[href="#"]')) e.preventDefault();
1024
+ $this.toggle();
1025
+ });
1144
1026
 
1145
- var right1 = boundarywidth - (this.justified.offset().left + jwidth),
1146
- right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
1027
+ togglers.push(this);
1028
+ },
1147
1029
 
1148
- dropdown.css("margin-right", right1 - right2);
1030
+ toggle: function() {
1149
1031
 
1150
- } else {
1151
- dropdown.css("margin-left", this.justified.offset().left - offset.left);
1152
- }
1032
+ if(!this.totoggle.length) return;
1153
1033
 
1154
- offset = dropdown.offset();
1034
+ this.totoggle.toggleClass(this.options.cls);
1155
1035
 
1036
+ if (this.options.cls == 'uk-hidden') {
1037
+ UI.Utils.checkDisplay(this.totoggle);
1156
1038
  }
1039
+ },
1157
1040
 
1158
- if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
1159
- dropdown.addClass("uk-dropdown-flip");
1160
- offset = dropdown.offset();
1041
+ getTogglers: function() {
1042
+ this.totoggle = this.options.target ? $(this.options.target):[];
1043
+ }
1044
+ });
1045
+
1046
+ // init code
1047
+ UI.ready(function(context) {
1048
+
1049
+ $("[data-uk-toggle]", context).each(function() {
1050
+ var ele = $(this);
1051
+
1052
+ if (!ele.data("toggle")) {
1053
+ var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
1161
1054
  }
1055
+ });
1162
1056
 
1163
- if ((offset.left-boundaryoffset) < 0) {
1057
+ setTimeout(function(){
1164
1058
 
1165
- dropdown.addClass("uk-dropdown-stack");
1059
+ togglers.forEach(function(toggler){
1060
+ toggler.getTogglers();
1061
+ });
1166
1062
 
1167
- if (dropdown.hasClass("uk-dropdown-flip")) {
1063
+ }, 0);
1064
+ });
1168
1065
 
1169
- if (!this.flipped) {
1170
- dropdown.removeClass("uk-dropdown-flip");
1171
- offset = dropdown.offset();
1172
- dropdown.addClass("uk-dropdown-flip");
1173
- }
1066
+ })(this, jQuery, jQuery.UIkit);
1067
+ (function($, UI) {
1174
1068
 
1175
- setTimeout(function(){
1069
+ "use strict";
1176
1070
 
1177
- if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
1178
- dropdown.removeClass("uk-dropdown-flip");
1179
- }
1180
- }, 0);
1181
- }
1071
+ UI.component('alert', {
1182
1072
 
1183
- this.trigger('uk.dropdown.stack', [this]);
1073
+ defaults: {
1074
+ "fade": true,
1075
+ "duration": 200,
1076
+ "trigger": ".uk-alert-close"
1077
+ },
1078
+
1079
+ init: function() {
1080
+
1081
+ var $this = this;
1082
+
1083
+ this.on("click", this.options.trigger, function(e) {
1084
+ e.preventDefault();
1085
+ $this.close();
1086
+ });
1087
+ },
1088
+
1089
+ close: function() {
1090
+
1091
+ var element = this.trigger("uk.alert.close");
1092
+
1093
+ if (this.options.fade) {
1094
+ element.css("overflow", "hidden").css("max-height", element.height()).animate({
1095
+ "height": 0,
1096
+ "opacity": 0,
1097
+ "padding-top": 0,
1098
+ "padding-bottom": 0,
1099
+ "margin-top": 0,
1100
+ "margin-bottom": 0
1101
+ }, this.options.duration, removeElement);
1102
+ } else {
1103
+ removeElement();
1184
1104
  }
1185
1105
 
1186
- dropdown.css("display", "");
1106
+ function removeElement() {
1107
+ element.trigger("uk.alert.closed").remove();
1108
+ }
1187
1109
  }
1188
1110
 
1189
1111
  });
1190
1112
 
1191
- var triggerevent = UI.support.touch ? "click" : "mouseenter";
1192
-
1193
1113
  // init code
1194
- UI.$doc.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
1195
- var ele = $(this);
1114
+ UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
1196
1115
 
1197
- if (!ele.data("dropdown")) {
1116
+ var ele = $(this);
1198
1117
 
1199
- var dropdown = UI.dropdown(ele, UI.Utils.options(ele.data("uk-dropdown")));
1118
+ if (!ele.data("alert")) {
1200
1119
 
1201
- if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
1202
- dropdown.element.trigger(triggerevent);
1203
- }
1120
+ var alert = UI.alert(ele, UI.Utils.options(ele.data("uk-alert")));
1204
1121
 
1205
- if(dropdown.element.find('.uk-dropdown').length) {
1122
+ if ($(e.target).is(ele.data("alert").options.trigger)) {
1206
1123
  e.preventDefault();
1124
+ alert.close();
1207
1125
  }
1208
1126
  }
1209
1127
  });
1210
1128
 
1211
1129
  })(jQuery, jQuery.UIkit);
1212
-
1213
1130
  (function($, UI) {
1214
1131
 
1215
1132
  "use strict";
1216
1133
 
1217
- var grids = [];
1218
-
1219
- UI.component('gridMatchHeight', {
1134
+ UI.component('buttonRadio', {
1220
1135
 
1221
1136
  defaults: {
1222
- "target" : false,
1223
- "row" : true
1137
+ "target": ".uk-button"
1224
1138
  },
1225
1139
 
1226
1140
  init: function() {
1227
1141
 
1228
1142
  var $this = this;
1229
1143
 
1230
- this.columns = this.element.children();
1231
- this.elements = this.options.target ? this.find(this.options.target) : this.columns;
1232
-
1233
- if (!this.columns.length) return;
1144
+ this.on("click", this.options.target, function(e) {
1234
1145
 
1235
- UI.$win.on('resize orientationchange', (function() {
1146
+ if ($(this).is('a[href="#"]')) e.preventDefault();
1236
1147
 
1237
- var fn = function() {
1238
- $this.match();
1239
- };
1148
+ $this.find($this.options.target).not(this).removeClass("uk-active").blur();
1149
+ $this.trigger("uk.button.change", [$(this).addClass("uk-active")]);
1150
+ });
1240
1151
 
1241
- $(function() {
1242
- fn();
1243
- UI.$win.on("load", fn);
1244
- });
1152
+ },
1245
1153
 
1246
- return UI.Utils.debounce(fn, 50);
1247
- })());
1248
-
1249
- UI.$doc.on("uk.dom.changed", function(e) {
1250
- $this.columns = $this.element.children();
1251
- $this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
1252
- $this.match();
1253
- });
1154
+ getSelected: function() {
1155
+ return this.find(".uk-active");
1156
+ }
1157
+ });
1254
1158
 
1255
- this.on("uk-check-display", function(e) {
1256
- if(this.element.is(":visible")) this.match();
1257
- }.bind(this));
1159
+ UI.component('buttonCheckbox', {
1258
1160
 
1259
- grids.push(this);
1161
+ defaults: {
1162
+ "target": ".uk-button"
1260
1163
  },
1261
1164
 
1262
- match: function() {
1263
-
1264
- this.revert();
1265
-
1266
- var firstvisible = this.columns.filter(":visible:first");
1267
-
1268
- if (!firstvisible.length) return;
1269
-
1270
- var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false,
1271
- max = 0,
1272
- $this = this;
1165
+ init: function() {
1273
1166
 
1274
- if (stacked) return;
1167
+ var $this = this;
1275
1168
 
1276
- if(this.options.row) {
1169
+ this.on("click", this.options.target, function(e) {
1277
1170
 
1278
- this.element.width(); // force redraw
1171
+ if ($(this).is('a[href="#"]')) e.preventDefault();
1279
1172
 
1280
- setTimeout(function(){
1173
+ $this.trigger("uk.button.change", [$(this).toggleClass("uk-active").blur()]);
1174
+ });
1281
1175
 
1282
- var lastoffset = false, group = [];
1176
+ },
1283
1177
 
1284
- $this.elements.each(function(i) {
1285
- var ele = $(this), offset = ele.offset().top;
1178
+ getSelected: function() {
1179
+ return this.find(".uk-active");
1180
+ }
1181
+ });
1286
1182
 
1287
- if(offset != lastoffset && group.length) {
1288
1183
 
1289
- $this.matchHeights($(group));
1290
- group = [];
1291
- offset = ele.offset().top;
1292
- }
1184
+ UI.component('button', {
1293
1185
 
1294
- group.push(ele);
1295
- lastoffset = offset;
1296
- });
1186
+ defaults: {},
1297
1187
 
1298
- if(group.length) {
1299
- $this.matchHeights($(group));
1300
- }
1188
+ init: function() {
1301
1189
 
1302
- }, 0);
1190
+ var $this = this;
1303
1191
 
1304
- } else {
1192
+ this.on("click", function(e) {
1305
1193
 
1306
- this.matchHeights(this.elements);
1307
- }
1194
+ if ($this.element.is('a[href="#"]')) e.preventDefault();
1308
1195
 
1309
- return this;
1310
- },
1196
+ $this.toggle();
1197
+ $this.trigger("uk.button.change", [$this.element.blur().hasClass("uk-active")]);
1198
+ });
1311
1199
 
1312
- revert: function() {
1313
- this.elements.css('min-height', '');
1314
- return this;
1315
1200
  },
1316
1201
 
1317
- matchHeights: function(elements){
1318
-
1319
- if(elements.length < 2) return;
1202
+ toggle: function() {
1203
+ this.element.toggleClass("uk-active");
1204
+ }
1205
+ });
1320
1206
 
1321
- var max = 0;
1322
1207
 
1323
- elements.each(function() {
1324
- max = Math.max(max, $(this).outerHeight());
1325
- }).each(function(i) {
1208
+ // init code
1209
+ UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
1210
+ var ele = $(this);
1326
1211
 
1327
- var element = $(this),
1328
- height = max - (element.outerHeight() - element.height());
1212
+ if (!ele.data("buttonRadio")) {
1213
+ var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio")));
1329
1214
 
1330
- element.css('min-height', height + 'px');
1331
- });
1215
+ if ($(e.target).is(obj.options.target)) {
1216
+ $(e.target).trigger("click");
1217
+ }
1332
1218
  }
1333
1219
  });
1334
1220
 
1335
- UI.component('gridMargin', {
1336
-
1337
- defaults: {
1338
- "cls": "uk-grid-margin"
1339
- },
1221
+ UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
1222
+ var ele = $(this);
1340
1223
 
1341
- init: function() {
1224
+ if (!ele.data("buttonCheckbox")) {
1342
1225
 
1343
- var $this = this;
1226
+ var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))), target=$(e.target);
1344
1227
 
1345
- var stackMargin = UI.stackMargin(this.element, this.options);
1228
+ if (target.is(obj.options.target)) {
1229
+ ele.trigger("uk.button.change", [target.toggleClass("uk-active").blur()]);
1230
+ }
1346
1231
  }
1347
1232
  });
1348
1233
 
1234
+ UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
1235
+ var ele = $(this);
1349
1236
 
1350
- // init code
1351
- UI.ready(function(context) {
1352
-
1353
- $("[data-uk-grid-match],[data-uk-grid-margin]", context).each(function() {
1354
- var grid = $(this), obj;
1355
-
1356
- if (grid.is("[data-uk-grid-match]") && !grid.data("gridMatchHeight")) {
1357
- obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
1358
- }
1237
+ if (!ele.data("button")) {
1359
1238
 
1360
- if (grid.is("[data-uk-grid-margin]") && !grid.data("gridMargin")) {
1361
- obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
1362
- }
1363
- });
1239
+ var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
1240
+ ele.trigger("click");
1241
+ }
1364
1242
  });
1365
1243
 
1366
1244
  })(jQuery, jQuery.UIkit);
@@ -1369,264 +1247,259 @@
1369
1247
 
1370
1248
  "use strict";
1371
1249
 
1372
- var active = false, $html = $('html'), body;
1250
+ var active = false, hoverIdle;
1373
1251
 
1374
- UI.component('modal', {
1252
+ UI.component('dropdown', {
1375
1253
 
1376
1254
  defaults: {
1377
- keyboard: true,
1378
- bgclose: true,
1379
- minScrollHeight: 150
1255
+ 'mode' : 'hover',
1256
+ 'remaintime' : 800,
1257
+ 'justify' : false,
1258
+ 'boundary' : UI.$win,
1259
+ 'delay' : 0
1380
1260
  },
1381
1261
 
1382
- scrollable: false,
1383
- transition: false,
1262
+ remainIdle: false,
1384
1263
 
1385
1264
  init: function() {
1386
1265
 
1387
- if (!body) body = $('body');
1388
-
1389
1266
  var $this = this;
1390
1267
 
1391
- this.transition = UI.support.transition;
1392
- this.dialog = this.find(".uk-modal-dialog");
1393
-
1394
- this.on("click", ".uk-modal-close", function(e) {
1395
- e.preventDefault();
1396
- $this.hide();
1268
+ this.dropdown = this.find(".uk-dropdown");
1397
1269
 
1398
- }).on("click", function(e) {
1270
+ this.centered = this.dropdown.hasClass("uk-dropdown-center");
1271
+ this.justified = this.options.justify ? $(this.options.justify) : false;
1399
1272
 
1400
- var target = $(e.target);
1273
+ this.boundary = $(this.options.boundary);
1274
+ this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
1401
1275
 
1402
- if (target[0] == $this.element[0] && $this.options.bgclose) {
1403
- $this.hide();
1404
- }
1405
- });
1406
- },
1276
+ if (!this.boundary.length) {
1277
+ this.boundary = UI.$win;
1278
+ }
1407
1279
 
1408
- toggle: function() {
1409
- return this[this.isActive() ? "hide" : "show"]();
1410
- },
1280
+ if (this.options.mode == "click" || UI.support.touch) {
1411
1281
 
1412
- show: function() {
1282
+ this.on("click", function(e) {
1413
1283
 
1414
- var $this = this;
1284
+ var $target = $(e.target);
1415
1285
 
1416
- if (this.isActive()) return;
1417
- if (active) active.hide(true);
1286
+ if (!$target.parents(".uk-dropdown").length) {
1418
1287
 
1419
- this.element.removeClass("uk-open").show();
1420
- this.resize();
1288
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
1289
+ e.preventDefault();
1290
+ }
1421
1291
 
1422
- active = this;
1423
- $html.addClass("uk-modal-page").height(); // force browser engine redraw
1292
+ $target.blur();
1293
+ }
1424
1294
 
1425
- this.element.addClass("uk-open").trigger("uk.modal.show");
1295
+ if (!$this.element.hasClass("uk-open")) {
1426
1296
 
1427
- UI.Utils.checkDisplay(this.dialog);
1297
+ $this.show();
1428
1298
 
1429
- return this;
1430
- },
1299
+ } else {
1431
1300
 
1432
- hide: function(force) {
1301
+ if ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length) {
1302
+ $this.hide();
1303
+ }
1304
+ }
1305
+ });
1433
1306
 
1434
- if (!this.isActive()) return;
1307
+ } else {
1435
1308
 
1436
- if (!force && UI.support.transition) {
1309
+ this.on("mouseenter", function(e) {
1437
1310
 
1438
- var $this = this;
1311
+ if ($this.remainIdle) {
1312
+ clearTimeout($this.remainIdle);
1313
+ }
1439
1314
 
1440
- this.one(UI.support.transition.end, function() {
1441
- $this._hide();
1442
- }).removeClass("uk-open");
1315
+ if (hoverIdle) {
1316
+ clearTimeout(hoverIdle);
1317
+ }
1443
1318
 
1444
- } else {
1319
+ hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
1445
1320
 
1446
- this._hide();
1447
- }
1321
+ }).on("mouseleave", function() {
1448
1322
 
1449
- return this;
1450
- },
1323
+ if (hoverIdle) {
1324
+ clearTimeout(hoverIdle);
1325
+ }
1451
1326
 
1452
- resize: function() {
1327
+ $this.remainIdle = setTimeout(function() {
1328
+ $this.hide();
1329
+ }, $this.options.remaintime);
1453
1330
 
1454
- var paddingdir = "padding-" + (UI.langdirection == 'left' ? "left":"right"),
1455
- margindir = "margin-" + (UI.langdirection == 'left' ? "left":"right"),
1456
- bodywidth = body.width();
1331
+ }).on("click", function(e){
1457
1332
 
1458
- this.scrollbarwidth = window.innerWidth - bodywidth;
1333
+ var $target = $(e.target);
1459
1334
 
1460
- $html.css(margindir, this.scrollbarwidth * -1);
1335
+ if ($this.remainIdle) {
1336
+ clearTimeout($this.remainIdle);
1337
+ }
1461
1338
 
1462
- this.element.css(paddingdir, "");
1339
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
1340
+ e.preventDefault();
1341
+ }
1463
1342
 
1464
- if (this.dialog.offset().left > this.scrollbarwidth) {
1465
- this.element.css(paddingdir, this.scrollbarwidth - (this.element[0].scrollHeight==window.innerHeight ? 0:this.scrollbarwidth ));
1343
+ $this.show();
1344
+ });
1466
1345
  }
1467
-
1468
- this.updateScrollable();
1469
-
1470
1346
  },
1471
1347
 
1472
- updateScrollable: function() {
1348
+ show: function(){
1473
1349
 
1474
- // has scrollable?
1350
+ UI.$html.off("click.outer.dropdown");
1475
1351
 
1476
- var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
1352
+ if (active && active[0] != this.element[0]) {
1353
+ active.removeClass("uk-open");
1354
+ }
1477
1355
 
1478
- if (scrollable) {
1356
+ if (hoverIdle) {
1357
+ clearTimeout(hoverIdle);
1358
+ }
1479
1359
 
1480
- scrollable.css("height", 0);
1360
+ this.checkDimensions();
1361
+ this.element.addClass("uk-open");
1362
+ this.trigger('uk.dropdown.show', [this]);
1481
1363
 
1482
- var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
1483
- dh = this.dialog.outerHeight(),
1484
- wh = window.innerHeight,
1485
- h = wh - 2*(offset < 20 ? 20:offset) - dh;
1364
+ UI.Utils.checkDisplay(this.dropdown);
1365
+ active = this.element;
1486
1366
 
1487
- scrollable.css("height", h < this.options.minScrollHeight ? "":h);
1488
- }
1367
+ this.registerOuterClick();
1489
1368
  },
1490
1369
 
1491
- _hide: function() {
1492
-
1493
- this.element.hide().removeClass("uk-open");
1370
+ hide: function() {
1371
+ this.element.removeClass("uk-open");
1372
+ this.remainIdle = false;
1494
1373
 
1495
- $html.removeClass("uk-modal-page").css("margin-" + (UI.langdirection == 'left' ? "left":"right"), "");
1374
+ if (active && active[0] == this.element[0]) active = false;
1375
+ },
1496
1376
 
1497
- if(active===this) active = false;
1377
+ registerOuterClick: function(){
1498
1378
 
1499
- this.trigger("uk.modal.hide");
1500
- },
1379
+ var $this = this;
1501
1380
 
1502
- isActive: function() {
1503
- return (active == this);
1504
- }
1381
+ UI.$html.off("click.outer.dropdown");
1505
1382
 
1506
- });
1383
+ setTimeout(function() {
1507
1384
 
1508
- UI.component('modalTrigger', {
1385
+ UI.$html.on("click.outer.dropdown", function(e) {
1509
1386
 
1510
- init: function() {
1387
+ if (hoverIdle) {
1388
+ clearTimeout(hoverIdle);
1389
+ }
1511
1390
 
1512
- var $this = this;
1391
+ var $target = $(e.target);
1513
1392
 
1514
- this.options = $.extend({
1515
- "target": $this.element.is("a") ? $this.element.attr("href") : false
1516
- }, this.options);
1393
+ if (active && active[0] == $this.element[0] && ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length)) {
1394
+ $this.hide();
1395
+ UI.$html.off("click.outer.dropdown");
1396
+ }
1397
+ });
1398
+ }, 10);
1399
+ },
1517
1400
 
1518
- this.modal = UI.modal(this.options.target, this.options);
1401
+ checkDimensions: function() {
1519
1402
 
1520
- this.on("click", function(e) {
1521
- e.preventDefault();
1522
- $this.show();
1523
- });
1403
+ if (!this.dropdown.length) return;
1524
1404
 
1525
- //methods
1526
- this.proxy(this.modal, "show hide isActive");
1527
- }
1528
- });
1405
+ if (this.justified && this.justified.length) {
1406
+ this.dropdown.css("min-width", "");
1407
+ }
1529
1408
 
1530
- UI.modal.dialog = function(content, options) {
1409
+ var $this = this,
1410
+ dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, ""),
1411
+ offset = dropdown.show().offset(),
1412
+ width = dropdown.outerWidth(),
1413
+ boundarywidth = this.boundary.width(),
1414
+ boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
1531
1415
 
1532
- var modal = UI.modal($(UI.modal.dialog.template).appendTo("body"), options);
1416
+ // centered dropdown
1417
+ if (this.centered) {
1418
+ dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
1419
+ offset = dropdown.offset();
1533
1420
 
1534
- modal.on("uk.modal.hide", function(){
1535
- if (modal.persist) {
1536
- modal.persist.appendTo(modal.persist.data("modalPersistParent"));
1537
- modal.persist = false;
1421
+ // reset dropdown
1422
+ if ((width + offset.left) > boundarywidth || offset.left < 0) {
1423
+ dropdown.css("margin-" + $.UIkit.langdirection, "");
1424
+ offset = dropdown.offset();
1425
+ }
1538
1426
  }
1539
- modal.element.remove();
1540
- });
1541
1427
 
1542
- setContent(content, modal);
1428
+ // justify dropdown
1429
+ if (this.justified && this.justified.length) {
1543
1430
 
1544
- return modal;
1545
- };
1431
+ var jwidth = this.justified.outerWidth();
1546
1432
 
1547
- UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog"></div></div>';
1433
+ dropdown.css("min-width", jwidth);
1548
1434
 
1549
- UI.modal.alert = function(content, options) {
1435
+ if ($.UIkit.langdirection == 'right') {
1550
1436
 
1551
- UI.modal.dialog(([
1552
- '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
1553
- '<div class="uk-modal-buttons"><button class="uk-button uk-button-primary uk-modal-close">Ok</button></div>'
1554
- ]).join(""), $.extend({bgclose:false, keyboard:false}, options)).show();
1555
- };
1437
+ var right1 = boundarywidth - (this.justified.offset().left + jwidth),
1438
+ right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
1556
1439
 
1557
- UI.modal.confirm = function(content, onconfirm, options) {
1440
+ dropdown.css("margin-right", right1 - right2);
1558
1441
 
1559
- onconfirm = $.isFunction(onconfirm) ? onconfirm : function(){};
1442
+ } else {
1443
+ dropdown.css("margin-left", this.justified.offset().left - offset.left);
1444
+ }
1560
1445
 
1561
- var modal = UI.modal.dialog(([
1562
- '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
1563
- '<div class="uk-modal-buttons"><button class="uk-button uk-button-primary js-modal-confirm">Ok</button> <button class="uk-button uk-modal-close">Cancel</button></div>'
1564
- ]).join(""), $.extend({bgclose:false, keyboard:false}, options));
1446
+ offset = dropdown.offset();
1565
1447
 
1566
- modal.element.find(".js-modal-confirm").on("click", function(){
1567
- onconfirm();
1568
- modal.hide();
1569
- });
1448
+ }
1570
1449
 
1571
- modal.show();
1572
- };
1450
+ if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
1451
+ dropdown.addClass("uk-dropdown-flip");
1452
+ offset = dropdown.offset();
1453
+ }
1573
1454
 
1574
- // init code
1575
- UI.$doc.on("click.modal.uikit", "[data-uk-modal]", function(e) {
1455
+ if ((offset.left-boundaryoffset) < 0) {
1576
1456
 
1577
- var ele = $(this);
1457
+ dropdown.addClass("uk-dropdown-stack");
1578
1458
 
1579
- if(ele.is("a")) {
1580
- e.preventDefault();
1581
- }
1459
+ if (dropdown.hasClass("uk-dropdown-flip")) {
1582
1460
 
1583
- if (!ele.data("modalTrigger")) {
1584
- var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
1585
- modal.show();
1586
- }
1461
+ if (!this.flipped) {
1462
+ dropdown.removeClass("uk-dropdown-flip");
1463
+ offset = dropdown.offset();
1464
+ dropdown.addClass("uk-dropdown-flip");
1465
+ }
1587
1466
 
1588
- });
1467
+ setTimeout(function(){
1589
1468
 
1590
- // close modal on esc button
1591
- UI.$doc.on('keydown.modal.uikit', function (e) {
1469
+ if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
1470
+ dropdown.removeClass("uk-dropdown-flip");
1471
+ }
1472
+ }, 0);
1473
+ }
1592
1474
 
1593
- if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
1594
- e.preventDefault();
1595
- active.hide();
1475
+ this.trigger('uk.dropdown.stack', [this]);
1476
+ }
1477
+
1478
+ dropdown.css("display", "");
1596
1479
  }
1480
+
1597
1481
  });
1598
1482
 
1599
- UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
1600
- if(active) active.resize();
1601
- }, 150));
1483
+ var triggerevent = UI.support.touch ? "click" : "mouseenter";
1602
1484
 
1485
+ // init code
1486
+ UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
1603
1487
 
1604
- // helper functions
1605
- function setContent(content, modal){
1488
+ var ele = $(this);
1606
1489
 
1607
- if(!modal) return;
1490
+ if (!ele.data("dropdown")) {
1608
1491
 
1609
- if (typeof content === 'object') {
1492
+ var dropdown = UI.dropdown(ele, UI.Utils.options(ele.data("uk-dropdown")));
1610
1493
 
1611
- // convert DOM object to a jQuery object
1612
- content = content instanceof jQuery ? content : $(content);
1494
+ if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
1495
+ dropdown.element.trigger(triggerevent);
1496
+ }
1613
1497
 
1614
- if(content.parent().length) {
1615
- modal.persist = content;
1616
- modal.persist.data("modalPersistParent", content.parent());
1498
+ if(dropdown.element.find('.uk-dropdown').length) {
1499
+ e.preventDefault();
1617
1500
  }
1618
- }else if (typeof content === 'string' || typeof content === 'number') {
1619
- // just insert the data as innerHTML
1620
- content = $('<div></div>').html(content);
1621
- }else {
1622
- // unsupported data type!
1623
- content = $('<div></div>').html('$.UIkitt.modal Error: Unsupported data type: ' + typeof content);
1624
1501
  }
1625
-
1626
- content.appendTo(modal.element.find('.uk-modal-dialog'));
1627
-
1628
- return modal;
1629
- }
1502
+ });
1630
1503
 
1631
1504
  })(jQuery, jQuery.UIkit);
1632
1505
 
@@ -1634,447 +1507,428 @@
1634
1507
 
1635
1508
  "use strict";
1636
1509
 
1637
- var scrollpos = {x: window.scrollX, y: window.scrollY},
1638
- $win = UI.$win,
1639
- $doc = UI.$doc,
1640
- $html = $('html'),
1641
- Offcanvas = {
1642
-
1643
- show: function(element) {
1644
-
1645
- element = $(element);
1646
-
1647
- if (!element.length) return;
1510
+ var grids = [];
1648
1511
 
1649
- var $body = $('body'),
1650
- winwidth = $win.width(),
1651
- bar = element.find(".uk-offcanvas-bar:first"),
1652
- rtl = ($.UIkit.langdirection == "right"),
1653
- flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
1654
- dir = flip * (rtl ? -1 : 1);
1512
+ UI.component('gridMatchHeight', {
1655
1513
 
1656
- scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
1514
+ defaults: {
1515
+ "target" : false,
1516
+ "row" : true
1517
+ },
1657
1518
 
1658
- element.addClass("uk-active");
1519
+ init: function() {
1659
1520
 
1660
- $body.css({"width": window.innerWidth, "height": $win.height()}).addClass("uk-offcanvas-page");
1661
- $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
1521
+ var $this = this;
1662
1522
 
1663
- $html.css('margin-top', scrollpos.y * -1);
1523
+ this.columns = this.element.children();
1524
+ this.elements = this.options.target ? this.find(this.options.target) : this.columns;
1664
1525
 
1665
- bar.addClass("uk-offcanvas-bar-show");
1526
+ if (!this.columns.length) return;
1666
1527
 
1667
- element.off(".ukoffcanvas").on("click.ukoffcanvas swipeRight.ukoffcanvas swipeLeft.ukoffcanvas", function(e) {
1528
+ UI.$win.on('resize orientationchange', (function() {
1668
1529
 
1669
- var target = $(e.target);
1530
+ var fn = function() {
1531
+ $this.match();
1532
+ };
1670
1533
 
1671
- if (!e.type.match(/swipe/)) {
1534
+ $(function() {
1535
+ fn();
1536
+ UI.$win.on("load", fn);
1537
+ });
1672
1538
 
1673
- if (!target.hasClass("uk-offcanvas-close")) {
1674
- if (target.hasClass("uk-offcanvas-bar")) return;
1675
- if (target.parents(".uk-offcanvas-bar:first").length) return;
1676
- }
1677
- }
1539
+ return UI.Utils.debounce(fn, 50);
1540
+ })());
1678
1541
 
1679
- e.stopImmediatePropagation();
1680
- Offcanvas.hide();
1542
+ UI.$html.on("uk.dom.changed", function(e) {
1543
+ $this.columns = $this.element.children();
1544
+ $this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
1545
+ $this.match();
1681
1546
  });
1682
1547
 
1683
- $doc.on('keydown.ukoffcanvas', function(e) {
1684
- if (e.keyCode === 27) { // ESC
1685
- Offcanvas.hide();
1686
- }
1687
- });
1548
+ this.on("uk.check.display", function(e) {
1549
+ if(this.element.is(":visible")) this.match();
1550
+ }.bind(this));
1688
1551
 
1689
- $doc.trigger('uk.offcanvas.show', [element, bar]);
1552
+ grids.push(this);
1690
1553
  },
1691
1554
 
1692
- hide: function(force) {
1555
+ match: function() {
1693
1556
 
1694
- var $body = $('body'),
1695
- panel = $(".uk-offcanvas.uk-active"),
1696
- rtl = ($.UIkit.langdirection == "right"),
1697
- bar = panel.find(".uk-offcanvas-bar:first"),
1698
- finalize = function() {
1699
- $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
1700
- panel.removeClass("uk-active");
1701
- bar.removeClass("uk-offcanvas-bar-show");
1702
- $html.css('margin-top', '');
1703
- window.scrollTo(scrollpos.x, scrollpos.y);
1704
- $doc.trigger('uk.offcanvas.hide', [panel, bar]);
1705
- };
1557
+ this.revert();
1706
1558
 
1707
- if (!panel.length) return;
1559
+ var firstvisible = this.columns.filter(":visible:first");
1708
1560
 
1709
- if ($.UIkit.support.transition && !force) {
1561
+ if (!firstvisible.length) return;
1710
1562
 
1711
- $body.one($.UIkit.support.transition.end, function() {
1712
- finalize();
1713
- }).css((rtl ? "margin-right" : "margin-left"), "");
1563
+ var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false,
1564
+ max = 0,
1565
+ $this = this;
1566
+
1567
+ if (stacked) return;
1568
+
1569
+ if(this.options.row) {
1570
+
1571
+ this.element.width(); // force redraw
1714
1572
 
1715
1573
  setTimeout(function(){
1716
- bar.removeClass("uk-offcanvas-bar-show");
1574
+
1575
+ var lastoffset = false, group = [];
1576
+
1577
+ $this.elements.each(function(i) {
1578
+ var ele = $(this), offset = ele.offset().top;
1579
+
1580
+ if(offset != lastoffset && group.length) {
1581
+
1582
+ $this.matchHeights($(group));
1583
+ group = [];
1584
+ offset = ele.offset().top;
1585
+ }
1586
+
1587
+ group.push(ele);
1588
+ lastoffset = offset;
1589
+ });
1590
+
1591
+ if(group.length) {
1592
+ $this.matchHeights($(group));
1593
+ }
1594
+
1717
1595
  }, 0);
1718
1596
 
1719
1597
  } else {
1720
- finalize();
1598
+
1599
+ this.matchHeights(this.elements);
1721
1600
  }
1722
1601
 
1723
- panel.off(".ukoffcanvas");
1724
- $doc.off(".ukoffcanvas");
1602
+ return this;
1603
+ },
1604
+
1605
+ revert: function() {
1606
+ this.elements.css('min-height', '');
1607
+ return this;
1608
+ },
1609
+
1610
+ matchHeights: function(elements){
1611
+
1612
+ if(elements.length < 2) return;
1613
+
1614
+ var max = 0;
1615
+
1616
+ elements.each(function() {
1617
+ max = Math.max(max, $(this).outerHeight());
1618
+ }).each(function(i) {
1619
+
1620
+ var element = $(this),
1621
+ height = max - (element.outerHeight() - element.height());
1622
+
1623
+ element.css('min-height', height + 'px');
1624
+ });
1725
1625
  }
1726
- };
1626
+ });
1727
1627
 
1728
- UI.component('offcanvasTrigger', {
1628
+ UI.component('gridMargin', {
1629
+
1630
+ defaults: {
1631
+ "cls": "uk-grid-margin"
1632
+ },
1729
1633
 
1730
1634
  init: function() {
1731
1635
 
1732
1636
  var $this = this;
1733
1637
 
1734
- this.options = $.extend({
1735
- "target": $this.element.is("a") ? $this.element.attr("href") : false
1736
- }, this.options);
1737
-
1738
- this.on("click", function(e) {
1739
- e.preventDefault();
1740
- Offcanvas.show($this.options.target);
1741
- });
1638
+ var stackMargin = UI.stackMargin(this.element, this.options);
1742
1639
  }
1743
1640
  });
1744
1641
 
1745
- UI.offcanvas = Offcanvas;
1746
1642
 
1747
1643
  // init code
1748
- $doc.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
1644
+ UI.ready(function(context) {
1749
1645
 
1750
- e.preventDefault();
1646
+ $("[data-uk-grid-match],[data-uk-grid-margin]", context).each(function() {
1647
+ var grid = $(this), obj;
1751
1648
 
1752
- var ele = $(this);
1649
+ if (grid.is("[data-uk-grid-match]") && !grid.data("gridMatchHeight")) {
1650
+ obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
1651
+ }
1753
1652
 
1754
- if (!ele.data("offcanvasTrigger")) {
1755
- var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
1756
- ele.trigger("click");
1757
- }
1653
+ if (grid.is("[data-uk-grid-margin]") && !grid.data("gridMargin")) {
1654
+ obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
1655
+ }
1656
+ });
1758
1657
  });
1759
1658
 
1760
1659
  })(jQuery, jQuery.UIkit);
1761
-
1762
1660
  (function($, UI) {
1763
1661
 
1764
1662
  "use strict";
1765
1663
 
1766
- UI.component('nav', {
1664
+ var active = false, $html = $('html'), body;
1665
+
1666
+ UI.component('modal', {
1767
1667
 
1768
1668
  defaults: {
1769
- "toggle": ">li.uk-parent > a[href='#']",
1770
- "lists": ">li.uk-parent > ul",
1771
- "multiple": false
1669
+ keyboard: true,
1670
+ bgclose: true,
1671
+ minScrollHeight: 150
1772
1672
  },
1773
1673
 
1674
+ scrollable: false,
1675
+ transition: false,
1676
+
1774
1677
  init: function() {
1775
1678
 
1679
+ if (!body) body = $('body');
1680
+
1776
1681
  var $this = this;
1777
1682
 
1778
- this.on("click", this.options.toggle, function(e) {
1683
+ this.transition = UI.support.transition;
1684
+ this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
1685
+ this.dialog = this.find(".uk-modal-dialog");
1686
+
1687
+ this.on("click", ".uk-modal-close", function(e) {
1779
1688
  e.preventDefault();
1780
- var ele = $(this);
1781
- $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
1782
- });
1689
+ $this.hide();
1783
1690
 
1784
- this.find(this.options.lists).each(function() {
1785
- var $ele = $(this),
1786
- parent = $ele.parent(),
1787
- active = parent.hasClass("uk-active");
1691
+ }).on("click", function(e) {
1788
1692
 
1789
- $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
1790
- parent.data("list-container", $ele.parent());
1693
+ var target = $(e.target);
1791
1694
 
1792
- if (active) $this.open(parent, true);
1695
+ if (target[0] == $this.element[0] && $this.options.bgclose) {
1696
+ $this.hide();
1697
+ }
1793
1698
  });
1794
-
1795
1699
  },
1796
1700
 
1797
- open: function(li, noanimation) {
1701
+ toggle: function() {
1702
+ return this[this.isActive() ? "hide" : "show"]();
1703
+ },
1798
1704
 
1799
- var element = this.element, $li = $(li);
1705
+ show: function() {
1800
1706
 
1801
- if (!this.options.multiple) {
1707
+ var $this = this;
1802
1708
 
1803
- element.children(".uk-open").not(li).each(function() {
1804
- if ($(this).data("list-container")) {
1805
- $(this).data("list-container").stop().animate({height: 0}, function() {
1806
- $(this).parent().removeClass("uk-open");
1807
- });
1808
- }
1809
- });
1810
- }
1709
+ if (this.isActive()) return;
1710
+ if (active) active.hide(true);
1811
1711
 
1812
- $li.toggleClass("uk-open");
1712
+ this.element.removeClass("uk-open").show();
1713
+ this.resize();
1813
1714
 
1814
- if ($li.data("list-container")) {
1815
- if (noanimation) {
1816
- $li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
1817
- } else {
1818
- $li.data('list-container').stop().animate({
1819
- height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
1820
- });
1821
- }
1822
- }
1823
- }
1824
- });
1715
+ active = this;
1716
+ $html.addClass("uk-modal-page").height(); // force browser engine redraw
1825
1717
 
1718
+ this.element.addClass("uk-open").trigger("uk.modal.show");
1826
1719
 
1827
- // helper
1720
+ UI.Utils.checkDisplay(this.dialog);
1828
1721
 
1829
- function getHeight(ele) {
1830
- var $ele = $(ele), height = "auto";
1722
+ return this;
1723
+ },
1831
1724
 
1832
- if ($ele.is(":visible")) {
1833
- height = $ele.outerHeight();
1834
- } else {
1835
- var tmp = {
1836
- position: $ele.css("position"),
1837
- visibility: $ele.css("visibility"),
1838
- display: $ele.css("display")
1839
- };
1725
+ hide: function(force) {
1840
1726
 
1841
- height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
1727
+ if (!this.isActive()) return;
1842
1728
 
1843
- $ele.css(tmp); // reset element
1844
- }
1729
+ if (!force && UI.support.transition) {
1845
1730
 
1846
- return height;
1847
- }
1731
+ var $this = this;
1848
1732
 
1849
- // init code
1850
- UI.ready(function(context) {
1733
+ this.one(UI.support.transition.end, function() {
1734
+ $this._hide();
1735
+ }).removeClass("uk-open");
1851
1736
 
1852
- $("[data-uk-nav]", context).each(function() {
1853
- var nav = $(this);
1737
+ } else {
1854
1738
 
1855
- if (!nav.data("nav")) {
1856
- var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
1739
+ this._hide();
1857
1740
  }
1858
- });
1859
- });
1860
1741
 
1861
- })(jQuery, jQuery.UIkit);
1742
+ return this;
1743
+ },
1862
1744
 
1863
- (function($, UI, $win) {
1745
+ resize: function() {
1864
1746
 
1865
- "use strict";
1747
+ var bodywidth = body.width();
1866
1748
 
1867
- var $tooltip, // tooltip container
1868
- tooltipdelay, checkdelay;
1749
+ this.scrollbarwidth = window.innerWidth - bodywidth;
1869
1750
 
1870
- UI.component('tooltip', {
1751
+ body.css(this.paddingdir, this.scrollbarwidth);
1752
+
1753
+ this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
1754
+
1755
+ this.updateScrollable();
1871
1756
 
1872
- defaults: {
1873
- "offset": 5,
1874
- "pos": "top",
1875
- "animation": false,
1876
- "delay": 0, // in miliseconds
1877
- "cls": "",
1878
- "src": function() { return this.attr("title"); }
1879
1757
  },
1880
1758
 
1881
- tip: "",
1759
+ updateScrollable: function() {
1882
1760
 
1883
- init: function() {
1761
+ // has scrollable?
1884
1762
 
1885
- var $this = this;
1763
+ var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
1886
1764
 
1887
- if (!$tooltip) {
1888
- $tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
1889
- }
1765
+ if (scrollable) {
1890
1766
 
1891
- this.on({
1892
- "focus" : function(e) { $this.show(); },
1893
- "blur" : function(e) { $this.hide(); },
1894
- "mouseenter": function(e) { $this.show(); },
1895
- "mouseleave": function(e) { $this.hide(); }
1896
- });
1767
+ scrollable.css("height", 0);
1897
1768
 
1898
- this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
1769
+ var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
1770
+ dh = this.dialog.outerHeight(),
1771
+ wh = window.innerHeight,
1772
+ h = wh - 2*(offset < 20 ? 20:offset) - dh;
1899
1773
 
1900
- // disable title attribute
1901
- this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
1774
+ scrollable.css("height", h < this.options.minScrollHeight ? "":h);
1775
+ }
1902
1776
  },
1903
1777
 
1904
- show: function() {
1778
+ _hide: function() {
1905
1779
 
1906
- if (tooltipdelay) clearTimeout(tooltipdelay);
1907
- if (checkdelay) clearTimeout(checkdelay);
1908
- if (!this.tip.length) return;
1780
+ this.element.hide().removeClass("uk-open");
1909
1781
 
1910
- $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).show();
1911
- $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
1782
+ $html.removeClass("uk-modal-page");
1912
1783
 
1913
- var $this = this,
1914
- pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
1915
- width = $tooltip[0].offsetWidth,
1916
- height = $tooltip[0].offsetHeight,
1917
- offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
1918
- position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
1919
- tmppos = position.split("-"),
1920
- tcss = {
1921
- "display" : "none",
1922
- "visibility" : "visible",
1923
- "top" : (pos.top + pos.height + height),
1924
- "left" : pos.left
1925
- };
1784
+ body.css(this.paddingdir, "");
1926
1785
 
1786
+ if(active===this) active = false;
1927
1787
 
1928
- // prevent strange position
1929
- // when tooltip is in offcanvas etc.
1930
- if ($('html').css('position')=='fixed' || $('body').css('position')=='fixed'){
1931
- var bodyoffset = $('body').offset(),
1932
- htmloffset = $('html').offset(),
1933
- docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
1788
+ this.trigger("uk.modal.hide");
1789
+ },
1934
1790
 
1935
- pos.left -= docoffset.left;
1936
- pos.top -= docoffset.top;
1937
- }
1791
+ isActive: function() {
1792
+ return (active == this);
1793
+ }
1938
1794
 
1795
+ });
1939
1796
 
1940
- if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
1941
- tmppos[0] = tmppos[0] == "left" ? "right" : "left";
1942
- }
1797
+ UI.component('modalTrigger', {
1943
1798
 
1944
- var variants = {
1945
- "bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
1946
- "top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
1947
- "left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
1948
- "right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
1949
- };
1799
+ init: function() {
1950
1800
 
1951
- $.extend(tcss, variants[tmppos[0]]);
1801
+ var $this = this;
1952
1802
 
1953
- if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
1803
+ this.options = $.extend({
1804
+ "target": $this.element.is("a") ? $this.element.attr("href") : false
1805
+ }, this.options);
1954
1806
 
1955
- var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
1807
+ this.modal = UI.modal(this.options.target, this.options);
1956
1808
 
1957
- if(boundary) {
1809
+ this.on("click", function(e) {
1810
+ e.preventDefault();
1811
+ $this.show();
1812
+ });
1958
1813
 
1959
- switch(boundary) {
1960
- case "x":
1814
+ //methods
1815
+ this.proxy(this.modal, "show hide isActive");
1816
+ }
1817
+ });
1961
1818
 
1962
- if (tmppos.length == 2) {
1963
- position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
1964
- } else {
1965
- position = tcss.left < 0 ? "right": "left";
1966
- }
1819
+ UI.modal.dialog = function(content, options) {
1967
1820
 
1968
- break;
1821
+ var modal = UI.modal($(UI.modal.dialog.template).appendTo("body"), options);
1969
1822
 
1970
- case "y":
1971
- if (tmppos.length == 2) {
1972
- position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
1973
- } else {
1974
- position = (tcss.top < 0 ? "bottom": "top");
1975
- }
1823
+ modal.on("uk.modal.hide", function(){
1824
+ if (modal.persist) {
1825
+ modal.persist.appendTo(modal.persist.data("modalPersistParent"));
1826
+ modal.persist = false;
1827
+ }
1828
+ modal.element.remove();
1829
+ });
1976
1830
 
1977
- break;
1831
+ setContent(content, modal);
1978
1832
 
1979
- case "xy":
1980
- if (tmppos.length == 2) {
1981
- position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
1982
- } else {
1983
- position = tcss.left < 0 ? "right": "left";
1984
- }
1833
+ return modal;
1834
+ };
1985
1835
 
1986
- break;
1836
+ UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog"></div></div>';
1987
1837
 
1988
- }
1838
+ UI.modal.alert = function(content, options) {
1989
1839
 
1990
- tmppos = position.split("-");
1840
+ UI.modal.dialog(([
1841
+ '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
1842
+ '<div class="uk-modal-buttons"><button class="uk-button uk-button-primary uk-modal-close">Ok</button></div>'
1843
+ ]).join(""), $.extend({bgclose:false, keyboard:false}, options)).show();
1844
+ };
1991
1845
 
1992
- $.extend(tcss, variants[tmppos[0]]);
1846
+ UI.modal.confirm = function(content, onconfirm, options) {
1993
1847
 
1994
- if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
1995
- }
1848
+ onconfirm = $.isFunction(onconfirm) ? onconfirm : function(){};
1996
1849
 
1850
+ var modal = UI.modal.dialog(([
1851
+ '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
1852
+ '<div class="uk-modal-buttons"><button class="uk-button uk-button-primary js-modal-confirm">Ok</button> <button class="uk-button uk-modal-close">Cancel</button></div>'
1853
+ ]).join(""), $.extend({bgclose:false, keyboard:false}, options));
1997
1854
 
1998
- tcss.left -= $("body").position().left;
1855
+ modal.element.find(".js-modal-confirm").on("click", function(){
1856
+ onconfirm();
1857
+ modal.hide();
1858
+ });
1999
1859
 
2000
- tooltipdelay = setTimeout(function(){
1860
+ modal.show();
1861
+ };
2001
1862
 
2002
- $tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
1863
+ // init code
1864
+ UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
2003
1865
 
2004
- if ($this.options.animation) {
2005
- $tooltip.css({opacity: 0, display: 'block'}).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
2006
- } else {
2007
- $tooltip.show();
2008
- }
1866
+ var ele = $(this);
2009
1867
 
2010
- tooltipdelay = false;
1868
+ if(ele.is("a")) {
1869
+ e.preventDefault();
1870
+ }
2011
1871
 
2012
- // close tooltip if element was removed or hidden
2013
- checkdelay = setInterval(function(){
2014
- if(!$this.element.is(':visible')) $this.hide();
2015
- }, 150);
1872
+ if (!ele.data("modalTrigger")) {
1873
+ var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
1874
+ modal.show();
1875
+ }
2016
1876
 
2017
- }, parseInt(this.options.delay, 10) || 0);
2018
- },
1877
+ });
2019
1878
 
2020
- hide: function() {
2021
- if(this.element.is("input") && this.element[0]===document.activeElement) return;
1879
+ // close modal on esc button
1880
+ UI.$html.on('keydown.modal.uikit', function (e) {
2022
1881
 
2023
- if(tooltipdelay) clearTimeout(tooltipdelay);
2024
- if (checkdelay) clearTimeout(checkdelay);
1882
+ if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
1883
+ e.preventDefault();
1884
+ active.hide();
1885
+ }
1886
+ });
2025
1887
 
2026
- $tooltip.stop();
1888
+ UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
1889
+ if(active) active.resize();
1890
+ }, 150));
2027
1891
 
2028
- if (this.options.animation) {
2029
- $tooltip.fadeOut(parseInt(this.options.animation, 10) || 400);
2030
- } else {
2031
- $tooltip.hide();
2032
- }
2033
- },
2034
1892
 
2035
- content: function() {
2036
- return this.tip;
2037
- },
1893
+ // helper functions
1894
+ function setContent(content, modal){
2038
1895
 
2039
- checkBoundary: function(left, top, width, height) {
1896
+ if(!modal) return;
2040
1897
 
2041
- var axis = "";
1898
+ if (typeof content === 'object') {
2042
1899
 
2043
- if(left < 0 || ((left-$win.scrollLeft())+width) > window.innerWidth) {
2044
- axis += "x";
2045
- }
1900
+ // convert DOM object to a jQuery object
1901
+ content = content instanceof jQuery ? content : $(content);
2046
1902
 
2047
- if(top < 0 || ((top-$win.scrollTop())+height) > window.innerHeight) {
2048
- axis += "y";
1903
+ if(content.parent().length) {
1904
+ modal.persist = content;
1905
+ modal.persist.data("modalPersistParent", content.parent());
2049
1906
  }
2050
-
2051
- return axis;
1907
+ }else if (typeof content === 'string' || typeof content === 'number') {
1908
+ // just insert the data as innerHTML
1909
+ content = $('<div></div>').html(content);
1910
+ }else {
1911
+ // unsupported data type!
1912
+ content = $('<div></div>').html('$.UIkit.modal Error: Unsupported data type: ' + typeof content);
2052
1913
  }
2053
- });
2054
1914
 
1915
+ content.appendTo(modal.element.find('.uk-modal-dialog'));
2055
1916
 
2056
- // init code
2057
- UI.$doc.on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
2058
- var ele = $(this);
2059
-
2060
- if (!ele.data("tooltip")) {
2061
- var obj = UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
2062
- ele.trigger("mouseenter");
2063
- }
2064
- });
1917
+ return modal;
1918
+ }
2065
1919
 
2066
- })(jQuery, jQuery.UIkit, jQuery(window));
1920
+ })(jQuery, jQuery.UIkit);
2067
1921
 
2068
1922
  (function($, UI) {
2069
1923
 
2070
1924
  "use strict";
2071
1925
 
2072
- UI.component('switcher', {
1926
+ UI.component('nav', {
2073
1927
 
2074
1928
  defaults: {
2075
- connect : false,
2076
- toggle : ">*",
2077
- active : 0
1929
+ "toggle": ">li.uk-parent > a[href='#']",
1930
+ "lists": ">li.uk-parent > ul",
1931
+ "multiple": false
2078
1932
  },
2079
1933
 
2080
1934
  init: function() {
@@ -2083,40 +1937,270 @@
2083
1937
 
2084
1938
  this.on("click", this.options.toggle, function(e) {
2085
1939
  e.preventDefault();
2086
- $this.show(this);
1940
+ var ele = $(this);
1941
+ $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
2087
1942
  });
2088
1943
 
2089
- if (this.options.connect) {
1944
+ this.find(this.options.lists).each(function() {
1945
+ var $ele = $(this),
1946
+ parent = $ele.parent(),
1947
+ active = parent.hasClass("uk-active");
2090
1948
 
2091
- this.connect = $(this.options.connect).find(".uk-active").removeClass(".uk-active").end();
1949
+ $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
1950
+ parent.data("list-container", $ele.parent());
2092
1951
 
2093
- // delegate switch commands within container content
2094
- if (this.connect.length) {
1952
+ if (active) $this.open(parent, true);
1953
+ });
2095
1954
 
2096
- this.connect.on("click", '[data-uk-switcher-item]', function(e) {
1955
+ },
2097
1956
 
2098
- e.preventDefault();
1957
+ open: function(li, noanimation) {
2099
1958
 
2100
- var item = $(this).data('ukSwitcherItem');
1959
+ var element = this.element, $li = $(li);
2101
1960
 
2102
- if ($this.index == item) return;
1961
+ if (!this.options.multiple) {
2103
1962
 
2104
- switch(item) {
2105
- case 'next':
2106
- case 'previous':
2107
- $this.show($this.index + (item=='next' ? 1:-1));
2108
- break;
2109
- default:
2110
- $this.show(item);
2111
- }
2112
- });
2113
- }
1963
+ element.children(".uk-open").not(li).each(function() {
1964
+ if ($(this).data("list-container")) {
1965
+ $(this).data("list-container").stop().animate({height: 0}, function() {
1966
+ $(this).parent().removeClass("uk-open");
1967
+ });
1968
+ }
1969
+ });
1970
+ }
2114
1971
 
2115
- var toggles = this.find(this.options.toggle),
2116
- active = toggles.filter(".uk-active");
1972
+ $li.toggleClass("uk-open");
2117
1973
 
2118
- if (active.length) {
2119
- this.show(active);
1974
+ if ($li.data("list-container")) {
1975
+ if (noanimation) {
1976
+ $li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
1977
+ } else {
1978
+ $li.data('list-container').stop().animate({
1979
+ height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
1980
+ });
1981
+ }
1982
+ }
1983
+ }
1984
+ });
1985
+
1986
+
1987
+ // helper
1988
+
1989
+ function getHeight(ele) {
1990
+ var $ele = $(ele), height = "auto";
1991
+
1992
+ if ($ele.is(":visible")) {
1993
+ height = $ele.outerHeight();
1994
+ } else {
1995
+ var tmp = {
1996
+ position: $ele.css("position"),
1997
+ visibility: $ele.css("visibility"),
1998
+ display: $ele.css("display")
1999
+ };
2000
+
2001
+ height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
2002
+
2003
+ $ele.css(tmp); // reset element
2004
+ }
2005
+
2006
+ return height;
2007
+ }
2008
+
2009
+ // init code
2010
+ UI.ready(function(context) {
2011
+
2012
+ $("[data-uk-nav]", context).each(function() {
2013
+ var nav = $(this);
2014
+
2015
+ if (!nav.data("nav")) {
2016
+ var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
2017
+ }
2018
+ });
2019
+ });
2020
+
2021
+ })(jQuery, jQuery.UIkit);
2022
+ (function($, UI) {
2023
+
2024
+ "use strict";
2025
+
2026
+ var scrollpos = {x: window.scrollX, y: window.scrollY},
2027
+ $win = UI.$win,
2028
+ $doc = UI.$doc,
2029
+ $html = UI.$html,
2030
+ Offcanvas = {
2031
+
2032
+ show: function(element) {
2033
+
2034
+ element = $(element);
2035
+
2036
+ if (!element.length) return;
2037
+
2038
+ var $body = $('body'),
2039
+ bar = element.find(".uk-offcanvas-bar:first"),
2040
+ rtl = ($.UIkit.langdirection == "right"),
2041
+ flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
2042
+ dir = flip * (rtl ? -1 : 1);
2043
+
2044
+ scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
2045
+
2046
+ element.addClass("uk-active");
2047
+
2048
+ $body.css({"width": window.innerWidth, "height": $win.height()}).addClass("uk-offcanvas-page");
2049
+ $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
2050
+
2051
+ $html.css('margin-top', scrollpos.y * -1);
2052
+
2053
+ bar.addClass("uk-offcanvas-bar-show");
2054
+
2055
+ element.off(".ukoffcanvas").on("click.ukoffcanvas swipeRight.ukoffcanvas swipeLeft.ukoffcanvas", function(e) {
2056
+
2057
+ var target = $(e.target);
2058
+
2059
+ if (!e.type.match(/swipe/)) {
2060
+
2061
+ if (!target.hasClass("uk-offcanvas-close")) {
2062
+ if (target.hasClass("uk-offcanvas-bar")) return;
2063
+ if (target.parents(".uk-offcanvas-bar:first").length) return;
2064
+ }
2065
+ }
2066
+
2067
+ e.stopImmediatePropagation();
2068
+ Offcanvas.hide();
2069
+ });
2070
+
2071
+ $html.on('keydown.ukoffcanvas', function(e) {
2072
+ if (e.keyCode === 27) { // ESC
2073
+ Offcanvas.hide();
2074
+ }
2075
+ });
2076
+
2077
+ $doc.trigger('uk.offcanvas.show', [element, bar]);
2078
+ },
2079
+
2080
+ hide: function(force) {
2081
+
2082
+ var $body = $('body'),
2083
+ panel = $(".uk-offcanvas.uk-active"),
2084
+ rtl = ($.UIkit.langdirection == "right"),
2085
+ bar = panel.find(".uk-offcanvas-bar:first"),
2086
+ finalize = function() {
2087
+ $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
2088
+ panel.removeClass("uk-active");
2089
+ bar.removeClass("uk-offcanvas-bar-show");
2090
+ $html.css('margin-top', '');
2091
+ window.scrollTo(scrollpos.x, scrollpos.y);
2092
+ $doc.trigger('uk.offcanvas.hide', [panel, bar]);
2093
+ };
2094
+
2095
+ if (!panel.length) return;
2096
+
2097
+ if ($.UIkit.support.transition && !force) {
2098
+
2099
+ $body.one($.UIkit.support.transition.end, function() {
2100
+ finalize();
2101
+ }).css((rtl ? "margin-right" : "margin-left"), "");
2102
+
2103
+ setTimeout(function(){
2104
+ bar.removeClass("uk-offcanvas-bar-show");
2105
+ }, 0);
2106
+
2107
+ } else {
2108
+ finalize();
2109
+ }
2110
+
2111
+ panel.off(".ukoffcanvas");
2112
+ $html.off(".ukoffcanvas");
2113
+ }
2114
+ };
2115
+
2116
+ UI.component('offcanvasTrigger', {
2117
+
2118
+ init: function() {
2119
+
2120
+ var $this = this;
2121
+
2122
+ this.options = $.extend({
2123
+ "target": $this.element.is("a") ? $this.element.attr("href") : false
2124
+ }, this.options);
2125
+
2126
+ this.on("click", function(e) {
2127
+ e.preventDefault();
2128
+ Offcanvas.show($this.options.target);
2129
+ });
2130
+ }
2131
+ });
2132
+
2133
+ UI.offcanvas = Offcanvas;
2134
+
2135
+ // init code
2136
+ $html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
2137
+
2138
+ e.preventDefault();
2139
+
2140
+ var ele = $(this);
2141
+
2142
+ if (!ele.data("offcanvasTrigger")) {
2143
+ var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
2144
+ ele.trigger("click");
2145
+ }
2146
+ });
2147
+
2148
+ })(jQuery, jQuery.UIkit);
2149
+ (function($, UI) {
2150
+
2151
+ "use strict";
2152
+
2153
+ var Animations;
2154
+
2155
+ UI.component('switcher', {
2156
+
2157
+ defaults: {
2158
+ connect : false,
2159
+ toggle : ">*",
2160
+ active : 0,
2161
+ animation: false
2162
+ },
2163
+
2164
+ init: function() {
2165
+
2166
+ var $this = this;
2167
+
2168
+ this.on("click", this.options.toggle, function(e) {
2169
+ e.preventDefault();
2170
+ $this.show(this);
2171
+ });
2172
+
2173
+ if (this.options.connect) {
2174
+
2175
+ this.connect = $(this.options.connect).find(".uk-active").removeClass(".uk-active").end();
2176
+
2177
+ // delegate switch commands within container content
2178
+ if (this.connect.length) {
2179
+
2180
+ this.connect.on("click", '[data-uk-switcher-item]', function(e) {
2181
+
2182
+ e.preventDefault();
2183
+
2184
+ var item = $(this).data('ukSwitcherItem');
2185
+
2186
+ if ($this.index == item) return;
2187
+
2188
+ switch(item) {
2189
+ case 'next':
2190
+ case 'previous':
2191
+ $this.show($this.index + (item=='next' ? 1:-1));
2192
+ break;
2193
+ default:
2194
+ $this.show(item);
2195
+ }
2196
+ });
2197
+ }
2198
+
2199
+ var toggles = this.find(this.options.toggle),
2200
+ active = toggles.filter(".uk-active");
2201
+
2202
+ if (active.length) {
2203
+ this.show(active);
2120
2204
  } else {
2121
2205
  active = toggles.eq(this.options.active);
2122
2206
  this.show(active.length ? active : toggles.eq(0));
@@ -2129,7 +2213,7 @@
2129
2213
 
2130
2214
  tab = isNaN(tab) ? $(tab) : this.find(this.options.toggle).eq(tab);
2131
2215
 
2132
- var $this = this, active = tab;
2216
+ var $this = this, active = tab, animation = Animations[this.options.animation] || Animations['none'];
2133
2217
 
2134
2218
  if (active.hasClass("uk-disabled")) return;
2135
2219
 
@@ -2145,8 +2229,18 @@
2145
2229
  }
2146
2230
 
2147
2231
  this.connect.each(function() {
2148
- $(this).children().removeClass("uk-active").eq($this.index).addClass("uk-active");
2149
- UI.Utils.checkDisplay(this);
2232
+
2233
+ var container = $(this),
2234
+ children = container.children(),
2235
+ current = children.filter('.uk-active'),
2236
+ next = children.eq($this.index);
2237
+
2238
+ animation.apply($this, [current, next]).then(function(){
2239
+
2240
+ current.removeClass("uk-active");
2241
+ next.addClass("uk-active");
2242
+ UI.Utils.checkDisplay(next);
2243
+ });
2150
2244
  });
2151
2245
  }
2152
2246
 
@@ -2155,6 +2249,33 @@
2155
2249
  });
2156
2250
 
2157
2251
 
2252
+ Animations = {
2253
+
2254
+ 'none': function() {
2255
+
2256
+ var d = $.Deferred();
2257
+ d.resolve();
2258
+ return d.promise();
2259
+ },
2260
+
2261
+ 'fade': function(current, next, dir) {
2262
+
2263
+ var d = $.Deferred();
2264
+
2265
+ if (current) {
2266
+ current.removeClass('uk-active');
2267
+ }
2268
+
2269
+ next.fadeIn(300, function(){
2270
+ next.css({opacity:'', display:''});
2271
+ d.resolve();
2272
+ });
2273
+
2274
+ return d.promise();
2275
+ }
2276
+ };
2277
+
2278
+
2158
2279
  // init code
2159
2280
  UI.ready(function(context) {
2160
2281
 
@@ -2235,8 +2356,12 @@
2235
2356
  this.check();
2236
2357
 
2237
2358
  UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
2238
- $this.check();
2359
+ if ($this.element.is(":visible")) $this.check();
2239
2360
  }, 100));
2361
+
2362
+ this.on('uk.check.display', function(){
2363
+ if ($this.element.is(":visible")) $this.check();
2364
+ });
2240
2365
  },
2241
2366
 
2242
2367
  check: function() {
@@ -2294,299 +2419,207 @@
2294
2419
  });
2295
2420
 
2296
2421
  })(jQuery, jQuery.UIkit);
2297
-
2298
- (function($, UI) {
2422
+ (function($, UI, $win) {
2299
2423
 
2300
2424
  "use strict";
2301
2425
 
2302
- var $win = UI.$win,
2303
- $doc = UI.$doc,
2304
- scrollspies = [],
2305
- checkScrollSpy = function() {
2306
- for(var i=0; i < scrollspies.length; i++) {
2307
- UI.support.requestAnimationFrame.apply(window, [scrollspies[i].check]);
2308
- }
2309
- };
2426
+ var $tooltip, // tooltip container
2427
+ tooltipdelay, checkdelay;
2310
2428
 
2311
- UI.component('scrollspy', {
2429
+ UI.component('tooltip', {
2312
2430
 
2313
2431
  defaults: {
2314
- "cls" : "uk-scrollspy-inview",
2315
- "initcls" : "uk-scrollspy-init-inview",
2316
- "topoffset" : 0,
2317
- "leftoffset" : 0,
2318
- "repeat" : false,
2319
- "delay" : 0
2432
+ "offset": 5,
2433
+ "pos": "top",
2434
+ "animation": false,
2435
+ "delay": 0, // in miliseconds
2436
+ "cls": "",
2437
+ "src": function() { return this.attr("title"); }
2320
2438
  },
2321
2439
 
2322
- init: function() {
2323
-
2324
- var $this = this, idle, inviewstate, initinview,
2325
- fn = function(){
2440
+ tip: "",
2326
2441
 
2327
- var inview = UI.Utils.isInView($this.element, $this.options);
2442
+ init: function() {
2328
2443
 
2329
- if(inview && !inviewstate) {
2444
+ var $this = this;
2330
2445
 
2331
- if(idle) clearTimeout(idle);
2446
+ if (!$tooltip) {
2447
+ $tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
2448
+ }
2332
2449
 
2333
- if(!initinview) {
2334
- $this.element.addClass($this.options.initcls);
2335
- $this.offset = $this.element.offset();
2336
- initinview = true;
2450
+ this.on({
2451
+ "focus" : function(e) { $this.show(); },
2452
+ "blur" : function(e) { $this.hide(); },
2453
+ "mouseenter": function(e) { $this.show(); },
2454
+ "mouseleave": function(e) { $this.hide(); }
2455
+ });
2337
2456
 
2338
- $this.trigger("uk.scrollspy.init");
2339
- }
2457
+ this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
2340
2458
 
2341
- idle = setTimeout(function(){
2459
+ // disable title attribute
2460
+ this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
2461
+ },
2342
2462
 
2343
- if(inview) {
2344
- $this.element.addClass("uk-scrollspy-inview").addClass($this.options.cls).width();
2345
- }
2346
- }, $this.options.delay);
2463
+ show: function() {
2347
2464
 
2348
- inviewstate = true;
2349
- $this.trigger("uk.scrollspy.inview");
2350
- }
2465
+ if (tooltipdelay) clearTimeout(tooltipdelay);
2466
+ if (checkdelay) clearTimeout(checkdelay);
2467
+ if (!this.tip.length) return;
2351
2468
 
2352
- if (!inview && inviewstate && $this.options.repeat) {
2353
- $this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
2354
- inviewstate = false;
2469
+ $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).show();
2470
+ $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
2355
2471
 
2356
- $this.trigger("uk.scrollspy.outview");
2357
- }
2472
+ var $this = this,
2473
+ pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
2474
+ width = $tooltip[0].offsetWidth,
2475
+ height = $tooltip[0].offsetHeight,
2476
+ offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
2477
+ position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
2478
+ tmppos = position.split("-"),
2479
+ tcss = {
2480
+ "display" : "none",
2481
+ "visibility" : "visible",
2482
+ "top" : (pos.top + pos.height + height),
2483
+ "left" : pos.left
2358
2484
  };
2359
2485
 
2360
- fn();
2361
-
2362
- this.check = fn;
2363
- scrollspies.push(this);
2364
- }
2365
- });
2366
2486
 
2487
+ // prevent strange position
2488
+ // when tooltip is in offcanvas etc.
2489
+ if ($('html').css('position')=='fixed' || $('body').css('position')=='fixed'){
2490
+ var bodyoffset = $('body').offset(),
2491
+ htmloffset = $('html').offset(),
2492
+ docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
2367
2493
 
2368
- var scrollspynavs = [],
2369
- checkScrollSpyNavs = function() {
2370
- for(var i=0; i < scrollspynavs.length; i++) {
2371
- UI.support.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
2494
+ pos.left -= docoffset.left;
2495
+ pos.top -= docoffset.top;
2372
2496
  }
2373
- };
2374
2497
 
2375
- UI.component('scrollspynav', {
2376
-
2377
- defaults: {
2378
- "cls" : 'uk-active',
2379
- "closest" : false,
2380
- "topoffset" : 0,
2381
- "leftoffset" : 0,
2382
- "smoothscroll" : false
2383
- },
2384
-
2385
- init: function() {
2386
-
2387
- var ids = [],
2388
- links = this.find("a[href^='#']").each(function(){ ids.push($(this).attr("href")); }),
2389
- targets = $(ids.join(","));
2390
-
2391
- var $this = this, inviews, fn = function(){
2392
-
2393
- inviews = [];
2394
-
2395
- for(var i=0 ; i < targets.length ; i++) {
2396
- if(UI.Utils.isInView(targets.eq(i), $this.options)) {
2397
- inviews.push(targets.eq(i));
2398
- }
2399
- }
2400
-
2401
- if(inviews.length) {
2402
-
2403
- var scrollTop = $win.scrollTop(),
2404
- target = (function(){
2405
- for(var i=0; i< inviews.length;i++){
2406
- if(inviews[i].offset().top >= scrollTop){
2407
- return inviews[i];
2408
- }
2409
- }
2410
- })();
2411
2498
 
2412
- if(!target) return;
2499
+ if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
2500
+ tmppos[0] = tmppos[0] == "left" ? "right" : "left";
2501
+ }
2413
2502
 
2414
- if($this.options.closest) {
2415
- links.closest($this.options.closest).removeClass($this.options.cls).end().filter("a[href='#"+target.attr("id")+"']").closest($this.options.closest).addClass($this.options.cls);
2416
- } else {
2417
- links.removeClass($this.options.cls).filter("a[href='#"+target.attr("id")+"']").addClass($this.options.cls);
2418
- }
2419
- }
2503
+ var variants = {
2504
+ "bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
2505
+ "top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
2506
+ "left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
2507
+ "right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
2420
2508
  };
2421
2509
 
2422
- if(this.options.smoothscroll && UI["smoothScroll"]) {
2423
- links.each(function(){
2424
- UI.smoothScroll(this, $this.options.smoothscroll);
2425
- });
2426
- }
2510
+ $.extend(tcss, variants[tmppos[0]]);
2427
2511
 
2428
- fn();
2512
+ if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
2429
2513
 
2430
- this.element.data("scrollspynav", this);
2514
+ var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
2431
2515
 
2432
- this.check = fn;
2433
- scrollspynavs.push(this);
2516
+ if(boundary) {
2434
2517
 
2435
- }
2436
- });
2518
+ switch(boundary) {
2519
+ case "x":
2437
2520
 
2521
+ if (tmppos.length == 2) {
2522
+ position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
2523
+ } else {
2524
+ position = tcss.left < 0 ? "right": "left";
2525
+ }
2438
2526
 
2439
- var fnCheck = function(){
2440
- checkScrollSpy();
2441
- checkScrollSpyNavs();
2442
- };
2527
+ break;
2443
2528
 
2444
- // listen to scroll and resize
2445
- $doc.on("uk-scroll", fnCheck);
2446
- $win.on("resize orientationchange", UI.Utils.debounce(fnCheck, 50));
2529
+ case "y":
2530
+ if (tmppos.length == 2) {
2531
+ position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
2532
+ } else {
2533
+ position = (tcss.top < 0 ? "bottom": "top");
2534
+ }
2447
2535
 
2448
- // init code
2449
- UI.ready(function(context) {
2536
+ break;
2450
2537
 
2451
- $("[data-uk-scrollspy]", context).each(function() {
2538
+ case "xy":
2539
+ if (tmppos.length == 2) {
2540
+ position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
2541
+ } else {
2542
+ position = tcss.left < 0 ? "right": "left";
2543
+ }
2452
2544
 
2453
- var element = $(this);
2545
+ break;
2454
2546
 
2455
- if (!element.data("scrollspy")) {
2456
- var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
2457
- }
2458
- });
2547
+ }
2459
2548
 
2460
- $("[data-uk-scrollspy-nav]", context).each(function() {
2549
+ tmppos = position.split("-");
2461
2550
 
2462
- var element = $(this);
2551
+ $.extend(tcss, variants[tmppos[0]]);
2463
2552
 
2464
- if (!element.data("scrollspynav")) {
2465
- var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
2553
+ if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
2466
2554
  }
2467
- });
2468
- });
2469
-
2470
- })(jQuery, jQuery.UIkit);
2471
-
2472
- (function($, UI) {
2473
-
2474
- "use strict";
2475
-
2476
- UI.component('smoothScroll', {
2477
-
2478
- defaults: {
2479
- duration: 1000,
2480
- transition: 'easeOutExpo',
2481
- offset: 0,
2482
- complete: function(){}
2483
- },
2484
2555
 
2485
- init: function() {
2486
2556
 
2487
- var $this = this;
2557
+ tcss.left -= $("body").position().left;
2488
2558
 
2489
- this.on("click", function(e) {
2559
+ tooltipdelay = setTimeout(function(){
2490
2560
 
2491
- // get / set parameters
2492
- var ele = ($(this.hash).length ? $(this.hash) : $("body")),
2493
- target = ele.offset().top - $this.options.offset,
2494
- docheight = UI.$doc.height(),
2495
- winheight = UI.$win.height(),
2496
- eleheight = ele.outerHeight();
2561
+ $tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
2497
2562
 
2498
- if ((target + winheight) > docheight) {
2499
- target = docheight - winheight;
2563
+ if ($this.options.animation) {
2564
+ $tooltip.css({opacity: 0, display: 'block'}).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
2565
+ } else {
2566
+ $tooltip.show();
2500
2567
  }
2501
2568
 
2502
- // animate to target, fire callback when done
2503
- $("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition).promise().done($this.options.complete);
2504
-
2505
- // cancel default click action
2506
- return false;
2507
- });
2508
-
2509
- }
2510
- });
2511
-
2512
- if (!$.easing['easeOutExpo']) {
2513
- $.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
2514
- }
2515
-
2516
- // init code
2517
- UI.$doc.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
2518
- var ele = $(this);
2519
-
2520
- if (!ele.data("smoothScroll")) {
2521
- var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
2522
- ele.trigger("click");
2523
- }
2524
-
2525
- return false;
2526
- });
2527
-
2528
- })(jQuery, jQuery.UIkit);
2529
-
2530
-
2531
- (function(global, $, UI){
2532
-
2533
- var togglers = [];
2569
+ tooltipdelay = false;
2534
2570
 
2535
- UI.component('toggle', {
2571
+ // close tooltip if element was removed or hidden
2572
+ checkdelay = setInterval(function(){
2573
+ if(!$this.element.is(':visible')) $this.hide();
2574
+ }, 150);
2536
2575
 
2537
- defaults: {
2538
- target: false,
2539
- cls: 'uk-hidden'
2576
+ }, parseInt(this.options.delay, 10) || 0);
2540
2577
  },
2541
2578
 
2542
- init: function() {
2579
+ hide: function() {
2580
+ if(this.element.is("input") && this.element[0]===document.activeElement) return;
2543
2581
 
2544
- var $this = this;
2582
+ if(tooltipdelay) clearTimeout(tooltipdelay);
2583
+ if (checkdelay) clearTimeout(checkdelay);
2545
2584
 
2546
- this.getTogglers();
2585
+ $tooltip.stop();
2547
2586
 
2548
- this.on("click", function(e) {
2549
- if ($this.element.is('a[href="#"]')) e.preventDefault();
2550
- $this.toggle();
2551
- });
2587
+ if (this.options.animation) {
2588
+ $tooltip.fadeOut(parseInt(this.options.animation, 10) || 400);
2589
+ } else {
2590
+ $tooltip.hide();
2591
+ }
2592
+ },
2552
2593
 
2553
- togglers.push(this);
2594
+ content: function() {
2595
+ return this.tip;
2554
2596
  },
2555
2597
 
2556
- toggle: function() {
2598
+ checkBoundary: function(left, top, width, height) {
2557
2599
 
2558
- if(!this.totoggle.length) return;
2600
+ var axis = "";
2559
2601
 
2560
- this.totoggle.toggleClass(this.options.cls);
2602
+ if(left < 0 || ((left-$win.scrollLeft())+width) > window.innerWidth) {
2603
+ axis += "x";
2604
+ }
2561
2605
 
2562
- if (this.options.cls == 'uk-hidden') {
2563
- UI.Utils.checkDisplay(this.totoggle);
2606
+ if(top < 0 || ((top-$win.scrollTop())+height) > window.innerHeight) {
2607
+ axis += "y";
2564
2608
  }
2565
- },
2566
2609
 
2567
- getTogglers: function() {
2568
- this.totoggle = this.options.target ? $(this.options.target):[];
2610
+ return axis;
2569
2611
  }
2570
2612
  });
2571
2613
 
2572
- // init code
2573
- UI.ready(function(context) {
2574
-
2575
- $("[data-uk-toggle]", context).each(function() {
2576
- var ele = $(this);
2577
-
2578
- if (!ele.data("toggle")) {
2579
- var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
2580
- }
2581
- });
2582
-
2583
- setTimeout(function(){
2584
2614
 
2585
- togglers.forEach(function(toggler){
2586
- toggler.getTogglers();
2587
- });
2615
+ // init code
2616
+ UI.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
2617
+ var ele = $(this);
2588
2618
 
2589
- }, 0);
2619
+ if (!ele.data("tooltip")) {
2620
+ var obj = UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
2621
+ ele.trigger("mouseenter");
2622
+ }
2590
2623
  });
2591
2624
 
2592
- })(this, jQuery, jQuery.UIkit);
2625
+ })(jQuery, jQuery.UIkit, jQuery(window));