mirror of
https://github.com/WenPai-org/wp-china-yes.git
synced 2025-08-08 06:56:08 +08:00
1 line
No EOL
1.9 KiB
JavaScript
1 line
No EOL
1.9 KiB
JavaScript
!function(t,e,c){var i,n,a,l,o,r,u,s=t.locoScope,f=e.getElementById("loco-fs"),d=e.getElementById("loco-poinit"),v=f&&s.fs.init(f),g=(a=(n=d)["select-locale"],l=n["custom-locale"],o=n["use-selector"],r=c(a).focus(p).closest("fieldset").click(p)[0],u=c(l).focus(x).closest("fieldset").click(x)[0],c(o).change(m),m(),s.watchtext(l,function(t){c(l.form).triggerHandler("change")}),{val:function(){var t=b();return t?s.locale.parse(t):s.locale.clone({lang:"zxx"})}});function h(){return o[0].checked}function p(){y(o[0].checked=!0)}function x(){l.value||(l.value=b()),y(!(o[1].checked=!0))}function b(){var t=c(h()?a:l).serializeArray();return t[0]&&t[0].value||""}function m(){return y(h()),!0}function y(t){l.disabled=t,a.disabled=!t,u.className=t?"disabled":"active",r.className=t?"active":"disabled",I()}var z,A=(z=d["select-path"],{val:function(){var t=k("path");return t&&t.value},txt:function(){var t=k("path");return t&&c(t.parentNode).find("code.path").text()}});function k(t){var e=function(){var t=c(z).serializeArray()[0];return t&&t.value||null}();return e&&d[t+"["+e+"]"]}function w(n){c(d).find("button.button-primary").each(function(t,e){e.disabled=n})}function I(){var t=g&&g.val(),e=t&&t.isValid()&&"zxx"!==t.lang,n=A&&A.val(),a=e&&n;if(j(t),w(!0),a){var c=A.txt();c!==i?(i=c,f.path.value=i,v.listen(N).connect()):w(!1)}}function N(t){w(!t)}function j(n){var t=c(d),e=n&&n.toString("_")||"",a=e?"zxx"===e?"<locale>":e:"<invalid>";t.find("code.path span").each(function(t,e){e.textContent=a}),t.find("span.lang").each(function(t,e){!function(t,e){e&&"zxx"!==e.lang?(t.setAttribute("lang",e.lang),t.setAttribute("class",e.getIcon())):(t.setAttribute("lang",""),t.setAttribute("class","lang nolang"))}(e,n)})}function B(t){var e=t&&t.redirect;e&&location.assign(e)}c(d).change(I).submit(function(t){return t.preventDefault(),v.applyCreds(d),s.ajax.submit(t.target,B),!1}),j(g.val())}(window,document,jQuery); |