🔥 HOT: Changeset/ - High Quality

Changeset 3384222


Ignore:
Timestamp:
10/24/2025 08:12:07 PM (2 months ago)
Author:
mihdan
Message:

Update to version 6.5.0 from GitHub

Location:
cyr2lat
Files:
4 added
30 edited
1 copied

Legend:

Unmodified
Added
Removed
  • cyr2lat/tags/6.5.0/assets/js/acf-field-group.min.js

    r2882726 r3384222  
    1 !function(e,n,a){"use strict";var r=CyrToLatAcfFieldGroup.table,c=function(n){return e.each(r,(function(e,a){var r=new RegExp(e,"g");n=n.replace(r,a)})),n=(n=(n=(n=n.replace(/[^\w\d\-_]/g,"")).replace(/_+/g,"_")).replace(/^_?(.*)$/g,"$1")).replace(/^(.*)_$/g,"$1")};acf.addFilter("generate_field_object_name",(function(e){return c(e)})),e(a).on("change",".acf-field .field-name",(function(){if(e(this).is(":focus"))return!1;var n=e(this),a=n.val();(a=c(a))!==n.val()&&n.val(a)}))}(window.jQuery,window,document);
     1!function(e,n,a){"use strict";var r=CyrToLatAcfFieldGroup.table,c=function(n){return e.each(r,function(e,a){var r=new RegExp(e,"g");n=n.replace(r,a)}),n=(n=(n=(n=n.replace(/[^\w\d\-_]/g,"")).replace(/_+/g,"_")).replace(/^_?(.*)$/g,"$1")).replace(/^(.*)_$/g,"$1")};acf.addFilter("generate_field_object_name",function(e){return c(e)}),e(a).on("change",".acf-field .field-name",function(){if(e(this).is(":focus"))return!1;var n=e(this),a=n.val();(a=c(a))!==n.val()&&n.val(a)})}(window.jQuery,window,document);
  • cyr2lat/tags/6.5.0/assets/js/apps/converter.js

    r3188005 r3384222  
    1 (()=>{"use strict";function t(o){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(o)}function o(t,o){for(var e=0;e<o.length;e++){var i=o[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(o){var n=function(o,n){if("object"!=t(o)||!o)return o;var e=o[Symbol.toPrimitive];if(void 0!==e){var i=e.call(o,n||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(o)}(o,"string");return"symbol"==t(n)?n:n+""}const e=function(){return t=function t(){!function(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}(this,t),this.CONVERT_FORM_SELECTOR="#ctl-convert-existing-slugs",this.CONVERT_BUTTON_SELECTOR="#ctl-convert-button",this.CONFIRM_POPUP_SELECTOR="#ctl-confirm-popup",this.CONFIRM_OK_SELECTOR="#ctl-confirm-ok",this.CONFIRM_CANCEL_SELECTOR="#ctl-confirm-cancel",this.confirmPopup=document.querySelector(this.CONFIRM_POPUP_SELECTOR),this.bindEvents()},(n=[{key:"bindEvents",value:function(){var t=this;document.querySelector(this.CONVERT_BUTTON_SELECTOR).onclick=function(o){return o.preventDefault(),t.confirmPopup.style.display="block",!1},this.confirmPopup.onclick=function(){t.hideConfirmPopup()},document.querySelector(this.CONFIRM_OK_SELECTOR).onclick=function(o){o.stopPropagation(),t.hideConfirmPopup(),document.querySelector(t.CONVERT_FORM_SELECTOR).submit()},document.querySelector(this.CONFIRM_CANCEL_SELECTOR).onclick=function(o){o.stopPropagation(),t.hideConfirmPopup()}}},{key:"hideConfirmPopup",value:function(){this.confirmPopup.style.display="none"}}])&&o(t.prototype,n),e&&o(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,e}();document.addEventListener("DOMContentLoaded",(function(){new e}))})();
     1(()=>{"use strict";function t(o){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(o)}function o(t,o){for(var e=0;e<o.length;e++){var i=o[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(o){var n=function(o,n){if("object"!=t(o)||!o)return o;var e=o[Symbol.toPrimitive];if(void 0!==e){var i=e.call(o,n||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(o)}(o,"string");return"symbol"==t(n)?n:n+""}const e=function(){return t=function t(){!function(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}(this,t),this.CONVERT_FORM_SELECTOR="#ctl-convert-existing-slugs",this.CONVERT_BUTTON_SELECTOR="#ctl-convert-button",this.CONFIRM_POPUP_SELECTOR="#ctl-confirm-popup",this.CONFIRM_OK_SELECTOR="#ctl-confirm-ok",this.CONFIRM_CANCEL_SELECTOR="#ctl-confirm-cancel",this.confirmPopup=document.querySelector(this.CONFIRM_POPUP_SELECTOR),this.bindEvents()},(n=[{key:"bindEvents",value:function(){var t=this;document.querySelector(this.CONVERT_BUTTON_SELECTOR).onclick=function(o){return o.preventDefault(),t.confirmPopup.style.display="block",!1},this.confirmPopup.onclick=function(){t.hideConfirmPopup()},document.querySelector(this.CONFIRM_OK_SELECTOR).onclick=function(o){o.stopPropagation(),t.hideConfirmPopup(),document.querySelector(t.CONVERT_FORM_SELECTOR).submit()},document.querySelector(this.CONFIRM_CANCEL_SELECTOR).onclick=function(o){o.stopPropagation(),t.hideConfirmPopup()}}},{key:"hideConfirmPopup",value:function(){this.confirmPopup.style.display="none"}}])&&o(t.prototype,n),e&&o(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,e}();document.addEventListener("DOMContentLoaded",function(){new e})})();
  • cyr2lat/tags/6.5.0/assets/js/apps/tables.js

    r3211834 r3384222  
    1 (()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(t){var i=function(t,i){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,i||"default");if("object"!=e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==e(i)?i:i+""}var s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.OPTIONS_FORM_SELECTOR="#ctl-options",this.HEADER_SELECTOR=this.OPTIONS_FORM_SELECTOR+" h2",this.TABLE_SELECTOR=this.OPTIONS_FORM_SELECTOR+" table",this.SUBMIT_SELECTOR=this.OPTIONS_FORM_SELECTOR+" #submit",this.CURRENT_STUB_ID="ctl-current",this.CURRENT_NAV_TAB_CLASS="nav-tab-current",this.ACTIVE_NAV_TAB_CLASS="nav-tab-active",this.ACTIVE_TABLE_CLASS="active",this.EDIT_LABEL_ID="ctl-edit-label",this.EDIT_LABEL_ERROR_CLASS="ctl-edit-label-error",this.plusButton='<button type="button" aria-haspopup="true" aria-expanded="false" class="components-button block-editor-inserter__toggle has-icon" aria-label="Добавить блок"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" role="img" aria-hidden="true" focusable="false"><path d="M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6zM10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"></path></svg></button>',this.PLUS_CLASS="ctl-plus",this.optionsForm=document.querySelector(this.OPTIONS_FORM_SELECTOR),this.tablesData=this.getTablesData(),this.submitButton=document.querySelector(this.SUBMIT_SELECTOR),this.addWrapper(),this.addMessageLines(),this.moveTabs(),this.addEditLabelInput(),this.hideTables(),this.bindEvents(),this.setSubmitStatus(),this.checkLocale()},i=[{key:"getHeaders",value:function(){return t(document.querySelectorAll(this.HEADER_SELECTOR))}},{key:"getActiveHeader",value:function(){return document.querySelector(this.HEADER_SELECTOR+"."+this.ACTIVE_NAV_TAB_CLASS)}},{key:"getActiveIndex",value:function(){return this.getActiveHeader().dataset.index}},{key:"getTables",value:function(){return t(document.querySelectorAll(this.TABLE_SELECTOR))}},{key:"getActiveTable",value:function(){return document.querySelector(this.TABLE_SELECTOR+"."+this.ACTIVE_TABLE_CLASS)}},{key:"getInputs",value:function(){return t(document.querySelectorAll(this.OPTIONS_FORM_SELECTOR+" input"))}},{key:"getLabels",value:function(){return t(document.querySelectorAll(this.OPTIONS_FORM_SELECTOR+" label"))}},{key:"getPlusButtons",value:function(){return t(document.querySelectorAll(this.OPTIONS_FORM_SELECTOR+" ."+this.PLUS_CLASS))}},{key:"isActiveTableChanged",value:function(){var e=this.getActiveIndex();return JSON.stringify(this.getActiveTableData())!==JSON.stringify(this.tablesData[e])}},{key:"setSubmitStatus",value:function(){this.submitButton.disabled=!this.isActiveTableChanged()}},{key:"checkLocale",value:function(){var e=Cyr2LatTablesObject.ctlLocale;e="ru_RU"===e?"ISO9":e;var t=this.getActiveTableLocale();t!==e?this.showMessage(this.warningMessage,Cyr2LatTablesObject.localeWarning.replace("{active_table}",t)):this.clearMessage(this.warningMessage)}},{key:"saveActiveTable",value:function(){var e=this;if(this.isActiveTableChanged()){var i=this.getActiveTable(),n=document.createElement("form");n.action=this.optionsForm.getAttribute("action"),n.method=this.optionsForm.method,n.appendChild(i.cloneNode(!0)),t(i.querySelectorAll("input")).map((function(e){return n.querySelector("#"+e.id).value=e.value})),t(this.optionsForm.querySelectorAll('input[type="hidden"]')).map((function(e){return n.appendChild(e.cloneNode(!0))})),document.body.appendChild(n);var a=new URLSearchParams(t(new FormData(n)));return a.append("action",Cyr2LatTablesObject.action),a.append("nonce",Cyr2LatTablesObject.nonce),fetch(Cyr2LatTablesObject.ajaxUrl,{method:"POST",body:a}).then((function(e){if(!e.ok)throw new Error(e.statusText);return e.json()})).then((function(t){t.success?(e.showMessage(e.successMessage,t.data),e.tablesData=e.getTablesData()):e.showMessage(e.errorMessage,t.data)})).catch((function(t){return e.showMessage(e.errorMessage,t),{}})).finally((function(){n.parentNode.removeChild(n),e.setSubmitStatus()}))}}},{key:"getTableData",value:function(e){var i=this,n=t(e.querySelectorAll("input")),a={};return n.forEach((function(e){var t=document.querySelector(i.OPTIONS_FORM_SELECTOR+' label[for="'+e.id+'"]');a[t.innerHTML]=e.value})),a}},{key:"getTablesData",value:function(){var e=this;return this.getTables().map((function(t){return e.getTableData(t)}))}},{key:"getActiveTableData",value:function(){return this.getTableData(this.getActiveTable())}},{key:"getActiveTableLocale",value:function(){return this.getActiveTable().querySelector("tr").classList[0].replace("cyr-to-lat-tables-","").replace("-","_")}},{key:"addWrapper",value:function(){this.wrapper=document.createElement("ul"),this.wrapper.classList.add("nav-tab-wrapper"),this.optionsForm.insertBefore(this.wrapper,this.optionsForm.firstChild)}},{key:"addMessageLine",value:function(e){var t=document.createElement("div");return t.id=e,this.optionsForm.insertBefore(t,this.optionsForm.firstChild),t}},{key:"addMessageLines",value:function(){this.successMessage=this.addMessageLine("ctl-success"),this.errorMessage=this.addMessageLine("ctl-error"),this.warningMessage=this.addMessageLine("ctl-warning")}},{key:"moveTabs",value:function(){var e=document.querySelector(".ctl-settings-tabs");e&&this.optionsForm.insertBefore(e,this.optionsForm.firstChild)}},{key:"addEditLabelInput",value:function(){this.editLabelInput=document.createElement("input"),this.editLabelInput.id=this.EDIT_LABEL_ID,this.editLabelInput.style.display="none",document.body.appendChild(this.editLabelInput)}},{key:"hideEditLabelInput",value:function(){this.editLabelInput.style.display="none",this.editLabelInput.classList.remove(this.EDIT_LABEL_ERROR_CLASS),document.body.appendChild(this.editLabelInput)}},{key:"getLastCell",value:function(){return document.querySelector(this.OPTIONS_FORM_SELECTOR+" ."+this.ACTIVE_TABLE_CLASS+" ."+this.PLUS_CLASS).previousElementSibling}},{key:"addCell",value:function(){var e=this.getLastCell();e.parentElement.insertBefore(e.cloneNode(!0),e.nextElementSibling);var t=(e=this.getLastCell()).querySelector("label"),i=e.querySelector("input"),n=i.id.split("-"),a=n[0]+"-"+(parseInt(n[1])+1);t.htmlFor=a,t.innerHTML="",i.id=a,i.value="",i.setAttribute("value",""),this.replaceName(i,""),this.bindEvents(),this.editLabel(t)}},{key:"hideTables",value:function(){var e=this,t=0;this.getTables().map((function(i,n){i.classList.add("ctl-table"),e.CURRENT_STUB_ID===i.previousElementSibling.id&&(t=n,i.classList.add(e.ACTIVE_TABLE_CLASS));var a=document.createElement("div");return a.classList.add(e.PLUS_CLASS),a.innerHTML=e.plusButton,i.querySelector("td fieldset").appendChild(a),null})),this.getHeaders().map((function(i,n){return i.classList.add("nav-tab"),i.dataset.index=n.toString(),e.wrapper.appendChild(i),n===t&&(i.classList.add(e.CURRENT_NAV_TAB_CLASS),i.classList.add(e.ACTIVE_NAV_TAB_CLASS)),null}))}},{key:"bindEvents",value:function(){var e=this;this.getHeaders().map((function(t,i,n){return t.onclick=function(t){t.preventDefault();var i=t.target.dataset.index;if(i===e.getActiveIndex())return!1;e.saveActiveTable(),n.map((function(t){return t.classList.remove(e.ACTIVE_NAV_TAB_CLASS)})),n[i].classList.add(e.ACTIVE_NAV_TAB_CLASS);var a=e.getTables();return a.map((function(t){return t.classList.remove(e.ACTIVE_TABLE_CLASS)})),a[i].classList.add(e.ACTIVE_TABLE_CLASS),e.setSubmitStatus(),e.checkLocale(),!1},null})),this.getInputs().map((function(t){return t.oninput=function(){e.setSubmitStatus()},null})),this.getLabels().map((function(t){return t.onclick=function(t){return t.preventDefault(),e.editLabel(t.target),!1},null})),this.editLabelInput.onblur=function(){e.saveLabel()},this.editLabelInput.onkeyup=function(t){"Escape"===t.key&&e.saveLabel(!0),"Enter"===t.key&&e.saveLabel()},this.getPlusButtons().map((function(t){return t.onclick=function(t){return t.preventDefault(),e.addCell(t.target),!1},null})),this.submitButton.onclick=function(t){return t.preventDefault(),e.saveActiveTable(),!1}}},{key:"editLabel",value:function(e){e.parentNode.insertBefore(this.editLabelInput,e.nextSibling),this.editLabelInput.value=e.innerHTML,this.editLabelInput.classList.remove(this.EDIT_LABEL_ERROR_CLASS),this.editLabelInput.style.display="block",this.editLabelInput.focus()}},{key:"isUniqueLabel",value:function(e){return t(this.getActiveTable().querySelectorAll("label")).reduce((function(t,i){return t&&i.innerHTML!==e}),!0)}},{key:"saveLabel",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("none"!==this.editLabelInput.style.display){var t=this.editLabelInput.value.trim();if(""===t){var i=document.getElementById(this.EDIT_LABEL_ID).parentElement;return this.hideEditLabelInput(),i.parentNode.removeChild(i),void this.setSubmitStatus()}var n=this.editLabelInput.parentNode.querySelector("label");if(e||t===n.innerHTML)this.hideEditLabelInput();else if(this.isUniqueLabel(t)){var a=this.editLabelInput.nextElementSibling;this.hideEditLabelInput(),n.innerHTML=t,this.replaceName(a,t),this.setSubmitStatus()}else this.editLabelInput.classList.add(this.EDIT_LABEL_ERROR_CLASS)}}},{key:"replaceName",value:function(e,t){e.name=e.name.replace(/(.+\[.+])\[.*]/g,"$1["+t+"]")}},{key:"clearMessage",value:function(e){e.innerHTML="",e.classList.remove("active")}},{key:"clearMessages",value:function(){this.clearMessage(this.successMessage),this.clearMessage(this.errorMessage),clearTimeout(this.msgTimer)}},{key:"showMessage",value:function(e,t){var i=this;e.innerHTML=t,e.classList.add("active"),this.msgTimer=setTimeout((function(){i.clearMessages()}),5e3)}}],i&&n(e.prototype,i),a&&n(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,a}();const r=s;document.addEventListener("DOMContentLoaded",(function(){new r}))})();
     1(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(t){var i=function(t,i){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,i||"default");if("object"!=e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(t)}(t,"string");return"symbol"==e(i)?i:i+""}var s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.OPTIONS_FORM_SELECTOR="#ctl-options",this.HEADER_SELECTOR=this.OPTIONS_FORM_SELECTOR+" h2",this.TABLE_SELECTOR=this.OPTIONS_FORM_SELECTOR+" table",this.SUBMIT_SELECTOR=this.OPTIONS_FORM_SELECTOR+" #submit",this.CURRENT_STUB_ID="ctl-current",this.CURRENT_NAV_TAB_CLASS="nav-tab-current",this.ACTIVE_NAV_TAB_CLASS="nav-tab-active",this.ACTIVE_TABLE_CLASS="active",this.EDIT_LABEL_ID="ctl-edit-label",this.EDIT_LABEL_ERROR_CLASS="ctl-edit-label-error",this.plusButton='<button type="button" aria-haspopup="true" aria-expanded="false" class="components-button block-editor-inserter__toggle has-icon" aria-label="Добавить блок"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 24 24" role="img" aria-hidden="true" focusable="false"><path d="M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6zM10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"></path></svg></button>',this.PLUS_CLASS="ctl-plus",this.optionsForm=document.querySelector(this.OPTIONS_FORM_SELECTOR),this.tablesData=this.getTablesData(),this.submitButton=document.querySelector(this.SUBMIT_SELECTOR),this.addWrapper(),this.addMessageLines(),this.moveTabs(),this.addEditLabelInput(),this.hideTables(),this.bindEvents(),this.setSubmitStatus(),this.checkLocale()},i=[{key:"getHeaders",value:function(){return t(document.querySelectorAll(this.HEADER_SELECTOR))}},{key:"getActiveHeader",value:function(){return document.querySelector(this.HEADER_SELECTOR+"."+this.ACTIVE_NAV_TAB_CLASS)}},{key:"getActiveIndex",value:function(){return this.getActiveHeader().dataset.index}},{key:"getTables",value:function(){return t(document.querySelectorAll(this.TABLE_SELECTOR))}},{key:"getActiveTable",value:function(){return document.querySelector(this.TABLE_SELECTOR+"."+this.ACTIVE_TABLE_CLASS)}},{key:"getInputs",value:function(){return t(document.querySelectorAll(this.OPTIONS_FORM_SELECTOR+" input"))}},{key:"getLabels",value:function(){return t(document.querySelectorAll(this.OPTIONS_FORM_SELECTOR+" label"))}},{key:"getPlusButtons",value:function(){return t(document.querySelectorAll(this.OPTIONS_FORM_SELECTOR+" ."+this.PLUS_CLASS))}},{key:"isActiveTableChanged",value:function(){var e=this.getActiveIndex();return JSON.stringify(this.getActiveTableData())!==JSON.stringify(this.tablesData[e])}},{key:"setSubmitStatus",value:function(){this.submitButton.disabled=!this.isActiveTableChanged()}},{key:"checkLocale",value:function(){var e=Cyr2LatTablesObject.ctlLocale;e="ru_RU"===e?"ISO9":e;var t=this.getActiveTableLocale();t!==e?this.showMessage(this.warningMessage,Cyr2LatTablesObject.localeWarning.replace("{active_table}",t)):this.clearMessage(this.warningMessage)}},{key:"saveActiveTable",value:function(){var e=this;if(this.isActiveTableChanged()){var i=this.getActiveTable(),n=document.createElement("form");n.action=this.optionsForm.getAttribute("action"),n.method=this.optionsForm.method,n.appendChild(i.cloneNode(!0)),t(i.querySelectorAll("input")).map(function(e){return n.querySelector("#"+e.id).value=e.value}),t(this.optionsForm.querySelectorAll('input[type="hidden"]')).map(function(e){return n.appendChild(e.cloneNode(!0))}),document.body.appendChild(n);var a=new URLSearchParams(t(new FormData(n)));return a.append("action",Cyr2LatTablesObject.action),a.append("nonce",Cyr2LatTablesObject.nonce),fetch(Cyr2LatTablesObject.ajaxUrl,{method:"POST",body:a}).then(function(e){if(!e.ok)throw new Error(e.statusText);return e.json()}).then(function(t){t.success?(e.showMessage(e.successMessage,t.data),e.tablesData=e.getTablesData()):e.showMessage(e.errorMessage,t.data)}).catch(function(t){return e.showMessage(e.errorMessage,t),{}}).finally(function(){n.parentNode.removeChild(n),e.setSubmitStatus()})}}},{key:"getTableData",value:function(e){var i=this,n=t(e.querySelectorAll("input")),a={};return n.forEach(function(e){var t=document.querySelector(i.OPTIONS_FORM_SELECTOR+' label[for="'+e.id+'"]');a[t.innerHTML]=e.value}),a}},{key:"getTablesData",value:function(){var e=this;return this.getTables().map(function(t){return e.getTableData(t)})}},{key:"getActiveTableData",value:function(){return this.getTableData(this.getActiveTable())}},{key:"getActiveTableLocale",value:function(){return this.getActiveTable().querySelector("tr").classList[0].replace("cyr-to-lat-tables-","").replace("-","_")}},{key:"addWrapper",value:function(){this.wrapper=document.createElement("ul"),this.wrapper.classList.add("nav-tab-wrapper"),this.optionsForm.insertBefore(this.wrapper,this.optionsForm.firstChild)}},{key:"addMessageLine",value:function(e){var t=document.createElement("div");return t.id=e,this.optionsForm.insertBefore(t,this.optionsForm.firstChild),t}},{key:"addMessageLines",value:function(){this.successMessage=this.addMessageLine("ctl-success"),this.errorMessage=this.addMessageLine("ctl-error"),this.warningMessage=this.addMessageLine("ctl-warning")}},{key:"moveTabs",value:function(){var e=document.querySelector(".ctl-settings-tabs");e&&this.optionsForm.insertBefore(e,this.optionsForm.firstChild)}},{key:"addEditLabelInput",value:function(){this.editLabelInput=document.createElement("input"),this.editLabelInput.id=this.EDIT_LABEL_ID,this.editLabelInput.style.display="none",document.body.appendChild(this.editLabelInput)}},{key:"hideEditLabelInput",value:function(){this.editLabelInput.style.display="none",this.editLabelInput.classList.remove(this.EDIT_LABEL_ERROR_CLASS),document.body.appendChild(this.editLabelInput)}},{key:"getLastCell",value:function(){return document.querySelector(this.OPTIONS_FORM_SELECTOR+" ."+this.ACTIVE_TABLE_CLASS+" ."+this.PLUS_CLASS).previousElementSibling}},{key:"addCell",value:function(){var e=this.getLastCell();e.parentElement.insertBefore(e.cloneNode(!0),e.nextElementSibling);var t=(e=this.getLastCell()).querySelector("label"),i=e.querySelector("input"),n=i.id.split("-"),a=n[0]+"-"+(parseInt(n[1])+1);t.htmlFor=a,t.innerHTML="",i.id=a,i.value="",i.setAttribute("value",""),this.replaceName(i,""),this.bindEvents(),this.editLabel(t)}},{key:"hideTables",value:function(){var e=this,t=0;this.getTables().map(function(i,n){i.classList.add("ctl-table"),e.CURRENT_STUB_ID===i.previousElementSibling.id&&(t=n,i.classList.add(e.ACTIVE_TABLE_CLASS));var a=document.createElement("div");return a.classList.add(e.PLUS_CLASS),a.innerHTML=e.plusButton,i.querySelector("td fieldset").appendChild(a),null}),this.getHeaders().map(function(i,n){return i.classList.add("nav-tab"),i.dataset.index=n.toString(),e.wrapper.appendChild(i),n===t&&(i.classList.add(e.CURRENT_NAV_TAB_CLASS),i.classList.add(e.ACTIVE_NAV_TAB_CLASS)),null})}},{key:"bindEvents",value:function(){var e=this;this.getHeaders().map(function(t,i,n){return t.onclick=function(t){t.preventDefault();var i=t.target.dataset.index;if(i===e.getActiveIndex())return!1;e.saveActiveTable(),n.map(function(t){return t.classList.remove(e.ACTIVE_NAV_TAB_CLASS)}),n[i].classList.add(e.ACTIVE_NAV_TAB_CLASS);var a=e.getTables();return a.map(function(t){return t.classList.remove(e.ACTIVE_TABLE_CLASS)}),a[i].classList.add(e.ACTIVE_TABLE_CLASS),e.setSubmitStatus(),e.checkLocale(),!1},null}),this.getInputs().map(function(t){return t.oninput=function(){e.setSubmitStatus()},null}),this.getLabels().map(function(t){return t.onclick=function(t){return t.preventDefault(),e.editLabel(t.target),!1},null}),this.editLabelInput.onblur=function(){e.saveLabel()},this.editLabelInput.onkeyup=function(t){"Escape"===t.key&&e.saveLabel(!0),"Enter"===t.key&&e.saveLabel()},this.getPlusButtons().map(function(t){return t.onclick=function(t){return t.preventDefault(),e.addCell(t.target),!1},null}),this.submitButton.onclick=function(t){return t.preventDefault(),e.saveActiveTable(),!1}}},{key:"editLabel",value:function(e){e.parentNode.insertBefore(this.editLabelInput,e.nextSibling),this.editLabelInput.value=e.innerHTML,this.editLabelInput.classList.remove(this.EDIT_LABEL_ERROR_CLASS),this.editLabelInput.style.display="block",this.editLabelInput.focus()}},{key:"isUniqueLabel",value:function(e){return t(this.getActiveTable().querySelectorAll("label")).reduce(function(t,i){return t&&i.innerHTML!==e},!0)}},{key:"saveLabel",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("none"!==this.editLabelInput.style.display){var t=this.editLabelInput.value.trim();if(""===t){var i=document.getElementById(this.EDIT_LABEL_ID).parentElement;return this.hideEditLabelInput(),i.parentNode.removeChild(i),void this.setSubmitStatus()}var n=this.editLabelInput.parentNode.querySelector("label");if(e||t===n.innerHTML)this.hideEditLabelInput();else if(this.isUniqueLabel(t)){var a=this.editLabelInput.nextElementSibling;this.hideEditLabelInput(),n.innerHTML=t,this.replaceName(a,t),this.setSubmitStatus()}else this.editLabelInput.classList.add(this.EDIT_LABEL_ERROR_CLASS)}}},{key:"replaceName",value:function(e,t){e.name=e.name.replace(/(.+\[.+])\[.*]/g,"$1["+t+"]")}},{key:"clearMessage",value:function(e){e.innerHTML="",e.classList.remove("active")}},{key:"clearMessages",value:function(){this.clearMessage(this.successMessage),this.clearMessage(this.errorMessage),clearTimeout(this.msgTimer)}},{key:"showMessage",value:function(e,t){var i=this;e.innerHTML=t,e.classList.add("active"),this.msgTimer=setTimeout(function(){i.clearMessages()},5e3)}}],i&&n(e.prototype,i),a&&n(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,a}();const r=s;document.addEventListener("DOMContentLoaded",function(){new r})})();
  • cyr2lat/tags/6.5.0/assets/js/system-info.min.js

    r2943272 r3384222  
    1 document.addEventListener("DOMContentLoaded",(function(){document.querySelector("#ctl-system-info-wrap .helper").addEventListener("click",(function(){var e=document.getElementById("ctl-system-info");navigator.clipboard.writeText(e.value).then((function(){}),(function(){}));var t=Cyr2LatSystemInfoObject.copiedMsg;alert(t)}))}));
     1document.addEventListener("DOMContentLoaded",function(){document.querySelector("#ctl-system-info-wrap .helper").addEventListener("click",function(){var e=document.getElementById("ctl-system-info");navigator.clipboard.writeText(e.value).then(function(){},function(){});var t=Cyr2LatSystemInfoObject.copiedMsg;alert(t)})});
  • cyr2lat/tags/6.5.0/changelog.txt

    r3211834 r3384222  
     1= 6.5.0 (24.10.2025) =
     2* Fixed transliteration of tags during editing.
     3
     4= 6.4.1 (03.05.2025) =
     5* Fixed the layout of messages on the Tables page.
     6* Tested with WordPress 6.8.
     7* Tested with WooCommerce 9.8.
     8
     9= 6.3.0 (22.12.2024) =
     10* Added a warning message on the Tables page when the active table does not match the site locale.
     11* Removed fix for translation after WordPress 6.5+ due to performance issues.
     12
    113= 6.2.3 (24.11.2024) =
    214* Fixed deprecation error with PHP 8.4.
     
    2133* Tested with WordPress 6.5.
    2234* Tested with WooCommerce 8.6.
    23 * Fixed error on System Info tab when post types or post statuses are not set.
     35* Fixed error on the System Info tab when post types or post statuses are not set.
    2436
    2537= 6.0.8 (14.02.2024) =
     
    3244* Added description of post types and post statuses on the Converter page.
    3345* Fixed displaying all file descriptions in the Theme Editor in the current locale.
    34 * Fixed PHP warning in SettingsBase.
    35 * Fixed output of variable product attributes.
     46* Fixed PHP warning in the SettingsBase.
     47* Fixed the output of variable product attributes.
    3648
    3749= 6.0.6 (14.01.2024) =
     
    4052* Tested with PHP 8.3.
    4153* Fixed documentation on ctl_allow filter.
    42 * Fixed improper display of the "rate plugin" message on options.php.
     54* Fixed the improper display of the "rate plugin" message on options.php.
    4355
    4456= 6.0.5 (09.10.2023) =
  • cyr2lat/tags/6.5.0/cyr-to-lat.php

    r3286669 r3384222  
    1111 * Plugin URI:        https://kagg.eu/cyr-to-lat/
    1212 * Description:       Convert Non-Latin characters in post and term slugs to Latin characters. Useful for creating human-readable URLs. Based on the original plugin by Anton Skorobogatov.
    13  * Version:           6.4.1
     13 * Version:           6.5.0
    1414 * Requires at least: 5.3
    1515 * Requires PHP:      7.2
     
    4242 * Plugin version.
    4343 */
    44 define( 'CYR_TO_LAT_VERSION', '6.4.1' );
     44define( 'CYR_TO_LAT_VERSION', '6.5.0' );
    4545
    4646/**
  • cyr2lat/tags/6.5.0/readme.txt

    r3382917 r3384222  
    44Requires at least: 5.3
    55Tested up to: 6.8
    6 Stable tag: 6.4.1
    76Requires PHP: 7.2
     7Stable tag: 6.5.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1616
    1717= Features =
    18 * The only plugin with fully editable transliteration table. Allows to add/remove and edit pairs like 'Я' => 'Ya', or even 'Пиво' => 'Beer'
     18* The only plugin with a fully editable transliteration table. Allows to add/remove and edit pairs like 'Я' => 'Ya', or even 'Пиво' => 'Beer'
    1919* Converts any number of existing post, page and term slugs in background processes
    2020* Saves existing post and page permalinks integrity
     
    4646== Installation ==
    4747
    48 1. Upload `cyr2lat` folder to the `/wp-content/plugins/` directory.
     481. Upload the ` cyr2lat ` folder to the `/wp-content/plugins/` directory.
    49492. Activate the plugin through the 'Plugins' menu in WordPress.
    5050
     
    207207Regeneration of thumbnails with the command `wp media regenerate` can break links in old posts as file names become transliterated.
    208208
    209 To avoid it, deactivate cyr2lat plugin during regeneration:
     209To avoid it, deactivate the cyr2lat plugin during regeneration:
    210210
    211211`
     
    225225
    226226== Changelog ==
     227
     228= 6.5.0 (24.10.2025) =
     229* Fixed transliteration of tags during editing.
    227230
    228231= 6.4.1 (03.05.2025) =
     
    232235
    233236= 6.3.0 (22.12.2024) =
    234 * Added warning message on the Tables page when active table does not match the site locale.
     237* Added a warning message on the Tables page when the active table does not match the site locale.
    235238* Removed fix for translation after WordPress 6.5+ due to performance issues.
    236239
     
    257260* Tested with WordPress 6.5.
    258261* Tested with WooCommerce 8.6.
    259 * Fixed error on System Info tab when post types or post statuses are not set.
     262* Fixed error on the System Info tab when post types or post statuses are not set.
    260263
    261264= 6.0.8 (14.02.2024) =
     
    268271* Added description of post types and post statuses on the Converter page.
    269272* Fixed displaying all file descriptions in the Theme Editor in the current locale.
    270 * Fixed PHP warning in SettingsBase.
    271 * Fixed output of variable product attributes.
     273* Fixed PHP warning in the SettingsBase.
     274* Fixed the output of variable product attributes.
    272275
    273276= 6.0.6 (14.01.2024) =
     
    276279* Tested with PHP 8.3.
    277280* Fixed documentation on ctl_allow filter.
    278 * Fixed improper display of the "rate plugin" message on options.php.
     281* Fixed the improper display of the "rate plugin" message on options.php.
    279282
    280283= 6.0.5 (09.10.2023) =
  • cyr2lat/tags/6.5.0/src/php/ConversionTables.php

    r3211834 r3384222  
    2121
    2222    /**
    23      * Get conversion table by locale.
     23     * Get a conversion table by locale.
    2424     *
    2525     * @link https://ru.wikipedia.org/wiki/ISO_9
     
    2929     * @return array
    3030     */
    31     public static function get( string $locale = '' ): array {
     31    public static function get( string $locale = '' ): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
    3232        switch ( $locale ) {
    3333            // Belorussian.
     
    12041204    /**
    12051205     * Get fix table for macOS.
    1206      * On macOS, files containing characters in the table, are sometimes encoded improperly.
     1206     * On macOS, files containing characters in the table are sometimes encoded improperly.
    12071207     *
    12081208     * @return array
  • cyr2lat/tags/6.5.0/src/php/ErrorHandler.php

    r3211834 r3384222  
    1919
    2020    /**
     21     * Text domain in the just_in_time error message.
     22     */
     23    private const TEXT_DOMAIN_IN_JIT_ERROR = '<code>cyr2lat</code>';
     24
     25    /**
    2126     * Initialize the class.
    2227     *
     
    3338     */
    3439    private function init_hooks(): void {
    35 
    3640        // Suppress the _load_textdomain_just_in_time() notices related the plugin for WP 6.7+.
    3741        if ( version_compare( $GLOBALS['wp_version'], '6.7', '>=' ) ) {
     
    5357     */
    5458    public function action_doing_it_wrong_run( $function_name, $message, $version ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
    55 
    5659        global $wp_filter;
    5760
     
    9699     */
    97100    public function filter_doing_it_wrong_trigger_error( $trigger, $function_name, $message, $version ): bool {
    98 
    99101        $trigger       = (bool) $trigger;
    100102        $function_name = (string) $function_name;
     
    113115     */
    114116    protected function is_just_in_time_for_plugin_domain( string $function_name, string $message ): bool {
    115         return '_load_textdomain_just_in_time' === $function_name && false !== strpos( $message, '<code>cyr2lat</code>' );
     117        return '_load_textdomain_just_in_time' === $function_name && false !== strpos( $message, self::TEXT_DOMAIN_IN_JIT_ERROR );
    116118    }
    117119}
  • cyr2lat/tags/6.5.0/src/php/Main.php

    r3189796 r3384222  
    245245        try {
    246246            /**
    247              * Method WP_CLI::add_command() accepts class as callable.
     247             * Method WP_CLI::add_command() accepts a class as callable.
    248248             *
    249249             * @noinspection PhpParamsInspection
     
    307307        if (
    308308            ! $title ||
    309             // Fixed bug with `_wp_old_slug` redirect.
     309            // Fix the bug with `_wp_old_slug` redirect.
    310310            'query' === $context ||
    311             // Transliterate on pre_term_slug with Polylang and WPML only.
    312             (
    313                 doing_filter( 'pre_term_slug' ) &&
    314                 ! ( class_exists( 'Polylang' ) || class_exists( 'SitePress' ) )
    315             )
     311            ! $this->transliterate_on_pre_term_slug_filter( (string) $title )
    316312        ) {
    317313            return $title;
     
    360356    /**
    361357     * WC before template part filter.
    362      * Add sanitize_title filter to support transliteration of WC attributes on frontend.
     358     * Add the sanitize_title filter to support transliteration of WC attributes on the frontend.
    363359     *