rhymix/modules/admin/tpl/js/admin.min.js
2012-03-06 08:32:27 +00:00

1 line
No EOL
19 KiB
JavaScript

jQuery(function(d){var a=27;d(".form li").find('>input:text:not(".notmulti"),>input:password,>textarea').filter('input[value!=""],textarea:not(:empty)').prev("label").css("visibility","hidden").end().end().prev("label").addClass("overlap").css({top:"15px",left:"5px"}).next().focus(function(){var e=d(this).prev().stop().animate({opacity:0,left:"25px"},"fast",function(){e.css("visibility","hidden")})}).blur(function(){var f=d(this),e;if(d.trim(f.val())==""){e=f.prev().stop().css("visibility","visible").animate({opacity:1,left:"5px"},"fast")}}).end().parent().css("position","relative");var b=d("input:radio+label,input:checkbox+label"),c=b.prev("input");c.change(function(){var e=d(this).attr("name");c.filter(function(){return this.name==e}).next("label").css("font-weight","normal").end().filter(":checked").next("label").css("font-weight","bold").end()}).change();d(".form th>input:checkbox").change(function(){var f=d(this),e=f.data("name");f.closest("table").find("input:checkbox").filter(function(){var g=d(this);return !g.prop("disabled")&&((g.attr("name")==e)||(g.data("name")==e))}).prop("checked",f.prop("checked")).end().end().trigger("update.checkbox",[e,this.checked])});d.fn.xePagination=function(){this.not(".xe-pagination").addClass("xe-pagination").find("span.tgContent").css("whiteSpace","nowrap").end().find("a.tgAnchor").each(function(e){var f=d(this);f.after(d(f.attr("href")))}).end();return this};d(".pagination").xePagination();d(".portlet .action").css({display:"none",position:"absolute"}).parent().mouseleave(function(){d(this).find(">.action").fadeOut(100)}).mouseenter(function(){d(this).find(">.action").fadeIn(100)}).focusin(function(){d(this).mouseenter()}).focusout(function(){var e=d(this),f;clearTimeout(e.data("timer"));f=setTimeout(function(){if(!e.find(":focus").length){e.mouseleave()}},10);e.data("timer",f)});d(window).resize(function(){if(d(document).width()<1300){d(".dashboard>.section>br").remove();d(".dashboard>.section>.portlet:odd").after('<br style="clear:both" />')}else{d(".dashboard>.section>br").remove();d(".dashboard>.section>.portlet:eq(2),.dashboard>.section>.portlet:eq(5)").after('<br style="clear:both" />')}});d(window).resize();d(".header>.siteTool>a.i").bind("before-open.tc",function(){d(this).addClass("active").next("div.tgContent").find(">.section:gt(0)").hide().end().find(">.btnArea>button").show()}).bind("after-close.tc",function(){d(this).removeClass("active")}).next("#siteMapList").find(">.section:last").after('<p class="btnArea"><button type="button">&rsaquo; more</button></p>').find("+p>button").click(function(){d(this).hide().parent().prevAll(".section").show()});d.fn.xeMask=function(){this.each(function(){var e=d(this),g=e.text();var f=/^([\w\-\.]+?)@(([\w-]+\.)+[a-z]{2,})$/ig;if(f.test(g)){e.html(g.replace(/(@.+)$/,'<span class="ellipsis">...</span><span class="cover">$1</span>')).find(">.ellipsis").css({position:"absolute",zIndex:1}).hover(function(){d(this).next(".cover").mouseover()},function(){d(this).next(".cover").mouseout()}).end().find(">.cover").css({zIndex:2,opacity:0}).hover(function(){d(this).css("opacity",1).prev("span").css("visibility","hidden")},function(){d(this).css("opacity",0).prev("span").css("visibility","visible")}).end()}})};d(".masked").xeMask()});jQuery(function(a){a.fn.xeMenu=function(){this.attr("role","navigation").find(">.nav>li").attr("role","menuitem").find(">ul").css("height","0").end().filter(":has(>ul)").attr("aria-haspopup","true").end().end().find(">.nav").mouseover(function(){a(this).parent(".gnb").addClass("active").end().find(">li>ul").css("height","auto").end()}).mouseleave(function(){a(this).parent(".gnb").removeClass("active").end().find(">li>ul").css("height","0").end()}).focusout(function(){var b=a(this);setTimeout(function(){if(!b.find(":focus").length){b.mouseleave()}},1)}).delegate("a",{focus:function(){a(this).mouseover()}});this.find(">.bmk").removeClass("active").mouseover(function(){a(this).addClass("active")}).mouseleave(function(){a(this).removeClass("active")}).focusout(function(){var b=a(this);setTimeout(function(){if(!b.find(":focus").length){b.mouseleave()}},1)}).delegate("a",{focus:function(){a(this).mouseover()}})};a("div.gnb").xeMenu();a(".gnb>.mnv").change(function(){window.location.href=a(this).find("option:selected").val()})});jQuery(function(a){var b=27;a.fn.xeModalWindow=function(){this.not(".xe-modal-window").addClass("xe-modal-window").each(function(){a(a(this).attr("href")).addClass("x").hide()}).click(function(){var f=a(this),c,e,d;c=a(f.attr("href"));if(!c.parent("body").length){e=a('<button type="button" class="modalClose" title="Close this layer">X</button>');e.click(function(){c.data("anchor").trigger("close.mw")});c.prepend('<span class="bg"></span>').append('<!--[if IE 6]><iframe class="ie6"></iframe><![endif]-->').find(">.fg").prepend(e).append(e.clone(true)).end().appendTo("body")}c.data("anchor",f);if(c.data("state")=="showing"){f.trigger("close.mw")}else{f.trigger("open.mw")}return false}).bind("open.mw",function(){var f=a(this),c,d,e;c=a.Event("before-open.mw");f.trigger(c);if(c.isDefaultPrevented()){return false}d=a(f.attr("href"));e=f.data("duration")||"fast";d.data("state","showing");a("html,body").addClass("modalContainer");function g(){f.trigger("after-open.mw")}a(document).bind("keydown.mw",function(h){if(h.which==b){f.trigger("close.mw");return false}});d.fadeIn(e,g).find(">.bg").height(a(document).height()).end().find("button.modalClose:first").focus()}).bind("close.mw",function(){var f=a(this),c,d,e;c=a.Event("before-close.mw");f.trigger(c);if(c.isDefaultPrevented()){return false}d=a(f.attr("href"));e=f.data("duration")||"fast";d.data("state","hiding");a("html,body").removeClass("modalContainer");function g(){f.trigger("after-close.mw")}d.fadeOut(e,g);f.focus()})};a("a.modalAnchor").xeModalWindow();a("div.modal").addClass("x").hide()});jQuery(function(b){var a=false;var c=27;b.fn.xeContentToggler=function(){this.not(".xe-content-toggler").addClass("xe-content-toggler").each(function(){var d=b(this);$layer=b(d.attr("href"));$layer.hide().not(".xe-toggling-content").addClass("xe-toggling-content").mousedown(function(e){a=true}).focusout(function(e){setTimeout(function(){if(!a&&!$layer.find(":focus").length&&$layer.data("state")=="showing"){d.trigger("close.tc")}a=false},1)})}).click(function(){var e=b(this),d;d=b(e.attr("href"));d.data("anchor",e);if(d.data("state")=="showing"){e.trigger("close.tc")}else{e.trigger("open.tc")}return false}).bind("open.tc",function(){var h=b(this),e,f,g;e=b(h.attr("href"));f=h.data("effect");g=h.data("duration")||"fast";e.data("state","showing");h.trigger("before-open.tc");a=false;b(document).unbind("mousedown.tc keydown.tc").bind("mousedown.tc keydown.tc",function(j){if(j){if(j.type=="keydown"&&j.which!=c){return true}if(j.type=="mousedown"){var k=b(j.target);if(k.is("html,.tgAnchor,.tgContent")||e.has(k).length){return true}}}h.trigger("close.tc");return false});function i(){h.trigger("after-open.tc")}switch(f){case"slide":e.slideDown(g,i);break;case"slide-h":var d=e.css({"overflow-x":"",width:""}).width();e.show().css({"overflow-x":"hidden",width:"0px"}).animate({width:d},g,function(){e.css({"overflow-x":"",width:""});i()});break;case"fade":e.fadeIn(g,i);break;default:e.show();h.trigger("after-open.tc")}}).bind("close.tc",function(){var g=b(this),d,e,f;b(document).unbind("mousedown.tc keydown.tc");d=b(g.attr("href"));e=g.data("effect");f=g.data("duration")||"fast";d.data("state","hiding");g.trigger("before-close.tc");function h(){g.trigger("after-close.tc")}switch(e){case"slide":d.slideUp(f,h);break;case"slide-h":d.animate({width:0},f,function(){d.hide();h()});break;case"fade":d.fadeOut(f,h);break;default:d.hide();g.trigger("after-close.tc")}});return this};b("a.tgAnchor").xeContentToggler()});jQuery(function(a){a.fn.xeModuleFinder=function(){this.not(".xe-module-finder").addClass("xe-module-finder").find("a.tgAnchor.findsite").bind("before-open.tc",function(){var c,b,d;c=a(this);b=a(c.attr("href")).find(">ul");d=c.prev("input:text").val();function e(h){var k,g=h.site_list,f,j;b.empty();c.closest(".modulefinder").find(".moduleList,.moduleIdList").attr("disabled","disabled");if(h.error||!a.isArray(g)){c.trigger("close.tc");return}for(f=0,j=g.length;f<j;f++){k=a("<li />").appendTo(b);a('<button type="button" />').text(g[f].domain).data("site_srl",g[f].site_srl).appendTo(k)}}a.exec_json("admin.getSiteAllList",{domain:d},e)}).end().find(".tgContent.suggestion").delegate("button","click",function(){var c,b;c=a(this);b=c.closest(".modulefinder");function d(h){var f,g=h.module_list,e;if(h.error||!g){return}f=b.find(".moduleList").data("module_list",g).removeAttr("disabled").empty();for(e in g){if(!g.hasOwnProperty(e)){continue}a("<option />").attr("value",e).text(g[e].title).appendTo(f)}f.prop("selectedIndex",0).change().focus();if(!f.is(":visible")){f.slideDown(100,function(){b.find(".moduleIdList:not(:visible)").slideDown(100).trigger("show")}).trigger("show")}}b.find("a.tgAnchor.findsite").trigger("close.tc");a.exec_json("module.procModuleAdminGetList",{site_srl:c.data("site_srl")},d)}).end().find(".moduleList,.moduleIdList").hide().end().find(".moduleList").change(function(){var e,c,f,d;e=a(this);f=e.val();d=e.data("module_list");if(!d[f]){return}d=d[f].list;c=e.closest(".modulefinder").find(".moduleIdList").removeAttr("disabled").empty();for(var b in d){if(!d.hasOwnProperty(b)){continue}a("<option />").attr("value",d[b].module_srl).text(d[b].browser_title).appendTo(c)}c.prop("selectedIndex",0).change()});return this};a(".modulefinder").xeModuleFinder()});jQuery(function(d){var c=false,b=d('<tr class="placeholder"><td>&nbsp;</td></tr>');d.fn.xeSortableTable=function(){this.not(".xe-sortable-table").addClass("xe-sortable-table").delegate("button.dragBtn","mousedown.st",function(e){var m,l,q,s,r,f,h,k,g,j,o,n,p;if(e.which!=1){return}m=d(this);l=m.closest("tr");q=m.closest("table");p=q.get(0).offsetParent;r=l.height();f=l.width();before_event=d.Event("before-drag.st");q.trigger(before_event);if(before_event.isDefaultPrevented()){return false}k={x:e.pageX,y:e.pageY};h=a(l.get(0),p);$clone=l.attr("target",true).clone(true).appendTo(q);n=(s=q.find("thead th")).length;s.filter("[colspan]").attr("colspan",function(t,i){n+=i-1});b.find("td").attr("colspan",n);g=[];q.find("tbody>tr:not([target],.sticky,:hidden)").each(function(){var i=d(this),t;t=a(this,p);g.push({top:t.top,bottom:t.top+i.height(),$item:i})});$clone.addClass("draggable").css({position:"absolute",opacity:0.6,width:f,height:r,left:h.left,top:h.top,zIndex:100});b.css({position:"absolute",opacity:0.6,width:f,height:"10px",left:h.left,top:h.top,backgroundColor:"#bbb",overflow:"hidden",zIndex:99}).appendTo(q);l.css("opacity",0.6);d(document).unbind("mousedown.st mouseup.st").bind("mousemove.st",function(w){var x,u,v,t,z,y;o=null;x={x:k.x-w.pageX,y:k.y-w.pageY};u=h.top-x.y;for(t=0,z=g.length;t<z;t++){y=g[t];if((t&&y.top>u)||((t<z-1)&&y.bottom<u)){continue}o={element:y.$item};if(y.top>u-12){o.state="before";b.css("top",y.top-5)}else{o.state="after";b.css("top",y.bottom-5)}}$clone.css({top:u})}).bind("mouseup.st",function(i){var t;c=false;d(document).unbind("mousemove.st mouseup.st");l.removeAttr("target").css("opacity","");$clone.remove();b.remove();if(!o){return}t=d(o.element);t[o.state](l);q.trigger("after-drag.st")})});return this};d("table.sortable").xeSortableTable();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}}});jQuery(function(h){var m=null,a=null,b=0,k=null,i=false,n=false,p;var c=27,o=38,l=40,e=13;h(".multiLangEdit").delegate("input.vLang:text,textarea.vLang",{textchange:function(){var s=h(this),u=h.trim(s.val()),q,t;if(a){clearTimeout(a);a=null}t=s.data("mle-container");q=p.find(">ul");if(!u||i){i=false;q.parent().hide();s.prev("input.vLang").val("");return}s.data("mle-langkey").val("");s.prev("input.vLang").val(u);function r(){s.addClass("loading");if(q.parent().is(":visible")){q.parent().hide()}show_waiting_message=false;h.exec_json("module.getLangListByLangcodeForAutoComplete",{search_keyword:u},(function(w){return function(x){v(x,w)}})(b++));show_waiting_message=true}function v(A,w){var y=A.results,z,x,B;if(A.error||!y||(b!=w+1)){return}s.removeClass("loading");q.empty();for(x=0,B=y.length;x<B;x++){z=h('<button type="button" class="_btnLang" />').data("langkey",y[x].name).text(y[x].value);h("<li />").append(z).appendTo(q)}p.trigger("show")}a=setTimeout(r,100)},keydown:function(u){var v,r,q,t,s=u.which;v=h(this);r=p.find(">ul");if(!p.is(":visible")||h.inArray(s,[o,l,e,c])<0){return true}if(s==c){p.trigger("hide");return false}q=r.find("button.active");if(s==e){q.click();return false}if(!q.length){r.find("li>button:first").addClass("active");return false}if(s==o){t=q.parent().prev("li").find(">button");if(!t.length){t=r.find(">li:last>button")}}else{if(s==l){t=q.parent().next("li").find(">button");if(!t.length){t=r.find(">li:first>button")}}}q.removeClass("active");t.addClass("active");return false},focus:function(){var r=h(this),q=h.trim(r.val()),s=r.closest(".multiLangEdit");r.after(p);if(!r.data("mle-container")){r.data("mle-container",s)}if(!r.data("mle-langkey")){r.data("mle-langkey",s.find("input.vLang:first"))}(function(){var t=h.trim(r.val());if(t!=q){q=t;r.trigger("textchange")}m=setTimeout(arguments.callee,50)})()},blur:function(){clearTimeout(m);m=null;h(this).closest(".multiLangEdit").focusout()},focusout:function(){var q=h(this);clearTimeout(k);k=setTimeout(function(){if(n){n=false;return}if(!q.find(":focus").is(".vLang,button._btnLang")){p.trigger("hide")}},10)}}).delegate("a.tgAnchor.editUserLang",{"before-open.tc":function(){var v,t,r,w,x,y,u,s;v=h(this);t=h(v.attr("href")).insertBefore(v);r=v.closest(".multiLangEdit");w=r.find("input.vLang,textarea.vLang");x=w.eq(0).val();y=w.eq(1).val();g(t);t.trigger("multilang-reset").removeClass("showChild").find(".langList").empty().end();t.find(".langInput li."+xe.current_lang).find(">input:text,>textarea").val(y).prev("label").css("visibility","hidden");p.trigger("hide");if(/^\$user_lang->(.+)$/.test(x)){u="module.getModuleAdminLangListByName";s={lang_name:RegExp.$1}}else{u="module.getModuleAdminLangListByValue";s={value:y}}function q(C){var B=C.lang_list,D,A,F,z,E;if(C.error||!B){return}B=d(B);t.data("multilang-list",B);E=t.find(".langList");h.each(B,function(H){var I=h("<li />").appendTo(E);var G=t.data("layer_index");h('<a href="#langInput_'+G+'" class="langItem" />').text(this[xe.current_lang]).data("multilang-name",H).appendTo(I)});if(j(B)>1){t.addClass("showChild")}t.find(".langList>li>a:first").click()}show_waiting_message=false;h.exec_json(u,s,q);show_waiting_message=true}}).delegate("button._btnLang",{click:function(){var q=h(this);i=true;p.trigger("hide");q.closest(".multiLangEdit").find("input.vLang,textarea.vLang").eq(0).val(q.data("langkey")).end().eq(1).val(q.text()).end();return false},mousedown:function(){n=true},focus:function(){h(this).mouseover()},mouseover:function(){h(this).closest("ul").find("button.active").removeClass("active")}});p=h('<div class="suggestion"><ul></ul></div>').bind("show",function(){h(this).show()}).bind("hide",function(){h(this).hide()});var f=0;function g(w){var r,C,D="",y=0,x,B,z,u=[];var A=0,t=1,v=0,q=1;if(w.data("init-multilang-editor")){return}w.data("init-multilang-editor",true).bind("multilang-reset",function(){w.data("multilang-current-name","").find(".langInput li").find(">input:text,>textarea").val(" ").prev("label").css("visibility","visible");x=v;E()}).find("h2 a").click(function(){x=!x;E();return false}).end().delegate("a.langItem","click",function(){var K=h(this),F,J,G,H,L;J=w.data("multilang-list");G=K.data("multilang-name");if(!J||!J[G]){return}J=J[G];F=w.find(".langInput");w.trigger("multilang-reset").find(".langList li.active").removeClass("active").end().data("multilang-current-name",G);K.parent("li").addClass("active");for(var I in J){if(!J.hasOwnProperty(I)){continue}F.find("li."+I).find(">input:text,>textarea").data("multilang-value",J[I]).val(J[I]).prev("label").css("visibility","hidden")}D=s();y=0;r.val(u[y]);x=q;E();return false}).data("layer_index",f).find(".langInput").attr("id","langInput_"+f++);z=w.find("h2 strong").text();B=w.find("h2 a").text();C=w.find("input:text,textarea").change(function(){var F=(s()==D)?A:t;if(F!=y){r.val(u[y=F])}});function s(){var F=[];C.each(function(){F.push(this.value)});return F.join("\n")}function E(){if(!w.data("multilang-current-name")){w.find("h2").find("strong").text(B).end().find("a").hide()}else{w.find("h2").find("strong").text(x==v?B:z).end().find("a").text(x==v?z:B).show().end()}}r=w.find("input[type=submit]").click(function(){var G=w.data("multilang-current-name");function F(){w.hide().closest(".multiLangEdit").find(".vLang").eq(0).val("$user_lang->"+G).end().eq(1).val(w.find(".langInput li."+xe.current_lang).find(">input:text,>textarea").val()).end()}function H(){var J={};if(G&&x==q){J.lang_name=G}C.each(function(L,K){var M=h(this);J[M.parent("li").attr("class")]=M.val()});h.exec_json("module.procModuleAdminInsertLang",J,I)}function I(J){if(!J||J.error||!J.name){return}G=J.name;F()}(s()==D)?F():H();return false});u=r.val().split("|");r.val(u[A])}function d(s){var q,u,t={},r;for(q=0,u=s.length;q<u;q++){r=s[q];if(!t[r.name]){t[r.name]={}}t[r.name][r.lang_code]=r.value}return t}function j(s){var r=0;for(var q in s){if(s.hasOwnProperty(q)){r++}}return r}});jQuery(function(a){a(".filebox").bind("before-open.mw",function(){var e,c,d;var b;e=a(this);b=e.attr("href");c=a(b).find(".filebox_list");function f(g){c.html(g.html);c.find(".lined .select").bind("click",function(j){var h=a("input.select_checkbox:checked");if(h.length==0){var i=a(this).parent().find("img.filebox_item").attr("src");if(!i){alert("None selected!")}else{e.trigger("filebox.selected",[i]);e.trigger("close.mw")}}else{e.trigger("filebox.selected",[h]);e.trigger("close.mw")}return false});c.find(".pagination").find("a").filter(function(){if(a(this).hasClass("tgAnchor")){return false}return true}).bind("click",function(){var h=a(this).attr("page");a.exec_json("module.getFileBoxListHtml",{page:h},f);a(window).scrollTop(a(b).find(".modalClose").offset().top);return false});a("#FileBoxGoTo").find("button").bind("click",function(){var h=a(this).prev("input").val();a.exec_json("module.getFileBoxListHtml",{page:h},f);a(window).scrollTop(a(b).find(".modalClose").offset().top);return false})}a.exec_json("module.getFileBoxListHtml",{page:"1"},f)})});function showWaitingFogLayer(){var a=jQuery('<span class="bg"></span>');a.height(jQuery(window).height());jQuery(".wfsr").wrap('<div class="wfsr_fog" />').before(a)}function hideWaitingFogLayer(){jQuery(".wfsr").prev("span").remove();jQuery(".wfsr").unwrap()}function doInstallModule(a){var b=new Array();b.module_name=a;exec_xml("install","procInstallAdminInstall",b,completeInstallModule);showWaitingFogLayer()}function doUpdateModule(a){var b=new Array();b.module_name=a;exec_xml("install","procInstallAdminUpdate",b,completeInstallModule);showWaitingFogLayer()}function completeInstallModule(a){alert(a.message);location.reload()}jQuery(document).ready(function(a){a("body").ajaxComplete(function(){hideWaitingFogLayer()})});jQuery(function(a){if(a(".x>.body>.lnb").length==0){a(".x>.body>.content").addClass("single")}});jQuery(function(c){var a=c(".x .dsTg>table>tbody>tr>td.title>p:not(:first-child)");var b=c(".x .dsTg>table>caption>span.side>button.text");a.hide();b.click(function(){a.slideToggle(200);b.toggleClass("details")})});