updated Uikit v2

This commit is contained in:
2017-11-12 02:33:10 +02:00
parent 7d27af5d59
commit 1cc40dbfe4
437 changed files with 9171 additions and 5797 deletions

View File

@@ -1,14 +1,14 @@
/*! UIkit 2.25.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
(function(addon) {
var component;
if (window.UIkit) {
component = addon(UIkit);
if (window.UIkit2) {
component = addon(UIkit2);
}
if (typeof define == "function" && define.amd) {
define("uikit-tooltip", ["uikit"], function(){
return component || addon(UIkit);
if (typeof define == 'function' && define.amd) {
define('uikit-tooltip', ['uikit'], function(){
return component || addon(UIkit2);
});
}
@@ -17,18 +17,18 @@
"use strict";
var $tooltip, // tooltip container
tooltipdelay, checkdelay;
tooltipdelay, checkIdle;
UI.component('tooltip', {
defaults: {
"offset": 5,
"pos": "top",
"animation": false,
"delay": 0, // in miliseconds
"cls": "",
"activeClass": "uk-active",
"src": function(ele) {
offset: 5,
pos: 'top',
animation: false,
delay: 0, // in miliseconds
cls: '',
activeClass: 'uk-active',
src: function(ele) {
var title = ele.attr('title');
if (title !== undefined) {
@@ -39,17 +39,17 @@
}
},
tip: "",
tip: '',
boot: function() {
// init code
UI.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
UI.$html.on('mouseenter.tooltip.uikit focus.tooltip.uikit', '[data-uk-tooltip]', function(e) {
var ele = UI.$(this);
if (!ele.data("tooltip")) {
UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
ele.trigger("mouseenter");
if (!ele.data('tooltip')) {
UI.tooltip(ele, UI.Utils.options(ele.attr('data-uk-tooltip')));
ele.trigger('mouseenter');
}
});
},
@@ -72,14 +72,14 @@
show: function() {
this.tip = typeof(this.options.src) === "function" ? this.options.src(this.element) : this.options.src;
this.tip = typeof(this.options.src) === 'function' ? this.options.src(this.element) : this.options.src;
if (tooltipdelay) clearTimeout(tooltipdelay);
if (checkdelay) clearTimeout(checkdelay);
if (tooltipdelay) clearTimeout(tooltipdelay);
if (checkIdle) clearInterval(checkIdle);
if (typeof(this.tip) === 'string' ? !this.tip.length:true) return;
$tooltip.stop().css({"top": -2000, "visibility": "hidden"}).removeClass(this.options.activeClass).show();
$tooltip.stop().css({top: -2000, visibility: 'hidden'}).removeClass(this.options.activeClass).show();
$tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
var $this = this,
@@ -90,10 +90,10 @@
position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
tmppos = position.split("-"),
tcss = {
"display" : "none",
"visibility" : "visible",
"top" : (pos.top + pos.height + height),
"left" : pos.left
display : 'none',
visibility : 'visible',
top : (pos.top + pos.height + height),
left : pos.left
};
@@ -102,22 +102,22 @@
if (UI.$html.css('position')=='fixed' || UI.$body.css('position')=='fixed'){
var bodyoffset = UI.$('body').offset(),
htmloffset = UI.$('html').offset(),
docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
docoffset = {top: (htmloffset.top + bodyoffset.top), left: (htmloffset.left + bodyoffset.left)};
pos.left -= docoffset.left;
pos.top -= docoffset.top;
}
if ((tmppos[0] == "left" || tmppos[0] == "right") && UI.langdirection == 'right') {
tmppos[0] = tmppos[0] == "left" ? "right" : "left";
if ((tmppos[0] == 'left' || tmppos[0] == 'right') && UI.langdirection == 'right') {
tmppos[0] = tmppos[0] == 'left' ? 'right' : 'left';
}
var variants = {
"bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
"top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
"left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
"right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
bottom : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
top : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
left : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
right : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
};
UI.$.extend(tcss, variants[tmppos[0]]);
@@ -129,37 +129,37 @@
if(boundary) {
switch(boundary) {
case "x":
case 'x':
if (tmppos.length == 2) {
position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
position = tmppos[0]+"-"+(tcss.left < 0 ? 'left': 'right');
} else {
position = tcss.left < 0 ? "right": "left";
position = tcss.left < 0 ? 'right': 'left';
}
break;
case "y":
case 'y':
if (tmppos.length == 2) {
position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
position = (tcss.top < 0 ? 'bottom': 'top')+'-'+tmppos[1];
} else {
position = (tcss.top < 0 ? "bottom": "top");
position = (tcss.top < 0 ? 'bottom': 'top');
}
break;
case "xy":
case 'xy':
if (tmppos.length == 2) {
position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
position = (tcss.top < 0 ? 'bottom': 'top')+'-'+(tcss.left < 0 ? 'left': 'right');
} else {
position = tcss.left < 0 ? "right": "left";
position = tcss.left < 0 ? 'right': 'left';
}
break;
}
tmppos = position.split("-");
tmppos = position.split('-');
UI.$.extend(tcss, variants[tmppos[0]]);
@@ -171,7 +171,7 @@
tooltipdelay = setTimeout(function(){
$tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
$tooltip.css(tcss).attr('class', ['uk-tooltip', 'uk-tooltip-'+position, $this.options.cls].join(' '));
if ($this.options.animation) {
$tooltip.css({opacity: 0, display: 'block'}).addClass($this.options.activeClass).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
@@ -182,7 +182,7 @@
tooltipdelay = false;
// close tooltip if element was removed or hidden
checkdelay = setInterval(function(){
checkIdle = setInterval(function(){
if(!$this.element.is(':visible')) $this.hide();
}, 150);
@@ -190,10 +190,11 @@
},
hide: function() {
if(this.element.is("input") && this.element[0]===document.activeElement) return;
if(tooltipdelay) clearTimeout(tooltipdelay);
if (checkdelay) clearTimeout(checkdelay);
if (this.element.is('input') && this.element[0]===document.activeElement) return;
if (tooltipdelay) clearTimeout(tooltipdelay);
if (checkIdle) clearInterval(checkIdle);
$tooltip.stop();