updated Uikit v2
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/*! 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 */
|
||||
/*
|
||||
* Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
||||
*/
|
||||
@ -6,13 +6,13 @@
|
||||
|
||||
var component;
|
||||
|
||||
if (window.UIkit) {
|
||||
component = addon(UIkit);
|
||||
if (window.UIkit2) {
|
||||
component = addon(UIkit2);
|
||||
}
|
||||
|
||||
if (typeof define == "function" && define.amd) {
|
||||
define("uikit-nestable", ["uikit"], function(){
|
||||
return component || addon(UIkit);
|
||||
if (typeof define == 'function' && define.amd) {
|
||||
define('uikit-nestable', ['uikit'], function(){
|
||||
return component || addon(UIkit2);
|
||||
});
|
||||
}
|
||||
|
||||
@ -130,7 +130,8 @@
|
||||
|
||||
var onStartEvent = function(e) {
|
||||
|
||||
var handle = UI.$(e.target);
|
||||
var handle = UI.$(e.target),
|
||||
link = handle.is('a[href]') ? handle:handle.parents('a[href]');
|
||||
|
||||
if (e.target === $this.element[0]) {
|
||||
return;
|
||||
@ -161,6 +162,8 @@
|
||||
|
||||
$this.delayMove = function(evt) {
|
||||
|
||||
link = false;
|
||||
|
||||
evt.preventDefault();
|
||||
$this.dragStart(e);
|
||||
$this.trigger('start.uk.nestable', [$this]);
|
||||
@ -172,6 +175,15 @@
|
||||
$this.delayMove.y = parseInt(e.pageY, 10);
|
||||
$this.delayMove.threshold = $this.options.idlethreshold;
|
||||
|
||||
if (link.length && eEnd == 'touchend') {
|
||||
|
||||
$this.one(eEnd, function(){
|
||||
if (link && link.attr('href').trim()) {
|
||||
location.href = link.attr('href');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
@ -236,10 +248,12 @@
|
||||
item = {}, attribute,
|
||||
sub = li.children(list.options._listClass);
|
||||
|
||||
for (var i = 0; i < li[0].attributes.length; i++) {
|
||||
for (var i = 0, attr, val; i < li[0].attributes.length; i++) {
|
||||
attribute = li[0].attributes[i];
|
||||
if (attribute.name.indexOf('data-') === 0) {
|
||||
item[attribute.name.substr(5)] = UI.Utils.str2json(attribute.value);
|
||||
attr = attribute.name.substr(5);
|
||||
val = UI.Utils.str2json(attribute.value);
|
||||
item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +337,7 @@
|
||||
},
|
||||
|
||||
toggleItem: function(li) {
|
||||
this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
|
||||
this[li.hasClass(this.options.collapsedClass) ? 'expandItem':'collapseItem'](li);
|
||||
},
|
||||
|
||||
expandItem: function(li) {
|
||||
@ -354,7 +368,7 @@
|
||||
setParent: function(li) {
|
||||
|
||||
if (li.children(this.options._listClass).length) {
|
||||
li.addClass("uk-parent");
|
||||
li.addClass('uk-parent');
|
||||
}
|
||||
},
|
||||
|
||||
@ -610,7 +624,7 @@
|
||||
}
|
||||
|
||||
if (!parent.children().length) {
|
||||
if (!parent.data("nestable")) this.unsetParent(parent.parent());
|
||||
if (!parent.data('nestable')) this.unsetParent(parent.parent());
|
||||
}
|
||||
|
||||
this.checkEmptyList(this.dragRootEl);
|
||||
|
Reference in New Issue
Block a user