").addClass(e.icon),o=$("").css({overflow:"auto"}).append(n).append(" ").append(l).append(s),r=$("
").data(e);r.addClass("list-group-item pr-0").append(o),t.append(r),MenuEditor.updateButtons(t),d()},this.getString=function(){var e=t.sortableListsToJson();return JSON.stringify(e)},this.setData=function(e){var s=Array.isArray(e)?e:function(e){try{var s=JSON.parse(e)}catch(e){return console.log("The string is not a json valid."),null}return s}(e);if(null!==s){t.empty();var n=f(s);o?t.find("li").each((function(){var e=$(this);e.children("ul").length&&h(e)})):(n.sortableLists(l.listOptions),o=!0),MenuEditor.updateButtons(t)}}}!function(e){
/**
* @desc jQuery plugin to sort html list also the tree structures
* @version 1.4.0
@@ -8,4 +8,4 @@ function MenuEditor(e,s){var t=$("#"+e).data("level","0"),l={labelEdit:'").prependTo(t).attr("id","sortableListsBase").css(n.baseCss).addClass(n.listsClass+" "+n.baseClass),i=e("").attr("id","sortableListsPlaceholder").css(n.placeholderCss).addClass(n.placeholderClass),r=e("").attr("id","sortableListsHint").css(n.hintCss).addClass(n.hintClass),a=e("<"+n.listSelector+" />").attr("id","sortableListsHintWrapper").addClass(n.listsClass+" "+n.hintWrapperClass).css(n.listsCss).css(n.hintWrapperCss),c=e("").addClass("sortableListsOpener "+n.opener.openerClass).css(n.opener.openerCss).on("mousedown touchstart",function(s){var t=e(this).closest("li");return t.hasClass("sortableListsClosed")?L(t):E(t),!1});"class"==n.opener.as?c.addClass(n.opener.close):"html"==n.opener.as?c.html(n.opener.close):console.error("Invalid setting for opener.as");var d={isDragged:!1,isRelEFP:null,oEl:null,rootEl:null,cEl:null,upScroll:!1,downScroll:!1,pX:0,pY:0,cX:0,cY:0,isAllowed:!0,e:{pageX:0,pageY:0,clientX:0,clientY:0},doc:e(document),win:e(window)};if(n.opener.active){if(!n.opener.open)throw"Opener.open value is not defined. It should be valid url, html or css class.";if(!n.opener.close)throw"Opener.close value is not defined. It should be valid url, html or css class.";e(this).find("li").each(function(){var s=e(this);s.children(n.listSelector).length&&(c.clone(!0).prependTo(s.children("div").first()),s.hasClass("sortableListsOpen")?L(s):E(s))})}return this.on("mousedown touchstart",function(s){var t=e(s.target);if(!(!1!==d.isDragged||n.ignoreClass&&t.hasClass(n.ignoreClass))){s.preventDefault(),"touchstart"===s.type&&v(s);var l=t.closest("li"),a=e(this);l[0]&&(n.onDragStart(s,l),function(s,t,l){d.isDragged=!0;var a=parseInt(t.css("margin-top")),c=parseInt(t.css("margin-bottom")),f=parseInt(t.css("margin-left")),h=parseInt(t.css("margin-right")),v=t.offset(),b=t.innerHeight();d.rootEl={el:l,offset:l.offset(),rootElClass:l.attr("class")},d.cEl={el:t,mT:a,mL:f,mB:c,mR:h,offset:v},d.cEl.xyOffsetDiff={X:s.pageX-d.cEl.offset.left,Y:s.pageY-d.cEl.offset.top},d.cEl.el.addClass("sortableListsCurrent "+n.currElClass),t.before(i);var g=d.placeholderNode=e("#sortableListsPlaceholder");t.css({width:t.width(),position:"absolute",top:v.top-a,left:v.left-f}).prependTo(o),g.css({display:"block",height:b}),r.css("height",b),d.doc.on("mousemove touchmove",p).on("mouseup touchend touchcancel",u)}(s,l,a))}});function p(s){if(d.isDragged){var t=d.cEl,l=d.doc,o=d.win;"touchmove"===s.type&&v(s),s.pageX||function(e){e.pageY=d.pY,e.pageX=d.pX,e.clientY=d.cY,e.clientX=d.cX}(s),l.scrollTop()>d.rootEl.offset.top-10&&s.clientY<50?d.upScroll?(s.pageY=s.pageY-n.scroll,e("html, body").each(function(s){e(this).scrollTop(e(this).scrollTop()-n.scroll)}),f(s)):function(e){if(d.upScroll)return;d.upScroll=setInterval(function(){d.doc.trigger("mousemove")},50)}():l.scrollTop()+o.height()0&&(l=null==(o=document.elementFromPoint(0,n+e(window).height()-1))||"HTML"==o.tagName.toUpperCase()),(n=d.doc.scrollLeft())>0&&(l=null==(o=document.elementFromPoint(n+e(window).width()-1,0))||"HTML"==o.tagName.toUpperCase())}l&&(s-=d.doc.scrollLeft(),t-=d.doc.scrollTop());var i=e(document.elementFromPoint(s,t));if(!d.rootEl.el.find(i).length)return null;if(i.is("#sortableListsPlaceholder")||i.is("#sortableListsHint"))return null;if(!i.is("li"))return(i=i.closest("li"))[0]?i:null;if(i.is("li"))return i}(s.pageX,s.pageY),t.el[0].style.visibility="visible",function(e,s){var t=s.oEl;if(!t||!s.oElOld)return;var l=t.outerHeight(!1),o=e.pageY-t.offset().top;n.insertZonePlus?14>o?g(e,t,7>o):l-14o?b(e,t):l-5n.insertZone){var o=t.children(),i=t.children(n.listSelector).first();if(i.children().first().is("#sortableListsPlaceholder"))return void r.css("display","none");i.length?i.prepend(r):(o.first().after(r),r.wrap(a)),d.oEl&&L(t)}else{if(t.prev("#sortableListsPlaceholder").length)return void r.css("display","none");t.before(r)}r.css("display","block"),d.isAllowed=n.isAllowed(d.cEl.el,r,r.parents("li").first())}function m(s,t){if(e("#sortableListsHintWrapper",d.rootEl.el).length&&r.unwrap(),s.pageX-t.offset().leftn.insertZone){var o=t.children(),i=t.children(n.listSelector).last();if(i.children().last().is("#sortableListsPlaceholder"))return void r.css("display","none");i.length?o.last().append(r):(t.append(r),r.wrap(a)),d.oEl&&L(t)}else{if(t.next("#sortableListsPlaceholder").length)return void r.css("display","none");t.after(r)}r.css("display","block"),d.isAllowed=n.isAllowed(d.cEl.el,r,r.parents("li").first())}function L(e){e.removeClass("sortableListsClosed").addClass("sortableListsOpen"),e.children(n.listSelector).css("display","block");var s=e.children("div").children(".sortableListsOpener").first();"html"==n.opener.as?s.html(n.opener.close):"class"==n.opener.as?s.addClass(n.opener.close).removeClass(n.opener.open):s.css("background-image","url("+n.opener.close+")")}function E(e){e.removeClass("sortableListsOpen").addClass("sortableListsClosed"),e.children(n.listSelector).css("display","none");var s=e.children("div").children(".sortableListsOpener").first();"html"==n.opener.as?s.html(n.opener.open):"class"==n.opener.as?s.addClass(n.opener.open).removeClass(n.opener.close):s.css("background-image","url("+n.opener.open+")")}function y(){e(n.listSelector,d.rootEl.el).each(function(s){e(this).children().length||(e(this).prev("div").children(".sortableListsOpener").first().remove(),e(this).remove())})}},e.fn.iconOpen=function(e){this.removeClass("sortableListsClosed").addClass("sortableListsOpen"),this.children("ul").css("display","block");var s=this.children("div").children(".sortableListsOpener").first();"html"===e.opener.as?s.html(e.opener.close):"class"===e.opener.as&&s.addClass(e.opener.close).removeClass(e.opener.open)},e.fn.iconClose=function(e){this.removeClass("sortableListsOpen").addClass("sortableListsClosed"),this.children("ul").css("display","none");var s=this.children("div").children(".sortableListsOpener").first();"html"===e.opener.as?s.html(e.opener.open):"class"===e.opener.as&&s.addClass(e.opener.open).removeClass(e.opener.close)},e.fn.sortableListsToJson=function(){var s=[];return e(this).children("li").each(function(){var t=e(this),l=t.data();s.push(l);var n=t.children("ul,ol").sortableListsToJson();n.length>0?l.children=n:delete l.children}),s},e.fn.updateLevels=function(s){var t=void 0===s?0:s;e(this).children("li").each(function(){var s=e(this).children("ul");s.length>0&&(s.data("level",t+1),s.updateLevels(t+1))})},e.fn.updateButtons=function(s){var t=void 0===s?0:s,l=["Up","In"],n=["Down"];0===t&&(l.push("Out"),n.push("Out"),e(this).children("li").hideButtons(["Out"])),e(this).children("li").each(function(){var s=e(this).children("ul");s.length>0&&s.updateButtons(t+1)}),e(this).children("li:first").hideButtons(l),e(this).children("li:last").hideButtons(n)},e.fn.hideButtons=function(s){for(var t=0;t").prependTo(t).attr("id","sortableListsBase").css(n.baseCss).addClass(n.listsClass+" "+n.baseClass),i=e("").attr("id","sortableListsPlaceholder").css(n.placeholderCss).addClass(n.placeholderClass),r=e("").attr("id","sortableListsHint").css(n.hintCss).addClass(n.hintClass),a=e("<"+n.listSelector+" />").attr("id","sortableListsHintWrapper").addClass(n.listsClass+" "+n.hintWrapperClass).css(n.listsCss).css(n.hintWrapperCss),c=e("").addClass("sortableListsOpener "+n.opener.openerClass).css(n.opener.openerCss).on("mousedown touchstart",(function(s){var t=e(this).closest("li");return t.hasClass("sortableListsClosed")?L(t):E(t),!1}));"class"==n.opener.as?c.addClass(n.opener.close):"html"==n.opener.as?c.html(n.opener.close):console.error("Invalid setting for opener.as");var d={isDragged:!1,isRelEFP:null,oEl:null,rootEl:null,cEl:null,upScroll:!1,downScroll:!1,pX:0,pY:0,cX:0,cY:0,isAllowed:!0,e:{pageX:0,pageY:0,clientX:0,clientY:0},doc:e(document),win:e(window)};if(n.opener.active){if(!n.opener.open)throw"Opener.open value is not defined. It should be valid url, html or css class.";if(!n.opener.close)throw"Opener.close value is not defined. It should be valid url, html or css class.";e(this).find("li").each((function(){var s=e(this);s.children(n.listSelector).length&&(c.clone(!0).prependTo(s.children("div").first()),s.hasClass("sortableListsOpen")?L(s):E(s))}))}return this.on("mousedown touchstart",(function(s){var t=e(s.target);if(!(!1!==d.isDragged||n.ignoreClass&&t.hasClass(n.ignoreClass))){s.preventDefault(),"touchstart"===s.type&&v(s);var l=t.closest("li"),a=e(this);l[0]&&(n.onDragStart(s,l),function(s,t,l){d.isDragged=!0;var a=parseInt(t.css("margin-top")),c=parseInt(t.css("margin-bottom")),f=parseInt(t.css("margin-left")),h=parseInt(t.css("margin-right")),v=t.offset(),b=t.innerHeight();d.rootEl={el:l,offset:l.offset(),rootElClass:l.attr("class")},d.cEl={el:t,mT:a,mL:f,mB:c,mR:h,offset:v},d.cEl.xyOffsetDiff={X:s.pageX-d.cEl.offset.left,Y:s.pageY-d.cEl.offset.top},d.cEl.el.addClass("sortableListsCurrent "+n.currElClass),t.before(i);var g=d.placeholderNode=e("#sortableListsPlaceholder");t.css({width:t.width(),position:"absolute",top:v.top-a,left:v.left-f}).prependTo(o),g.css({display:"block",height:b}),r.css("height",b),d.doc.on("mousemove touchmove",p).on("mouseup touchend touchcancel",u)}(s,l,a))}}));function p(s){if(d.isDragged){var t=d.cEl,l=d.doc,o=d.win;"touchmove"===s.type&&v(s),s.pageX||function(e){e.pageY=d.pY,e.pageX=d.pX,e.clientY=d.cY,e.clientX=d.cX}(s),l.scrollTop()>d.rootEl.offset.top-10&&s.clientY<50?d.upScroll?(s.pageY=s.pageY-n.scroll,e("html, body").each((function(s){e(this).scrollTop(e(this).scrollTop()-n.scroll)})),f(s)):function(e){if(d.upScroll)return;d.upScroll=setInterval((function(){d.doc.trigger("mousemove")}),50)}():l.scrollTop()+o.height()0&&(l=null==(o=document.elementFromPoint(0,n+e(window).height()-1))||"HTML"==o.tagName.toUpperCase()),(n=d.doc.scrollLeft())>0&&(l=null==(o=document.elementFromPoint(n+e(window).width()-1,0))||"HTML"==o.tagName.toUpperCase())}l&&(s-=d.doc.scrollLeft(),t-=d.doc.scrollTop());var i=e(document.elementFromPoint(s,t));if(!d.rootEl.el.find(i).length)return null;if(i.is("#sortableListsPlaceholder")||i.is("#sortableListsHint"))return null;if(!i.is("li"))return(i=i.closest("li"))[0]?i:null;if(i.is("li"))return i}(s.pageX,s.pageY),t.el[0].style.visibility="visible",function(e,s){var t=s.oEl;if(!t||!s.oElOld)return;var l=t.outerHeight(!1),o=e.pageY-t.offset().top;n.insertZonePlus?14>o?g(e,t,7>o):l-14o?b(e,t):l-5n.insertZone){var o=t.children(),i=t.children(n.listSelector).first();if(i.children().first().is("#sortableListsPlaceholder"))return void r.css("display","none");i.length?i.prepend(r):(o.first().after(r),r.wrap(a)),d.oEl&&L(t)}else{if(t.prev("#sortableListsPlaceholder").length)return void r.css("display","none");t.before(r)}r.css("display","block"),d.isAllowed=n.isAllowed(d.cEl.el,r,r.parents("li").first())}function m(s,t){if(e("#sortableListsHintWrapper",d.rootEl.el).length&&r.unwrap(),s.pageX-t.offset().leftn.insertZone){var o=t.children(),i=t.children(n.listSelector).last();if(i.children().last().is("#sortableListsPlaceholder"))return void r.css("display","none");i.length?o.last().append(r):(t.append(r),r.wrap(a)),d.oEl&&L(t)}else{if(t.next("#sortableListsPlaceholder").length)return void r.css("display","none");t.after(r)}r.css("display","block"),d.isAllowed=n.isAllowed(d.cEl.el,r,r.parents("li").first())}function L(e){e.removeClass("sortableListsClosed").addClass("sortableListsOpen"),e.children(n.listSelector).css("display","block");var s=e.children("div").children(".sortableListsOpener").first();"html"==n.opener.as?s.html(n.opener.close):"class"==n.opener.as?s.addClass(n.opener.close).removeClass(n.opener.open):s.css("background-image","url("+n.opener.close+")")}function E(e){e.removeClass("sortableListsOpen").addClass("sortableListsClosed"),e.children(n.listSelector).css("display","none");var s=e.children("div").children(".sortableListsOpener").first();"html"==n.opener.as?s.html(n.opener.open):"class"==n.opener.as?s.addClass(n.opener.open).removeClass(n.opener.close):s.css("background-image","url("+n.opener.open+")")}function y(){e(n.listSelector,d.rootEl.el).each((function(s){e(this).children().length||(e(this).prev("div").children(".sortableListsOpener").first().remove(),e(this).remove())}))}},e.fn.iconOpen=function(e){this.removeClass("sortableListsClosed").addClass("sortableListsOpen"),this.children("ul").css("display","block");var s=this.children("div").children(".sortableListsOpener").first();"html"===e.opener.as?s.html(e.opener.close):"class"===e.opener.as&&s.addClass(e.opener.close).removeClass(e.opener.open)},e.fn.iconClose=function(e){this.removeClass("sortableListsOpen").addClass("sortableListsClosed"),this.children("ul").css("display","none");var s=this.children("div").children(".sortableListsOpener").first();"html"===e.opener.as?s.html(e.opener.open):"class"===e.opener.as&&s.addClass(e.opener.open).removeClass(e.opener.close)},e.fn.sortableListsToJson=function(){var s=[];return e(this).children("li").each((function(){var t=e(this),l=t.data();s.push(l);var n=t.children("ul,ol").sortableListsToJson();n.length>0?l.children=n:delete l.children})),s},e.fn.updateLevels=function(s){var t=void 0===s?0:s;e(this).children("li").each((function(){var s=e(this).children("ul");s.length>0&&(s.data("level",t+1),s.updateLevels(t+1))}))},e.fn.updateButtons=function(s){var t=void 0===s?0:s,l=["Up","In"],n=["Down"];0===t&&(l.push("Out"),n.push("Out"),e(this).children("li").hideButtons(["Out"])),e(this).children("li").each((function(){var s=e(this).children("ul");s.length>0&&s.updateButtons(t+1)})),e(this).children("li:first").hideButtons(l),e(this).children("li:last").hideButtons(n)},e.fn.hideButtons=function(s){for(var t=0;t