rails-uikit-sass 2.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
- data/lib/rails-uikit-sass.rb +12 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/components/accordion.js +180 -0
- data/vendor/assets/javascripts/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/components/autocomplete.js +340 -0
- data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/components/datepicker.js +3167 -0
- data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/components/form-password.js +67 -0
- data/vendor/assets/javascripts/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/components/form-select.js +85 -0
- data/vendor/assets/javascripts/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
- data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/grid.js +540 -0
- data/vendor/assets/javascripts/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/components/htmleditor.js +679 -0
- data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/components/lightbox.js +588 -0
- data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/components/nestable.js +653 -0
- data/vendor/assets/javascripts/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/components/notify.js +189 -0
- data/vendor/assets/javascripts/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/components/pagination.js +147 -0
- data/vendor/assets/javascripts/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/components/parallax.js +462 -0
- data/vendor/assets/javascripts/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/search.js +92 -0
- data/vendor/assets/javascripts/components/search.min.js +2 -0
- data/vendor/assets/javascripts/components/slider.js +552 -0
- data/vendor/assets/javascripts/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/components/slideset.js +523 -0
- data/vendor/assets/javascripts/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
- data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow.js +596 -0
- data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/components/sortable.js +688 -0
- data/vendor/assets/javascripts/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/components/sticky.js +364 -0
- data/vendor/assets/javascripts/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/components/tooltip.js +235 -0
- data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/components/upload.js +262 -0
- data/vendor/assets/javascripts/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/core/alert.js +66 -0
- data/vendor/assets/javascripts/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/core/button.js +156 -0
- data/vendor/assets/javascripts/core/button.min.js +2 -0
- data/vendor/assets/javascripts/core/core.js +820 -0
- data/vendor/assets/javascripts/core/core.min.js +2 -0
- data/vendor/assets/javascripts/core/cover.js +87 -0
- data/vendor/assets/javascripts/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/core/dropdown.js +534 -0
- data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/core/grid.js +117 -0
- data/vendor/assets/javascripts/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/core/modal.js +387 -0
- data/vendor/assets/javascripts/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/core/nav.js +153 -0
- data/vendor/assets/javascripts/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/core/offcanvas.js +197 -0
- data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/core/scrollspy.js +209 -0
- data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/core/switcher.js +307 -0
- data/vendor/assets/javascripts/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/core/tab.js +169 -0
- data/vendor/assets/javascripts/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/core/toggle.js +124 -0
- data/vendor/assets/javascripts/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/core/touch.js +175 -0
- data/vendor/assets/javascripts/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/core/utility.js +335 -0
- data/vendor/assets/javascripts/core/utility.min.js +2 -0
- data/vendor/assets/javascripts/uikit.js +3898 -0
- data/vendor/assets/javascripts/uikit.min.js +3 -0
- data/vendor/assets/stylesheets/components/accordion.scss +94 -0
- data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
- data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
- data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
- data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
- data/vendor/assets/stylesheets/components/form-file.scss +63 -0
- data/vendor/assets/stylesheets/components/form-password.scss +74 -0
- data/vendor/assets/stylesheets/components/form-select.scss +66 -0
- data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
- data/vendor/assets/stylesheets/components/nestable.scss +231 -0
- data/vendor/assets/stylesheets/components/notify.scss +190 -0
- data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
- data/vendor/assets/stylesheets/components/progress.scss +173 -0
- data/vendor/assets/stylesheets/components/search.scss +309 -0
- data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
- data/vendor/assets/stylesheets/components/slider.scss +139 -0
- data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
- data/vendor/assets/stylesheets/components/sortable.scss +124 -0
- data/vendor/assets/stylesheets/components/sticky.scss +57 -0
- data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
- data/vendor/assets/stylesheets/components/upload.scss +34 -0
- data/vendor/assets/stylesheets/core/alert.scss +141 -0
- data/vendor/assets/stylesheets/core/animation.scss +599 -0
- data/vendor/assets/stylesheets/core/article.scss +139 -0
- data/vendor/assets/stylesheets/core/badge.scss +110 -0
- data/vendor/assets/stylesheets/core/base.scss +563 -0
- data/vendor/assets/stylesheets/core/block.scss +155 -0
- data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
- data/vendor/assets/stylesheets/core/button.scss +406 -0
- data/vendor/assets/stylesheets/core/close.scss +132 -0
- data/vendor/assets/stylesheets/core/column.scss +209 -0
- data/vendor/assets/stylesheets/core/comment.scss +172 -0
- data/vendor/assets/stylesheets/core/contrast.scss +493 -0
- data/vendor/assets/stylesheets/core/cover.scss +70 -0
- data/vendor/assets/stylesheets/core/description-list.scss +71 -0
- data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
- data/vendor/assets/stylesheets/core/flex.scss +320 -0
- data/vendor/assets/stylesheets/core/form.scss +629 -0
- data/vendor/assets/stylesheets/core/grid.scss +731 -0
- data/vendor/assets/stylesheets/core/icon.scss +930 -0
- data/vendor/assets/stylesheets/core/list.scss +102 -0
- data/vendor/assets/stylesheets/core/modal.scss +343 -0
- data/vendor/assets/stylesheets/core/nav.scss +468 -0
- data/vendor/assets/stylesheets/core/navbar.scss +325 -0
- data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
- data/vendor/assets/stylesheets/core/overlay.scss +534 -0
- data/vendor/assets/stylesheets/core/pagination.scss +197 -0
- data/vendor/assets/stylesheets/core/panel.scss +332 -0
- data/vendor/assets/stylesheets/core/print.scss +61 -0
- data/vendor/assets/stylesheets/core/subnav.scss +213 -0
- data/vendor/assets/stylesheets/core/switcher.scss +38 -0
- data/vendor/assets/stylesheets/core/tab.scss +368 -0
- data/vendor/assets/stylesheets/core/table.scss +147 -0
- data/vendor/assets/stylesheets/core/text.scss +136 -0
- data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
- data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
- data/vendor/assets/stylesheets/core/utility.scss +610 -0
- data/vendor/assets/stylesheets/core/variables.scss +23 -0
- data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
- data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
- data/vendor/assets/stylesheets/uikit.scss +52 -0
- metadata +251 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-lightbox",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";function t(t){if(e)return e.lightbox=t,e;e=i.$(['<div class="uk-modal">','<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2-200)+'px;">','<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>','<div class="uk-lightbox-content"></div>','<div class="uk-modal-spinner uk-hidden"></div>',"</div>","</div>"].join("")).appendTo("body"),e.dialog=e.find(".uk-modal-dialog:first"),e.content=e.find(".uk-lightbox-content:first"),e.loader=e.find(".uk-modal-spinner:first"),e.closer=e.find(".uk-close.uk-close-alt"),e.modal=i.modal(e,{modal:!1}),e.on("swipeRight swipeLeft",function(i){e.lightbox["swipeLeft"==i.type?"next":"previous"]()}).on("click","[data-lightbox-previous], [data-lightbox-next]",function(t){t.preventDefault(),e.lightbox[i.$(this).is("[data-lightbox-next]")?"next":"previous"]()}),e.on("hide.uk.modal",function(){e.content.html("")});var o={w:window.innerWidth,h:window.innerHeight};return i.$win.on("load resize orientationchange",i.Utils.debounce(function(){o.w!==window.innerWidth&&e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize(),o={w:window.innerWidth,h:window.innerHeight}},100)),e.lightbox=t,e}var e,o={};return i.component("lightbox",{defaults:{allowfullscreen:!0,duration:400,group:!1,keyboard:!0},index:0,items:!1,boot:function(){i.$html.on("click","[data-uk-lightbox]",function(t){t.preventDefault();var e=i.$(this);e.data("lightbox")||i.lightbox(e,i.Utils.options(e.attr("data-uk-lightbox"))),e.data("lightbox").show(e)}),i.$doc.on("keyup",function(i){if(e&&e.is(":visible")&&e.lightbox.options.keyboard)switch(i.preventDefault(),i.keyCode){case 37:e.lightbox.previous();break;case 39:e.lightbox.next()}})},init:function(){var t=[];if(this.index=0,this.siblings=[],this.element&&this.element.length){var e=this.options.group?i.$('[data-uk-lightbox*="'+this.options.group+'"]'):this.element;e.each(function(){var e=i.$(this);t.push({source:e.attr("href"),title:e.attr("data-title")||e.attr("title"),type:e.attr("data-lightbox-type")||"auto",link:e})}),this.index=e.index(this.element),this.siblings=t}else this.options.group&&this.options.group.length&&(this.siblings=this.options.group);this.trigger("lightbox-init",[this])},show:function(e){this.modal=t(this),this.modal.dialog.stop(),this.modal.content.stop();var o,n,s=this,h=i.$.Deferred();e=e||0,"object"==typeof e&&this.siblings.forEach(function(i,t){e[0]===i.link[0]&&(e=t)}),0>e?e=this.siblings.length-e:this.siblings[e]||(e=0),n=this.siblings[e],o={lightbox:s,source:n.source,type:n.type,index:e,promise:h,title:n.title,item:n,meta:{content:"",width:null,height:null}},this.index=e,this.modal.content.empty(),this.modal.is(":visible")||(this.modal.content.css({width:"",height:""}).empty(),this.modal.modal.show()),this.modal.loader.removeClass("uk-hidden"),h.promise().done(function(){s.data=o,s.fitSize(o)}).fail(function(){o.meta.content='<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>',o.meta.width=400,o.meta.height=300,s.data=o,s.fitSize(o)}),s.trigger("showitem.uk.lightbox",[o])},fitSize:function(){var t=this,e=this.data,o=this.modal.dialog.outerWidth()-this.modal.dialog.width(),n=parseInt(this.modal.dialog.css("margin-top"),10),s=parseInt(this.modal.dialog.css("margin-bottom"),10),h=n+s,a=e.meta.content,l=t.options.duration;this.siblings.length>1&&(a=[a,'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>','<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'].join(""));var d,r,u=i.$("<div> </div>").css({opacity:0,position:"absolute",top:0,left:0,width:"100%",maxWidth:t.modal.dialog.css("max-width"),padding:t.modal.dialog.css("padding"),margin:t.modal.dialog.css("margin")}),c=e.meta.width,g=e.meta.height;u.appendTo("body").width(),d=u.width(),r=window.innerHeight-h,u.remove(),this.modal.dialog.find(".uk-modal-caption").remove(),e.title&&(this.modal.dialog.append('<div class="uk-modal-caption">'+e.title+"</div>"),r-=this.modal.dialog.find(".uk-modal-caption").outerHeight()),d<e.meta.width&&(g=Math.floor(g*(d/c)),c=d),g>r&&(g=Math.floor(r),c=Math.ceil(e.meta.width*(r/e.meta.height))),this.modal.content.css("opacity",0).width(c).html(a),"iframe"==e.type&&this.modal.content.find("iframe:first").height(g);var m=g+o,p=Math.floor(window.innerHeight/2-m/2)-h;0>p&&(p=0),this.modal.closer.addClass("uk-hidden"),t.modal.data("mwidth")==c&&t.modal.data("mheight")==g&&(l=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},l,"swing",function(){t.modal.loader.addClass("uk-hidden"),t.modal.content.css({width:""}).animate({opacity:1},function(){t.modal.closer.removeClass("uk-hidden")}),t.modal.data({mwidth:c,mheight:g})})},next:function(){this.show(this.siblings[this.index+1]?this.index+1:0)},previous:function(){this.show(this.siblings[this.index-1]?this.index-1:this.siblings.length-1)}}),i.plugin("lightbox","image",{init:function(i){i.on("showitem.uk.lightbox",function(i,t){if("image"==t.type||t.source&&t.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var e=function(i,e,o){t.meta={content:'<img class="uk-responsive-width" width="'+e+'" height="'+o+'" src ="'+i+'">',width:e,height:o},t.type="image",t.promise.resolve()};if(o[t.source])e(t.source,o[t.source].width,o[t.source].height);else{var n=new Image;n.onerror=function(){t.promise.reject("Loading image failed")},n.onload=function(){o[t.source]={width:n.width,height:n.height},e(t.source,o[t.source].width,o[t.source].height)},n.src=t.source}}})}}),i.plugin("lightbox","youtube",{init:function(i){var t=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,n=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,s){var h,a,l=function(i,t,o){s.meta={content:'<iframe src="//www.youtube.com/embed/'+i+'" width="'+t+'" height="'+o+'" style="max-width:100%;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},s.type="iframe",s.promise.resolve()};if((a=s.source.match(t))&&(h=a[2]),(a=s.source.match(n))&&(h=a[1]),h){if(o[h])l(h,o[h].width,o[h].height);else{var d=new Image,r=!1;d.onerror=function(){o[h]={width:640,height:320},l(h,o[h].width,o[h].height)},d.onload=function(){120==d.width&&90==d.height?r?(o[h]={width:640,height:320},l(h,o[h].width,o[h].height)):(r=!0,d.src="//img.youtube.com/vi/"+h+"/0.jpg"):(o[h]={width:d.width,height:d.height},l(h,d.width,d.height))},d.src="//img.youtube.com/vi/"+h+"/maxresdefault.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var n,s=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,h){var a,l=function(i,t,o){h.meta={content:'<iframe src="//player.vimeo.com/video/'+i+'" width="'+t+'" height="'+o+'" style="width:100%;box-sizing:border-box;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},h.type="iframe",h.promise.resolve()};(n=h.source.match(s))&&(a=n[2],o[a]?l(a,o[a].width,o[a].height):i.$.ajax({type:"GET",url:"//vimeo.com/api/oembed.json?url="+encodeURI(h.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[a]={width:i.width,height:i.height},l(a,o[a].width,o[a].height)}}),t.stopImmediatePropagation())})}}),i.plugin("lightbox","video",{init:function(t){t.on("showitem.uk.lightbox",function(t,e){var n=function(i,t,o){e.meta={content:'<video class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+o+'" controls></video>',width:t,height:o},e.type="video",e.promise.resolve()};if("video"==e.type||e.source.match(/\.(mp4|webm|ogv)$/i))if(o[e.source])n(e.source,o[e.source].width,o[e.source].height);else var s=i.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr("src",e.source).appendTo("body"),h=setInterval(function(){s[0].videoWidth&&(clearInterval(h),o[e.source]={width:s[0].videoWidth,height:s[0].videoHeight},n(e.source,o[e.source].width,o[e.source].height),s.remove())},20)})}}),UIkit.plugin("lightbox","iframe",{init:function(i){i.on("showitem.uk.lightbox",function(t,o){var n=function(i,t,n){o.meta={content:'<iframe class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+n+'"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:n},o.type="iframe",o.promise.resolve()};("iframe"===o.type||o.source.match(/\.(html|php)$/))&&n(o.source,i.options.width||800,i.options.height||600)})}}),i.lightbox.create=function(t,e){if(t){var o,n=[];return t.forEach(function(t){n.push(i.$.extend({source:"",title:"",type:"auto",link:!1},"string"==typeof t?{source:t}:t))}),o=i.lightbox(i.$.extend({},e,{group:n}))}},i.lightbox});
|
@@ -0,0 +1,653 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
/*
|
3
|
+
* Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
4
|
+
*/
|
5
|
+
(function(addon) {
|
6
|
+
|
7
|
+
var component;
|
8
|
+
|
9
|
+
if (window.UIkit) {
|
10
|
+
component = addon(UIkit);
|
11
|
+
}
|
12
|
+
|
13
|
+
if (typeof define == 'function' && define.amd) {
|
14
|
+
define('uikit-nestable', ['uikit'], function(){
|
15
|
+
return component || addon(UIkit);
|
16
|
+
});
|
17
|
+
}
|
18
|
+
|
19
|
+
})(function(UI) {
|
20
|
+
|
21
|
+
"use strict";
|
22
|
+
|
23
|
+
var hasTouch = 'ontouchstart' in window,
|
24
|
+
html = UI.$html,
|
25
|
+
touchedlists = [],
|
26
|
+
$win = UI.$win,
|
27
|
+
draggingElement;
|
28
|
+
|
29
|
+
var eStart = hasTouch ? 'touchstart' : 'mousedown',
|
30
|
+
eMove = hasTouch ? 'touchmove' : 'mousemove',
|
31
|
+
eEnd = hasTouch ? 'touchend' : 'mouseup',
|
32
|
+
eCancel = hasTouch ? 'touchcancel' : 'mouseup';
|
33
|
+
|
34
|
+
|
35
|
+
UI.component('nestable', {
|
36
|
+
|
37
|
+
defaults: {
|
38
|
+
listBaseClass : 'uk-nestable',
|
39
|
+
listClass : 'uk-nestable-list',
|
40
|
+
listItemClass : 'uk-nestable-item',
|
41
|
+
dragClass : 'uk-nestable-dragged',
|
42
|
+
movingClass : 'uk-nestable-moving',
|
43
|
+
noChildrenClass : 'uk-nestable-nochildren',
|
44
|
+
emptyClass : 'uk-nestable-empty',
|
45
|
+
handleClass : '',
|
46
|
+
collapsedClass : 'uk-collapsed',
|
47
|
+
placeholderClass: 'uk-nestable-placeholder',
|
48
|
+
noDragClass : 'uk-nestable-nodrag',
|
49
|
+
group : false,
|
50
|
+
maxDepth : 10,
|
51
|
+
threshold : 20,
|
52
|
+
idlethreshold : 10,
|
53
|
+
},
|
54
|
+
|
55
|
+
boot: function() {
|
56
|
+
|
57
|
+
// adjust document scrolling
|
58
|
+
UI.$html.on('mousemove touchmove', function(e) {
|
59
|
+
|
60
|
+
if (draggingElement) {
|
61
|
+
|
62
|
+
var top = draggingElement.offset().top;
|
63
|
+
|
64
|
+
if (top < UI.$win.scrollTop()) {
|
65
|
+
UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
|
66
|
+
} else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
|
67
|
+
UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
|
68
|
+
}
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
// init code
|
73
|
+
UI.ready(function(context) {
|
74
|
+
|
75
|
+
UI.$("[data-uk-nestable]", context).each(function(){
|
76
|
+
|
77
|
+
var ele = UI.$(this);
|
78
|
+
|
79
|
+
if (!ele.data("nestable")) {
|
80
|
+
UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
|
81
|
+
}
|
82
|
+
});
|
83
|
+
});
|
84
|
+
},
|
85
|
+
|
86
|
+
init: function() {
|
87
|
+
|
88
|
+
var $this = this;
|
89
|
+
|
90
|
+
Object.keys(this.options).forEach(function(key){
|
91
|
+
|
92
|
+
if(String(key).indexOf('Class')!=-1) {
|
93
|
+
$this.options['_'+key] = '.' + $this.options[key];
|
94
|
+
}
|
95
|
+
});
|
96
|
+
|
97
|
+
this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass);
|
98
|
+
|
99
|
+
this.checkEmptyList();
|
100
|
+
|
101
|
+
this.reset();
|
102
|
+
this.element.data('nestable-group', this.options.group || UI.Utils.uid('nestable-group'));
|
103
|
+
|
104
|
+
this.find(this.options._listItemClass).each(function() {
|
105
|
+
$this.setParent(UI.$(this));
|
106
|
+
});
|
107
|
+
|
108
|
+
this.on('click', '[data-nestable-action]', function(e) {
|
109
|
+
|
110
|
+
if ($this.dragEl || (!hasTouch && e.button !== 0)) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
114
|
+
e.preventDefault();
|
115
|
+
|
116
|
+
var target = UI.$(e.currentTarget),
|
117
|
+
action = target.data('nestableAction'),
|
118
|
+
item = target.closest($this.options._listItemClass);
|
119
|
+
|
120
|
+
if (action === 'collapse') {
|
121
|
+
$this.collapseItem(item);
|
122
|
+
}
|
123
|
+
if (action === 'expand') {
|
124
|
+
$this.expandItem(item);
|
125
|
+
}
|
126
|
+
if (action === 'toggle') {
|
127
|
+
$this.toggleItem(item);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
|
131
|
+
var onStartEvent = function(e) {
|
132
|
+
|
133
|
+
var handle = UI.$(e.target),
|
134
|
+
link = handle.is('a[href]') ? handle:handle.parents('a[href]');
|
135
|
+
|
136
|
+
if (e.target === $this.element[0]) {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
|
140
|
+
if (handle.is($this.options._noDragClass) || handle.closest($this.options._noDragClass).length) {
|
141
|
+
return;
|
142
|
+
}
|
143
|
+
|
144
|
+
if (handle.is('[data-nestable-action]') || handle.closest('[data-nestable-action]').length) {
|
145
|
+
return;
|
146
|
+
}
|
147
|
+
|
148
|
+
if ($this.options.handleClass && !handle.hasClass($this.options.handleClass)) {
|
149
|
+
|
150
|
+
if ($this.options.handleClass) {
|
151
|
+
handle = handle.closest($this.options._handleClass);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
|
159
|
+
if (e.originalEvent && e.originalEvent.touches) {
|
160
|
+
e = evt.originalEvent.touches[0];
|
161
|
+
}
|
162
|
+
|
163
|
+
$this.delayMove = function(evt) {
|
164
|
+
|
165
|
+
link = false;
|
166
|
+
|
167
|
+
evt.preventDefault();
|
168
|
+
$this.dragStart(e);
|
169
|
+
$this.trigger('start.uk.nestable', [$this]);
|
170
|
+
|
171
|
+
$this.delayMove = false;
|
172
|
+
};
|
173
|
+
|
174
|
+
$this.delayMove.x = parseInt(e.pageX, 10);
|
175
|
+
$this.delayMove.y = parseInt(e.pageY, 10);
|
176
|
+
$this.delayMove.threshold = $this.options.idlethreshold;
|
177
|
+
|
178
|
+
if (link.length && eEnd == 'touchend') {
|
179
|
+
|
180
|
+
$this.one(eEnd, function(){
|
181
|
+
if (link && link.attr('href').trim()) {
|
182
|
+
location.href = link.attr('href');
|
183
|
+
}
|
184
|
+
});
|
185
|
+
}
|
186
|
+
|
187
|
+
e.preventDefault();
|
188
|
+
};
|
189
|
+
|
190
|
+
var onMoveEvent = function(e) {
|
191
|
+
|
192
|
+
if (e.originalEvent && e.originalEvent.touches) {
|
193
|
+
e = e.originalEvent.touches[0];
|
194
|
+
}
|
195
|
+
|
196
|
+
if ($this.delayMove && (Math.abs(e.pageX - $this.delayMove.x) > $this.delayMove.threshold || Math.abs(e.pageY - $this.delayMove.y) > $this.delayMove.threshold)) {
|
197
|
+
|
198
|
+
if (!window.getSelection().toString()) {
|
199
|
+
$this.delayMove(e);
|
200
|
+
} else {
|
201
|
+
$this.delayMove = false;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
if ($this.dragEl) {
|
206
|
+
e.preventDefault();
|
207
|
+
$this.dragMove(e);
|
208
|
+
$this.trigger('move.uk.nestable', [$this]);
|
209
|
+
}
|
210
|
+
};
|
211
|
+
|
212
|
+
var onEndEvent = function(e) {
|
213
|
+
|
214
|
+
if ($this.dragEl) {
|
215
|
+
e.preventDefault();
|
216
|
+
$this.dragStop(hasTouch ? e.touches[0] : e);
|
217
|
+
}
|
218
|
+
|
219
|
+
draggingElement = false;
|
220
|
+
$this.delayMove = false;
|
221
|
+
};
|
222
|
+
|
223
|
+
if (hasTouch) {
|
224
|
+
this.element[0].addEventListener(eStart, onStartEvent, false);
|
225
|
+
window.addEventListener(eMove, onMoveEvent, false);
|
226
|
+
window.addEventListener(eEnd, onEndEvent, false);
|
227
|
+
window.addEventListener(eCancel, onEndEvent, false);
|
228
|
+
} else {
|
229
|
+
this.on(eStart, onStartEvent);
|
230
|
+
$win.on(eMove, onMoveEvent);
|
231
|
+
$win.on(eEnd, onEndEvent);
|
232
|
+
}
|
233
|
+
|
234
|
+
},
|
235
|
+
|
236
|
+
serialize: function() {
|
237
|
+
|
238
|
+
var data,
|
239
|
+
depth = 0,
|
240
|
+
list = this,
|
241
|
+
step = function(level, depth) {
|
242
|
+
|
243
|
+
var array = [ ], items = level.children(list.options._listItemClass);
|
244
|
+
|
245
|
+
items.each(function() {
|
246
|
+
|
247
|
+
var li = UI.$(this),
|
248
|
+
item = {}, attribute,
|
249
|
+
sub = li.children(list.options._listClass);
|
250
|
+
|
251
|
+
for (var i = 0, attr, val; i < li[0].attributes.length; i++) {
|
252
|
+
attribute = li[0].attributes[i];
|
253
|
+
if (attribute.name.indexOf('data-') === 0) {
|
254
|
+
attr = attribute.name.substr(5);
|
255
|
+
val = UI.Utils.str2json(attribute.value);
|
256
|
+
item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
if (sub.length) {
|
261
|
+
item.children = step(sub, depth + 1);
|
262
|
+
}
|
263
|
+
|
264
|
+
array.push(item);
|
265
|
+
|
266
|
+
});
|
267
|
+
return array;
|
268
|
+
};
|
269
|
+
|
270
|
+
data = step(list.element, depth);
|
271
|
+
|
272
|
+
return data;
|
273
|
+
},
|
274
|
+
|
275
|
+
list: function(options) {
|
276
|
+
|
277
|
+
var data = [],
|
278
|
+
list = this,
|
279
|
+
depth = 0,
|
280
|
+
step = function(level, depth, parent) {
|
281
|
+
|
282
|
+
var items = level.children(options._listItemClass);
|
283
|
+
|
284
|
+
items.each(function(index) {
|
285
|
+
var li = UI.$(this),
|
286
|
+
item = UI.$.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
|
287
|
+
sub = li.children(options._listClass);
|
288
|
+
|
289
|
+
data.push(item);
|
290
|
+
|
291
|
+
if (sub.length) {
|
292
|
+
step(sub, depth + 1, li.data(options.idProperty || 'id'));
|
293
|
+
}
|
294
|
+
});
|
295
|
+
};
|
296
|
+
|
297
|
+
options = UI.$.extend({}, list.options, options);
|
298
|
+
|
299
|
+
step(list.element, depth);
|
300
|
+
|
301
|
+
return data;
|
302
|
+
},
|
303
|
+
|
304
|
+
reset: function() {
|
305
|
+
|
306
|
+
this.mouse = {
|
307
|
+
offsetX : 0,
|
308
|
+
offsetY : 0,
|
309
|
+
startX : 0,
|
310
|
+
startY : 0,
|
311
|
+
lastX : 0,
|
312
|
+
lastY : 0,
|
313
|
+
nowX : 0,
|
314
|
+
nowY : 0,
|
315
|
+
distX : 0,
|
316
|
+
distY : 0,
|
317
|
+
dirAx : 0,
|
318
|
+
dirX : 0,
|
319
|
+
dirY : 0,
|
320
|
+
lastDirX : 0,
|
321
|
+
lastDirY : 0,
|
322
|
+
distAxX : 0,
|
323
|
+
distAxY : 0
|
324
|
+
};
|
325
|
+
this.moving = false;
|
326
|
+
this.dragEl = null;
|
327
|
+
this.dragRootEl = null;
|
328
|
+
this.dragDepth = 0;
|
329
|
+
this.hasNewRoot = false;
|
330
|
+
this.pointEl = null;
|
331
|
+
|
332
|
+
for (var i=0; i<touchedlists.length; i++) {
|
333
|
+
this.checkEmptyList(touchedlists[i]);
|
334
|
+
}
|
335
|
+
|
336
|
+
touchedlists = [];
|
337
|
+
},
|
338
|
+
|
339
|
+
toggleItem: function(li) {
|
340
|
+
this[li.hasClass(this.options.collapsedClass) ? 'expandItem':'collapseItem'](li);
|
341
|
+
},
|
342
|
+
|
343
|
+
expandItem: function(li) {
|
344
|
+
li.removeClass(this.options.collapsedClass);
|
345
|
+
},
|
346
|
+
|
347
|
+
collapseItem: function(li) {
|
348
|
+
var lists = li.children(this.options._listClass);
|
349
|
+
if (lists.length) {
|
350
|
+
li.addClass(this.options.collapsedClass);
|
351
|
+
}
|
352
|
+
},
|
353
|
+
|
354
|
+
expandAll: function() {
|
355
|
+
var list = this;
|
356
|
+
this.find(list.options._listItemClass).each(function() {
|
357
|
+
list.expandItem(UI.$(this));
|
358
|
+
});
|
359
|
+
},
|
360
|
+
|
361
|
+
collapseAll: function() {
|
362
|
+
var list = this;
|
363
|
+
this.find(list.options._listItemClass).each(function() {
|
364
|
+
list.collapseItem(UI.$(this));
|
365
|
+
});
|
366
|
+
},
|
367
|
+
|
368
|
+
setParent: function(li) {
|
369
|
+
|
370
|
+
if (li.children(this.options._listClass).length) {
|
371
|
+
li.addClass('uk-parent');
|
372
|
+
}
|
373
|
+
},
|
374
|
+
|
375
|
+
unsetParent: function(li) {
|
376
|
+
li.removeClass('uk-parent '+this.options.collapsedClass);
|
377
|
+
li.children(this.options._listClass).remove();
|
378
|
+
},
|
379
|
+
|
380
|
+
dragStart: function(e) {
|
381
|
+
|
382
|
+
var mouse = this.mouse,
|
383
|
+
target = UI.$(e.target),
|
384
|
+
dragItem = target.closest(this.options._listItemClass),
|
385
|
+
offset = dragItem.offset();
|
386
|
+
|
387
|
+
this.placeEl = dragItem;
|
388
|
+
|
389
|
+
mouse.offsetX = e.pageX - offset.left;
|
390
|
+
mouse.offsetY = e.pageY - offset.top;
|
391
|
+
|
392
|
+
mouse.startX = mouse.lastX = offset.left;
|
393
|
+
mouse.startY = mouse.lastY = offset.top;
|
394
|
+
|
395
|
+
this.dragRootEl = this.element;
|
396
|
+
|
397
|
+
this.dragEl = UI.$('<ul></ul>').addClass(this.options.listClass + ' ' + this.options.dragClass).append(dragItem.clone());
|
398
|
+
this.dragEl.css('width', dragItem.width());
|
399
|
+
this.placeEl.addClass(this.options.placeholderClass);
|
400
|
+
|
401
|
+
draggingElement = this.dragEl;
|
402
|
+
|
403
|
+
this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
|
404
|
+
|
405
|
+
UI.$body.append(this.dragEl);
|
406
|
+
|
407
|
+
this.dragEl.css({
|
408
|
+
left : offset.left,
|
409
|
+
top : offset.top
|
410
|
+
});
|
411
|
+
|
412
|
+
// total depth of dragging item
|
413
|
+
var i, depth, items = this.dragEl.find(this.options._listItemClass);
|
414
|
+
|
415
|
+
for (i = 0; i < items.length; i++) {
|
416
|
+
depth = UI.$(items[i]).parents(this.options._listClass+','+this.options._listBaseClass).length;
|
417
|
+
if (depth > this.dragDepth) {
|
418
|
+
this.dragDepth = depth;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
|
422
|
+
html.addClass(this.options.movingClass);
|
423
|
+
},
|
424
|
+
|
425
|
+
dragStop: function(e) {
|
426
|
+
|
427
|
+
var el = UI.$(this.placeEl),
|
428
|
+
root = this.placeEl.parents(this.options._listBaseClass+':first');
|
429
|
+
|
430
|
+
this.placeEl.removeClass(this.options.placeholderClass);
|
431
|
+
this.dragEl.remove();
|
432
|
+
|
433
|
+
if (this.element[0] !== root[0]) {
|
434
|
+
|
435
|
+
root.trigger('change.uk.nestable',[root.data('nestable'), el, 'added']);
|
436
|
+
this.element.trigger('change.uk.nestable', [this, el, 'removed']);
|
437
|
+
|
438
|
+
} else {
|
439
|
+
this.element.trigger('change.uk.nestable',[this, el, "moved"]);
|
440
|
+
}
|
441
|
+
|
442
|
+
this.trigger('stop.uk.nestable', [this, el]);
|
443
|
+
|
444
|
+
this.reset();
|
445
|
+
|
446
|
+
html.removeClass(this.options.movingClass);
|
447
|
+
},
|
448
|
+
|
449
|
+
dragMove: function(e) {
|
450
|
+
var list, parent, prev, next, depth,
|
451
|
+
opt = this.options,
|
452
|
+
mouse = this.mouse,
|
453
|
+
maxDepth = this.dragRootEl ? this.dragRootEl.data('nestable').options.maxDepth : opt.maxDepth;
|
454
|
+
|
455
|
+
this.dragEl.css({
|
456
|
+
left : e.pageX - mouse.offsetX,
|
457
|
+
top : e.pageY - mouse.offsetY
|
458
|
+
});
|
459
|
+
|
460
|
+
// mouse position last events
|
461
|
+
mouse.lastX = mouse.nowX;
|
462
|
+
mouse.lastY = mouse.nowY;
|
463
|
+
// mouse position this events
|
464
|
+
mouse.nowX = e.pageX;
|
465
|
+
mouse.nowY = e.pageY;
|
466
|
+
// distance mouse moved between events
|
467
|
+
mouse.distX = mouse.nowX - mouse.lastX;
|
468
|
+
mouse.distY = mouse.nowY - mouse.lastY;
|
469
|
+
// direction mouse was moving
|
470
|
+
mouse.lastDirX = mouse.dirX;
|
471
|
+
mouse.lastDirY = mouse.dirY;
|
472
|
+
// direction mouse is now moving (on both axis)
|
473
|
+
mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
|
474
|
+
mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
|
475
|
+
// axis mouse is now moving on
|
476
|
+
var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
|
477
|
+
|
478
|
+
// do nothing on first move
|
479
|
+
if (!mouse.moving) {
|
480
|
+
mouse.dirAx = newAx;
|
481
|
+
mouse.moving = true;
|
482
|
+
return;
|
483
|
+
}
|
484
|
+
|
485
|
+
// calc distance moved on this axis (and direction)
|
486
|
+
if (mouse.dirAx !== newAx) {
|
487
|
+
mouse.distAxX = 0;
|
488
|
+
mouse.distAxY = 0;
|
489
|
+
} else {
|
490
|
+
mouse.distAxX += Math.abs(mouse.distX);
|
491
|
+
if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
|
492
|
+
mouse.distAxX = 0;
|
493
|
+
}
|
494
|
+
mouse.distAxY += Math.abs(mouse.distY);
|
495
|
+
if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
|
496
|
+
mouse.distAxY = 0;
|
497
|
+
}
|
498
|
+
}
|
499
|
+
mouse.dirAx = newAx;
|
500
|
+
|
501
|
+
/**
|
502
|
+
* move horizontal
|
503
|
+
*/
|
504
|
+
if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
|
505
|
+
// reset move distance on x-axis for new phase
|
506
|
+
mouse.distAxX = 0;
|
507
|
+
prev = this.placeEl.prev('li');
|
508
|
+
|
509
|
+
// increase horizontal level if previous sibling exists, is not collapsed, and does not have a 'no children' class
|
510
|
+
if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) {
|
511
|
+
|
512
|
+
// cannot increase level when item above is collapsed
|
513
|
+
list = prev.find(opt._listClass).last();
|
514
|
+
|
515
|
+
// check if depth limit has reached
|
516
|
+
depth = this.placeEl.parents(opt._listClass+','+opt._listBaseClass).length;
|
517
|
+
|
518
|
+
if (depth + this.dragDepth <= maxDepth) {
|
519
|
+
|
520
|
+
// create new sub-level if one doesn't exist
|
521
|
+
if (!list.length) {
|
522
|
+
list = UI.$('<ul/>').addClass(opt.listClass);
|
523
|
+
list.append(this.placeEl);
|
524
|
+
prev.append(list);
|
525
|
+
this.setParent(prev);
|
526
|
+
} else {
|
527
|
+
// else append to next level up
|
528
|
+
list = prev.children(opt._listClass).last();
|
529
|
+
list.append(this.placeEl);
|
530
|
+
}
|
531
|
+
}
|
532
|
+
}
|
533
|
+
|
534
|
+
// decrease horizontal level
|
535
|
+
if (mouse.distX < 0) {
|
536
|
+
|
537
|
+
// we cannot decrease the level if an item precedes the current one
|
538
|
+
next = this.placeEl.next(opt._listItemClass);
|
539
|
+
if (!next.length) {
|
540
|
+
|
541
|
+
// get parent ul of the list item
|
542
|
+
var parentUl = this.placeEl.closest([opt._listBaseClass, opt._listClass].join(','));
|
543
|
+
// try to get the li surrounding the ul
|
544
|
+
var surroundingLi = parentUl.closest(opt._listItemClass);
|
545
|
+
|
546
|
+
// if the ul is inside of a li (meaning it is nested)
|
547
|
+
if (surroundingLi.length) {
|
548
|
+
// we can decrease the horizontal level
|
549
|
+
surroundingLi.after(this.placeEl);
|
550
|
+
// if the previous parent ul is now empty
|
551
|
+
if (!parentUl.children().length) {
|
552
|
+
this.unsetParent(surroundingLi);
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|
556
|
+
}
|
557
|
+
}
|
558
|
+
|
559
|
+
var isEmpty = false;
|
560
|
+
|
561
|
+
// find list item under cursor
|
562
|
+
var pointX = e.pageX - (window.pageXOffset || document.scrollLeft || 0),
|
563
|
+
pointY = e.pageY - (window.pageYOffset || document.documentElement.scrollTop);
|
564
|
+
this.pointEl = UI.$(document.elementFromPoint(pointX, pointY));
|
565
|
+
|
566
|
+
if (opt.handleClass && this.pointEl.hasClass(opt.handleClass)) {
|
567
|
+
|
568
|
+
this.pointEl = this.pointEl.closest(opt._listItemClass);
|
569
|
+
|
570
|
+
} else {
|
571
|
+
|
572
|
+
var nestableitem = this.pointEl.closest(opt._listItemClass);
|
573
|
+
|
574
|
+
if (nestableitem.length) {
|
575
|
+
this.pointEl = nestableitem;
|
576
|
+
}
|
577
|
+
}
|
578
|
+
|
579
|
+
if (this.placeEl.find(this.pointEl).length) {
|
580
|
+
return;
|
581
|
+
}
|
582
|
+
|
583
|
+
if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
|
584
|
+
isEmpty = true;
|
585
|
+
this.checkEmptyList(this.pointEl);
|
586
|
+
} else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listItemClass)) {
|
587
|
+
return;
|
588
|
+
}
|
589
|
+
|
590
|
+
// find parent list of item under cursor
|
591
|
+
var pointElRoot = this.element,
|
592
|
+
tmpRoot = this.pointEl.closest(this.options._listBaseClass),
|
593
|
+
isNewRoot = pointElRoot[0] != tmpRoot[0];
|
594
|
+
|
595
|
+
/**
|
596
|
+
* move vertical
|
597
|
+
*/
|
598
|
+
if (!mouse.dirAx || isNewRoot || isEmpty) {
|
599
|
+
|
600
|
+
// check if groups match if dragging over new root
|
601
|
+
if (isNewRoot && opt.group !== tmpRoot.data('nestable-group')) {
|
602
|
+
return;
|
603
|
+
} else {
|
604
|
+
touchedlists.push(pointElRoot);
|
605
|
+
}
|
606
|
+
|
607
|
+
// check depth limit
|
608
|
+
depth = this.dragDepth - 1 + this.pointEl.parents(opt._listClass+','+opt._listBaseClass).length;
|
609
|
+
|
610
|
+
if (depth > maxDepth) {
|
611
|
+
return;
|
612
|
+
}
|
613
|
+
|
614
|
+
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
|
615
|
+
|
616
|
+
parent = this.placeEl.parent();
|
617
|
+
|
618
|
+
if (isEmpty) {
|
619
|
+
this.pointEl.append(this.placeEl);
|
620
|
+
} else if (before) {
|
621
|
+
this.pointEl.before(this.placeEl);
|
622
|
+
} else {
|
623
|
+
this.pointEl.after(this.placeEl);
|
624
|
+
}
|
625
|
+
|
626
|
+
if (!parent.children().length) {
|
627
|
+
if (!parent.data('nestable')) this.unsetParent(parent.parent());
|
628
|
+
}
|
629
|
+
|
630
|
+
this.checkEmptyList(this.dragRootEl);
|
631
|
+
this.checkEmptyList(pointElRoot);
|
632
|
+
|
633
|
+
// parent root list has changed
|
634
|
+
if (isNewRoot) {
|
635
|
+
this.dragRootEl = tmpRoot;
|
636
|
+
this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
|
637
|
+
}
|
638
|
+
}
|
639
|
+
},
|
640
|
+
|
641
|
+
checkEmptyList: function(list) {
|
642
|
+
|
643
|
+
list = list ? UI.$(list) : this.element;
|
644
|
+
|
645
|
+
if (this.options.emptyClass) {
|
646
|
+
list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
|
647
|
+
}
|
648
|
+
}
|
649
|
+
|
650
|
+
});
|
651
|
+
|
652
|
+
return UI.nestable;
|
653
|
+
});
|