Files
2023-09-12 21:41:04 +02:00

1 line
7.4 KiB
JavaScript

!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.content=e}return o(t,[{key:"setMode",value:function(t){var e="originalLink";t&&(e="tmEditorLink"),this.content.find(".js-wpml-translate-link").toArray().forEach(function(t){t.href=t.dataset[e]})}}]),t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.ajax=e,this.postId=n}return o(t,[{key:"save",value:function(t,e,n,o){this.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"wpml-tm-editor-mode",mode:t,useTMEditor:e,postId:this.postId,nonce:n},success:function(t){t.success&&o()}})}}]),t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e,n,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$=e,this.dialogId=n,this.content=o,this.maxWidth="95%",this.setupDialog()}return o(t,[{key:"setupDialog",value:function(){this.dialogElement=this.content.find("#"+this.dialogId),this.dialogElement.dialog({autoOpen:!1,resizable:!1,draggable:!1,modal:!0,width:"auto",dialogClass:"wpml-dialog otgs-ui-dialog",closeText:this.dialogElement.data("cancel-text"),closeOnEscape:!0,buttons:this.getButtons()})}},{key:"getButtons",value:function(){return[this.getDefaultCancelButton()]}},{key:"getDefaultCancelButton",value:function(){var t=this;return{class:"button-secondary alignleft "+this.dialogId+"-cancel",text:this.dialogElement.data("cancel-text"),click:function(){return t.onCancel()}}}},{key:"onCancel",value:function(){this.close()}},{key:"open",value:function(){var t=this;this.$(window).on("resize.repositionDialog",function(){return t.repositionDialog()}),this.dialogElement.dialog("open"),this.repositionDialog()}},{key:"close",value:function(){this.$(window).off("resize.repositionDialog"),this.dialogElement.dialog("close")}},{key:"destroy",value:function(){this.dialogElement.dialog("destroy").remove()}},{key:"repositionDialog",value:function(){this.$(".otgs-ui-dialog .ui-dialog-content").css({"max-height":this.$(window).height()-180}),this.$(".otgs-ui-dialog").css({"max-width":this.maxWidth});var t=this.getFullWidthElements();t.length&&this.dialogElement.find(t.join()).css({"max-width":"100%"}),this.setPosition({my:"center",at:"center",of:window})}},{key:"getFullWidthElements",value:function(){return[]}},{key:"setTitle",value:function(t){this.dialogElement.dialog("option","title",t)}},{key:"setMaxWidth",value:function(t){this.maxWidth=t,this.repositionDialog()}},{key:"setPosition",value:function(t){this.dialogElement.dialog("option","position",t)}},{key:"find",value:function(t){return this.dialogElement.find(t)}}]),t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=function(t){return t&&t.__esModule?t:{default:t}}(n(2));var a=function(t){function e(t,n,o,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var a=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,"js-tm-editor-dialog",n));return a.toggle=n.find(".js-toggle-tm-editor"),a.toggle.on("change",function(){return a.open()}),a.dialogElement.on("dialogclose",function(){return a.onClose()}),a.saveSetting=o,a.setLinks=i,a}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,i.default),o(e,[{key:"open",value:function(){this.toggle.prop("checked")?this.setTitle(this.dialogElement.data("tm-editor")):this.setTitle(this.dialogElement.data("wp-editor")),function t(e,n,o){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,n);if(void 0===i){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,n,o)}if("value"in i)return i.value;var r=i.get;return void 0!==r?r.call(o):void 0}(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"open",this).call(this),this.applyingChanges=!1}},{key:"onClose",value:function(){var t=this;this.applyingChanges||(this.toggle.off("change"),this.toggle.prop("checked",!this.toggle.prop("checked")),this.toggle.on("change",function(){return t.open()}))}},{key:"getButtons",value:function(){var t=this;return[this.getDefaultCancelButton(),{class:"button-primary alignright "+this.dialogId+"-ok",text:this.dialogElement.data("apply-text"),click:function(){return t.okApply()}}]}},{key:"okApply",value:function(){var t=this;this.applyingChanges=!0,this.setSaveButtonDisabled(!0),this.saveSetting.save(this.find('input[name="tm-editor-mode"]:checked').val(),this.toggle.prop("checked"),this.dialogElement.data("nonce"),function(){return t.onSaved()})}},{key:"onSaved",value:function(){this.setLinks.setMode(this.toggle.prop("checked")),this.close(),this.setSaveButtonDisabled(!1),this.applyingChanges=!1}},{key:"setSaveButtonDisabled",value:function(t){this.dialogElement.parent(".ui-dialog").find(".button-primary").prop("disabled",t)}}]),e}();e.default=a},function(t,e,n){"use strict";var o=r(n(3)),i=r(n(1)),a=r(n(0));function r(t){return t&&t.__esModule?t:{default:t}}function l(){document.getElementById("post_ID")&&new o.default(jQuery,jQuery("#icl_div"),new i.default(jQuery.ajax,document.getElementById("post_ID").value),new a.default(jQuery("#icl_div")))}document.addEventListener("DOMContentLoaded",function(){return l()}),document.addEventListener("WPMLLanguagesMetaBoxesRefreshed",function(){return l()})},function(t,e,n){t.exports=n(4)}]);