From fd7dc90dac330f89480668549b0b66c1c7357bf1 Mon Sep 17 00:00:00 2001 From: flyskyko Date: Fri, 26 Oct 2012 05:01:20 +0000 Subject: [PATCH] retouch multilingual git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11908 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/admin/tpl/js/admin.js | 23 ++++++++----- modules/admin/tpl/js/admin.min.js | 56 +++++++++++++++---------------- 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/modules/admin/tpl/js/admin.js b/modules/admin/tpl/js/admin.js index 21edddb8b..75c50fb86 100644 --- a/modules/admin/tpl/js/admin.js +++ b/modules/admin/tpl/js/admin.js @@ -1570,18 +1570,23 @@ jQuery(function($){ }); // load value - $displayInput.val($hiddenInput.val()); - var pattern = /^\$user_lang->/; - if(pattern.test($displayInput.val())){ - function on_complete2(data){ - if(!data || !data.langs) return; + function loadValue(){ + $displayInput.val($hiddenInput.val()); + var pattern = /^\$user_lang->/; + if(pattern.test($displayInput.val())){ + function on_complete2(data){ + if(!data || !data.langs) return; - $displayInput.closest('.g11n').addClass('active'); - $displayInput.val(data.langs[xe.current_lang]).attr('disabled', 'disabled').width(135); + $displayInput.closest('.g11n').addClass('active'); + $displayInput.val(data.langs[xe.current_lang]).attr('disabled', 'disabled').width(135); + } + + $.exec_json('module.getModuleAdminLangCode', {'name': $displayInput.val().replace('$user_lang->', '')}, on_complete2); } - - $.exec_json('module.getModuleAdminLangCode', {'name': $displayInput.val().replace('$user_lang->', '')}, on_complete2); } + + $this.bind('reload-multilingual', loadValue); + loadValue(); } if($('#g11n').length){ diff --git a/modules/admin/tpl/js/admin.min.js b/modules/admin/tpl/js/admin.min.js index 6afedd5d5..bbec744d4 100644 --- a/modules/admin/tpl/js/admin.min.js +++ b/modules/admin/tpl/js/admin.min.js @@ -3,8 +3,8 @@ function doUpdateModule(a){var e=[];e.module_name=a;exec_xml("install","procInst 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 b=a(this),d=a(b.attr("data-toggle"));d.toggle();d.is(":visible")&&!d.find("a,input,button,textarea,select").length?d.attr("tabindex","0").not(":disabled").focus():d.is(":visible")&&d.find("a,input,button,textarea,select").length?d.find("a,input,button,textarea,select").not(":disabled").eq(0).focus(): b.focus();return!1});a(document.body).on("click",".x [data-show]",function(){a(a(this).attr("data-show")).show().attr("tabindex","0").focus();return!1});a(document.body).on("click",".x [data-hide]",function(){var b=a(this);a(b.attr("data-hide")).hide();b.focus();return!1});a.fn.xeTabbable=function(){a(this).each(function(){var b=a(this);b.find(">.x_nav-tabs>li>a").each(function(b){a(this).attr("data-index",b+1)});b.find(">.x_tab-content>.x_tab-pane").each(function(b){a(this).attr("data-index",b+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 b=a(this);b.parent("li").addClass("x_active").siblings().removeClass("x_active");b.closest(".x_nav-tabs").next(".x_tab-content").find(">.x_tab-pane").eq(b.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!1});a.fn.gnb=function(){function b(){e.width("99.99%");setTimeout(function(){e.removeAttr("style");g.height()>e.height()&&e.height(g.height())},100)}var d=a(".x>.xin>.body"),e=d.children("#content.content"),g=d.find(">.gnb"),f=g.find(">ul>li");f.find("a").prepend("");f.each(function(b){a(this).attr("data-index",b+1)});var k=f.find(">ul>li.active_").closest("li.active").attr("data-index");f.find(">ul>li.active_").clone().addClass("active").attr("data-index",k).prependTo("#gnbNav"); -f.find("ul").prev("a").bind("click focus",function(){a(this).parent("li").addClass("open").siblings("li").removeClass("open");d.removeClass("wide");b();return!1});g.find('>a[href="#gnbNav"]').click(function(){a(this).parent(".gnb").toggleClass("open");d.toggleClass("wide");b();return!1});g.prepend('');a(".x .section.collapse>h1>.snToggle").removeClass("x_icon-chevron-up").addClass("x_icon-chevron-down");e.find(">.snToggle").click(function(){var b=a(this),d=b.closest(".section");d.hasClass("collapse")?(d.removeClass("collapse").children("h1:first").siblings().show(),b.removeClass("x_icon-chevron-down").addClass("x_icon-chevron-up")):(d.addClass("collapse").children("h1:first").siblings().hide(), b.removeClass("x_icon-chevron-up").addClass("x_icon-chevron-down"));reflow()});e=a(".x .x_alert");e.prepend('');e.children(".x_close").click(function(){a(this).parent(".x_alert").hide()});a(".x .x_btn").click(function(){if(a(this).hasClass("x_disabled"))return!1});a.fn.vr=function(){this.each(function(){var b=a(this);"|"==b.text()&&b.addClass("vr").filter(":first-child, :last-child").remove()})};a(".x i").vr();a.fn.labelMaker=function(){this.each(function(b){var b= @@ -17,42 +17,42 @@ jQuery(function(a){a.fn.xeModalWindow=function(){this.not(".xe-modal-window").ad a("body").append('
').append(b),b.prepend(d));b.data("anchor",e);d=a.Event("before-open.mw");e.trigger(d);if(d.isDefaultPrevented())return!1;b=a(e.attr("href"));d=e.data("duration")||"fast";b.data("state","showing");a(document).bind("keydown.mw",function(a){if(27==a.which)return e.trigger("close.mw"),!1});b.fadeIn(d,function(){e.trigger("after-open.mw")}).find("button.x_close:first").focus().end().prev(".x_modal-backdrop").show();a("body").css("overflow","hidden")}).bind("close.mw", function(){var e=a(this),b,d;b=a.Event("before-close.mw");e.trigger(b);if(b.isDefaultPrevented())return!1;b=a(e.attr("href"));d=e.data("duration")||"fast";b.data("state","hiding");b.fadeOut(d,function(){e.trigger("after-close.mw")}).prev(".x_modal-backdrop").hide();a("body").css("overflow","auto");e.focus()});a("div.x_modal").addClass("x").hide()};a("a.modalAnchor").xeModalWindow()}); jQuery(function(a){var e=!1;a.fn.xeContentToggler=function(){this.not(".xe-content-toggler").addClass("xe-content-toggler").each(function(){var b=a(this);$layer=a(b.attr("href"));$layer.hide().not(".xe-toggling-content").addClass("xe-toggling-content").mousedown(function(){e=!0}).focusout(function(){setTimeout(function(){!e&&(!$layer.find(":focus").length&&"showing"==$layer.data("state"))&&b.trigger("close.tc");e=!1},1)})}).click(function(){var b=a(this),d;d=a(b.attr("href"));d.data("anchor",b);"showing"== -d.data("state")?b.trigger("close.tc"):b.trigger("open.tc");return!1}).bind("open.tc",function(){function b(){d.trigger("after-open.tc")}var d=a(this),h,g,f;h=a(d.attr("href"));g=d.data("effect");f=d.data("duration")||"fast";h.data("state","showing");d.trigger("before-open.tc");e=!1;a(document).unbind("mousedown.tc keydown.tc").bind("mousedown.tc keydown.tc",function(b){if(b&&("keydown"==b.type&&27!=b.which||"mousedown"==b.type&&(b=a(b.target),b.is("html,.tgAnchor,.tgContent")||h.has(b).length)))return!0; -d.trigger("close.tc");return!1});switch(g){case "slide":h.slideDown(f,b);break;case "slide-h":g=h.css({"overflow-x":"",width:""}).width();h.show().css({"overflow-x":"hidden",width:"0px"}).animate({width:g},f,function(){h.css({"overflow-x":"",width:""});b()});break;case "fade":h.fadeIn(f,b);break;default:h.show(),d.trigger("after-open.tc")}}).bind("close.tc",function(){function b(){d.trigger("after-close.tc")}var d=a(this),e,g,f;a(document).unbind("mousedown.tc keydown.tc");e=a(d.attr("href"));g=d.data("effect"); -f=d.data("duration")||"fast";e.data("state","hiding");d.trigger("before-close.tc");switch(g){case "slide":e.slideUp(f,b);break;case "slide-h":e.animate({width:0},f,function(){e.hide();b()});break;case "fade":e.fadeOut(f,b);break;default:e.hide(),d.trigger("after-close.tc")}});return this};a("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 e,b,d;e=a(this);b=a(e.attr("href")).find(">ul");d=e.prev("input:text").val();a.exec_json("admin.getSiteAllList",{domain:d},function(d){var g=d.site_list,f,k;b.empty();e.closest(".modulefinder").find(".moduleList,.moduleIdList").attr("disabled","disabled");if(d.error||!a.isArray(g))e.trigger("close.tc");else{f=0;for(k=g.length;f< -k;f++)d=a("
  • ").appendTo(b),a('