uikit-sass-rails 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +15 -12
- data/lib/uikit/sass/rails/engine.rb +1 -1
- data/lib/uikit/sass/rails/version.rb +1 -1
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +525 -464
- 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 +30 -3
- data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +48 -27
- data/vendor/assets/javascripts/uikit/components/datepicker.js +2887 -97
- data/vendor/assets/javascripts/uikit/components/form-password.js +24 -19
- data/vendor/assets/javascripts/uikit/components/form-select.js +24 -18
- data/vendor/assets/javascripts/uikit/components/grid.js +524 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +46 -39
- data/vendor/assets/javascripts/uikit/components/lightbox.js +543 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +125 -98
- data/vendor/assets/javascripts/uikit/components/notify.js +34 -22
- data/vendor/assets/javascripts/uikit/components/pagination.js +24 -21
- data/vendor/assets/javascripts/uikit/components/parallax.js +400 -0
- data/vendor/assets/javascripts/uikit/components/search.js +19 -16
- data/vendor/assets/javascripts/uikit/components/slider.js +482 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +498 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +377 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +540 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +392 -263
- data/vendor/assets/javascripts/uikit/components/sticky.js +127 -68
- data/vendor/assets/javascripts/uikit/components/timepicker.js +65 -42
- data/vendor/assets/javascripts/uikit/components/tooltip.js +220 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +11 -10
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/button.js +154 -0
- data/vendor/assets/javascripts/uikit/core/core.js +717 -0
- data/vendor/assets/javascripts/uikit/{components → core}/cover.js +41 -35
- data/vendor/assets/javascripts/uikit/core/dropdown.js +296 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +172 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +323 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +117 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +178 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +298 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +159 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +117 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +157 -0
- data/vendor/assets/javascripts/uikit/uikit.js +1538 -871
- data/vendor/assets/stylesheets/extra/font-awesome.scss +4 -7
- data/vendor/assets/stylesheets/uikit.scss +22 -1
- data/vendor/assets/stylesheets/uikit/almost-flat.scss +22 -2
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.scss +45 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.scss +45 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.scss +43 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.scss +62 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.scss +62 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +60 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.scss +148 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.scss +158 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.scss +142 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.scss +152 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.scss +152 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.scss +148 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.scss +282 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.scss +290 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +208 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.scss +137 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.scss +141 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.scss +134 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.scss +112 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.scss +112 -0
- data/vendor/assets/stylesheets/uikit/components/notify.scss +106 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.scss +130 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.scss +138 -0
- data/vendor/assets/stylesheets/uikit/components/progress.scss +118 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.scss +216 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.scss +216 -0
- data/vendor/assets/stylesheets/uikit/components/search.scss +214 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slider.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.scss +129 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.scss +129 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.scss +127 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.scss +11 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.scss +11 -0
- data/vendor/assets/stylesheets/uikit/components/upload.scss +11 -0
- data/vendor/assets/stylesheets/uikit/gradient.scss +22 -2
- data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +1768 -498
- data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +1776 -512
- data/vendor/assets/stylesheets/uikit/uikit.scss +1722 -462
- metadata +92 -7
- data/vendor/assets/stylesheets/uikit/components/uikit.components.almost-flat.scss +0 -1586
- data/vendor/assets/stylesheets/uikit/components/uikit.components.gradient.scss +0 -1608
- data/vendor/assets/stylesheets/uikit/components/uikit.components.scss +0 -1489
@@ -0,0 +1,208 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
var $win = UI.$win,
|
7
|
+
$doc = UI.$doc,
|
8
|
+
scrollspies = [],
|
9
|
+
checkScrollSpy = function() {
|
10
|
+
for(var i=0; i < scrollspies.length; i++) {
|
11
|
+
window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
|
12
|
+
}
|
13
|
+
};
|
14
|
+
|
15
|
+
UI.component('scrollspy', {
|
16
|
+
|
17
|
+
defaults: {
|
18
|
+
"target" : false,
|
19
|
+
"cls" : "uk-scrollspy-inview",
|
20
|
+
"initcls" : "uk-scrollspy-init-inview",
|
21
|
+
"topoffset" : 0,
|
22
|
+
"leftoffset" : 0,
|
23
|
+
"repeat" : false,
|
24
|
+
"delay" : 0
|
25
|
+
},
|
26
|
+
|
27
|
+
boot: function() {
|
28
|
+
|
29
|
+
// listen to scroll and resize
|
30
|
+
$doc.on("scrolling.uk.document", checkScrollSpy);
|
31
|
+
$win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
|
32
|
+
|
33
|
+
// init code
|
34
|
+
UI.ready(function(context) {
|
35
|
+
|
36
|
+
UI.$("[data-uk-scrollspy]", context).each(function() {
|
37
|
+
|
38
|
+
var element = UI.$(this);
|
39
|
+
|
40
|
+
if (!element.data("scrollspy")) {
|
41
|
+
var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
|
42
|
+
}
|
43
|
+
});
|
44
|
+
});
|
45
|
+
},
|
46
|
+
|
47
|
+
init: function() {
|
48
|
+
|
49
|
+
var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
|
50
|
+
|
51
|
+
var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
|
52
|
+
delayIdx = elements.length === 1 ? 1 : 0,
|
53
|
+
toggleclsIdx = 0;
|
54
|
+
|
55
|
+
elements.each(function(idx){
|
56
|
+
|
57
|
+
var element = UI.$(this),
|
58
|
+
inviewstate = element.data('inviewstate'),
|
59
|
+
inview = UI.Utils.isInView(element, $this.options),
|
60
|
+
toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
|
61
|
+
|
62
|
+
if (inview && !inviewstate && !element.data('scrollspy-idle')) {
|
63
|
+
|
64
|
+
if (!initinview) {
|
65
|
+
element.addClass($this.options.initcls);
|
66
|
+
$this.offset = element.offset();
|
67
|
+
initinview = true;
|
68
|
+
|
69
|
+
element.trigger("init.uk.scrollspy");
|
70
|
+
}
|
71
|
+
|
72
|
+
element.data('scrollspy-idle', setTimeout(function(){
|
73
|
+
|
74
|
+
element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
|
75
|
+
element.trigger("inview.uk.scrollspy");
|
76
|
+
|
77
|
+
element.data('scrollspy-idle', false);
|
78
|
+
element.data('inviewstate', true);
|
79
|
+
|
80
|
+
}, $this.options.delay * delayIdx));
|
81
|
+
|
82
|
+
delayIdx++;
|
83
|
+
}
|
84
|
+
|
85
|
+
if (!inview && inviewstate && $this.options.repeat) {
|
86
|
+
|
87
|
+
if (element.data('scrollspy-idle')) {
|
88
|
+
clearTimeout(element.data('scrollspy-idle'));
|
89
|
+
}
|
90
|
+
|
91
|
+
element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
|
92
|
+
element.data('inviewstate', false);
|
93
|
+
|
94
|
+
element.trigger("outview.uk.scrollspy");
|
95
|
+
}
|
96
|
+
|
97
|
+
toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
|
98
|
+
|
99
|
+
});
|
100
|
+
};
|
101
|
+
|
102
|
+
fn();
|
103
|
+
|
104
|
+
this.check = fn;
|
105
|
+
|
106
|
+
scrollspies.push(this);
|
107
|
+
}
|
108
|
+
});
|
109
|
+
|
110
|
+
|
111
|
+
var scrollspynavs = [],
|
112
|
+
checkScrollSpyNavs = function() {
|
113
|
+
for(var i=0; i < scrollspynavs.length; i++) {
|
114
|
+
window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
|
115
|
+
}
|
116
|
+
};
|
117
|
+
|
118
|
+
UI.component('scrollspynav', {
|
119
|
+
|
120
|
+
defaults: {
|
121
|
+
"cls" : 'uk-active',
|
122
|
+
"closest" : false,
|
123
|
+
"topoffset" : 0,
|
124
|
+
"leftoffset" : 0,
|
125
|
+
"smoothscroll" : false
|
126
|
+
},
|
127
|
+
|
128
|
+
boot: function() {
|
129
|
+
|
130
|
+
// listen to scroll and resize
|
131
|
+
$doc.on("scrolling.uk.document", checkScrollSpyNavs);
|
132
|
+
$win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
|
133
|
+
|
134
|
+
// init code
|
135
|
+
UI.ready(function(context) {
|
136
|
+
|
137
|
+
UI.$("[data-uk-scrollspy-nav]", context).each(function() {
|
138
|
+
|
139
|
+
var element = UI.$(this);
|
140
|
+
|
141
|
+
if (!element.data("scrollspynav")) {
|
142
|
+
var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
|
143
|
+
}
|
144
|
+
});
|
145
|
+
});
|
146
|
+
},
|
147
|
+
|
148
|
+
init: function() {
|
149
|
+
|
150
|
+
var ids = [],
|
151
|
+
links = this.find("a[href^='#']").each(function(){ ids.push(UI.$(this).attr("href")); }),
|
152
|
+
targets = UI.$(ids.join(",")),
|
153
|
+
|
154
|
+
clsActive = this.options.cls,
|
155
|
+
clsClosest = this.options.closest || this.options.closest;
|
156
|
+
|
157
|
+
var $this = this, inviews, fn = function(){
|
158
|
+
|
159
|
+
inviews = [];
|
160
|
+
|
161
|
+
for (var i=0 ; i < targets.length ; i++) {
|
162
|
+
if (UI.Utils.isInView(targets.eq(i), $this.options)) {
|
163
|
+
inviews.push(targets.eq(i));
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
if (inviews.length) {
|
168
|
+
|
169
|
+
var navitems,
|
170
|
+
scrollTop = $win.scrollTop(),
|
171
|
+
target = (function(){
|
172
|
+
for(var i=0; i< inviews.length;i++){
|
173
|
+
if(inviews[i].offset().top >= scrollTop){
|
174
|
+
return inviews[i];
|
175
|
+
}
|
176
|
+
}
|
177
|
+
})();
|
178
|
+
|
179
|
+
if (!target) return;
|
180
|
+
|
181
|
+
if ($this.options.closest) {
|
182
|
+
links.closest(clsClosest).removeClass(clsActive);
|
183
|
+
navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
|
184
|
+
} else {
|
185
|
+
navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
|
186
|
+
}
|
187
|
+
|
188
|
+
$this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
|
189
|
+
}
|
190
|
+
};
|
191
|
+
|
192
|
+
if (this.options.smoothscroll && UI.smoothScroll) {
|
193
|
+
links.each(function(){
|
194
|
+
UI.smoothScroll(this, $this.options.smoothscroll);
|
195
|
+
});
|
196
|
+
}
|
197
|
+
|
198
|
+
fn();
|
199
|
+
|
200
|
+
this.element.data("scrollspynav", this);
|
201
|
+
|
202
|
+
this.check = fn;
|
203
|
+
scrollspynavs.push(this);
|
204
|
+
|
205
|
+
}
|
206
|
+
});
|
207
|
+
|
208
|
+
})(UIkit);
|
@@ -0,0 +1,62 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
UI.component('smoothScroll', {
|
7
|
+
|
8
|
+
boot: function() {
|
9
|
+
|
10
|
+
// init code
|
11
|
+
UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
|
12
|
+
var ele = UI.$(this);
|
13
|
+
|
14
|
+
if (!ele.data("smoothScroll")) {
|
15
|
+
var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
|
16
|
+
ele.trigger("click");
|
17
|
+
}
|
18
|
+
|
19
|
+
return false;
|
20
|
+
});
|
21
|
+
},
|
22
|
+
|
23
|
+
init: function() {
|
24
|
+
|
25
|
+
var $this = this;
|
26
|
+
|
27
|
+
this.on("click", function(e) {
|
28
|
+
e.preventDefault();
|
29
|
+
scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
});
|
33
|
+
|
34
|
+
function scrollToElement(ele, options) {
|
35
|
+
|
36
|
+
options = UI.$.extend({
|
37
|
+
duration: 1000,
|
38
|
+
transition: 'easeOutExpo',
|
39
|
+
offset: 0,
|
40
|
+
complete: function(){}
|
41
|
+
}, options);
|
42
|
+
|
43
|
+
// get / set parameters
|
44
|
+
var target = ele.offset().top - options.offset,
|
45
|
+
docheight = UI.$doc.height(),
|
46
|
+
winheight = window.innerHeight;
|
47
|
+
|
48
|
+
if ((target + winheight) > docheight) {
|
49
|
+
target = docheight - winheight;
|
50
|
+
}
|
51
|
+
|
52
|
+
// animate to target, fire callback when done
|
53
|
+
UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
|
54
|
+
}
|
55
|
+
|
56
|
+
UI.Utils.scrollToElement = scrollToElement;
|
57
|
+
|
58
|
+
if (!UI.$.easing.easeOutExpo) {
|
59
|
+
UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
|
60
|
+
}
|
61
|
+
|
62
|
+
})(UIkit);
|
@@ -0,0 +1,298 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(UI) {
|
3
|
+
|
4
|
+
"use strict";
|
5
|
+
|
6
|
+
var Animations;
|
7
|
+
|
8
|
+
UI.component('switcher', {
|
9
|
+
|
10
|
+
defaults: {
|
11
|
+
connect : false,
|
12
|
+
toggle : ">*",
|
13
|
+
active : 0,
|
14
|
+
animation : false,
|
15
|
+
duration : 200
|
16
|
+
},
|
17
|
+
|
18
|
+
animating: false,
|
19
|
+
|
20
|
+
boot: function() {
|
21
|
+
|
22
|
+
// init code
|
23
|
+
UI.ready(function(context) {
|
24
|
+
|
25
|
+
UI.$("[data-uk-switcher]", context).each(function() {
|
26
|
+
var switcher = UI.$(this);
|
27
|
+
|
28
|
+
if (!switcher.data("switcher")) {
|
29
|
+
var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
|
30
|
+
}
|
31
|
+
});
|
32
|
+
});
|
33
|
+
},
|
34
|
+
|
35
|
+
init: function() {
|
36
|
+
|
37
|
+
var $this = this;
|
38
|
+
|
39
|
+
this.on("click.uikit.switcher", this.options.toggle, function(e) {
|
40
|
+
e.preventDefault();
|
41
|
+
$this.show(this);
|
42
|
+
});
|
43
|
+
|
44
|
+
if (this.options.connect) {
|
45
|
+
|
46
|
+
this.connect = UI.$(this.options.connect);
|
47
|
+
|
48
|
+
this.connect.find(".uk-active").removeClass(".uk-active");
|
49
|
+
|
50
|
+
// delegate switch commands within container content
|
51
|
+
if (this.connect.length) {
|
52
|
+
|
53
|
+
// Init ARIA for connect
|
54
|
+
this.connect.children().attr('aria-hidden', 'true');
|
55
|
+
|
56
|
+
this.connect.on("click", '[data-uk-switcher-item]', function(e) {
|
57
|
+
|
58
|
+
e.preventDefault();
|
59
|
+
|
60
|
+
var item = UI.$(this).attr('data-uk-switcher-item');
|
61
|
+
|
62
|
+
if ($this.index == item) return;
|
63
|
+
|
64
|
+
switch(item) {
|
65
|
+
case 'next':
|
66
|
+
case 'previous':
|
67
|
+
$this.show($this.index + (item=='next' ? 1:-1));
|
68
|
+
break;
|
69
|
+
default:
|
70
|
+
$this.show(parseInt(item, 10));
|
71
|
+
}
|
72
|
+
}).on('swipeRight swipeLeft', function(e) {
|
73
|
+
e.preventDefault();
|
74
|
+
if(!window.getSelection().toString()) {
|
75
|
+
$this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
|
76
|
+
}
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
var toggles = this.find(this.options.toggle),
|
81
|
+
active = toggles.filter(".uk-active");
|
82
|
+
|
83
|
+
if (active.length) {
|
84
|
+
this.show(active, false);
|
85
|
+
} else {
|
86
|
+
|
87
|
+
if (this.options.active===false) return;
|
88
|
+
|
89
|
+
active = toggles.eq(this.options.active);
|
90
|
+
this.show(active.length ? active : toggles.eq(0), false);
|
91
|
+
}
|
92
|
+
|
93
|
+
// Init ARIA for toggles
|
94
|
+
toggles.not(active).attr('aria-expanded', 'false');
|
95
|
+
active.attr('aria-expanded', 'true');
|
96
|
+
|
97
|
+
this.on('changed.uk.dom', function() {
|
98
|
+
$this.connect = UI.$($this.options.connect);
|
99
|
+
});
|
100
|
+
}
|
101
|
+
|
102
|
+
},
|
103
|
+
|
104
|
+
show: function(tab, animate) {
|
105
|
+
|
106
|
+
if (this.animating) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
|
110
|
+
if (isNaN(tab)) {
|
111
|
+
tab = UI.$(tab);
|
112
|
+
} else {
|
113
|
+
|
114
|
+
var toggles = this.find(this.options.toggle);
|
115
|
+
|
116
|
+
tab = tab < 0 ? toggles.length-1 : tab;
|
117
|
+
tab = toggles.eq(toggles[tab] ? tab : 0);
|
118
|
+
}
|
119
|
+
|
120
|
+
var $this = this,
|
121
|
+
toggles = this.find(this.options.toggle),
|
122
|
+
active = UI.$(tab),
|
123
|
+
animation = Animations[this.options.animation] || function(current, next) {
|
124
|
+
|
125
|
+
if (!$this.options.animation) {
|
126
|
+
return Animations.none.apply($this);
|
127
|
+
}
|
128
|
+
|
129
|
+
var anim = $this.options.animation.split(',');
|
130
|
+
|
131
|
+
if (anim.length == 1) {
|
132
|
+
anim[1] = anim[0];
|
133
|
+
}
|
134
|
+
|
135
|
+
anim[0] = anim[0].trim();
|
136
|
+
anim[1] = anim[1].trim();
|
137
|
+
|
138
|
+
return coreAnimation.apply($this, [anim, current, next]);
|
139
|
+
};
|
140
|
+
|
141
|
+
if (animate===false || !UI.support.animation) {
|
142
|
+
animation = Animations.none;
|
143
|
+
}
|
144
|
+
|
145
|
+
if (active.hasClass("uk-disabled")) return;
|
146
|
+
|
147
|
+
// Update ARIA for Toggles
|
148
|
+
toggles.attr('aria-expanded', 'false');
|
149
|
+
active.attr('aria-expanded', 'true');
|
150
|
+
|
151
|
+
toggles.filter(".uk-active").removeClass("uk-active");
|
152
|
+
active.addClass("uk-active");
|
153
|
+
|
154
|
+
if (this.options.connect && this.connect.length) {
|
155
|
+
|
156
|
+
this.index = this.find(this.options.toggle).index(active);
|
157
|
+
|
158
|
+
if (this.index == -1 ) {
|
159
|
+
this.index = 0;
|
160
|
+
}
|
161
|
+
|
162
|
+
this.connect.each(function() {
|
163
|
+
|
164
|
+
var container = UI.$(this),
|
165
|
+
children = UI.$(container.children()),
|
166
|
+
current = UI.$(children.filter('.uk-active')),
|
167
|
+
next = UI.$(children.eq($this.index));
|
168
|
+
|
169
|
+
$this.animating = true;
|
170
|
+
|
171
|
+
animation.apply($this, [current, next]).then(function(){
|
172
|
+
|
173
|
+
current.removeClass("uk-active");
|
174
|
+
next.addClass("uk-active");
|
175
|
+
|
176
|
+
// Update ARIA for connect
|
177
|
+
current.attr('aria-hidden', 'true');
|
178
|
+
next.attr('aria-hidden', 'false');
|
179
|
+
|
180
|
+
UI.Utils.checkDisplay(next, true);
|
181
|
+
|
182
|
+
$this.animating = false;
|
183
|
+
});
|
184
|
+
});
|
185
|
+
}
|
186
|
+
|
187
|
+
this.trigger("show.uk.switcher", [active]);
|
188
|
+
}
|
189
|
+
});
|
190
|
+
|
191
|
+
Animations = {
|
192
|
+
|
193
|
+
'none': function() {
|
194
|
+
var d = UI.$.Deferred();
|
195
|
+
d.resolve();
|
196
|
+
return d.promise();
|
197
|
+
},
|
198
|
+
|
199
|
+
'fade': function(current, next) {
|
200
|
+
return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
|
201
|
+
},
|
202
|
+
|
203
|
+
'slide-bottom': function(current, next) {
|
204
|
+
return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
|
205
|
+
},
|
206
|
+
|
207
|
+
'slide-top': function(current, next) {
|
208
|
+
return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
|
209
|
+
},
|
210
|
+
|
211
|
+
'slide-vertical': function(current, next, dir) {
|
212
|
+
|
213
|
+
var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
|
214
|
+
|
215
|
+
if (current && current.index() > next.index()) {
|
216
|
+
anim.reverse();
|
217
|
+
}
|
218
|
+
|
219
|
+
return coreAnimation.apply(this, [anim, current, next]);
|
220
|
+
},
|
221
|
+
|
222
|
+
'slide-left': function(current, next) {
|
223
|
+
return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
|
224
|
+
},
|
225
|
+
|
226
|
+
'slide-right': function(current, next) {
|
227
|
+
return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
|
228
|
+
},
|
229
|
+
|
230
|
+
'slide-horizontal': function(current, next, dir) {
|
231
|
+
|
232
|
+
var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
|
233
|
+
|
234
|
+
if (current && current.index() > next.index()) {
|
235
|
+
anim.reverse();
|
236
|
+
}
|
237
|
+
|
238
|
+
return coreAnimation.apply(this, [anim, current, next]);
|
239
|
+
},
|
240
|
+
|
241
|
+
'scale': function(current, next) {
|
242
|
+
return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
|
243
|
+
}
|
244
|
+
};
|
245
|
+
|
246
|
+
UI.switcher.animations = Animations;
|
247
|
+
|
248
|
+
|
249
|
+
// helpers
|
250
|
+
|
251
|
+
function coreAnimation(cls, current, next) {
|
252
|
+
|
253
|
+
var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
|
254
|
+
|
255
|
+
if (next[0]===current[0]) {
|
256
|
+
d.resolve();
|
257
|
+
return d.promise();
|
258
|
+
}
|
259
|
+
|
260
|
+
if (typeof(cls) == 'object') {
|
261
|
+
clsIn = cls[0];
|
262
|
+
clsOut = cls[1] || cls[0];
|
263
|
+
}
|
264
|
+
|
265
|
+
release = function() {
|
266
|
+
|
267
|
+
if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
|
268
|
+
|
269
|
+
next.addClass(clsIn).one(UI.support.animation.end, function() {
|
270
|
+
|
271
|
+
next.removeClass(''+clsIn+'').css({opacity:'', display:''});
|
272
|
+
|
273
|
+
d.resolve();
|
274
|
+
|
275
|
+
if (current) current.css({opacity:'', display:''});
|
276
|
+
|
277
|
+
}.bind(this)).show();
|
278
|
+
};
|
279
|
+
|
280
|
+
next.css('animation-duration', this.options.duration+'ms');
|
281
|
+
|
282
|
+
if (current && current.length) {
|
283
|
+
|
284
|
+
current.css('animation-duration', this.options.duration+'ms');
|
285
|
+
|
286
|
+
current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
|
287
|
+
release();
|
288
|
+
}.bind(this)).css('display', '');
|
289
|
+
|
290
|
+
} else {
|
291
|
+
next.addClass('uk-active');
|
292
|
+
release();
|
293
|
+
}
|
294
|
+
|
295
|
+
return d.promise();
|
296
|
+
}
|
297
|
+
|
298
|
+
})(UIkit);
|