rhymix/modules/admin/tpl/js/admin.min.js
ChanMyeong de06a76bd8 Installed module UI cleaning.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11973 201d5d3c-b55e-5fd7-737f-ddc643e51545
2012-10-30 10:04:37 +00:00

1 line
No EOL
28 KiB
JavaScript

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(function(a){window.scrollTo(0,0);a(".x .skipNav>a").click(function(){a(a(this).attr("href")).attr("tabindex","0").css("outline","0").focus();});a(document.body).on("click",".x [data-toggle]",function(){var f=a(this);var e=a(f.attr("data-toggle"));var g="a,input,button,textarea,select";e.toggle();if(e.is(":visible")&&!e.find(g).length){e.attr("tabindex","0").not(":disabled").focus();}else{if(e.is(":visible")&&e.find(g).length){e.find(g).not(":disabled").eq(0).focus();}else{f.focus();}}return false;});a(document.body).on("click",".x [data-show]",function(){a(a(this).attr("data-show")).show().attr("tabindex","0").focus();return false;});a(document.body).on("click",".x [data-hide]",function(){var e=a(this);a(e.attr("data-hide")).hide();e.focus();return false;});a.fn.xeTabbable=function(){a(this).each(function(){var e=a(this);e.find(">.x_nav-tabs>li>a").each(function(f){a(this).attr("data-index",f+1);});e.find(">.x_tab-content>.x_tab-pane").each(function(f){a(this).attr("data-index",f+1);});});a('.x .x_tab-content>.x_tab-pane:not(".x_active")').hide();};a(".x .x_tabbable").xeTabbable();a(document.body).on("click",'.x .x_nav-tabs>li>a[href*="#"]',function(){var e=a(this);e.parent("li").addClass("x_active").siblings().removeClass("x_active");e.closest(".x_nav-tabs").next(".x_tab-content").find(">.x_tab-pane").eq(e.attr("data-index")-1).addClass("x_active").show().siblings().removeClass("x_active").hide();a(this).parents(".x_tabbable").trigger("tab_change",[parseInt(a(this).attr("data-index"))-1,a(this)]);return false;});a.fn.gnb=function(){var k=a(".x>.xin>.body");var e=k.children("#content.content");var g=k.find(">.gnb");var j=g.find(">ul>li");j.find("a").prepend("<i />");j.each(function(l){a(this).attr("data-index",l+1);});var h=j.find(">ul>li.active_").closest("li.active").attr("data-index");j.find(">ul>li.active_").clone().addClass("active").attr("data-index",h).prependTo("#gnbNav");function f(){e.width("99.99%");setTimeout(function(){e.removeAttr("style");if(g.height()>e.height()){e.height(g.height());}},100);}j.find("ul").prev("a").bind("click focus",function(){var l=a(this);l.parent("li").addClass("open").siblings("li").removeClass("open");k.removeClass("wide");f();return false;});g.find('>a[href="#gnbNav"]').click(function(){a(this).parent(".gnb").toggleClass("open");k.toggleClass("wide");f();return false;});g.prepend('<button type="button" class="close before" />').append('<button type="button" class="close after" />');g.find(">.close").focus(function(){k.addClass("wide");f();});};a(".gnb").gnb();a(".x #lang").mouseleave(function(){a(this).hide();}).focusout(function(){var e=a(this);setTimeout(function(){if(!e.find("a:focus").length){e.mouseleave();}},0);});a('.x th>input[type="checkbox"]').change(function(){var f=a(this),e=f.data("name");f.closest("table").find("input:checkbox").filter(function(){var g=a(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]);});a(document.body).on("click",".x .x_pagination .x_disabled, .x .x_pagination .x_active",function(){return false;});if(a(".section").length>1){var b=a(".x .section").find(">h1:first");b.append('<button type="button" class="snToggle x_icon-chevron-up">Toggle this section</button>');a(".x .section.collapse>h1>.snToggle").removeClass("x_icon-chevron-up").addClass("x_icon-chevron-down");b.find(">.snToggle").click(function(){var f=a(this);var e=f.closest(".section");if(!e.hasClass("collapse")){e.addClass("collapse").children("h1:first").siblings().hide();f.removeClass("x_icon-chevron-up").addClass("x_icon-chevron-down");}else{e.removeClass("collapse").children("h1:first").siblings().show();f.removeClass("x_icon-chevron-down").addClass("x_icon-chevron-up");}reflow();});}var d=a(".x .x_alert");d.prepend('<button type="button" class="x_close">&times;</button>');d.children(".x_close").click(function(){a(this).parent(".x_alert").hide();});a(".x .x_btn").click(function(){if(a(this).hasClass("x_disabled")){return false;}});a.fn.vr=function(){this.each(function(){var e=a(this);if(e.text()=="|"){e.addClass("vr").filter(":first-child, :last-child").remove();}});};a(".x i").vr();a.fn.labelMaker=function(){this.each(function(g){g=g+1;var j=a(this);var f="input, textarea, select";var e=":radio, :checkbox";var k="[id]";var h="i"+g;if(j.next(f).filter(k).not(e).length){j.attr("for",j.next().attr("id"));}else{if(j.next(f).not(k).not(e).length){j.attr("for",h).next().attr("id",h);}else{if(j.prev(e).filter(k).length){j.attr("for",j.prev().attr("id"));}else{if(j.prev(e).not(k).length){j.attr("for",h).prev().attr("id",h);}else{if(j.children(f).filter(k).length){j.attr("for",j.children(f).filter(k).eq(0).attr("id"));}else{if(j.children(f).not(k).length){j.attr("for",h).children(f).not(k).eq(0).attr("id",h);}}}}}}});};a("label:not([for])").labelMaker();a.fn.checkToggle=function(){function e(){a(":checked").parent("label").addClass("checked");a(':not(":checked")').parent("label").removeClass("checked");}this.change(e);e();};a(":radio, :checkbox").checkToggle();a.fn.fileTypeOverlap=function(){this.each(function(){var f=a(this);f.wrap('<span class="fileBtn" />').before('<button type="button">');var e=f.prev("button");e.text(f.attr("title")).addClass(f.attr("class")).removeClass("overlap");f.attr("class","overlap").width(e.width()).height(e.height()).offset(e.offset());});};a('input[type="file"].overlap').fileTypeOverlap();a.fn.xeMask=function(){this.each(function(){var e=a(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(){a(this).next(".cover").mouseover();},function(){a(this).next(".cover").mouseout();}).end().find(">.cover").css({zIndex:2,opacity:0}).hover(function(){a(this).css("opacity",1).prev("span").css("visibility","hidden");},function(){a(this).css("opacity",0).prev("span").css("visibility","visible");}).end();}});};a(".masked").xeMask();a.fn.tableSpan=function(){this.each(function(){var f=a(this);var g=f.find(">thead>tr:eq(0)>th").length;var e=f.find(">tbody>tr:eq(0)>td:only-child");if(g!=e.attr("colspan")){e.attr("colspan",g).css("text-align","center");}});};a("table").tableSpan();});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 g=a(this),d,f,e;d=a(g.attr("href"));if(d.data("state")=="showing"){g.trigger("close.mw");}else{g.trigger("open.mw");}return false;}).bind("open.mw",function(){var j=a(this),e,h,f,d,g;e=a(j.attr("href"));if(!e.parent("body").length){h=a('<button type="button" class="x_close">&times;</button>');h.click(function(){e.data("anchor").trigger("close.mw");});e.find("[data-hide]").click(function(){e.data("anchor").trigger("close.mw");});a("body").append('<div class="x_modal-backdrop"></div>').append(e);e.prepend(h);}e.data("anchor",j);d=a.Event("before-open.mw");j.trigger(d);if(d.isDefaultPrevented()){return false;}e=a(j.attr("href"));g=j.data("duration")||"fast";e.data("state","showing");function k(){j.trigger("after-open.mw");}a(document).bind("keydown.mw",function(l){if(l.which==b){j.trigger("close.mw");return false;}});e.fadeIn(g,k).find("button.x_close:first").focus().end().prev(".x_modal-backdrop").show();a("body").css("overflow","hidden");}).bind("close.mw",function(){var g=a(this),d,e,f;d=a.Event("before-close.mw");g.trigger(d);if(d.isDefaultPrevented()){return false;}e=a(g.attr("href"));f=g.data("duration")||"fast";e.data("state","hiding");function h(){g.trigger("after-close.mw");}e.fadeOut(f,h).prev(".x_modal-backdrop").hide();a("body").css("overflow","auto");g.focus();});a("div.x_modal").addClass("x").hide();};a("a.modalAnchor").xeModalWindow();});jQuery(function(b){var a=false;var d=27;b.fn.xeContentToggler=function(){this.not(".xe-content-toggler").addClass("xe-content-toggler").each(function(){var e=b(this);$layer=b(e.attr("href"));$layer.hide().not(".xe-toggling-content").addClass("xe-toggling-content").mousedown(function(f){a=true;}).focusout(function(f){setTimeout(function(){if(!a&&!$layer.find(":focus").length&&$layer.data("state")=="showing"){e.trigger("close.tc");}a=false;},1);});}).click(function(){var f=b(this),e;e=b(f.attr("href"));e.data("anchor",f);if(e.data("state")=="showing"){f.trigger("close.tc");}else{f.trigger("open.tc");}return false;}).bind("open.tc",function(){var j=b(this),f,g,h;f=b(j.attr("href"));g=j.data("effect");h=j.data("duration")||"fast";f.data("state","showing");j.trigger("before-open.tc");a=false;b(document).unbind("mousedown.tc keydown.tc").bind("mousedown.tc keydown.tc",function(l){if(l){if(l.type=="keydown"&&l.which!=d){return true;}if(l.type=="mousedown"){var m=b(l.target);if(m.is("html,.tgAnchor,.tgContent")||f.has(m).length){return true;}}}j.trigger("close.tc");return false;});function k(){j.trigger("after-open.tc");}switch(g){case"slide":f.slideDown(h,k);break;case"slide-h":var e=f.css({"overflow-x":"",width:""}).width();f.show().css({"overflow-x":"hidden",width:"0px"}).animate({width:e},h,function(){f.css({"overflow-x":"",width:""});k();});break;case"fade":f.fadeIn(h,k);break;default:f.show();j.trigger("after-open.tc");}}).bind("close.tc",function(){var h=b(this),e,f,g;b(document).unbind("mousedown.tc keydown.tc");e=b(h.attr("href"));f=h.data("effect");g=h.data("duration")||"fast";e.data("state","hiding");h.trigger("before-close.tc");function j(){h.trigger("after-close.tc");}switch(f){case"slide":e.slideUp(g,j);break;case"slide-h":e.animate({width:0},g,function(){e.hide();j();});break;case"fade":e.fadeOut(g,j);break;default:e.hide();h.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 d,b,e;d=a(this);b=a(d.attr("href")).find(">ul");e=d.prev("input:text").val();function f(j){var l,h=j.site_list,g,k;b.empty();d.closest(".modulefinder").find(".moduleList,.moduleIdList").attr("disabled","disabled");if(j.error||!a.isArray(h)){d.trigger("close.tc");return;}for(g=0,k=h.length;g<k;g++){l=a("<li />").appendTo(b);a('<button type="button" />').text(h[g].domain).data("site_srl",h[g].site_srl).appendTo(l);}}a.exec_json("admin.getSiteAllList",{domain:e},f);}).end().find(".tgContent.suggestion").delegate("button","click",function(){var d,b;d=a(this);b=d.closest(".modulefinder");function e(j){var g,h=j.module_list,f;if(j.error||!h){return;}g=b.find(".moduleList").data("module_list",h).removeAttr("disabled").empty();for(f in h){if(!h.hasOwnProperty(f)){continue;}a("<option />").attr("value",f).text(h[f].title).appendTo(g);}g.prop("selectedIndex",0).change().focus();if(!g.is(":visible")){g.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:d.data("site_srl")},e);}).end().find(".moduleList,.moduleIdList").hide().end().find(".moduleList").change(function(){var f,d,g,e;f=a(this);g=f.val();e=f.data("module_list");if(!e[g]){return;}e=e[g].list;d=f.closest(".modulefinder").find(".moduleIdList").removeAttr("disabled").empty();for(var b in e){if(!e.hasOwnProperty(b)){continue;}a("<option />").attr("value",e[b].module_srl).text(e[b].browser_title).appendTo(d);}d.prop("selectedIndex",0).change();});return this;};a(".modulefinder").xeModuleFinder();});jQuery(function(b){var a=0;_xeModuleSearch=function(){var e=this;var g=b(this);var d=g.data("multiple");if(!d){d="";}var f="__module_searcher_"+a;a++;b.exec_json("module.getModuleAdminModuleSearcherHtml",{id:f,is_multiple:d},function(p){if(!p||!p.html){return;}g.after(p.html).addClass("tgAnchor").attr("href","#"+f).xeContentToggler();var k=g.next(".moduleWindow");var m=k.find(".siteList");var h=k.find(".moduleList");var t=k.find(".instanceList");var u=m.find(">ul");var j=h.find(">ul");var l=t.find(">select");var n=k.find("input.siteFinder");var r;var s=280;function o(y,w){var x,v;y.find("li div").width("");y.css("height","auto");y.css("overflow-y","");if(y.height()>w){v=y.find("li div");v.width(v.width()-20+"px");y.css("height",w+"px");y.css("overflow-y","auto");}}function q(y){var v;var w=new RegExp(y,"ig");var x=r;u.empty();for(i=0,c=x.length;i<c;i++){v=x[i].domain;if(y){if(!v.match(w)){continue;}v=v.replace(w,function(z){return'<span class="highlight">'+z+"</span>";});}$li=b("<li />").appendTo(u);b("<a>").attr("href","#").html(v).data("site_srl",x[i].site_srl).appendTo($li);}o(u,s-n.parent("div").height());}n.keyup(function(){q(n.val());});if(typeof console=="undefined"){console={log:function(){}};}g.not(".xe-module-search").addClass("xe-module-search").parent().find("a.moduleTrigger").bind("before-open.tc",function(){var v;v=b(this);function w(z){var B,y=z.site_list,x,A;if(z.error||!b.isArray(y)){v.trigger("close.tc");return;}r=y;q(n.val());n.focus();}u.empty();l.empty();h.hide();t.hide();b.exec_json("admin.getSiteAllList",{domain:""},w);});k.find(".siteList>ul").delegate("a","click",function(w){var x,v;x=b(this);v=x.closest(".moduleSearch");function y(B){var A=B.module_list,z;if(B.error||!A){return;}for(z in A){if(!A.hasOwnProperty(z)){continue;}$li=b("<li />").appendTo(j);b("<a>").attr("href","#").html(A[z].title).data("moduleInstanceList",A[z].list).appendTo($li);}k.find(".moduleList").show();o(j,s);u.find("li").removeClass("x_active");x.parent("li").addClass("x_active");}j.empty();t.hide();b.exec_json("module.procModuleAdminGetList",{site_srl:x.data("site_srl")},y);w.preventDefault();}).end().find(".moduleList>ul").delegate("a","click",function(w){var A,y,B,z;A=b(this);z=A.data("moduleInstanceList");if(!z){return;}e.sSelectedModuleType=A.text();l.empty();for(var v in z){if(!z.hasOwnProperty(v)){continue;}$li=b("<option />").html(z[v].browser_title+" ("+z[v].mid+")").appendTo(l).val(z[v].module_srl).data("mid",z[v].mid).data("module_srl",z[v].module_srl).data("layout_srl",z[v].layout_srl).data("browser_title",z[v].browser_title);}t.show();o(l,s);j.find("li").removeClass("x_active");A.parent("li").addClass("x_active");w.preventDefault();}).end().find(".moduleSearch_ok").click(function(v){var w=[];l.find("option:selected").each(function(){w.push({type:e.sSelectedModuleType,module_srl:b(this).data("module_srl"),layout_srl:b(this).data("layout_srl"),browser_title:b(this).data("browser_title"),mid:b(this).data("mid")});});g.trigger("moduleSelect",[w]);b("a.moduleTrigger").trigger("close.tc");v.preventDefault();});});return this;};b.fn.xeModuleSearch=function(){b(this).each(_xeModuleSearch);};b(".moduleTrigger").xeModuleSearch();b.fn.xeModuleSearchHtml=function(){var d=0;b(this).each(function(){var f=b(this);var h=f.attr("id");if(!h){h="__module_search_"+d;}d++;var e=b('<a class="x_btn moduleTrigger">'+xe.cmd_find+"</a>");var g=b('<input type="text" readonly>');f.after(e).after("&nbsp;").after(g).hide();e.xeModuleSearch();e.bind("moduleSelect",function(k,j){g.val(j[0].browser_title+" ("+j[0].mid+")");f.val(j[0].module_srl);});if(f.val()){b.exec_json("module.getModuleAdminModuleInfo",{module_srl:f.val()},function(j){if(!j||!j.module_info){return;}g.val(j.module_info.browser_title+" ("+j.module_info.mid+")");});}});return this;};b(".module_search").xeModuleSearchHtml();});jQuery(function(d){var b=false,a=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=getOffset(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(u,t){n+=t-1;});a.find("td").attr("colspan",n);g=[];q.find("tbody>tr:not([target],.sticky,:hidden)").each(function(){var t=d(this),u;u=getOffset(this,p);g.push({top:u.top,bottom:u.top+t.height(),$item:t});});$clone.addClass("draggable").css({position:"absolute",opacity:0.6,width:f,height:r,left:h.left,top:h.top,zIndex:100});a.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";a.css("top",y.top-5);}else{o.state="after";a.css("top",y.bottom-5);}}$clone.css({top:u});}).bind("mouseup.st",function(t){var u;b=false;d(document).unbind("mousemove.st mouseup.st");l.removeAttr("target").css("opacity","");$clone.remove();a.remove();if(!o){return;}u=d(o.element);u[o.state](l);q.trigger("after-drag.st");});});return this;};d("table.sortable").xeSortableTable();});jQuery(function(e){e(".filebox").bind("before-open.mw",function(){var k,h,j;var g;k=e(this);g=k.attr("href");h=e(g).find(".filebox_list");function l(m){h.html(m.html);h.find(".select").bind("click",function(p){var n=e("input.select_checkbox:checked");if(n.length==0){var o=e(this).closest("tr").find("img.filebox_item").attr("src");if(!o){alert("None selected!");}else{k.trigger("filebox.selected",[o]);k.trigger("close.mw");}}else{k.trigger("filebox.selected",[n]);k.trigger("close.mw");}return false;});h.find(".x_pagination").find("a").filter(function(){if(e(this).data("toggle")){return false;}if(e(this).parent().hasClass("x_disabled")){return false;}if(e(this).parent().hasClass("x_active")){return false;}return true;}).bind("click",function(){var n=e(this).attr("page");e.exec_json("module.getFileBoxListHtml",{page:n},l);return false;});e("#goToFileBox").find("button").bind("click",function(){var n=e(this).prev("input").val();e.exec_json("module.getFileBoxListHtml",{page:n},l);return false;});h.closest(".x_modal-body").scrollTop(0);}e.exec_json("module.getFileBoxListHtml",{page:"1"},l);});var f=e(".x .dsTg .__simple");var d=e(".x .dsTg .__detail");var a=e(".x .dsTg td.title");a.each(function(){var g=e(this);if(g.find("p.x_alert").length==0){g.addClass("tg").find(">*:not(:first-child)").hide();}});var b=e(".x .dsTg td.tg>*:not(:first-child)");f.click(function(){b.slideUp(200);d.removeClass("x_active");f.addClass("x_active");});d.click(function(){b.slideDown(200);d.addClass("x_active");f.removeClass("x_active");});});jQuery(function(a){a.fn.xeMultilingualWindow=function(s){var j=a(this);var k=j.find("#lang_create");var d=j.find("#lang_search");var b=false;s=a.extend({create_type:"save_and_use",modify_type:"save_and_use",view_use:true,view_modify:true,view_delete:false,list_count:5},s||{});if(s.create_type!="save_and_use"){k.find(".save-useit").text(xe.cmd_save);}function m(){if(k.is(":visible")&&b){if(confirm(xe.msg_confirm_save_and_use_multilingual)){k.find(".save-useit").trigger("click");}}return true;}function q(){if(d.is(":visible")&&d.find(".editMode").length){var t=d.find(".editMode");if(confirm(xe.msg_confirm_save_and_use_multilingual)){t.find(".save").trigger("click");}else{t.find(".cancel").trigger("click");}}return true;}function f(){d.find(".item > fieldset").hide().prev("a").children("i").removeClass("x_icon-chevrom-up").addClass("x_icon-chevron-down");j.find('[href="#lang_create"]').trigger("click");k.find(".editMode").children("textarea").val("");b=false;return true;}function p(t){if(!t){l(1,"","",false);}else{l(1,"",t,false);j.find('[href="#lang_search"]').trigger("click");}}function e(){if(!m()){return false;}if(!q()){return false;}if(!f()){return false;}}function o(u,v){var t=j.data("lang-target");b=false;if(t){t.trigger("selected.g11n",[u,v]);}}function l(w,v,u,t){if(typeof w=="undefined"){w=1;}if(typeof v=="undefined"){v="";}if(typeof u=="undefined"){u="";}if(typeof t=="undefined"){t=true;}a.exec_json("module.getModuleAdminLangListHtml",{page:w,search_keyword:v,name:u,list_count:s.list_count},function(x){if(!x||!x.html){return;}d.html(x.html);g();h();n();r();if(t){document.location.href="#lang_search";}if(u){a("#lang_search").find('[href^="#lang-"]').trigger("click");}});}function g(){d.find(".x_pagination a").click(function(){var u=a(this).data("page");var t=a(this).data("search_keyword");if(!u){return;}l(u,t);return false;});d.find(".x_pagination").submit(function(){var u=a(this).find('[name="page"]').val();var t=a(this).data("search_keyword");if(!u){return false;}l(u,t);return false;});}function h(){d.find(".search").submit(function(){var t=a(this).find('[name="search_keyword"]').val();l(1,t);return false;});d.find("#search_cancel").click(function(){l(1,"");});}function n(){d.find(".set").append('<i class="x_icon-chevron-down"></i>').click(function(){var v=a(this);var u=v.data("lang_code");q();var t="x_icon-chevron-up";var x="x_icon-chevron-down";if(v.next("fieldset").is(":visible")){v.children("i").removeClass(t).addClass(x);}else{v.parent(".item").siblings(".item").find("a > i").removeClass(t).addClass(x).end().children("fieldset").hide();v.children("i").removeClass(x).addClass(t);}if(typeof v.data("is_loaded")!="undefined"){return;}a.exec_json("module.getModuleAdminLangCode",{name:u},w);function w(y){var z=v.next("fieldset").find("textarea");z.each(function(){var C=a(this);var B=y.langs[C.data("lang")];var A=/^\$user_lang->/;if(A.test(B)){C.val("").data("value","");}else{C.val(B).data("value",B);}});v.data("is_loaded",true);}});}function r(){if(!s.view_use){d.find(".useit").hide();}if(!s.view_modify){d.find(".modify").hide();}if(!s.view_delete){d.find(".delete").hide();}if(s.modify_type=="save"){d.find(".save").text(xe.cmd_save);}d.find(".modify").click(function(){a(this).closest("fieldset").addClass("editMode").find("textarea").removeAttr("disabled");a(this).siblings(".cancel").prependTo(a(this).parent());a(this).siblings(".delete").attr("disabled","disabled");});d.find(".cancel").click(function(){a(this).closest("fieldset").removeClass("editMode").find("textarea").attr("disabled","disabled").each(function(){var t=a(this);t.val(t.data("value"));});a(this).siblings(".modify").prependTo(a(this).parent());a(this).siblings(".delete").removeAttr("disabled");return false;});d.find(".delete").click(function(){if(!confirm(xe.confirm_delete)){return;}var t=a(this);lang_name=t.closest(".item").find('[href^="#lang-"]').data("lang_code");a.exec_json("module.procModuleAdminDeleteLang",{name:lang_name},function(x){if(!x){return;}if(x.error){alert(x.message);return;}var u=d.find(".x_pagination");var w=u.data("page");var v=u.data("search_keyword");if(!w){$page=1;}l(w,v);});});d.find(".item").submit(function(){var w=a(this);var v=w.find(".editMode").children("textarea");var u=w.find('[href^="#lang-"]');var x={};var t=null;v.each(function(){var y=a(this);x[y.attr("class")]=y.val();y.data("tmp_value",y.val());if(xe.current_lang==y.attr("class")){t=y.val();}});x.lang_name=u.data("lang_code");a.exec_json("module.procModuleAdminInsertLang",x,function(y){if(!y||y.error||!y.name){return;}v.each(function(){var z=a(this);z.data("value",z.data("tmp_value"));});u.children("span").html(t);d.find(".cancel").trigger("click");w.find(".useit").trigger("click");});return false;});d.find(".useit").click(function(){var w=a(this);var u=w.closest(".item").find('[href^="#lang-"]');var t=u.data("lang_code");var v=u.children("span").text();o(t,v);});}j.find(".x_tabbable").xeTabbable();k.find(".editMode textarea").change(function(){b=true;});k.submit(function(){var u=a(this);var v={};var t=null;u.find(".editMode").children("textarea").each(function(){var x=a(this);v[x.attr("class")]=x.val();if(xe.current_lang==x.attr("class")){t=x.val();}});if(!t){alert(xe.msg_empty_multilingual);return false;}a.exec_json("module.procModuleAdminInsertLang",v,w);function w(x){if(!x||x.error||!x.name){return;}if(s.create_type=="save_and_use"){o(x.name,t);}else{alert(x.message);f();}}return false;});j.find('[href="#lang_search"]').click(function(){l();});j.bind("reset.g11n",function(){f();});j.bind("before-open.g11n",function(u,t){p(t);});j.bind("before-close.g11n",function(){return e();});return this;};});var is_loaded_multilingual_window_html=false;jQuery(function(a){a.fn.xeLoadMultilingualWindowHtml=function(){function b(e){var d=a(".x #content");a(e.html).appendTo(d).xeMultilingualWindow();a(".lang_code").trigger("loaded-multilingualWindow");}a.exec_json("module.getModuleAdminMultilingualHtml",{},b);return this;};});var multilingual_id_count=0;jQuery(function(a){a.fn.xeApplyMultilingualUI=function(){a(this).each(function(){if(!is_loaded_multilingual_window_html){a().xeLoadMultilingualWindowHtml();is_loaded_multilingual_window_html=true;}var e=a(this);var d=this;if(e.parent().hasClass("g11n")){e.siblings().remove();}else{e.wrap("<span></span>");}var f=e.attr("id");if(!f){f="__lang_code_"+multilingual_id_count;multilingual_id_count++;e.attr("id",f);}function b(){var l=a("#g11n");var j=e.width()-44;if(d.tagName=="TEXTAREA"||e.data("type")=="textarea"){var n=a('<textarea id="lang_'+f+'" class="displayInput" style="width:'+j+'px">').data("lang-id",f);}else{var n=a('<input type="text" id="lang_'+f+'" class="displayInput" style="width:'+j+'px">').data("lang-id",f);}var h=a('<button type="button" class="x_add-on remover" title="'+xe.cmd_remove_multilingual_text+'"><i class="x_icon-remove"></i>'+xe.cmd_remove_multilingual_text+"</button>").data("lang-target",f);var g=a('<a href="#g11n" class="x_add-on modalAnchor" title="'+xe.cmd_set_multilingual_text+'"><i class="x_icon-globe"></i>'+xe.cmd_set_multilingual_text+"</a>").data("lang-target",f);e.parent().addClass("g11n").addClass("x_input-append");e.after(n,h,g);e.hide();g.attr("href","#g11n").xeModalWindow();n.bind("selected.g11n",function(r,p,q){var o=n.width();if(!a(this).parent().hasClass("active")){o-=44;}n.width(o).attr("disabled","disabled").val(q).parent(".g11n").addClass("active");n.siblings("#"+n.data("lang-id")).val("$user_lang->"+p);g.trigger("close.mw");});g.bind("open.mw",function(){var o=a(this);var p=o.siblings(".displayInput");if(o.closest(".g11n").hasClass("active")){l.trigger("before-open.g11n",p.prev(".lang_code").val().replace("$user_lang->",""));}else{l.trigger("before-open.g11n");}l.data("lang-target",p);});g.bind("before-close.mw",function(){return l.trigger("before-close.g11n");});h.click(function(){var q=a(this);if(!q.closest(".g11n").hasClass("active")){return;}var o=a("#lang_"+q.data("lang-target"));var p=o.width();o.val("").removeAttr("disabled").width(p+44).parent(".g11n").removeClass("active");q.siblings(".lang_code").val("");});var m=e;n.bind("change keyup",function(){e=a(this);if(e.closest(".g11n").hasClass("active")){return;}m.val(e.val());});function k(){var p=m.val();h.trigger("click");m.val(p);n.val(p);var o=/^\$user_lang->/;if(o.test(n.val())){function q(s){if(!s||!s.langs){return;}var r=n.width();n.closest(".g11n").addClass("active");n.val(s.langs[xe.current_lang]).attr("disabled","disabled").width(r-44);}a.exec_json("module.getModuleAdminLangCode",{name:n.val().replace("$user_lang->","")},q);}}e.bind("reload-multilingual",k);k();}if(a("#g11n").length){b();}else{e.bind("loaded-multilingualWindow",b);}});return this;};a('.vLang[type="hidden"]').each(function(){var b=a(this);if(b.next("textarea.vLang").length){b.data("type","textarea");}b.removeClass("vLang").addClass("lang_code");b.parent().find(".editUserLang").remove().end().find(".vLang").remove();});a(".lang_code").xeApplyMultilingualUI();});function getOffset(b,a){var e=0,d=0;while(b&&b!=a){e+=b.offsetTop;d+=b.offsetLeft;b=b.offsetParent;}return{top:e,left:d};}