uikit2-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/uikit2/rails.rb +8 -0
- data/lib/uikit2/rails/version.rb +5 -0
- data/uikit2-rails.gemspec +25 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/uikit.js +3537 -0
- data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
- data/vendor/assets/javascripts/uikit/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +334 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.js +3166 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/uikit/components/form-password.js +67 -0
- data/vendor/assets/javascripts/uikit/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/form-select.js +70 -0
- data/vendor/assets/javascripts/uikit/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/grid.js +523 -0
- data/vendor/assets/javascripts/uikit/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +623 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.js +555 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +638 -0
- data/vendor/assets/javascripts/uikit/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/notify.js +189 -0
- data/vendor/assets/javascripts/uikit/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/pagination.js +147 -0
- data/vendor/assets/javascripts/uikit/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/parallax.js +417 -0
- data/vendor/assets/javascripts/uikit/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/search.js +92 -0
- data/vendor/assets/javascripts/uikit/components/search.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slider.js +520 -0
- data/vendor/assets/javascripts/uikit/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +502 -0
- data/vendor/assets/javascripts/uikit/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +375 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +545 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +664 -0
- data/vendor/assets/javascripts/uikit/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/sticky.js +349 -0
- data/vendor/assets/javascripts/uikit/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.js +234 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +260 -0
- data/vendor/assets/javascripts/uikit/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/button.js +157 -0
- data/vendor/assets/javascripts/uikit/core/button.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/core.js +725 -0
- data/vendor/assets/javascripts/uikit/core/core.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/cover.js +95 -0
- data/vendor/assets/javascripts/uikit/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.js +421 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +114 -0
- data/vendor/assets/javascripts/uikit/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +372 -0
- data/vendor/assets/javascripts/uikit/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +136 -0
- data/vendor/assets/javascripts/uikit/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +180 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +304 -0
- data/vendor/assets/javascripts/uikit/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +165 -0
- data/vendor/assets/javascripts/uikit/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +120 -0
- data/vendor/assets/javascripts/uikit/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
- data/vendor/assets/javascripts/uikit/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +239 -0
- data/vendor/assets/javascripts/uikit/core/utility.min.js +2 -0
- data/vendor/assets/stylesheets/uikit.almost-flat.css +8551 -0
- data/vendor/assets/stylesheets/uikit.css +8252 -0
- data/vendor/assets/stylesheets/uikit.gradient.css +8614 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.css +39 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.css +37 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.css +39 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.css +52 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.css +50 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.css +52 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.css +129 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.css +123 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.css +139 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.css +128 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.css +124 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.css +128 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.css +222 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.css +164 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.css +229 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.css +135 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.css +132 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.css +139 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.css +92 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.css +104 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.css +94 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.css +112 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.css +191 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.css +189 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.css +191 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.css +118 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.css +116 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.css +118 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.min.css +2 -0
- metadata +295 -0
@@ -0,0 +1,172 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
var component;
|
4
|
+
|
5
|
+
if (window.UIkit) {
|
6
|
+
component = addon(UIkit);
|
7
|
+
}
|
8
|
+
|
9
|
+
if (typeof define == "function" && define.amd) {
|
10
|
+
define("uikit-accordion", ["uikit"], function(){
|
11
|
+
return component || addon(UIkit);
|
12
|
+
});
|
13
|
+
}
|
14
|
+
})(function(UI){
|
15
|
+
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
UI.component('accordion', {
|
19
|
+
|
20
|
+
defaults: {
|
21
|
+
showfirst : true,
|
22
|
+
collapse : true,
|
23
|
+
animate : true,
|
24
|
+
easing : 'swing',
|
25
|
+
duration : 300,
|
26
|
+
toggle : '.uk-accordion-title',
|
27
|
+
containers : '.uk-accordion-content',
|
28
|
+
clsactive : 'uk-active'
|
29
|
+
},
|
30
|
+
|
31
|
+
boot: function() {
|
32
|
+
|
33
|
+
// init code
|
34
|
+
UI.ready(function(context) {
|
35
|
+
|
36
|
+
setTimeout(function(){
|
37
|
+
|
38
|
+
UI.$("[data-uk-accordion]", context).each(function(){
|
39
|
+
|
40
|
+
var ele = UI.$(this);
|
41
|
+
|
42
|
+
if(!ele.data("accordion")) {
|
43
|
+
UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
|
44
|
+
}
|
45
|
+
});
|
46
|
+
|
47
|
+
}, 0);
|
48
|
+
});
|
49
|
+
},
|
50
|
+
|
51
|
+
init: function() {
|
52
|
+
|
53
|
+
var $this = this;
|
54
|
+
|
55
|
+
this.element.on('click.uikit.accordion', this.options.toggle, function(e) {
|
56
|
+
|
57
|
+
e.preventDefault();
|
58
|
+
|
59
|
+
$this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
|
60
|
+
});
|
61
|
+
|
62
|
+
this.update();
|
63
|
+
|
64
|
+
if (this.options.showfirst) {
|
65
|
+
this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
|
66
|
+
}
|
67
|
+
},
|
68
|
+
|
69
|
+
toggleItem: function(wrapper, animated, collapse) {
|
70
|
+
|
71
|
+
var $this = this;
|
72
|
+
|
73
|
+
wrapper.data('toggle').toggleClass(this.options.clsactive);
|
74
|
+
|
75
|
+
var active = wrapper.data('toggle').hasClass(this.options.clsactive);
|
76
|
+
|
77
|
+
if (collapse) {
|
78
|
+
this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
|
79
|
+
this.content.not(wrapper.data('content')).parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
|
80
|
+
}
|
81
|
+
|
82
|
+
wrapper.stop().css('overflow', 'hidden');
|
83
|
+
|
84
|
+
if (animated) {
|
85
|
+
|
86
|
+
wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
|
87
|
+
|
88
|
+
if (active) {
|
89
|
+
wrapper.css({'overflow': '', 'height': 'auto'});
|
90
|
+
UI.Utils.checkDisplay(wrapper.data('content'));
|
91
|
+
}
|
92
|
+
|
93
|
+
$this.trigger('display.uk.check');
|
94
|
+
}});
|
95
|
+
|
96
|
+
} else {
|
97
|
+
|
98
|
+
wrapper.height(active ? 'auto' : 0);
|
99
|
+
|
100
|
+
if (active) {
|
101
|
+
wrapper.css({'overflow': ''});
|
102
|
+
UI.Utils.checkDisplay(wrapper.data('content'));
|
103
|
+
}
|
104
|
+
|
105
|
+
this.trigger('display.uk.check');
|
106
|
+
}
|
107
|
+
|
108
|
+
// Update ARIA
|
109
|
+
wrapper.attr('aria-expanded', active);
|
110
|
+
|
111
|
+
this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
|
112
|
+
},
|
113
|
+
|
114
|
+
update: function() {
|
115
|
+
|
116
|
+
var $this = this, $content, $wrapper, $toggle;
|
117
|
+
|
118
|
+
this.toggle = this.find(this.options.toggle);
|
119
|
+
this.content = this.find(this.options.containers);
|
120
|
+
|
121
|
+
this.content.each(function(index) {
|
122
|
+
|
123
|
+
$content = UI.$(this);
|
124
|
+
|
125
|
+
if ($content.parent().data('wrapper')) {
|
126
|
+
$wrapper = $content.parent();
|
127
|
+
} else {
|
128
|
+
$wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
|
129
|
+
|
130
|
+
// Init ARIA
|
131
|
+
$wrapper.attr('aria-expanded', 'false');
|
132
|
+
}
|
133
|
+
|
134
|
+
$toggle = $this.toggle.eq(index);
|
135
|
+
|
136
|
+
$wrapper.data('toggle', $toggle);
|
137
|
+
$wrapper.data('content', $content);
|
138
|
+
$toggle.data('wrapper', $wrapper);
|
139
|
+
$content.data('wrapper', $wrapper);
|
140
|
+
});
|
141
|
+
|
142
|
+
this.element.trigger('update.uk.accordion', [this]);
|
143
|
+
}
|
144
|
+
|
145
|
+
});
|
146
|
+
|
147
|
+
// helper
|
148
|
+
|
149
|
+
function getHeight(ele) {
|
150
|
+
|
151
|
+
var $ele = UI.$(ele), height = "auto";
|
152
|
+
|
153
|
+
if ($ele.is(":visible")) {
|
154
|
+
height = $ele.outerHeight();
|
155
|
+
} else {
|
156
|
+
|
157
|
+
var tmp = {
|
158
|
+
position : $ele.css("position"),
|
159
|
+
visibility : $ele.css("visibility"),
|
160
|
+
display : $ele.css("display")
|
161
|
+
};
|
162
|
+
|
163
|
+
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
164
|
+
|
165
|
+
$ele.css(tmp); // reset element
|
166
|
+
}
|
167
|
+
|
168
|
+
return height;
|
169
|
+
}
|
170
|
+
|
171
|
+
return UI.accordion;
|
172
|
+
});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-accordion",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(i){var o=t.$(i),e="auto";if(o.is(":visible"))e=o.outerHeight();else{var a={position:o.css("position"),visibility:o.css("visibility"),display:o.css("display")};e=o.css({position:"absolute",visibility:"hidden",display:"block"}).outerHeight(),o.css(a)}return e}return t.component("accordion",{defaults:{showfirst:!0,collapse:!0,animate:!0,easing:"swing",duration:300,toggle:".uk-accordion-title",containers:".uk-accordion-content",clsactive:"uk-active"},boot:function(){t.ready(function(i){setTimeout(function(){t.$("[data-uk-accordion]",i).each(function(){var i=t.$(this);i.data("accordion")||t.accordion(i,t.Utils.options(i.attr("data-uk-accordion")))})},0)})},init:function(){var i=this;this.element.on("click.uikit.accordion",this.options.toggle,function(o){o.preventDefault(),i.toggleItem(t.$(this).data("wrapper"),i.options.animate,i.options.collapse)}),this.update(),this.options.showfirst&&this.toggleItem(this.toggle.eq(0).data("wrapper"),!1,!1)},toggleItem:function(o,e,a){var n=this;o.data("toggle").toggleClass(this.options.clsactive);var s=o.data("toggle").hasClass(this.options.clsactive);a&&(this.toggle.not(o.data("toggle")).removeClass(this.options.clsactive),this.content.not(o.data("content")).parent().stop().css("overflow","hidden").animate({height:0},{easing:this.options.easing,duration:e?this.options.duration:0}).attr("aria-expanded","false")),o.stop().css("overflow","hidden"),e?o.animate({height:s?i(o.data("content")):0},{easing:this.options.easing,duration:this.options.duration,complete:function(){s&&(o.css({overflow:"",height:"auto"}),t.Utils.checkDisplay(o.data("content"))),n.trigger("display.uk.check")}}):(o.height(s?"auto":0),s&&(o.css({overflow:""}),t.Utils.checkDisplay(o.data("content"))),this.trigger("display.uk.check")),o.attr("aria-expanded",s),this.element.trigger("toggle.uk.accordion",[s,o.data("toggle"),o.data("content")])},update:function(){var i,o,e,a=this;this.toggle=this.find(this.options.toggle),this.content=this.find(this.options.containers),this.content.each(function(n){i=t.$(this),i.parent().data("wrapper")?o=i.parent():(o=t.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent(),o.attr("aria-expanded","false")),e=a.toggle.eq(n),o.data("toggle",e),o.data("content",i),e.data("wrapper",o),i.data("wrapper",o)}),this.element.trigger("update.uk.accordion",[this])}}),t.accordion});
|
@@ -0,0 +1,334 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == "function" && define.amd) {
|
11
|
+
define("uikit-autocomplete", ["uikit"], function(){
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
var active;
|
21
|
+
|
22
|
+
UI.component('autocomplete', {
|
23
|
+
|
24
|
+
defaults: {
|
25
|
+
minLength: 3,
|
26
|
+
param: 'search',
|
27
|
+
method: 'post',
|
28
|
+
delay: 300,
|
29
|
+
loadingClass: 'uk-loading',
|
30
|
+
flipDropdown: false,
|
31
|
+
skipClass: 'uk-skip',
|
32
|
+
hoverClass: 'uk-active',
|
33
|
+
source: null,
|
34
|
+
renderer: null,
|
35
|
+
|
36
|
+
// template
|
37
|
+
|
38
|
+
template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
|
39
|
+
},
|
40
|
+
|
41
|
+
visible : false,
|
42
|
+
value : null,
|
43
|
+
selected : null,
|
44
|
+
|
45
|
+
boot: function() {
|
46
|
+
|
47
|
+
// init code
|
48
|
+
UI.$html.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
|
49
|
+
|
50
|
+
var ele = UI.$(this);
|
51
|
+
|
52
|
+
if (!ele.data("autocomplete")) {
|
53
|
+
UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
// register outer click for autocompletes
|
58
|
+
UI.$html.on("click.autocomplete.uikit", function(e) {
|
59
|
+
if (active && e.target!=active.input[0]) active.hide();
|
60
|
+
});
|
61
|
+
},
|
62
|
+
|
63
|
+
init: function() {
|
64
|
+
|
65
|
+
var $this = this,
|
66
|
+
select = false,
|
67
|
+
trigger = UI.Utils.debounce(function(e) {
|
68
|
+
if(select) {
|
69
|
+
return (select = false);
|
70
|
+
}
|
71
|
+
$this.handle();
|
72
|
+
}, this.options.delay);
|
73
|
+
|
74
|
+
|
75
|
+
this.dropdown = this.find('.uk-dropdown');
|
76
|
+
this.template = this.find('script[type="text/autocomplete"]').html();
|
77
|
+
this.template = UI.Utils.template(this.template || this.options.template);
|
78
|
+
this.input = this.find("input:first").attr("autocomplete", "off");
|
79
|
+
|
80
|
+
if (!this.dropdown.length) {
|
81
|
+
this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
|
82
|
+
}
|
83
|
+
|
84
|
+
if (this.options.flipDropdown) {
|
85
|
+
this.dropdown.addClass('uk-dropdown-flip');
|
86
|
+
}
|
87
|
+
|
88
|
+
this.dropdown.attr('aria-expanded', 'false');
|
89
|
+
|
90
|
+
this.input.on({
|
91
|
+
"keydown": function(e) {
|
92
|
+
|
93
|
+
if (e && e.which && !e.shiftKey) {
|
94
|
+
|
95
|
+
switch (e.which) {
|
96
|
+
case 13: // enter
|
97
|
+
select = true;
|
98
|
+
|
99
|
+
if ($this.selected) {
|
100
|
+
e.preventDefault();
|
101
|
+
$this.select();
|
102
|
+
}
|
103
|
+
break;
|
104
|
+
case 38: // up
|
105
|
+
e.preventDefault();
|
106
|
+
$this.pick('prev', true);
|
107
|
+
break;
|
108
|
+
case 40: // down
|
109
|
+
e.preventDefault();
|
110
|
+
$this.pick('next', true);
|
111
|
+
break;
|
112
|
+
case 27:
|
113
|
+
case 9: // esc, tab
|
114
|
+
$this.hide();
|
115
|
+
break;
|
116
|
+
default:
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
},
|
122
|
+
"keyup": trigger
|
123
|
+
});
|
124
|
+
|
125
|
+
this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
|
126
|
+
$this.select();
|
127
|
+
});
|
128
|
+
|
129
|
+
this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
|
130
|
+
$this.pick(UI.$(this));
|
131
|
+
});
|
132
|
+
|
133
|
+
this.triggercomplete = trigger;
|
134
|
+
},
|
135
|
+
|
136
|
+
handle: function() {
|
137
|
+
|
138
|
+
var $this = this, old = this.value;
|
139
|
+
|
140
|
+
this.value = this.input.val();
|
141
|
+
|
142
|
+
if (this.value.length < this.options.minLength) return this.hide();
|
143
|
+
|
144
|
+
if (this.value != old) {
|
145
|
+
$this.request();
|
146
|
+
}
|
147
|
+
|
148
|
+
return this;
|
149
|
+
},
|
150
|
+
|
151
|
+
pick: function(item, scrollinview) {
|
152
|
+
|
153
|
+
var $this = this,
|
154
|
+
items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
|
155
|
+
selected = false;
|
156
|
+
|
157
|
+
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
158
|
+
selected = item;
|
159
|
+
} else if (item == 'next' || item == 'prev') {
|
160
|
+
|
161
|
+
if (this.selected) {
|
162
|
+
var index = items.index(this.selected);
|
163
|
+
|
164
|
+
if (item == 'next') {
|
165
|
+
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
|
166
|
+
} else {
|
167
|
+
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
|
168
|
+
}
|
169
|
+
|
170
|
+
} else {
|
171
|
+
selected = items[(item == 'next') ? 'first' : 'last']();
|
172
|
+
}
|
173
|
+
|
174
|
+
selected = UI.$(selected);
|
175
|
+
}
|
176
|
+
|
177
|
+
if (selected && selected.length) {
|
178
|
+
this.selected = selected;
|
179
|
+
items.removeClass(this.options.hoverClass);
|
180
|
+
this.selected.addClass(this.options.hoverClass);
|
181
|
+
|
182
|
+
// jump to selected if not in view
|
183
|
+
if (scrollinview) {
|
184
|
+
|
185
|
+
var top = selected.position().top,
|
186
|
+
scrollTop = $this.dropdown.scrollTop(),
|
187
|
+
dpheight = $this.dropdown.height();
|
188
|
+
|
189
|
+
if (top > dpheight || top < 0) {
|
190
|
+
$this.dropdown.scrollTop(scrollTop + top);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
},
|
195
|
+
|
196
|
+
select: function() {
|
197
|
+
|
198
|
+
if(!this.selected) return;
|
199
|
+
|
200
|
+
var data = this.selected.data();
|
201
|
+
|
202
|
+
this.trigger("selectitem.uk.autocomplete", [data, this]);
|
203
|
+
|
204
|
+
if (data.value) {
|
205
|
+
this.input.val(data.value).trigger('change');
|
206
|
+
}
|
207
|
+
|
208
|
+
this.hide();
|
209
|
+
},
|
210
|
+
|
211
|
+
show: function() {
|
212
|
+
if (this.visible) return;
|
213
|
+
this.visible = true;
|
214
|
+
this.element.addClass("uk-open");
|
215
|
+
|
216
|
+
if (active && active!==this) {
|
217
|
+
active.hide();
|
218
|
+
}
|
219
|
+
|
220
|
+
active = this;
|
221
|
+
|
222
|
+
// Update aria
|
223
|
+
this.dropdown.attr('aria-expanded', 'true');
|
224
|
+
|
225
|
+
return this;
|
226
|
+
},
|
227
|
+
|
228
|
+
hide: function() {
|
229
|
+
if (!this.visible) return;
|
230
|
+
this.visible = false;
|
231
|
+
this.element.removeClass("uk-open");
|
232
|
+
|
233
|
+
if (active === this) {
|
234
|
+
active = false;
|
235
|
+
}
|
236
|
+
|
237
|
+
// Update aria
|
238
|
+
this.dropdown.attr('aria-expanded', 'false');
|
239
|
+
|
240
|
+
return this;
|
241
|
+
},
|
242
|
+
|
243
|
+
request: function() {
|
244
|
+
|
245
|
+
var $this = this,
|
246
|
+
release = function(data) {
|
247
|
+
|
248
|
+
if(data) {
|
249
|
+
$this.render(data);
|
250
|
+
}
|
251
|
+
|
252
|
+
$this.element.removeClass($this.options.loadingClass);
|
253
|
+
};
|
254
|
+
|
255
|
+
this.element.addClass(this.options.loadingClass);
|
256
|
+
|
257
|
+
if (this.options.source) {
|
258
|
+
|
259
|
+
var source = this.options.source;
|
260
|
+
|
261
|
+
switch(typeof(this.options.source)) {
|
262
|
+
case 'function':
|
263
|
+
|
264
|
+
this.options.source.apply(this, [release]);
|
265
|
+
|
266
|
+
break;
|
267
|
+
|
268
|
+
case 'object':
|
269
|
+
|
270
|
+
if(source.length) {
|
271
|
+
|
272
|
+
var items = [];
|
273
|
+
|
274
|
+
source.forEach(function(item){
|
275
|
+
if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
|
276
|
+
items.push(item);
|
277
|
+
}
|
278
|
+
});
|
279
|
+
|
280
|
+
release(items);
|
281
|
+
}
|
282
|
+
|
283
|
+
break;
|
284
|
+
|
285
|
+
case 'string':
|
286
|
+
|
287
|
+
var params ={};
|
288
|
+
|
289
|
+
params[this.options.param] = this.value;
|
290
|
+
|
291
|
+
UI.$.ajax({
|
292
|
+
url: this.options.source,
|
293
|
+
data: params,
|
294
|
+
type: this.options.method,
|
295
|
+
dataType: 'json'
|
296
|
+
}).done(function(json) {
|
297
|
+
release(json || []);
|
298
|
+
});
|
299
|
+
|
300
|
+
break;
|
301
|
+
|
302
|
+
default:
|
303
|
+
release(null);
|
304
|
+
}
|
305
|
+
|
306
|
+
} else {
|
307
|
+
this.element.removeClass($this.options.loadingClass);
|
308
|
+
}
|
309
|
+
},
|
310
|
+
|
311
|
+
render: function(data) {
|
312
|
+
|
313
|
+
this.dropdown.empty();
|
314
|
+
|
315
|
+
this.selected = false;
|
316
|
+
|
317
|
+
if (this.options.renderer) {
|
318
|
+
|
319
|
+
this.options.renderer.apply(this, [data]);
|
320
|
+
|
321
|
+
} else if(data && data.length) {
|
322
|
+
|
323
|
+
this.dropdown.append(this.template({"items":data}));
|
324
|
+
this.show();
|
325
|
+
|
326
|
+
this.trigger('show.uk.autocomplete');
|
327
|
+
}
|
328
|
+
|
329
|
+
return this;
|
330
|
+
}
|
331
|
+
});
|
332
|
+
|
333
|
+
return UI.autocomplete;
|
334
|
+
});
|