ServState 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -1
- data/ServState.gemspec +3 -3
- data/bin/servstate +37 -1
- data/lib/ServState/info.rb +2 -0
- data/lib/ServState/main.rb +37 -4
- data/lib/ServState/public/js/app.js +6 -3
- data/lib/ServState/version.rb +1 -1
- data/lib/ServState/views/css/custom.scss +5 -0
- data/lib/ServState/views/index.erb +4 -6
- data/lib/ServState/views/login.erb +25 -0
- metadata +15 -20
- data/lib/ServState/public/css/uikit.almost-flat.css +0 -7743
- data/lib/ServState/public/css/uikit.almost-flat.min.css +0 -3
- data/lib/ServState/public/css/uikit.css +0 -6990
- data/lib/ServState/public/css/uikit.gradient.css +0 -7859
- data/lib/ServState/public/css/uikit.min.css +0 -3
- data/lib/ServState/public/js/uikit.js +0 -2078
@@ -1,2078 +0,0 @@
|
|
1
|
-
/*! UIkit 1.2.0 | http://www.getuikit.com | (c) 2013 YOOtheme | MIT License */
|
2
|
-
|
3
|
-
(function($, doc) {
|
4
|
-
|
5
|
-
"use strict";
|
6
|
-
|
7
|
-
var UI = $.UIkit || {};
|
8
|
-
|
9
|
-
if (UI.fn) {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
|
13
|
-
UI.fn = function(command, options) {
|
14
|
-
|
15
|
-
var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
|
16
|
-
|
17
|
-
if (!UI[component]) {
|
18
|
-
$.error("UIkit component [" + component + "] does not exist.");
|
19
|
-
return this;
|
20
|
-
}
|
21
|
-
|
22
|
-
return this.each(function() {
|
23
|
-
var $this = $(this), data = $this.data(component);
|
24
|
-
if (!data) $this.data(component, (data = new UI[component](this, method ? undefined : options)));
|
25
|
-
if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
|
26
|
-
});
|
27
|
-
};
|
28
|
-
|
29
|
-
UI.version = '1.2.0';
|
30
|
-
|
31
|
-
UI.support = {};
|
32
|
-
UI.support.transition = (function() {
|
33
|
-
|
34
|
-
var transitionEnd = (function() {
|
35
|
-
|
36
|
-
var element = doc.body || doc.documentElement,
|
37
|
-
transEndEventNames = {
|
38
|
-
WebkitTransition: 'webkitTransitionEnd',
|
39
|
-
MozTransition: 'transitionend',
|
40
|
-
OTransition: 'oTransitionEnd otransitionend',
|
41
|
-
transition: 'transitionend'
|
42
|
-
}, name;
|
43
|
-
|
44
|
-
for (name in transEndEventNames) {
|
45
|
-
if (element.style[name] !== undefined) {
|
46
|
-
return transEndEventNames[name];
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
}());
|
51
|
-
|
52
|
-
return transitionEnd && { end: transitionEnd };
|
53
|
-
|
54
|
-
})();
|
55
|
-
|
56
|
-
UI.support.touch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
|
57
|
-
UI.support.mutationobserver = (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver || null);
|
58
|
-
|
59
|
-
|
60
|
-
UI.Utils = {};
|
61
|
-
|
62
|
-
UI.Utils.debounce = function(func, wait, immediate) {
|
63
|
-
var timeout;
|
64
|
-
return function() {
|
65
|
-
var context = this, args = arguments;
|
66
|
-
var later = function() {
|
67
|
-
timeout = null;
|
68
|
-
if (!immediate) func.apply(context, args);
|
69
|
-
};
|
70
|
-
var callNow = immediate && !timeout;
|
71
|
-
clearTimeout(timeout);
|
72
|
-
timeout = setTimeout(later, wait);
|
73
|
-
if (callNow) func.apply(context, args);
|
74
|
-
};
|
75
|
-
};
|
76
|
-
|
77
|
-
UI.Utils.options = function(string) {
|
78
|
-
|
79
|
-
if ($.isPlainObject(string)) return string;
|
80
|
-
|
81
|
-
var start = (string ? string.indexOf("{") : -1), options = {};
|
82
|
-
|
83
|
-
if (start != -1) {
|
84
|
-
try {
|
85
|
-
options = (new Function("", "var json = " + string.substr(start) + "; return JSON.parse(JSON.stringify(json));"))();
|
86
|
-
} catch (e) {}
|
87
|
-
}
|
88
|
-
|
89
|
-
return options;
|
90
|
-
};
|
91
|
-
|
92
|
-
$.UIkit = UI;
|
93
|
-
$.fn.uk = UI.fn;
|
94
|
-
|
95
|
-
$.UIkit.langdirection = $("html").attr("dir") == "rtl" ? "right" : "left";
|
96
|
-
|
97
|
-
$(function(){
|
98
|
-
|
99
|
-
$(doc).trigger("uk-domready");
|
100
|
-
|
101
|
-
// Check for dom modifications
|
102
|
-
if(!UI.support.mutationobserver) return;
|
103
|
-
|
104
|
-
var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
|
105
|
-
$(doc).trigger("uk-domready");
|
106
|
-
}, 300));
|
107
|
-
|
108
|
-
// pass in the target node, as well as the observer options
|
109
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
110
|
-
});
|
111
|
-
|
112
|
-
|
113
|
-
})(jQuery, document);
|
114
|
-
|
115
|
-
;(function($){
|
116
|
-
var touch = {},
|
117
|
-
touchTimeout, tapTimeout, swipeTimeout,
|
118
|
-
longTapDelay = 750, longTapTimeout;
|
119
|
-
|
120
|
-
function parentIfText(node) {
|
121
|
-
return 'tagName' in node ? node : node.parentNode;
|
122
|
-
}
|
123
|
-
|
124
|
-
function swipeDirection(x1, x2, y1, y2) {
|
125
|
-
var xDelta = Math.abs(x1 - x2), yDelta = Math.abs(y1 - y2);
|
126
|
-
return xDelta >= yDelta ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
|
127
|
-
}
|
128
|
-
|
129
|
-
function longTap() {
|
130
|
-
longTapTimeout = null;
|
131
|
-
if (touch.last) {
|
132
|
-
touch.el.trigger('longTap');
|
133
|
-
touch = {};
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
function cancelLongTap() {
|
138
|
-
if (longTapTimeout) clearTimeout(longTapTimeout);
|
139
|
-
longTapTimeout = null;
|
140
|
-
}
|
141
|
-
|
142
|
-
function cancelAll() {
|
143
|
-
if (touchTimeout) clearTimeout(touchTimeout);
|
144
|
-
if (tapTimeout) clearTimeout(tapTimeout);
|
145
|
-
if (swipeTimeout) clearTimeout(swipeTimeout);
|
146
|
-
if (longTapTimeout) clearTimeout(longTapTimeout);
|
147
|
-
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
|
148
|
-
touch = {};
|
149
|
-
}
|
150
|
-
|
151
|
-
$(document).ready(function(){
|
152
|
-
var now, delta;
|
153
|
-
|
154
|
-
$(document.body)
|
155
|
-
.bind('touchstart', function(e){
|
156
|
-
now = Date.now();
|
157
|
-
delta = now - (touch.last || now);
|
158
|
-
touch.el = $(parentIfText(e.originalEvent.touches[0].target));
|
159
|
-
if(touchTimeout) clearTimeout(touchTimeout);
|
160
|
-
touch.x1 = e.originalEvent.touches[0].pageX;
|
161
|
-
touch.y1 = e.originalEvent.touches[0].pageY;
|
162
|
-
if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
|
163
|
-
touch.last = now;
|
164
|
-
longTapTimeout = setTimeout(longTap, longTapDelay);
|
165
|
-
})
|
166
|
-
.bind('touchmove', function(e){
|
167
|
-
cancelLongTap();
|
168
|
-
touch.x2 = e.originalEvent.touches[0].pageX;
|
169
|
-
touch.y2 = e.originalEvent.touches[0].pageY;
|
170
|
-
})
|
171
|
-
.bind('touchend', function(e){
|
172
|
-
cancelLongTap();
|
173
|
-
|
174
|
-
// swipe
|
175
|
-
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30))
|
176
|
-
|
177
|
-
swipeTimeout = setTimeout(function() {
|
178
|
-
touch.el.trigger('swipe');
|
179
|
-
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
|
180
|
-
touch = {};
|
181
|
-
}, 0);
|
182
|
-
|
183
|
-
// normal tap
|
184
|
-
else if ('last' in touch)
|
185
|
-
|
186
|
-
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
|
187
|
-
// ('tap' fires before 'scroll')
|
188
|
-
tapTimeout = setTimeout(function() {
|
189
|
-
|
190
|
-
// trigger universal 'tap' with the option to cancelTouch()
|
191
|
-
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
|
192
|
-
var event = $.Event('tap');
|
193
|
-
event.cancelTouch = cancelAll;
|
194
|
-
touch.el.trigger(event);
|
195
|
-
|
196
|
-
// trigger double tap immediately
|
197
|
-
if (touch.isDoubleTap) {
|
198
|
-
touch.el.trigger('doubleTap');
|
199
|
-
touch = {};
|
200
|
-
}
|
201
|
-
|
202
|
-
// trigger single tap after 250ms of inactivity
|
203
|
-
else {
|
204
|
-
touchTimeout = setTimeout(function(){
|
205
|
-
touchTimeout = null;
|
206
|
-
touch.el.trigger('singleTap');
|
207
|
-
touch = {};
|
208
|
-
}, 250);
|
209
|
-
}
|
210
|
-
|
211
|
-
}, 0);
|
212
|
-
|
213
|
-
})
|
214
|
-
.bind('touchcancel', cancelAll);
|
215
|
-
|
216
|
-
$(window).bind('scroll', cancelAll);
|
217
|
-
});
|
218
|
-
|
219
|
-
['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(m){
|
220
|
-
$.fn[m] = function(callback){ return this.bind(m, callback); };
|
221
|
-
});
|
222
|
-
})(jQuery);
|
223
|
-
|
224
|
-
(function($, UI) {
|
225
|
-
|
226
|
-
"use strict";
|
227
|
-
|
228
|
-
var Alert = function(element, options) {
|
229
|
-
|
230
|
-
var $this = this;
|
231
|
-
|
232
|
-
this.options = $.extend({}, this.options, options);
|
233
|
-
this.element = $(element);
|
234
|
-
|
235
|
-
if(this.element.data("alert")) return;
|
236
|
-
|
237
|
-
this.element.on("click", this.options.trigger, function(e) {
|
238
|
-
e.preventDefault();
|
239
|
-
$this.close();
|
240
|
-
});
|
241
|
-
|
242
|
-
this.element.data("alert", this);
|
243
|
-
};
|
244
|
-
|
245
|
-
$.extend(Alert.prototype, {
|
246
|
-
|
247
|
-
options: {
|
248
|
-
"fade": true,
|
249
|
-
"duration": 200,
|
250
|
-
"trigger": ".uk-alert-close"
|
251
|
-
},
|
252
|
-
|
253
|
-
close: function() {
|
254
|
-
|
255
|
-
var element = this.element.trigger("close");
|
256
|
-
|
257
|
-
if (this.options.fade) {
|
258
|
-
element.css("overflow", "hidden").css("max-height", element.height()).animate({
|
259
|
-
"height": 0,
|
260
|
-
"opacity": 0,
|
261
|
-
"padding-top": 0,
|
262
|
-
"padding-bottom": 0,
|
263
|
-
"margin-top": 0,
|
264
|
-
"margin-bottom": 0
|
265
|
-
}, this.options.duration, removeElement);
|
266
|
-
} else {
|
267
|
-
removeElement();
|
268
|
-
}
|
269
|
-
|
270
|
-
function removeElement() {
|
271
|
-
element.trigger("closed").remove();
|
272
|
-
}
|
273
|
-
}
|
274
|
-
|
275
|
-
});
|
276
|
-
|
277
|
-
UI["alert"] = Alert;
|
278
|
-
|
279
|
-
// init code
|
280
|
-
$(document).on("click.alert.uikit", "[data-uk-alert]", function(e) {
|
281
|
-
|
282
|
-
var ele = $(this);
|
283
|
-
if (!ele.data("alert")) {
|
284
|
-
|
285
|
-
var alert = new Alert(ele, UI.Utils.options(ele.data("uk-alert")));
|
286
|
-
|
287
|
-
if ($(e.target).is(ele.data("alert").options.trigger)) {
|
288
|
-
e.preventDefault();
|
289
|
-
alert.close();
|
290
|
-
}
|
291
|
-
}
|
292
|
-
});
|
293
|
-
|
294
|
-
})(jQuery, jQuery.UIkit);
|
295
|
-
|
296
|
-
(function($, UI) {
|
297
|
-
|
298
|
-
"use strict";
|
299
|
-
|
300
|
-
var ButtonRadio = function(element, options) {
|
301
|
-
|
302
|
-
var $this = this, $element = $(element);
|
303
|
-
|
304
|
-
if($element.data("buttonRadio")) return;
|
305
|
-
|
306
|
-
this.options = $.extend({}, this.options, options);
|
307
|
-
this.element = $element.on("click", this.options.target, function(e) {
|
308
|
-
e.preventDefault();
|
309
|
-
$element.find($this.options.target).not(this).removeClass("uk-active").blur();
|
310
|
-
$element.trigger("change", [$(this).addClass("uk-active")]);
|
311
|
-
});
|
312
|
-
|
313
|
-
this.element.data("buttonRadio", this);
|
314
|
-
};
|
315
|
-
|
316
|
-
$.extend(ButtonRadio.prototype, {
|
317
|
-
|
318
|
-
options: {
|
319
|
-
"target": ".uk-button"
|
320
|
-
},
|
321
|
-
|
322
|
-
getSelected: function() {
|
323
|
-
this.element.find(".uk-active");
|
324
|
-
}
|
325
|
-
|
326
|
-
});
|
327
|
-
|
328
|
-
var ButtonCheckbox = function(element, options) {
|
329
|
-
|
330
|
-
var $element = $(element);
|
331
|
-
|
332
|
-
if($element.data("buttonCheckbox")) return;
|
333
|
-
|
334
|
-
this.options = $.extend({}, this.options, options);
|
335
|
-
this.element = $element.on("click", this.options.target, function(e) {
|
336
|
-
e.preventDefault();
|
337
|
-
$element.trigger("change", [$(this).toggleClass("uk-active").blur()]);
|
338
|
-
});
|
339
|
-
|
340
|
-
this.element.data("buttonCheckbox", this);
|
341
|
-
};
|
342
|
-
|
343
|
-
$.extend(ButtonCheckbox.prototype, {
|
344
|
-
|
345
|
-
options: {
|
346
|
-
"target": ".uk-button"
|
347
|
-
},
|
348
|
-
|
349
|
-
getSelected: function() {
|
350
|
-
this.element.find(".uk-active");
|
351
|
-
}
|
352
|
-
|
353
|
-
});
|
354
|
-
|
355
|
-
var Button = function(element, options) {
|
356
|
-
|
357
|
-
var $this = this, $element = $(element);
|
358
|
-
|
359
|
-
if($element.data("button")) return;
|
360
|
-
|
361
|
-
this.options = $.extend({}, this.options, options);
|
362
|
-
this.element = $element.on("click", function(e) {
|
363
|
-
e.preventDefault();
|
364
|
-
$this.toggle();
|
365
|
-
$this.element.blur();
|
366
|
-
});
|
367
|
-
|
368
|
-
this.element.data("button", this);
|
369
|
-
};
|
370
|
-
|
371
|
-
$.extend(Button.prototype, {
|
372
|
-
|
373
|
-
options: {},
|
374
|
-
|
375
|
-
toggle: function() {
|
376
|
-
this.element.toggleClass("uk-active");
|
377
|
-
}
|
378
|
-
|
379
|
-
});
|
380
|
-
|
381
|
-
UI["button"] = Button;
|
382
|
-
UI["buttonCheckbox"] = ButtonCheckbox;
|
383
|
-
UI["buttonRadio"] = ButtonRadio;
|
384
|
-
|
385
|
-
// init code
|
386
|
-
$(document).on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
|
387
|
-
var ele = $(this);
|
388
|
-
|
389
|
-
if (!ele.data("buttonRadio")) {
|
390
|
-
var obj = new ButtonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio")));
|
391
|
-
|
392
|
-
if ($(e.target).is(obj.options.target)) {
|
393
|
-
$(e.target).trigger("click");
|
394
|
-
}
|
395
|
-
}
|
396
|
-
});
|
397
|
-
|
398
|
-
$(document).on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
|
399
|
-
var ele = $(this);
|
400
|
-
|
401
|
-
if (!ele.data("buttonCheckbox")) {
|
402
|
-
var obj = new ButtonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox")));
|
403
|
-
|
404
|
-
if ($(e.target).is(obj.options.target)) {
|
405
|
-
$(e.target).trigger("click");
|
406
|
-
}
|
407
|
-
}
|
408
|
-
});
|
409
|
-
|
410
|
-
$(document).on("click.button.uikit", "[data-uk-button]", function(e) {
|
411
|
-
var ele = $(this);
|
412
|
-
|
413
|
-
if (!ele.data("button")) {
|
414
|
-
|
415
|
-
var obj = new Button(ele, ele.attr("data-uk-button"));
|
416
|
-
ele.trigger("click");
|
417
|
-
}
|
418
|
-
});
|
419
|
-
|
420
|
-
})(jQuery, jQuery.UIkit);
|
421
|
-
|
422
|
-
(function($, UI) {
|
423
|
-
|
424
|
-
"use strict";
|
425
|
-
|
426
|
-
var active = false,
|
427
|
-
Dropdown = function(element, options) {
|
428
|
-
|
429
|
-
var $this = this, $element = $(element);
|
430
|
-
|
431
|
-
if($element.data("dropdown")) return;
|
432
|
-
|
433
|
-
this.options = $.extend({}, this.options, options);
|
434
|
-
this.element = $element;
|
435
|
-
this.dropdown = this.element.find(".uk-dropdown");
|
436
|
-
|
437
|
-
this.centered = this.dropdown.hasClass("uk-dropdown-center");
|
438
|
-
this.justified = this.options.justify ? $(this.options.justify) : false;
|
439
|
-
|
440
|
-
this.boundary = $(this.options.boundary);
|
441
|
-
|
442
|
-
if(!this.boundary.length) {
|
443
|
-
this.boundary = $(window);
|
444
|
-
}
|
445
|
-
|
446
|
-
if (this.options.mode == "click") {
|
447
|
-
|
448
|
-
this.element.on("click", function(e) {
|
449
|
-
|
450
|
-
if (!$(e.target).parents(".uk-dropdown").length) {
|
451
|
-
e.preventDefault();
|
452
|
-
}
|
453
|
-
|
454
|
-
if (active && active[0] != $this.element[0]) {
|
455
|
-
active.removeClass("uk-open");
|
456
|
-
}
|
457
|
-
|
458
|
-
if (!$this.element.hasClass("uk-open")) {
|
459
|
-
|
460
|
-
$this.checkDimensions();
|
461
|
-
|
462
|
-
$this.element.addClass("uk-open");
|
463
|
-
|
464
|
-
active = $this.element;
|
465
|
-
|
466
|
-
$(document).off("click.outer.dropdown");
|
467
|
-
|
468
|
-
setTimeout(function() {
|
469
|
-
$(document).on("click.outer.dropdown", function(e) {
|
470
|
-
|
471
|
-
if (active && active[0] == $this.element[0] && ($(e.target).is("a") || !$this.element.find(".uk-dropdown").find(e.target).length)) {
|
472
|
-
active.removeClass("uk-open");
|
473
|
-
|
474
|
-
$(document).off("click.outer.dropdown");
|
475
|
-
}
|
476
|
-
});
|
477
|
-
}, 10);
|
478
|
-
|
479
|
-
} else {
|
480
|
-
|
481
|
-
if ($(e.target).is("a") || !$this.element.find(".uk-dropdown").find(e.target).length) {
|
482
|
-
$this.element.removeClass("uk-open");
|
483
|
-
active = false;
|
484
|
-
}
|
485
|
-
}
|
486
|
-
});
|
487
|
-
|
488
|
-
} else {
|
489
|
-
|
490
|
-
this.element.on("mouseenter", function(e) {
|
491
|
-
|
492
|
-
if ($this.remainIdle) {
|
493
|
-
clearTimeout($this.remainIdle);
|
494
|
-
}
|
495
|
-
|
496
|
-
if (active && active[0] != $this.element[0]) {
|
497
|
-
active.removeClass("uk-open");
|
498
|
-
}
|
499
|
-
|
500
|
-
$this.checkDimensions();
|
501
|
-
|
502
|
-
$this.element.addClass("uk-open");
|
503
|
-
active = $this.element;
|
504
|
-
|
505
|
-
}).on("mouseleave", function() {
|
506
|
-
|
507
|
-
$this.remainIdle = setTimeout(function() {
|
508
|
-
|
509
|
-
$this.element.removeClass("uk-open");
|
510
|
-
$this.remainIdle = false;
|
511
|
-
|
512
|
-
if (active && active[0] == $this.element[0]) active = false;
|
513
|
-
|
514
|
-
}, $this.options.remaintime);
|
515
|
-
});
|
516
|
-
}
|
517
|
-
|
518
|
-
this.element.data("dropdown", this);
|
519
|
-
|
520
|
-
};
|
521
|
-
|
522
|
-
$.extend(Dropdown.prototype, {
|
523
|
-
|
524
|
-
remainIdle: false,
|
525
|
-
|
526
|
-
options: {
|
527
|
-
"mode": "hover",
|
528
|
-
"remaintime": 800,
|
529
|
-
"justify": false,
|
530
|
-
"boundary": $(window)
|
531
|
-
},
|
532
|
-
|
533
|
-
checkDimensions: function() {
|
534
|
-
|
535
|
-
if(!this.dropdown.length) return;
|
536
|
-
|
537
|
-
var dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, "").css("min-width", ""),
|
538
|
-
offset = dropdown.show().offset(),
|
539
|
-
width = dropdown.outerWidth(),
|
540
|
-
boundarywidth = this.boundary.width(),
|
541
|
-
boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
|
542
|
-
|
543
|
-
// centered dropdown
|
544
|
-
if (this.centered) {
|
545
|
-
dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
|
546
|
-
offset = dropdown.offset();
|
547
|
-
|
548
|
-
// reset dropdown
|
549
|
-
if ((width + offset.left) > boundarywidth || offset.left < 0) {
|
550
|
-
dropdown.css("margin-" + $.UIkit.langdirection, "");
|
551
|
-
offset = dropdown.offset();
|
552
|
-
}
|
553
|
-
}
|
554
|
-
|
555
|
-
// justify dropdown
|
556
|
-
if (this.justified && this.justified.length) {
|
557
|
-
|
558
|
-
var jwidth = this.justified.outerWidth();
|
559
|
-
|
560
|
-
dropdown.css("min-width", jwidth);
|
561
|
-
|
562
|
-
if ($.UIkit.langdirection == 'right') {
|
563
|
-
|
564
|
-
var right1 = boundarywidth - (this.justified.offset().left + jwidth),
|
565
|
-
right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
|
566
|
-
|
567
|
-
dropdown.css("margin-right", right1 - right2);
|
568
|
-
|
569
|
-
} else {
|
570
|
-
dropdown.css("margin-left", this.justified.offset().left - offset.left);
|
571
|
-
}
|
572
|
-
|
573
|
-
offset = dropdown.offset();
|
574
|
-
|
575
|
-
}
|
576
|
-
|
577
|
-
if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
|
578
|
-
dropdown.addClass("uk-dropdown-flip");
|
579
|
-
offset = dropdown.offset();
|
580
|
-
}
|
581
|
-
|
582
|
-
if (offset.left < 0) {
|
583
|
-
dropdown.addClass("uk-dropdown-stack");
|
584
|
-
}
|
585
|
-
|
586
|
-
dropdown.css("display", "");
|
587
|
-
}
|
588
|
-
|
589
|
-
});
|
590
|
-
|
591
|
-
UI["dropdown"] = Dropdown;
|
592
|
-
|
593
|
-
|
594
|
-
var triggerevent = UI.support.touch ? "touchstart":"mouseenter";
|
595
|
-
|
596
|
-
// init code
|
597
|
-
$(document).on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
|
598
|
-
var ele = $(this);
|
599
|
-
|
600
|
-
if (!ele.data("dropdown")) {
|
601
|
-
|
602
|
-
var dropdown = new Dropdown(ele, UI.Utils.options(ele.data("uk-dropdown")));
|
603
|
-
|
604
|
-
if(triggerevent == "mouseenter" && dropdown.options.mode == "hover") {
|
605
|
-
ele.trigger("mouseenter");
|
606
|
-
}
|
607
|
-
}
|
608
|
-
});
|
609
|
-
|
610
|
-
})(jQuery, jQuery.UIkit);
|
611
|
-
|
612
|
-
(function($, UI) {
|
613
|
-
|
614
|
-
"use strict";
|
615
|
-
|
616
|
-
var win = $(window),
|
617
|
-
event = 'resize orientationchange',
|
618
|
-
|
619
|
-
GridMatch = function(element, options) {
|
620
|
-
|
621
|
-
var $this = this, $element = $(element);
|
622
|
-
|
623
|
-
if($element.data("gridMatchHeight")) return;
|
624
|
-
|
625
|
-
this.options = $.extend({}, this.options, options);
|
626
|
-
|
627
|
-
this.element = $element;
|
628
|
-
this.columns = this.element.children();
|
629
|
-
this.elements = this.options.target ? this.element.find(this.options.target) : this.columns;
|
630
|
-
|
631
|
-
if (!this.columns.length) return;
|
632
|
-
|
633
|
-
win.on(event, (function() {
|
634
|
-
var fn = function() {
|
635
|
-
$this.match();
|
636
|
-
};
|
637
|
-
|
638
|
-
$(function() {
|
639
|
-
fn();
|
640
|
-
win.on("load", fn);
|
641
|
-
});
|
642
|
-
|
643
|
-
return UI.Utils.debounce(fn, 150);
|
644
|
-
})());
|
645
|
-
|
646
|
-
$(document).on("uk-domready", function(e) {
|
647
|
-
$this.columns = $this.element.children();
|
648
|
-
$this.elements = $this.options.target ? $this.element.find($this.options.target) : $this.columns;
|
649
|
-
$this.match();
|
650
|
-
});
|
651
|
-
|
652
|
-
this.element.data("gridMatch", this);
|
653
|
-
};
|
654
|
-
|
655
|
-
$.extend(GridMatch.prototype, {
|
656
|
-
|
657
|
-
options: {
|
658
|
-
"target": false
|
659
|
-
},
|
660
|
-
|
661
|
-
match: function() {
|
662
|
-
|
663
|
-
this.revert();
|
664
|
-
|
665
|
-
var firstvisible = this.columns.filter(":visible:first");
|
666
|
-
|
667
|
-
if (!firstvisible.length) return;
|
668
|
-
|
669
|
-
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false,
|
670
|
-
max = 0,
|
671
|
-
$this = this;
|
672
|
-
|
673
|
-
if (stacked) return;
|
674
|
-
|
675
|
-
this.elements.each(function() {
|
676
|
-
max = Math.max(max, $(this).outerHeight());
|
677
|
-
}).each(function(i) {
|
678
|
-
|
679
|
-
var element = $(this),
|
680
|
-
boxheight = element.css("box-sizing") == "border-box" ? "outerHeight" : "height",
|
681
|
-
box = $this.columns.eq(i),
|
682
|
-
height = (element.height() + (max - box[boxheight]()));
|
683
|
-
|
684
|
-
element.css('min-height', height + 'px');
|
685
|
-
});
|
686
|
-
|
687
|
-
return this;
|
688
|
-
},
|
689
|
-
|
690
|
-
revert: function() {
|
691
|
-
this.elements.css('min-height', '');
|
692
|
-
return this;
|
693
|
-
}
|
694
|
-
|
695
|
-
});
|
696
|
-
|
697
|
-
var GridMargin = function(element) {
|
698
|
-
|
699
|
-
var $this = this, $element = $(element);
|
700
|
-
|
701
|
-
if($element.data("gridMargin")) return;
|
702
|
-
|
703
|
-
this.element = $element;
|
704
|
-
this.columns = this.element.children();
|
705
|
-
|
706
|
-
if (!this.columns.length) return;
|
707
|
-
|
708
|
-
win.on(event, (function() {
|
709
|
-
var fn = function() {
|
710
|
-
$this.process();
|
711
|
-
};
|
712
|
-
|
713
|
-
$(function() {
|
714
|
-
fn();
|
715
|
-
win.on("load", fn);
|
716
|
-
});
|
717
|
-
|
718
|
-
return UI.Utils.debounce(fn, 150);
|
719
|
-
})());
|
720
|
-
|
721
|
-
$(document).on("uk-domready", function(e) {
|
722
|
-
$this.columns = $this.element.children();
|
723
|
-
$this.process();
|
724
|
-
});
|
725
|
-
|
726
|
-
this.element.data("gridMargin", this);
|
727
|
-
};
|
728
|
-
|
729
|
-
$.extend(GridMargin.prototype, {
|
730
|
-
|
731
|
-
process: function() {
|
732
|
-
|
733
|
-
this.revert();
|
734
|
-
|
735
|
-
var skip = false,
|
736
|
-
firstvisible = this.columns.filter(":visible:first"),
|
737
|
-
offset = firstvisible.length ? firstvisible.offset().top : false;
|
738
|
-
|
739
|
-
if (offset === false) return;
|
740
|
-
|
741
|
-
this.columns.each(function() {
|
742
|
-
|
743
|
-
var column = $(this);
|
744
|
-
|
745
|
-
if (column.is(":visible")) {
|
746
|
-
|
747
|
-
if (skip) {
|
748
|
-
column.addClass("uk-grid-margin");
|
749
|
-
} else {
|
750
|
-
if (column.offset().top != offset) {
|
751
|
-
column.addClass("uk-grid-margin");
|
752
|
-
skip = true;
|
753
|
-
}
|
754
|
-
}
|
755
|
-
}
|
756
|
-
|
757
|
-
});
|
758
|
-
|
759
|
-
return this;
|
760
|
-
},
|
761
|
-
|
762
|
-
revert: function() {
|
763
|
-
this.columns.removeClass('uk-grid-margin');
|
764
|
-
return this;
|
765
|
-
}
|
766
|
-
|
767
|
-
});
|
768
|
-
|
769
|
-
UI["gridMatch"] = GridMatch;
|
770
|
-
UI["gridMargin"] = GridMargin;
|
771
|
-
|
772
|
-
// init code
|
773
|
-
$(document).on("uk-domready", function(e) {
|
774
|
-
$("[data-uk-grid-match],[data-uk-grid-margin]").each(function() {
|
775
|
-
var grid = $(this), obj;
|
776
|
-
|
777
|
-
if (grid.is("[data-uk-grid-match]") && !grid.data("gridMatch")) {
|
778
|
-
obj = new GridMatch(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
|
779
|
-
}
|
780
|
-
|
781
|
-
if (grid.is("[data-uk-grid-margin]") && !grid.data("gridMargin")) {
|
782
|
-
obj = new GridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
|
783
|
-
}
|
784
|
-
});
|
785
|
-
});
|
786
|
-
|
787
|
-
})(jQuery, jQuery.UIkit);
|
788
|
-
|
789
|
-
(function($, UI, $win) {
|
790
|
-
|
791
|
-
"use strict";
|
792
|
-
|
793
|
-
var active = false,
|
794
|
-
html = $("html"),
|
795
|
-
|
796
|
-
Modal = function(element, options) {
|
797
|
-
|
798
|
-
var $this = this;
|
799
|
-
|
800
|
-
this.element = $(element);
|
801
|
-
this.options = $.extend({
|
802
|
-
keyboard: true,
|
803
|
-
show: false,
|
804
|
-
bgclose: true
|
805
|
-
}, options);
|
806
|
-
|
807
|
-
this.transition = UI.support.transition;
|
808
|
-
this.dialog = this.element.find(".uk-modal-dialog");
|
809
|
-
|
810
|
-
this.element.on("click", ".uk-modal-close", function(e) {
|
811
|
-
e.preventDefault();
|
812
|
-
$this.hide();
|
813
|
-
|
814
|
-
}).on("click", function(e) {
|
815
|
-
|
816
|
-
var target = $(e.target);
|
817
|
-
|
818
|
-
if (target[0] == $this.element[0] && $this.options.bgclose) {
|
819
|
-
$this.hide();
|
820
|
-
}
|
821
|
-
|
822
|
-
});
|
823
|
-
|
824
|
-
if (this.options.keyboard) {
|
825
|
-
$(document).on('keyup.ui.modal.escape', function(e) {
|
826
|
-
if (active && e.which == 27 && $this.isActive()) $this.hide();
|
827
|
-
});
|
828
|
-
}
|
829
|
-
};
|
830
|
-
|
831
|
-
$.extend(Modal.prototype, {
|
832
|
-
|
833
|
-
transition: false,
|
834
|
-
|
835
|
-
toggle: function() {
|
836
|
-
this[this.isActive() ? "hide" : "show"]();
|
837
|
-
},
|
838
|
-
|
839
|
-
show: function() {
|
840
|
-
|
841
|
-
var $this = this;
|
842
|
-
|
843
|
-
if (this.isActive()) return;
|
844
|
-
if (active) active.hide(true);
|
845
|
-
|
846
|
-
this.resize();
|
847
|
-
|
848
|
-
this.element.removeClass("uk-open").show();
|
849
|
-
|
850
|
-
active = this;
|
851
|
-
html.addClass("uk-modal-page").height(); // force browser engine redraw
|
852
|
-
|
853
|
-
this.element.addClass("uk-open").trigger("uk.modal.show");
|
854
|
-
},
|
855
|
-
|
856
|
-
hide: function(force) {
|
857
|
-
|
858
|
-
if (!this.isActive()) return;
|
859
|
-
|
860
|
-
if (!force && UI.support.transition) {
|
861
|
-
|
862
|
-
var $this = this;
|
863
|
-
|
864
|
-
this.element.one(UI.support.transition.end, function() {
|
865
|
-
$this._hide();
|
866
|
-
}).removeClass("uk-open");
|
867
|
-
|
868
|
-
} else {
|
869
|
-
|
870
|
-
this._hide();
|
871
|
-
}
|
872
|
-
},
|
873
|
-
|
874
|
-
resize: function() {
|
875
|
-
|
876
|
-
this.dialog.css("margin-left", "");
|
877
|
-
|
878
|
-
var modalwidth = parseInt(this.dialog.css("width"), 10),
|
879
|
-
inview = (modalwidth + parseInt(this.dialog.css("margin-left"),10) + parseInt(this.dialog.css("margin-right"),10)) < $win.width();
|
880
|
-
|
881
|
-
this.dialog.css("margin-left", modalwidth && inview ? -1*Math.ceil(modalwidth/2) : "");
|
882
|
-
},
|
883
|
-
|
884
|
-
_hide: function() {
|
885
|
-
|
886
|
-
this.element.hide().removeClass("uk-open");
|
887
|
-
|
888
|
-
html.removeClass("uk-modal-page");
|
889
|
-
|
890
|
-
if(active===this) active = false;
|
891
|
-
|
892
|
-
this.element.trigger("uk.modal.hide");
|
893
|
-
},
|
894
|
-
|
895
|
-
isActive: function() {
|
896
|
-
return (active == this);
|
897
|
-
}
|
898
|
-
|
899
|
-
});
|
900
|
-
|
901
|
-
var ModalTrigger = function(element, options) {
|
902
|
-
|
903
|
-
var $this = this,
|
904
|
-
$element = $(element);
|
905
|
-
|
906
|
-
if($element.data("modal")) return;
|
907
|
-
|
908
|
-
this.options = $.extend({
|
909
|
-
"target": $element.is("a") ? $element.attr("href") : false
|
910
|
-
}, options);
|
911
|
-
|
912
|
-
this.element = $element;
|
913
|
-
|
914
|
-
this.modal = new Modal(this.options.target, options);
|
915
|
-
|
916
|
-
$element.on("click", function(e) {
|
917
|
-
e.preventDefault();
|
918
|
-
$this.show();
|
919
|
-
});
|
920
|
-
|
921
|
-
//methods
|
922
|
-
|
923
|
-
$.each(["show", "hide", "isActive"], function(index, method) {
|
924
|
-
$this[method] = function() { return $this.modal[method](); };
|
925
|
-
});
|
926
|
-
|
927
|
-
this.element.data("modal", this);
|
928
|
-
};
|
929
|
-
|
930
|
-
ModalTrigger.Modal = Modal;
|
931
|
-
|
932
|
-
UI["modal"] = ModalTrigger;
|
933
|
-
|
934
|
-
// init code
|
935
|
-
$(document).on("click.modal.uikit", "[data-uk-modal]", function(e) {
|
936
|
-
var ele = $(this);
|
937
|
-
|
938
|
-
if (!ele.data("modal")) {
|
939
|
-
var modal = new ModalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
|
940
|
-
modal.show();
|
941
|
-
}
|
942
|
-
|
943
|
-
});
|
944
|
-
|
945
|
-
$win.on("resize orientationchange", UI.Utils.debounce(function(){
|
946
|
-
|
947
|
-
if(active) active.resize();
|
948
|
-
|
949
|
-
}, 150));
|
950
|
-
|
951
|
-
})(jQuery, jQuery.UIkit, jQuery(window));
|
952
|
-
|
953
|
-
(function($, UI) {
|
954
|
-
|
955
|
-
"use strict";
|
956
|
-
|
957
|
-
if (UI.support.touch) {
|
958
|
-
$("html").addClass("uk-touch");
|
959
|
-
}
|
960
|
-
|
961
|
-
var $win = $(window),
|
962
|
-
$doc = $(document),
|
963
|
-
Offcanvas = {
|
964
|
-
|
965
|
-
show: function(element) {
|
966
|
-
|
967
|
-
element = $(element);
|
968
|
-
|
969
|
-
if (!element.length) return;
|
970
|
-
|
971
|
-
var doc = $("html"),
|
972
|
-
bar = element.find(".uk-offcanvas-bar:first"),
|
973
|
-
dir = bar.hasClass("uk-offcanvas-bar-flip") ? -1 : 1,
|
974
|
-
scrollbar = dir == -1 && $win.width() < window.innerWidth ? (window.innerWidth - $win.width()) : 0;
|
975
|
-
|
976
|
-
scrollpos = {x: window.scrollX, y: window.scrollY};
|
977
|
-
|
978
|
-
element.addClass("uk-active");
|
979
|
-
|
980
|
-
doc.css({"width": window.innerWidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
|
981
|
-
doc.css("margin-left", ((bar.outerWidth() - scrollbar) * dir)).width(); // .width() - force redraw
|
982
|
-
|
983
|
-
bar.addClass("uk-offcanvas-bar-show").width();
|
984
|
-
|
985
|
-
element.off(".ukoffcanvas").on("click.ukoffcanvas swipeRight.ukoffcanvas swipeLeft.ukoffcanvas", function(e) {
|
986
|
-
|
987
|
-
var target = $(e.target);
|
988
|
-
|
989
|
-
if (!e.type.match(/swipe/)) {
|
990
|
-
if (target.hasClass("uk-offcanvas-bar")) return;
|
991
|
-
if (target.parents(".uk-offcanvas-bar:first").length) return;
|
992
|
-
}
|
993
|
-
|
994
|
-
e.stopImmediatePropagation();
|
995
|
-
|
996
|
-
Offcanvas.hide();
|
997
|
-
});
|
998
|
-
|
999
|
-
$doc.on('keydown.offcanvas', function(e) {
|
1000
|
-
if (e.keyCode === 27) { // ESC
|
1001
|
-
Offcanvas.hide();
|
1002
|
-
}
|
1003
|
-
});
|
1004
|
-
},
|
1005
|
-
|
1006
|
-
hide: function(force) {
|
1007
|
-
|
1008
|
-
var doc = $("html"),
|
1009
|
-
panel = $(".uk-offcanvas.uk-active"),
|
1010
|
-
bar = panel.find(".uk-offcanvas-bar:first");
|
1011
|
-
|
1012
|
-
if (!panel.length) return;
|
1013
|
-
|
1014
|
-
if ($.UIkit.support.transition && !force) {
|
1015
|
-
|
1016
|
-
|
1017
|
-
doc.one($.UIkit.support.transition.end, function() {
|
1018
|
-
doc.removeClass("uk-offcanvas-page").attr("style", "");
|
1019
|
-
panel.removeClass("uk-active");
|
1020
|
-
window.scrollTo(scrollpos.x, scrollpos.y);
|
1021
|
-
}).css("margin-left", "");
|
1022
|
-
|
1023
|
-
setTimeout(function(){
|
1024
|
-
bar.removeClass("uk-offcanvas-bar-show");
|
1025
|
-
}, 50);
|
1026
|
-
|
1027
|
-
} else {
|
1028
|
-
doc.removeClass("uk-offcanvas-page").attr("style", "");
|
1029
|
-
panel.removeClass("uk-active");
|
1030
|
-
bar.removeClass("uk-offcanvas-bar-show");
|
1031
|
-
window.scrollTo(scrollpos.x, scrollpos.y);
|
1032
|
-
}
|
1033
|
-
|
1034
|
-
panel.off(".ukoffcanvas");
|
1035
|
-
$doc.off(".ukoffcanvas");
|
1036
|
-
}
|
1037
|
-
|
1038
|
-
}, scrollpos;
|
1039
|
-
|
1040
|
-
|
1041
|
-
var OffcanvasTrigger = function(element, options) {
|
1042
|
-
|
1043
|
-
var $this = this,
|
1044
|
-
$element = $(element);
|
1045
|
-
|
1046
|
-
if($element.data("offcanvas")) return;
|
1047
|
-
|
1048
|
-
this.options = $.extend({
|
1049
|
-
"target": $element.is("a") ? $element.attr("href") : false
|
1050
|
-
}, options);
|
1051
|
-
|
1052
|
-
this.element = $element;
|
1053
|
-
|
1054
|
-
$element.on("click", function(e) {
|
1055
|
-
e.preventDefault();
|
1056
|
-
Offcanvas.show($this.options.target);
|
1057
|
-
});
|
1058
|
-
|
1059
|
-
this.element.data("offcanvas", this);
|
1060
|
-
};
|
1061
|
-
|
1062
|
-
OffcanvasTrigger.offcanvas = Offcanvas;
|
1063
|
-
|
1064
|
-
UI["offcanvas"] = OffcanvasTrigger;
|
1065
|
-
|
1066
|
-
|
1067
|
-
// init code
|
1068
|
-
$doc.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
|
1069
|
-
|
1070
|
-
e.preventDefault();
|
1071
|
-
|
1072
|
-
var ele = $(this);
|
1073
|
-
|
1074
|
-
if (!ele.data("offcanvas")) {
|
1075
|
-
var obj = new OffcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
|
1076
|
-
ele.trigger("click");
|
1077
|
-
}
|
1078
|
-
});
|
1079
|
-
|
1080
|
-
})(jQuery, jQuery.UIkit);
|
1081
|
-
|
1082
|
-
(function($, UI) {
|
1083
|
-
|
1084
|
-
"use strict";
|
1085
|
-
|
1086
|
-
var Nav = function(element, options) {
|
1087
|
-
|
1088
|
-
var $this = this, $element = $(element);
|
1089
|
-
|
1090
|
-
if($element.data("nav")) return;
|
1091
|
-
|
1092
|
-
this.options = $.extend({}, this.options, options);
|
1093
|
-
this.element = $element.on("click", this.options.toggler, function(e) {
|
1094
|
-
e.preventDefault();
|
1095
|
-
|
1096
|
-
var ele = $(this);
|
1097
|
-
|
1098
|
-
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
|
1099
|
-
});
|
1100
|
-
|
1101
|
-
this.element.find(this.options.lists).each(function() {
|
1102
|
-
var $ele = $(this),
|
1103
|
-
parent = $ele.parent(),
|
1104
|
-
active = parent.hasClass("uk-active");
|
1105
|
-
|
1106
|
-
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
|
1107
|
-
parent.data("list-container", $ele.parent());
|
1108
|
-
|
1109
|
-
if (active) $this.open(parent, true);
|
1110
|
-
});
|
1111
|
-
|
1112
|
-
this.element.data("nav", this);
|
1113
|
-
};
|
1114
|
-
|
1115
|
-
$.extend(Nav.prototype, {
|
1116
|
-
|
1117
|
-
options: {
|
1118
|
-
"toggler": ">li.uk-parent > a[href='#']",
|
1119
|
-
"lists": ">li.uk-parent > ul",
|
1120
|
-
"multiple": false
|
1121
|
-
},
|
1122
|
-
|
1123
|
-
open: function(li, noanimation) {
|
1124
|
-
|
1125
|
-
var element = this.element, $li = $(li);
|
1126
|
-
|
1127
|
-
if (!this.options.multiple) {
|
1128
|
-
|
1129
|
-
element.children(".uk-open").not(li).each(function() {
|
1130
|
-
if ($(this).data("list-container")) {
|
1131
|
-
$(this).data("list-container").stop().animate({height: 0}, function() {
|
1132
|
-
$(this).parent().removeClass("uk-open");
|
1133
|
-
});
|
1134
|
-
}
|
1135
|
-
});
|
1136
|
-
}
|
1137
|
-
|
1138
|
-
$li.toggleClass("uk-open");
|
1139
|
-
|
1140
|
-
if ($li.data("list-container")) {
|
1141
|
-
if (noanimation) {
|
1142
|
-
$li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
|
1143
|
-
} else {
|
1144
|
-
$li.data('list-container').stop().animate({
|
1145
|
-
height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
|
1146
|
-
});
|
1147
|
-
}
|
1148
|
-
}
|
1149
|
-
}
|
1150
|
-
|
1151
|
-
});
|
1152
|
-
|
1153
|
-
UI["nav"] = Nav;
|
1154
|
-
|
1155
|
-
// helper
|
1156
|
-
|
1157
|
-
function getHeight(ele) {
|
1158
|
-
var $ele = $(ele), height = "auto";
|
1159
|
-
|
1160
|
-
if ($ele.is(":visible")) {
|
1161
|
-
height = $ele.outerHeight();
|
1162
|
-
} else {
|
1163
|
-
var tmp = {
|
1164
|
-
position: $ele.css("position"),
|
1165
|
-
visibility: $ele.css("visibility"),
|
1166
|
-
display: $ele.css("display")
|
1167
|
-
};
|
1168
|
-
|
1169
|
-
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
1170
|
-
|
1171
|
-
$ele.css(tmp); // reset element
|
1172
|
-
}
|
1173
|
-
|
1174
|
-
return height;
|
1175
|
-
}
|
1176
|
-
|
1177
|
-
// init code
|
1178
|
-
$(document).on("uk-domready", function(e) {
|
1179
|
-
$("[data-uk-nav]").each(function() {
|
1180
|
-
var nav = $(this);
|
1181
|
-
|
1182
|
-
if (!nav.data("nav")) {
|
1183
|
-
var obj = new Nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
|
1184
|
-
}
|
1185
|
-
});
|
1186
|
-
});
|
1187
|
-
|
1188
|
-
})(jQuery, jQuery.UIkit);
|
1189
|
-
|
1190
|
-
(function($, UI) {
|
1191
|
-
|
1192
|
-
"use strict";
|
1193
|
-
|
1194
|
-
var $tooltip, // tooltip container
|
1195
|
-
tooltipdelay;
|
1196
|
-
|
1197
|
-
|
1198
|
-
var Tooltip = function(element, options) {
|
1199
|
-
|
1200
|
-
var $this = this, $element = $(element);
|
1201
|
-
|
1202
|
-
if($element.data("tooltip")) return;
|
1203
|
-
|
1204
|
-
this.options = $.extend({}, Tooltip.defaults, options);
|
1205
|
-
|
1206
|
-
this.element = $element.on({
|
1207
|
-
"focus" : function(e) { $this.show(); },
|
1208
|
-
"blur" : function(e) { $this.hide(); },
|
1209
|
-
"mouseenter": function(e) { $this.show(); },
|
1210
|
-
"mouseleave": function(e) { $this.hide(); }
|
1211
|
-
});
|
1212
|
-
|
1213
|
-
this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
|
1214
|
-
|
1215
|
-
// disable title attribute
|
1216
|
-
this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
|
1217
|
-
|
1218
|
-
this.element.data("tooltip", this);
|
1219
|
-
};
|
1220
|
-
|
1221
|
-
$.extend(Tooltip.prototype, {
|
1222
|
-
|
1223
|
-
tip: "",
|
1224
|
-
|
1225
|
-
show: function() {
|
1226
|
-
|
1227
|
-
if (tooltipdelay) clearTimeout(tooltipdelay);
|
1228
|
-
if (!this.tip.length) return;
|
1229
|
-
|
1230
|
-
$tooltip.stop().css({"top": -2000, "visibility": "hidden"}).show();
|
1231
|
-
$tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
|
1232
|
-
|
1233
|
-
var $this = this,
|
1234
|
-
pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
|
1235
|
-
width = $tooltip[0].offsetWidth,
|
1236
|
-
height = $tooltip[0].offsetHeight,
|
1237
|
-
offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
|
1238
|
-
position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
|
1239
|
-
tcss = {
|
1240
|
-
"display": "none",
|
1241
|
-
"visibility": "visible",
|
1242
|
-
"top": (pos.top + pos.height + height),
|
1243
|
-
"left": pos.left
|
1244
|
-
},
|
1245
|
-
tmppos = position.split("-");
|
1246
|
-
|
1247
|
-
if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
|
1248
|
-
tmppos[0] = tmppos[0] == "left" ? "right" : "left";
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
var variants = {
|
1252
|
-
"bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
|
1253
|
-
"top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
|
1254
|
-
"left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
|
1255
|
-
"right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
|
1256
|
-
};
|
1257
|
-
|
1258
|
-
$.extend(tcss, variants[tmppos[0]]);
|
1259
|
-
|
1260
|
-
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
|
1261
|
-
|
1262
|
-
var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
|
1263
|
-
|
1264
|
-
if(boundary) {
|
1265
|
-
|
1266
|
-
switch(boundary) {
|
1267
|
-
case "x":
|
1268
|
-
|
1269
|
-
if (tmppos.length == 2) {
|
1270
|
-
position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
|
1271
|
-
} else {
|
1272
|
-
position = tcss.left < 0 ? "right": "left";
|
1273
|
-
}
|
1274
|
-
|
1275
|
-
break;
|
1276
|
-
|
1277
|
-
case "y":
|
1278
|
-
if (tmppos.length == 2) {
|
1279
|
-
position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
|
1280
|
-
} else {
|
1281
|
-
position = (tcss.top < 0 ? "bottom": "top");
|
1282
|
-
}
|
1283
|
-
|
1284
|
-
break;
|
1285
|
-
|
1286
|
-
case "xy":
|
1287
|
-
if (tmppos.length == 2) {
|
1288
|
-
position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
|
1289
|
-
} else {
|
1290
|
-
position = tcss.left < 0 ? "right": "left";
|
1291
|
-
}
|
1292
|
-
|
1293
|
-
break;
|
1294
|
-
|
1295
|
-
}
|
1296
|
-
|
1297
|
-
tmppos = position.split("-");
|
1298
|
-
|
1299
|
-
$.extend(tcss, variants[tmppos[0]]);
|
1300
|
-
|
1301
|
-
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
|
1302
|
-
}
|
1303
|
-
|
1304
|
-
tooltipdelay = setTimeout(function(){
|
1305
|
-
|
1306
|
-
$tooltip.css(tcss).attr("class", "uk-tooltip uk-tooltip-" + position);
|
1307
|
-
|
1308
|
-
if ($this.options.animation) {
|
1309
|
-
$tooltip.css({opacity: 0, display: 'block'}).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
|
1310
|
-
} else {
|
1311
|
-
$tooltip.show();
|
1312
|
-
}
|
1313
|
-
|
1314
|
-
tooltipdelay = false;
|
1315
|
-
}, parseInt(this.options.delay, 10) || 0);
|
1316
|
-
},
|
1317
|
-
|
1318
|
-
hide: function() {
|
1319
|
-
if(this.element.is("input") && this.element[0]===document.activeElement) return;
|
1320
|
-
|
1321
|
-
if(tooltipdelay) clearTimeout(tooltipdelay);
|
1322
|
-
|
1323
|
-
$tooltip.stop();
|
1324
|
-
|
1325
|
-
if (this.options.animation) {
|
1326
|
-
$tooltip.fadeOut(parseInt(this.options.animation, 10) || 400);
|
1327
|
-
} else {
|
1328
|
-
$tooltip.hide();
|
1329
|
-
}
|
1330
|
-
},
|
1331
|
-
|
1332
|
-
content: function() {
|
1333
|
-
return this.tip;
|
1334
|
-
},
|
1335
|
-
|
1336
|
-
checkBoundary: function(left, top, width, height) {
|
1337
|
-
|
1338
|
-
var axis = "";
|
1339
|
-
|
1340
|
-
if(left < 0 || left+width > window.innerWidth) {
|
1341
|
-
axis += "x";
|
1342
|
-
}
|
1343
|
-
|
1344
|
-
if(top < 0 || top+height > window.innerHeight) {
|
1345
|
-
axis += "y";
|
1346
|
-
}
|
1347
|
-
|
1348
|
-
return axis;
|
1349
|
-
}
|
1350
|
-
|
1351
|
-
});
|
1352
|
-
|
1353
|
-
Tooltip.defaults = {
|
1354
|
-
"offset": 5,
|
1355
|
-
"pos": "top",
|
1356
|
-
"animation": false,
|
1357
|
-
"delay": 0, // in miliseconds
|
1358
|
-
"src": function() { return this.attr("title"); }
|
1359
|
-
};
|
1360
|
-
|
1361
|
-
UI["tooltip"] = Tooltip;
|
1362
|
-
|
1363
|
-
$(function() {
|
1364
|
-
$tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
|
1365
|
-
});
|
1366
|
-
|
1367
|
-
// init code
|
1368
|
-
$(document).on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
|
1369
|
-
var ele = $(this);
|
1370
|
-
|
1371
|
-
if (!ele.data("tooltip")) {
|
1372
|
-
var obj = new Tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
|
1373
|
-
ele.trigger("mouseenter");
|
1374
|
-
}
|
1375
|
-
});
|
1376
|
-
|
1377
|
-
})(jQuery, jQuery.UIkit);
|
1378
|
-
|
1379
|
-
(function($, UI) {
|
1380
|
-
|
1381
|
-
"use strict";
|
1382
|
-
|
1383
|
-
var Switcher = function(element, options) {
|
1384
|
-
|
1385
|
-
var $this = this, $element = $(element);
|
1386
|
-
|
1387
|
-
if($element.data("switcher")) return;
|
1388
|
-
|
1389
|
-
this.options = $.extend({}, this.options, options);
|
1390
|
-
|
1391
|
-
this.element = $element.on("click", this.options.toggler, function(e) {
|
1392
|
-
e.preventDefault();
|
1393
|
-
$this.show(this);
|
1394
|
-
});
|
1395
|
-
|
1396
|
-
if (this.options.connect) {
|
1397
|
-
|
1398
|
-
this.connect = $(this.options.connect).find(".uk-active").removeClass(".uk-active").end();
|
1399
|
-
|
1400
|
-
var active = this.element.find(this.options.toggler).filter(".uk-active");
|
1401
|
-
|
1402
|
-
if (active.length) {
|
1403
|
-
this.show(active);
|
1404
|
-
}
|
1405
|
-
}
|
1406
|
-
|
1407
|
-
this.element.data("switcher", this);
|
1408
|
-
};
|
1409
|
-
|
1410
|
-
$.extend(Switcher.prototype, {
|
1411
|
-
|
1412
|
-
options: {
|
1413
|
-
connect: false,
|
1414
|
-
toggler: ">*"
|
1415
|
-
},
|
1416
|
-
|
1417
|
-
show: function(tab) {
|
1418
|
-
|
1419
|
-
tab = isNaN(tab) ? $(tab) : this.element.find(this.options.toggler).eq(tab);
|
1420
|
-
|
1421
|
-
var active = tab;
|
1422
|
-
|
1423
|
-
if (active.hasClass("uk-disabled")) return;
|
1424
|
-
|
1425
|
-
this.element.find(this.options.toggler).filter(".uk-active").removeClass("uk-active");
|
1426
|
-
active.addClass("uk-active");
|
1427
|
-
|
1428
|
-
if (this.options.connect && this.connect.length) {
|
1429
|
-
|
1430
|
-
var index = this.element.find(this.options.toggler).index(active);
|
1431
|
-
|
1432
|
-
this.connect.children().removeClass("uk-active").eq(index).addClass("uk-active");
|
1433
|
-
}
|
1434
|
-
|
1435
|
-
this.element.trigger("uk.switcher.show", [active]);
|
1436
|
-
}
|
1437
|
-
|
1438
|
-
});
|
1439
|
-
|
1440
|
-
UI["switcher"] = Switcher;
|
1441
|
-
|
1442
|
-
// init code
|
1443
|
-
$(document).on("uk-domready", function(e) {
|
1444
|
-
$("[data-uk-switcher]").each(function() {
|
1445
|
-
var switcher = $(this);
|
1446
|
-
|
1447
|
-
if (!switcher.data("switcher")) {
|
1448
|
-
var obj = new Switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
|
1449
|
-
}
|
1450
|
-
});
|
1451
|
-
});
|
1452
|
-
|
1453
|
-
})(jQuery, jQuery.UIkit);
|
1454
|
-
|
1455
|
-
(function($, UI) {
|
1456
|
-
|
1457
|
-
"use strict";
|
1458
|
-
|
1459
|
-
var Tab = function(element, options) {
|
1460
|
-
|
1461
|
-
var $this = this, $element = $(element);
|
1462
|
-
|
1463
|
-
if($element.data("tab")) return;
|
1464
|
-
|
1465
|
-
this.element = $element;
|
1466
|
-
this.options = $.extend({
|
1467
|
-
connect: false
|
1468
|
-
}, this.options, options);
|
1469
|
-
|
1470
|
-
if (this.options.connect) {
|
1471
|
-
this.connect = $(this.options.connect);
|
1472
|
-
}
|
1473
|
-
|
1474
|
-
if (window.location.hash) {
|
1475
|
-
var active = this.element.children().filter(window.location.hash);
|
1476
|
-
|
1477
|
-
if (active.length) {
|
1478
|
-
this.element.children().removeClass('uk-active').filter(active).addClass("uk-active");
|
1479
|
-
}
|
1480
|
-
}
|
1481
|
-
|
1482
|
-
var mobiletab = $('<li class="uk-tab-responsive uk-active"><a href="javascript:void(0);"></a></li>'),
|
1483
|
-
caption = mobiletab.find("a:first"),
|
1484
|
-
dropdown = $('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>'),
|
1485
|
-
ul = dropdown.find("ul");
|
1486
|
-
|
1487
|
-
caption.html(this.element.find("li.uk-active:first").find("a").text());
|
1488
|
-
|
1489
|
-
if (this.element.hasClass("uk-tab-bottom")) dropdown.addClass("uk-dropdown-up");
|
1490
|
-
if (this.element.hasClass("uk-tab-flip")) dropdown.addClass("uk-dropdown-flip");
|
1491
|
-
|
1492
|
-
this.element.find("a").each(function(i) {
|
1493
|
-
|
1494
|
-
var tab = $(this).parent(),
|
1495
|
-
item = $('<li><a href="javascript:void(0);">' + tab.text() + '</a></li>').on("click", function(e) {
|
1496
|
-
$this.element.data("switcher").show(i);
|
1497
|
-
});
|
1498
|
-
|
1499
|
-
if (!$(this).parents(".uk-disabled:first").length) ul.append(item);
|
1500
|
-
});
|
1501
|
-
|
1502
|
-
this.element.uk("switcher", {"toggler": ">li:not(.uk-tab-responsive)", "connect": this.options.connect});
|
1503
|
-
|
1504
|
-
mobiletab.append(dropdown).uk("dropdown", {"mode": "click"});
|
1505
|
-
|
1506
|
-
this.element.append(mobiletab).data({
|
1507
|
-
"dropdown": mobiletab.data("dropdown"),
|
1508
|
-
"mobilecaption": caption
|
1509
|
-
}).on("uk.switcher.show", function(e, tab) {
|
1510
|
-
mobiletab.addClass("uk-active");
|
1511
|
-
caption.html(tab.find("a").text());
|
1512
|
-
});
|
1513
|
-
|
1514
|
-
this.element.data("tab", this);
|
1515
|
-
};
|
1516
|
-
|
1517
|
-
$(document).on("uk-domready", function(e) {
|
1518
|
-
|
1519
|
-
$("[data-uk-tab]").each(function() {
|
1520
|
-
var tab = $(this);
|
1521
|
-
|
1522
|
-
if (!tab.data("tab")) {
|
1523
|
-
var obj = new Tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
|
1524
|
-
}
|
1525
|
-
});
|
1526
|
-
});
|
1527
|
-
|
1528
|
-
})(jQuery, jQuery.UIkit);
|
1529
|
-
|
1530
|
-
(function($, UI) {
|
1531
|
-
|
1532
|
-
"use strict";
|
1533
|
-
|
1534
|
-
var renderers = {},
|
1535
|
-
|
1536
|
-
Search = function(element, options) {
|
1537
|
-
|
1538
|
-
var $this = this, $element = $(element);
|
1539
|
-
|
1540
|
-
if($element.data("search")) return;
|
1541
|
-
|
1542
|
-
this.options = $.extend({}, this.options, options);
|
1543
|
-
|
1544
|
-
this.element = $element;
|
1545
|
-
|
1546
|
-
this.timer = null;
|
1547
|
-
this.value = null;
|
1548
|
-
this.input = this.element.find(".uk-search-field");
|
1549
|
-
this.form = this.input.length ? $(this.input.get(0).form) : $();
|
1550
|
-
this.input.attr('autocomplete', 'off');
|
1551
|
-
|
1552
|
-
this.input.on({
|
1553
|
-
keydown: function(event) {
|
1554
|
-
$this.form[($this.input.val()) ? 'addClass' : 'removeClass']($this.options.filledClass);
|
1555
|
-
|
1556
|
-
if (event && event.which && !event.shiftKey) {
|
1557
|
-
|
1558
|
-
switch (event.which) {
|
1559
|
-
case 13: // enter
|
1560
|
-
$this.done($this.selected);
|
1561
|
-
event.preventDefault();
|
1562
|
-
break;
|
1563
|
-
case 38: // up
|
1564
|
-
$this.pick('prev');
|
1565
|
-
event.preventDefault();
|
1566
|
-
break;
|
1567
|
-
case 40: // down
|
1568
|
-
$this.pick('next');
|
1569
|
-
event.preventDefault();
|
1570
|
-
break;
|
1571
|
-
case 27:
|
1572
|
-
case 9: // esc, tab
|
1573
|
-
$this.hide();
|
1574
|
-
break;
|
1575
|
-
default:
|
1576
|
-
break;
|
1577
|
-
}
|
1578
|
-
}
|
1579
|
-
|
1580
|
-
},
|
1581
|
-
keyup: function(event) {
|
1582
|
-
$this.trigger();
|
1583
|
-
},
|
1584
|
-
blur: function(event) {
|
1585
|
-
setTimeout(function() { $this.hide(event); }, 200);
|
1586
|
-
}
|
1587
|
-
});
|
1588
|
-
|
1589
|
-
this.form.find('button[type=reset]').bind('click', function() {
|
1590
|
-
$this.form.removeClass("uk-open").removeClass("uk-loading").removeClass("uk-active");
|
1591
|
-
$this.value = null;
|
1592
|
-
$this.input.focus();
|
1593
|
-
});
|
1594
|
-
|
1595
|
-
this.dropdown = $('<div class="uk-dropdown uk-dropdown-search"><ul class="uk-nav uk-nav-search"></ul></div>').appendTo(this.form).find('.uk-nav-search');
|
1596
|
-
|
1597
|
-
if (this.options.flipDropdown) {
|
1598
|
-
this.dropdown.parent().addClass('uk-dropdown-flip');
|
1599
|
-
}
|
1600
|
-
|
1601
|
-
this.dropdown.on("mouseover", ">li", function(){
|
1602
|
-
$this.pick($(this));
|
1603
|
-
});
|
1604
|
-
|
1605
|
-
this.renderer = new renderers[this.options.renderer](this);
|
1606
|
-
|
1607
|
-
this.element.data("search", this);
|
1608
|
-
};
|
1609
|
-
|
1610
|
-
$.extend(Search.prototype, {
|
1611
|
-
|
1612
|
-
options: {
|
1613
|
-
source: false,
|
1614
|
-
param: 'search',
|
1615
|
-
method: 'post',
|
1616
|
-
minLength: 3,
|
1617
|
-
delay: 300,
|
1618
|
-
flipDropdown: false,
|
1619
|
-
match: ':not(.uk-skip)',
|
1620
|
-
skipClass: 'uk-skip',
|
1621
|
-
loadingClass: 'uk-loading',
|
1622
|
-
filledClass: 'uk-active',
|
1623
|
-
listClass: 'results',
|
1624
|
-
hoverClass: 'uk-active',
|
1625
|
-
onLoadedResults: function(results) { return results; },
|
1626
|
-
renderer: "default"
|
1627
|
-
},
|
1628
|
-
|
1629
|
-
request: function(options) {
|
1630
|
-
var $this = this;
|
1631
|
-
|
1632
|
-
this.form.addClass(this.options.loadingClass);
|
1633
|
-
|
1634
|
-
if (this.options.source) {
|
1635
|
-
|
1636
|
-
$.ajax($.extend({
|
1637
|
-
url: this.options.source,
|
1638
|
-
type: this.options.method,
|
1639
|
-
dataType: 'json',
|
1640
|
-
success: function(data) {
|
1641
|
-
data = $this.options.onLoadedResults.apply(this, [data]);
|
1642
|
-
$this.form.removeClass($this.options.loadingClass);
|
1643
|
-
$this.suggest(data);
|
1644
|
-
}
|
1645
|
-
}, options));
|
1646
|
-
|
1647
|
-
} else {
|
1648
|
-
this.form.removeClass($this.options.loadingClass);
|
1649
|
-
}
|
1650
|
-
},
|
1651
|
-
|
1652
|
-
pick: function(item) {
|
1653
|
-
var selected = false;
|
1654
|
-
|
1655
|
-
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
1656
|
-
selected = item;
|
1657
|
-
}
|
1658
|
-
|
1659
|
-
if (item == 'next' || item == 'prev') {
|
1660
|
-
|
1661
|
-
var items = this.dropdown.children().filter(this.options.match);
|
1662
|
-
|
1663
|
-
if (this.selected) {
|
1664
|
-
var index = items.index(this.selected);
|
1665
|
-
|
1666
|
-
if (item == 'next') {
|
1667
|
-
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
|
1668
|
-
} else {
|
1669
|
-
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
|
1670
|
-
}
|
1671
|
-
|
1672
|
-
} else {
|
1673
|
-
selected = items[(item == 'next') ? 'first' : 'last']();
|
1674
|
-
}
|
1675
|
-
|
1676
|
-
}
|
1677
|
-
|
1678
|
-
if (selected && selected.length) {
|
1679
|
-
this.selected = selected;
|
1680
|
-
this.dropdown.children().removeClass(this.options.hoverClass);
|
1681
|
-
this.selected.addClass(this.options.hoverClass);
|
1682
|
-
}
|
1683
|
-
},
|
1684
|
-
|
1685
|
-
trigger: function() {
|
1686
|
-
|
1687
|
-
var $this = this, old = this.value, data = {};
|
1688
|
-
|
1689
|
-
this.value = this.input.val();
|
1690
|
-
|
1691
|
-
if (this.value.length < this.options.minLength) {
|
1692
|
-
return this.hide();
|
1693
|
-
}
|
1694
|
-
|
1695
|
-
if (this.value != old) {
|
1696
|
-
|
1697
|
-
if (this.timer) window.clearTimeout(this.timer);
|
1698
|
-
|
1699
|
-
this.timer = window.setTimeout(function() {
|
1700
|
-
data[$this.options.param] = $this.value;
|
1701
|
-
$this.request({'data': data});
|
1702
|
-
}, this.options.delay, this);
|
1703
|
-
}
|
1704
|
-
|
1705
|
-
return this;
|
1706
|
-
},
|
1707
|
-
|
1708
|
-
done: function(selected) {
|
1709
|
-
|
1710
|
-
this.renderer.done(selected);
|
1711
|
-
},
|
1712
|
-
|
1713
|
-
suggest: function(data) {
|
1714
|
-
|
1715
|
-
if (!data) return;
|
1716
|
-
|
1717
|
-
if (data === false) {
|
1718
|
-
this.hide();
|
1719
|
-
} else {
|
1720
|
-
|
1721
|
-
this.selected = null;
|
1722
|
-
|
1723
|
-
this.dropdown.empty();
|
1724
|
-
|
1725
|
-
this.renderer.suggest(data);
|
1726
|
-
|
1727
|
-
this.show();
|
1728
|
-
}
|
1729
|
-
},
|
1730
|
-
|
1731
|
-
show: function() {
|
1732
|
-
if (this.visible) return;
|
1733
|
-
this.visible = true;
|
1734
|
-
this.form.addClass("uk-open");
|
1735
|
-
},
|
1736
|
-
|
1737
|
-
hide: function() {
|
1738
|
-
if (!this.visible)
|
1739
|
-
return;
|
1740
|
-
this.visible = false;
|
1741
|
-
this.form.removeClass(this.options.loadingClass).removeClass("uk-open");
|
1742
|
-
}
|
1743
|
-
});
|
1744
|
-
|
1745
|
-
Search.addRenderer = function(name, klass) {
|
1746
|
-
renderers[name] = klass;
|
1747
|
-
};
|
1748
|
-
|
1749
|
-
|
1750
|
-
var DefaultRenderer = function(search) {
|
1751
|
-
this.search = search;
|
1752
|
-
this.options = $.extend({}, DefaultRenderer.defaults, search.options);
|
1753
|
-
};
|
1754
|
-
|
1755
|
-
$.extend(DefaultRenderer.prototype, {
|
1756
|
-
|
1757
|
-
done: function(selected) {
|
1758
|
-
|
1759
|
-
if (!selected) {
|
1760
|
-
this.search.form.submit();
|
1761
|
-
return;
|
1762
|
-
}
|
1763
|
-
|
1764
|
-
if (selected.hasClass(this.options.moreResultsClass)) {
|
1765
|
-
this.search.form.submit();
|
1766
|
-
} else if (selected.data('choice')) {
|
1767
|
-
window.location = selected.data('choice').url;
|
1768
|
-
}
|
1769
|
-
|
1770
|
-
this.search.hide();
|
1771
|
-
},
|
1772
|
-
|
1773
|
-
suggest: function(data) {
|
1774
|
-
|
1775
|
-
var $this = this,
|
1776
|
-
events = {
|
1777
|
-
'click': function(e) {
|
1778
|
-
e.preventDefault();
|
1779
|
-
$this.done($(this).parent());
|
1780
|
-
}
|
1781
|
-
};
|
1782
|
-
|
1783
|
-
if (this.options.msgResultsHeader) {
|
1784
|
-
$('<li>').addClass(this.options.resultsHeaderClass + ' ' + this.options.skipClass).html(this.options.msgResultsHeader).appendTo(this.search.dropdown);
|
1785
|
-
}
|
1786
|
-
|
1787
|
-
if (data.results && data.results.length > 0) {
|
1788
|
-
|
1789
|
-
$(data.results).each(function(i) {
|
1790
|
-
|
1791
|
-
var item = $('<li><a href="#">' + this.title + '</a></li>').data('choice', this);
|
1792
|
-
|
1793
|
-
if (this["text"]) {
|
1794
|
-
item.find("a").append('<div>' + this.text + '</div>');
|
1795
|
-
}
|
1796
|
-
|
1797
|
-
$this.search.dropdown.append(item);
|
1798
|
-
});
|
1799
|
-
|
1800
|
-
if (this.options.msgMoreResults) {
|
1801
|
-
$('<li>').addClass('uk-nav-divider ' + $this.options.skipClass).appendTo($this.dropdown);
|
1802
|
-
$('<li>').addClass($this.options.moreResultsClass).html('<a href="#">' + $this.options.msgMoreResults + '</a>').appendTo($this.search.dropdown).on(events);
|
1803
|
-
}
|
1804
|
-
|
1805
|
-
$this.search.dropdown.find("li>a").on(events);
|
1806
|
-
|
1807
|
-
} else if (this.options.msgNoResults) {
|
1808
|
-
$('<li>').addClass(this.options.noResultsClass + ' ' + this.options.skipClass).html('<a>' + this.options.msgNoResults + '</a>').appendTo($this.search.dropdown);
|
1809
|
-
}
|
1810
|
-
}
|
1811
|
-
});
|
1812
|
-
|
1813
|
-
DefaultRenderer.defaults = {
|
1814
|
-
resultsHeaderClass: 'uk-nav-header',
|
1815
|
-
moreResultsClass: '',
|
1816
|
-
noResultsClass: '',
|
1817
|
-
msgResultsHeader: 'Search Results',
|
1818
|
-
msgMoreResults: 'More Results',
|
1819
|
-
msgNoResults: 'No results found'
|
1820
|
-
};
|
1821
|
-
|
1822
|
-
Search.addRenderer("default", DefaultRenderer);
|
1823
|
-
|
1824
|
-
UI["search"] = Search;
|
1825
|
-
|
1826
|
-
// init code
|
1827
|
-
$(document).on("focus.search.uikit", "[data-uk-search]", function(e) {
|
1828
|
-
var ele = $(this);
|
1829
|
-
|
1830
|
-
if (!ele.data("search")) {
|
1831
|
-
var obj = new Search(ele, UI.Utils.options(ele.attr("data-uk-search")));
|
1832
|
-
}
|
1833
|
-
});
|
1834
|
-
|
1835
|
-
})(jQuery, jQuery.UIkit);
|
1836
|
-
|
1837
|
-
(function($, UI) {
|
1838
|
-
|
1839
|
-
"use strict";
|
1840
|
-
|
1841
|
-
var $win = $(window),
|
1842
|
-
|
1843
|
-
ScrollSpy = function(element, options) {
|
1844
|
-
|
1845
|
-
var $element = $(element);
|
1846
|
-
|
1847
|
-
if($element.data("scrollspy")) return;
|
1848
|
-
|
1849
|
-
this.options = $.extend({}, ScrollSpy.defaults, options);
|
1850
|
-
this.element = $(element);
|
1851
|
-
|
1852
|
-
var $this = this, idle, inviewstate, initinview,
|
1853
|
-
fn = function(){
|
1854
|
-
|
1855
|
-
var inview = isInView($this.element, $this.options);
|
1856
|
-
|
1857
|
-
if(inview && !inviewstate) {
|
1858
|
-
|
1859
|
-
if(idle) clearTimeout(idle);
|
1860
|
-
|
1861
|
-
if(!initinview) {
|
1862
|
-
$this.element.addClass($this.options.initcls);
|
1863
|
-
$this.offset = $this.element.offset();
|
1864
|
-
initinview = true;
|
1865
|
-
|
1866
|
-
$this.element.trigger("uk-scrollspy-init");
|
1867
|
-
}
|
1868
|
-
|
1869
|
-
idle = setTimeout(function(){
|
1870
|
-
|
1871
|
-
if(inview) {
|
1872
|
-
$this.element.addClass("uk-scrollspy-inview").addClass($this.options.cls).width();
|
1873
|
-
}
|
1874
|
-
|
1875
|
-
}, $this.options.delay);
|
1876
|
-
|
1877
|
-
inviewstate = true;
|
1878
|
-
$this.element.trigger("uk.scrollspy.inview");
|
1879
|
-
}
|
1880
|
-
|
1881
|
-
if (!inview && inviewstate && $this.options.repeat) {
|
1882
|
-
$this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
|
1883
|
-
inviewstate = false;
|
1884
|
-
|
1885
|
-
$this.element.trigger("uk.scrollspy.outview");
|
1886
|
-
}
|
1887
|
-
};
|
1888
|
-
|
1889
|
-
$win.on("scroll", fn).on("resize orientationchange", UI.Utils.debounce(fn, 50));
|
1890
|
-
|
1891
|
-
fn();
|
1892
|
-
|
1893
|
-
this.element.data("scrollspy", this);
|
1894
|
-
};
|
1895
|
-
|
1896
|
-
ScrollSpy.defaults = {
|
1897
|
-
"cls" : "uk-scrollspy-inview",
|
1898
|
-
"initcls" : "uk-scrollspy-init-inview",
|
1899
|
-
"topoffset" : 0,
|
1900
|
-
"leftoffset" : 0,
|
1901
|
-
"repeat" : false,
|
1902
|
-
"delay" : 0
|
1903
|
-
};
|
1904
|
-
|
1905
|
-
UI["scrollspy"] = ScrollSpy;
|
1906
|
-
|
1907
|
-
var ScrollSpyNav = function(element, options) {
|
1908
|
-
|
1909
|
-
var $element = $(element);
|
1910
|
-
|
1911
|
-
if($element.data("scrollspynav")) return;
|
1912
|
-
|
1913
|
-
this.element = $element;
|
1914
|
-
this.options = $.extend({}, ScrollSpyNav.defaults, options);
|
1915
|
-
|
1916
|
-
var ids = [],
|
1917
|
-
links = this.element.find("a[href^='#']").each(function(){ ids.push($(this).attr("href")); }),
|
1918
|
-
targets = $(ids.join(","));
|
1919
|
-
|
1920
|
-
var $this = this, inviews, fn = function(){
|
1921
|
-
|
1922
|
-
inviews = [];
|
1923
|
-
|
1924
|
-
for(var i=0 ; i < targets.length ; i++) {
|
1925
|
-
if(isInView(targets.eq(i), $this.options)) {
|
1926
|
-
inviews.push(targets.eq(i));
|
1927
|
-
}
|
1928
|
-
}
|
1929
|
-
|
1930
|
-
if(inviews.length) {
|
1931
|
-
|
1932
|
-
var scrollTop = $win.scrollTop(),
|
1933
|
-
target = (function(){
|
1934
|
-
for(var i=0; i< inviews.length;i++){
|
1935
|
-
if(inviews[i].offset().top >= scrollTop){
|
1936
|
-
return inviews[i];
|
1937
|
-
}
|
1938
|
-
}
|
1939
|
-
})();
|
1940
|
-
|
1941
|
-
if(!target) return;
|
1942
|
-
|
1943
|
-
if($this.options.closest) {
|
1944
|
-
links.closest($this.options.closest).removeClass($this.options.cls).end().filter("a[href='#"+target.attr("id")+"']").closest($this.options.closest).addClass($this.options.cls);
|
1945
|
-
} else {
|
1946
|
-
links.removeClass($this.options.cls).filter("a[href='#"+target.attr("id")+"']").addClass($this.options.cls);
|
1947
|
-
}
|
1948
|
-
}
|
1949
|
-
};
|
1950
|
-
|
1951
|
-
if(this.options.smoothscroll && UI["smoothScroll"]) {
|
1952
|
-
links.each(function(){
|
1953
|
-
new UI["smoothScroll"](this, $this.options.smoothscroll);
|
1954
|
-
});
|
1955
|
-
}
|
1956
|
-
|
1957
|
-
fn();
|
1958
|
-
|
1959
|
-
$win.on("scroll", fn).on("resize orientationchange", UI.Utils.debounce(fn, 50));
|
1960
|
-
|
1961
|
-
this.element.data("scrollspynav", this);
|
1962
|
-
};
|
1963
|
-
|
1964
|
-
ScrollSpyNav.defaults = {
|
1965
|
-
"cls" : 'uk-active',
|
1966
|
-
"closest" : false,
|
1967
|
-
"topoffset" : 0,
|
1968
|
-
"leftoffset" : 0,
|
1969
|
-
"smoothscroll" : false
|
1970
|
-
};
|
1971
|
-
|
1972
|
-
UI["scrollspynav"] = ScrollSpyNav;
|
1973
|
-
|
1974
|
-
// helper
|
1975
|
-
|
1976
|
-
function isInView(element, options) {
|
1977
|
-
|
1978
|
-
var $element = element;
|
1979
|
-
|
1980
|
-
if (!$element.is(':visible')) {
|
1981
|
-
return false;
|
1982
|
-
}
|
1983
|
-
|
1984
|
-
var window_left = $win.scrollLeft(), window_top = $win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
|
1985
|
-
|
1986
|
-
if (top + $element.height() >= window_top && top - options.topoffset <= window_top + $win.height() &&
|
1987
|
-
left + $element.width() >= window_left && left - options.leftoffset <= window_left + $win.width()) {
|
1988
|
-
return true;
|
1989
|
-
} else {
|
1990
|
-
return false;
|
1991
|
-
}
|
1992
|
-
}
|
1993
|
-
|
1994
|
-
ScrollSpy.isInView = isInView;
|
1995
|
-
|
1996
|
-
// init code
|
1997
|
-
$(document).on("uk-domready", function(e) {
|
1998
|
-
$("[data-uk-scrollspy]").each(function() {
|
1999
|
-
|
2000
|
-
var element = $(this);
|
2001
|
-
|
2002
|
-
if (!element.data("scrollspy")) {
|
2003
|
-
var obj = new ScrollSpy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
|
2004
|
-
}
|
2005
|
-
});
|
2006
|
-
|
2007
|
-
$("[data-uk-scrollspy-nav]").each(function() {
|
2008
|
-
|
2009
|
-
var element = $(this);
|
2010
|
-
|
2011
|
-
if (!element.data("scrollspynav")) {
|
2012
|
-
var obj = new ScrollSpyNav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
|
2013
|
-
}
|
2014
|
-
});
|
2015
|
-
});
|
2016
|
-
|
2017
|
-
})(jQuery, jQuery.UIkit);
|
2018
|
-
|
2019
|
-
(function($, UI) {
|
2020
|
-
|
2021
|
-
"use strict";
|
2022
|
-
|
2023
|
-
var SmoothScroll = function(element, options) {
|
2024
|
-
|
2025
|
-
var $this = this, $element = $(element);
|
2026
|
-
|
2027
|
-
if($element.data("smoothScroll")) return;
|
2028
|
-
|
2029
|
-
this.options = $.extend({}, SmoothScroll.defaults, options);
|
2030
|
-
|
2031
|
-
this.element = $element.on("click", function(e) {
|
2032
|
-
|
2033
|
-
// get / set parameters
|
2034
|
-
var ele = ($(this.hash).length ? $(this.hash) : $("body")),
|
2035
|
-
target = ele.offset().top - $this.options.offset,
|
2036
|
-
docheight = $(document).height(),
|
2037
|
-
winheight = $(window).height(),
|
2038
|
-
eleheight = ele.outerHeight();
|
2039
|
-
|
2040
|
-
if ((target + winheight) > docheight) {
|
2041
|
-
target = docheight - winheight;
|
2042
|
-
}
|
2043
|
-
|
2044
|
-
// animate to target and set the hash to the window.location after the animation
|
2045
|
-
$("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition);
|
2046
|
-
|
2047
|
-
// cancel default click action
|
2048
|
-
return false;
|
2049
|
-
});
|
2050
|
-
|
2051
|
-
this.element.data("smoothScroll", this);
|
2052
|
-
};
|
2053
|
-
|
2054
|
-
SmoothScroll.defaults = {
|
2055
|
-
duration: 1000,
|
2056
|
-
transition: 'easeOutExpo',
|
2057
|
-
offset: 0
|
2058
|
-
};
|
2059
|
-
|
2060
|
-
UI["smoothScroll"] = SmoothScroll;
|
2061
|
-
|
2062
|
-
|
2063
|
-
if (!$.easing['easeOutExpo']) {
|
2064
|
-
$.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
|
2065
|
-
}
|
2066
|
-
|
2067
|
-
|
2068
|
-
// init code
|
2069
|
-
$(document).on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
|
2070
|
-
var ele = $(this);
|
2071
|
-
|
2072
|
-
if (!ele.data("smoothScroll")) {
|
2073
|
-
var obj = new SmoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
|
2074
|
-
ele.trigger("click");
|
2075
|
-
}
|
2076
|
-
});
|
2077
|
-
|
2078
|
-
})(jQuery, jQuery.UIkit);
|