mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-17 10:19:55 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11860 201d5d3c-b55e-5fd7-737f-ddc643e51545
1 line
No EOL
3.5 KiB
JavaScript
1 line
No EOL
3.5 KiB
JavaScript
jQuery(function(e){var d;var f;var a=e("#editForm");var c=e("#listForm");e("a._add").click(function(){f=e(this).parent().prevAll("._item_key").val();a.find("input[name=parent_srl]").val(f);if(!d){var h=new Array();var g=new Array("menuList");exec_xml("menu","procMenuAdminAllActList",h,b,g);}});function b(k){var h;moduleList=k.menuList;if(moduleList){var i=e("#menuNameList");for(var g in moduleList){var j=moduleList[g];h=e('<optgroup label="'+g+'" />').appendTo(i);for(var l in j){h.append('<option value="'+g+":"+l+'">'+j[l].title+"</option>");}}}}e("a._parent_delete").click(function(){var g=e(this).parent().prevAll("._parent_key").val();c.find("input[name=menu_item_srl]").val(g);c.submit();});e("a._child_delete").click(function(){var g=e(this).parents("li").find("._item_key").val();c.find("input[name=menu_item_srl]").val(g);c.submit();});});jQuery(function(d){d("form.adminMap").delegate("li:not(.placeholder)","dropped.st",function(){var h=d(this),g,e,f;g=h.find(">input._parent_key");f=!!h.parent("ul").parent("li").length;if(f){g.val(h.parent("ul").parent("li").find(">input._item_key").val());}else{g.val("0");}});var c=false,b=d('<li class="placeholder">');d("form.adminMap>ul").delegate("li:not(.placeholder,.parent)",{"mousedown.st":function(f){var o,m,l,g,q,j,n,h,k,p,e="";if(d(f.target).is("a,input,label,textarea")||f.which!=1){return;}c=true;o=d(this);q=o.height();g=o.width();m=o.parentsUntil(".adminMap").filter("ul");l=m.eq(-1);n={x:f.pageX,y:f.pageY};j=a(this,l.get(0));$clone=o.clone(true).attr("target",true);for(k=m.length-1;k;k--){$clone=$clone.wrap("<li><ul /></li>").parent().parent();}h=[];l.find("li").each(function(i){if(o[0]===this||o.has(this).length){return true;}var r=a(this,l.get(0));h.push({top:r.top,bottom:r.top+32,$item:d(this)});});$clone.find(".side,input").remove().end().addClass("draggable").css({position:"absolute",opacity:0.6,width:g,height:q,left:j.left,top:j.top,zIndex:100}).appendTo(l.eq(0));b.css({position:"absolute",opacity:0.6,width:g,height:"10px",left:j.left,top:j.top,zIndex:99}).appendTo(l.eq(0));o.css("opacity",0.6);d(document).unbind("mousemove.st mouseup.st").bind("mousemove.st",function(u){var v,s,t,r,x,w;p=null;v={x:n.x-u.pageX,y:n.y-u.pageY};s=j.top-v.y;for(r=0,x=h.length;r<x;r++){w=h[r];if(w.top>s||w.bottom<s){continue;}p={element:w.$item};if(w.$item.hasClass("parent")){p.state="prepend";b.css("top",w.bottom-5);}else{if(w.top>s-12){p.state="before";b.css("top",w.top-5);}else{p.state="after";b.css("top",w.bottom-5);}}}$clone.css({top:s});}).bind("mouseup.st",function(i){var s,r;c=false;d(document).unbind("mousemove.st mouseup.st");o.css("opacity","");$clone.remove();b.remove();r=d("<li />").height(o.height());if(!p){return;}s=d(p.element);o.before(r);if(p.state=="prepend"){if(!s.find(">ul").length){s.find(">.side").after("<ul>");}s.find(">ul").prepend(o.hide());}else{s[p.state](o.hide());}o.slideDown(100,function(){o.removeClass("active");});r.slideUp(100,function(){var t=r.parent();r.remove();if(!t.children("li").length){t.remove();}});o.trigger("dropped.st");});return false;},"mouseover.st":function(){if(!c){d(this).addClass("active");}return false;},"mouseout.st":function(){if(!c){d(this).removeClass("active");}return false;}}).find("li li").prepend('<button type="button" class="moveTo">Move to</button>').end().end();d('<div id="dropzone-marker" />').css({display:"none",position:"absolute",backgroundColor:"#000",opacity:0.7}).appendTo("body");function a(f,e){var h=0,g=0;while(f&&f!=e){h+=f.offsetTop;g+=f.offsetLeft;f=f.offsetParent;}return{top:h,left:g};}}); |