rhymix/modules/admin/tpl/js/menu_setup.min.js
2015-01-05 14:05:08 +09:00

2 lines
No EOL
3.3 KiB
JavaScript

jQuery(function(a){function b(b){var c;if(moduleList=b.menuList){var d=a("#menuNameList");for(var e in moduleList){var f=moduleList[e];c=a('<optgroup label="'+e+'" />').appendTo(d);for(var g in f)c.append('<option value="'+e+":"+g+'">'+f[g].title+"</option>")}}}var c,d,e=a("#editForm"),f=a("#listForm");a("a._add").click(function(){if(d=a(this).parent().prevAll("._item_key").val(),e.find("input[name=parent_srl]").val(d),!c){var f=[],g=["menuList"];exec_xml("menu","procMenuAdminAllActList",f,b,g)}}),a("a._parent_delete").click(function(){var b=a(this).parent().prevAll("._parent_key").val();f.find("input[name=menu_item_srl]").val(b),f.submit()}),a("a._child_delete").click(function(){var b=a(this).closest("li").find("._item_key").val();f.find("input[name=menu_item_srl]").val(b),f.submit()})}),jQuery(function(a){function b(a,b){for(var c=0,d=0;a&&a!=b;)c+=a.offsetTop,d+=a.offsetLeft,a=a.offsetParent;return{top:c,left:d}}a("form.adminMap").delegate("li:not(.placeholder)","dropped.st",function(){var b,c,d=a(this);b=d.find(">input._parent_key"),c=!!d.parent("ul").parent("li").length,b.val(c?d.parent("ul").parent("li").find(">input._item_key").val():"0")});var c=!1,d=a('<li class="placeholder">');a("form.adminMap>ul").delegate("li:not(.placeholder,.parent)",{"mousedown.st":function(e){var f,g,h,i,j,k,l,m,n,o;if(!a(e.target).is("a,input,label,textarea")&&1==e.which){for(c=!0,f=a(this),j=f.height(),i=f.width(),g=f.parentsUntil(".adminMap").filter("ul"),h=g.eq(-1),l={x:e.pageX,y:e.pageY},k=b(this,h.get(0)),$clone=f.clone(!0).attr("target",!0),n=g.length-1;n;n--)$clone=$clone.wrap("<li><ul /></li>").parent().parent();return m=[],h.find("li").each(function(){if(f[0]===this||f.has(this).length)return!0;var c=b(this,h.get(0));m.push({top:c.top,bottom:c.top+32,$item:a(this)})}),$clone.find(".side,input").remove().end().addClass("draggable").css({position:"absolute",opacity:.6,width:i,height:j,left:k.left,top:k.top,zIndex:100}).appendTo(h.eq(0)),d.css({position:"absolute",opacity:.6,width:i,height:"10px",left:k.left,top:k.top,zIndex:99}).appendTo(h.eq(0)),f.css("opacity",.6),a(document).unbind("mousemove.st mouseup.st").bind("mousemove.st",function(a){var b,c,e,f,g;for(o=null,b={x:l.x-a.pageX,y:l.y-a.pageY},c=k.top-b.y,e=0,f=m.length;f>e;e++)g=m[e],g.top>c||g.bottom<c||(o={element:g.$item},g.$item.hasClass("parent")?(o.state="prepend",d.css("top",g.bottom-5)):g.top>c-12?(o.state="before",d.css("top",g.top-5)):(o.state="after",d.css("top",g.bottom-5)));$clone.css({top:c})}).bind("mouseup.st",function(){var b,e;c=!1,a(document).unbind("mousemove.st mouseup.st"),f.css("opacity",""),$clone.remove(),d.remove(),e=a("<li />").height(f.height()),o&&(b=a(o.element),f.before(e),"prepend"==o.state?(b.find(">ul").length||b.find(">.side").after("<ul>"),b.find(">ul").prepend(f.hide())):b[o.state](f.hide()),f.slideDown(100,function(){f.removeClass("active")}),e.slideUp(100,function(){var a=e.parent();e.remove(),a.children("li").length||a.remove()}),f.trigger("dropped.st"))}),!1}},"mouseover.st":function(){return c||a(this).addClass("active"),!1},"mouseout.st":function(){return c||a(this).removeClass("active"),!1}}).find("li li").prepend('<button type="button" class="moveTo">Move to</button>').end().end(),a('<div id="dropzone-marker" />').css({display:"none",position:"absolute",backgroundColor:"#000",opacity:.7}).appendTo("body")});
//# sourceMappingURL=menu_setup.min.map