1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
|
!function(e){var t={};function o(a){if(t[a])return t[a].exports;var l=t[a]={i:a,l:!1,exports:{}};return e[a].call(l.exports,l,l.exports,o),l.l=!0,l.exports}o.m=e,o.c=t,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)o.d(a,l,function(t){return e[t]}.bind(null,l));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/dist/",o(o.s=4)}([,function(e,t){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),o=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var a=arguments[1],l=0;l<o;){var n=t[l];if(e.call(a,n,l,t))return n;l++}},configurable:!0,writable:!0})},function(e,t){Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if("Function"!=typeof e&&"function"!=typeof e||!this)throw new TypeError;var o=this.length>>>0,a=new Array(o),l=this,n=0,r=-1;if(void 0===t)for(;++r!==o;)r in this&&e(l[r],r,l)&&(a[n++]=l[r]);else for(;++r!==o;)r in this&&e.call(t,l[r],r,l)&&(a[n++]=l[r]);return a.length=n,a})},,function(e,t,o){"use strict";o.r(t);var a=function(){const e=jQuery;let t;const o=()=>{let o=e("#original_language").val();e("#original_language").on("change",(function(a){const l=o,n=o;o=a.target.value,t[0].selectize.removeOption(o);const r=weglot_languages.available.find(e=>e.internal_code===n),s=weglot_languages.available.find(e=>e.internal_code===o);t[0].selectize.addOption(r);const i=e("#is_fullname").is(":checked");let g="";e("#with_name").is(":checked")&&(g=i?s.local:s.internal_code.toUpperCase()),e(".wgcurrent.wg-li").removeClass(l).addClass(o).attr("data-code-language",o).find("span").text(g)})),t=e(".weglot-select-destination").selectize({delimiter:"|",persist:!1,valueField:"internal_code",labelField:"local",searchField:["internal_code","english","local"],sortField:[{field:"english",direction:"asc"}],maxItems:weglot_languages.limit,plugins:["remove_button"],options:weglot_languages.available.filter(t=>t.internal_code!==e("#original_language").val()),render:{option:function(e,t){return`<div class="weglot__choice__language"><span class="weglot__choice__language--english">${t(e.english)}</span><span class="weglot__choice__language--local">${t(e.local)}[${t(e.external_code)}]</span></div>`}}}).on("change",o=>{const a=t[0].selectize.getValue(),l=e("#li-button-tpl");if(0===l.length)return;const n=e("#is_fullname").is(":checked"),r=e("#with_name").is(":checked"),s=e("#with_flags").is(":checked");let i="";s&&(i="weglot-flags");let g="";var c=e("label.weglot-flags").attr("class").split(/\s+/);e.each(c,(function(e,t){if(1==t.includes("flag-"))return i+=" "+t,!1})),a.forEach(e=>{const t=weglot_languages.available.find(t=>t.internal_code===e);let o="";r&&(o=n?t.local:e.toUpperCase()),g+=l.html().replace("{LABEL_LANGUAGE}",o).replace(new RegExp("{CODE_LANGUAGE}","g"),e).replace("{CLASSES}",i)}),e(".country-selector ul").html(g)}),window.addEventListener("weglotCheckApi",e=>{t[0].selectize.settings.maxItems=weglot_languages.limit})};document.addEventListener("DOMContentLoaded",()=>{o()})};var l=function(){const e=jQuery,t=()=>{e("#weglot-box-first-settings .weglot-btn-close").on("click",(function(t){t.preventDefault(),e("#weglot-box-first-settings").hide()})),e('a[href*="#"]').not('[href="#"]').not('[href="#0"]').click((function(t){var o=e(this.hash);(o=o.length?o:e("[name="+this.hash.slice(1)+"]")).length&&(t.preventDefault(),e("html, body").animate({scrollTop:o.offset().top},1e3,(
|