HEX
Server: Apache
System: Linux webd001.cluster127.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: mciraet (192513)
PHP: 8.2.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/mciraet/www/wp-content/plugins/polylang-pro/js/build/machine-translation-settings.min.js
const{addAction}=wp.hooks,pllMachineTranslation={init:()=>{"loading"!==document.readyState?(pllMachineTranslation.ajaxButton.attachEvent(),pllMachineTranslation.dataUsage.fetchData(),pllMachineTranslation.glossaries.init()):(document.addEventListener("DOMContentLoaded",pllMachineTranslation.ajaxButton.attachEvent),document.addEventListener("DOMContentLoaded",pllMachineTranslation.dataUsage.fetchData),document.addEventListener("DOMContentLoaded",pllMachineTranslation.glossaries.init)),addAction("pll_settings_saved","polylang-pro",pllMachineTranslation.saveSettings.highlightRow),addAction("pll_settings_saved","polylang-pro",pllMachineTranslation.dataUsage.fetchData),addAction("pll_settings_saved","polylang-pro",pllMachineTranslation.glossaries.fetchDataOnSave)},resetFieldRow:e=>{e.querySelectorAll(".pll-message-shown").forEach((e=>{e.classList.remove("pll-message-shown")})),e.classList.remove("notice-success","notice-warning","notice-error","notice-alt"),e.querySelectorAll(".pll-error-message-text").forEach((e=>{e.textContent=""}))},displayErrorMessage:(e,t,a="error")=>{t&&e.querySelectorAll("."+t).forEach((e=>{e.classList.add("pll-message-shown")})),e.classList.add("notice-"+a,"notice-alt")},ajaxButton:{attachEvent:()=>{document.querySelectorAll(".pll-ajax-button").forEach((e=>{e.addEventListener("click",(e=>{const t=e.target,a=t.getAttribute("data-action"),n=t.getAttribute("data-nonce"),s=t.closest("tr"),l=s.querySelectorAll(".pll-error-message-text");if(!a||!n||!s||!l.length||t.getAttribute("disabled"))return;const i={action:a,_pll_nonce:n,pll_ajax_settings:1};s.querySelectorAll("[data-name]").forEach((e=>{i[e.getAttribute("data-name")]=e.value}));const r=wp.url.addQueryArgs(ajaxurl,i);t.setAttribute("disabled","disabled"),pllMachineTranslation.resetFieldRow(s),fetch(r).then((e=>e.json())).then((e=>{t.removeAttribute("disabled"),e.success?s.classList.add("notice-success","notice-alt"):(l[0].textContent=e.data&&e.data.message?e.data.message:"",pllMachineTranslation.displayErrorMessage(s,e.data?e.data.message_class:""))})).catch((()=>{t.removeAttribute("disabled"),s.classList.add("notice-error","notice-alt")}))}))}))}},saveSettings:{highlightRow:(e,t)=>{switch(e.what){case"success":t.querySelectorAll(".notice-alt, .pll-message-shown").forEach((e=>{e.classList.remove("notice-success","notice-warning","notice-error","notice-alt","pll-message-shown")}));break;case"error":const a=pllMachineTranslation.saveSettings.getNoticeData(e.data);if(!a.fieldId)break;const n=document.getElementById(a.fieldId);if(!n)break;const s=n.closest("tr");if(!s)break;pllMachineTranslation.resetFieldRow(s),pllMachineTranslation.displayErrorMessage(s,a.messageClass,a.type)}},getNoticeData:e=>{const t=document.createElement("div");return t.innerHTML=e.trim(),{type:pllMachineTranslation.saveSettings.find(t.firstChild.className,"notice-(success|warning|error)","error"),fieldId:pllMachineTranslation.saveSettings.find(t.firstChild.className,"pll-field-id-([^\\s]+)",""),messageClass:pllMachineTranslation.saveSettings.find(t.firstChild.className,"pll-message-class-([^\\s]+)","")}},find:(e,t,a)=>{const n=(" "+e+" ").match(new RegExp("\\s"+t+"\\s"));return n&&n[1]?n[1]:a}},dataUsage:{fetchData:()=>{document.querySelectorAll(".pll-progress-bar-wrapper").forEach((e=>{const t=e.getAttribute("data-action"),a=e.getAttribute("data-nonce"),n=e.querySelectorAll("div").item(0),s=e.closest("tr");if(!(t&&a&&n&&s&&e.parentElement))return;const l=e.parentElement.querySelectorAll(".description").item(0);if(!l)return;n.style.width="0%",n.textContent="";let i=e.querySelectorAll(".spinner").item(0);i?i.style.visibility="visible":(i=document.createElement("span"),i.className="spinner pll-spinner-inline",e.innerHTML="",e.appendChild(i),e.appendChild(n));if(""===document.getElementById("pll-deepl-api-key").value.trim())return void(s.style.display="none");e.style.display="",s.style.display="";const r={action:t,_pll_nonce:a,pll_ajax_settings:1},o=wp.url.addQueryArgs(ajaxurl,r);fetch(o).then((e=>e.json())).then((t=>{if(!t.success||!t.data.percent)return e.style.display="none",void(l.textContent=t.data.message);e.replaceChild(document.createTextNode(t.data.percent_formatted),i),n.textContent=t.data.percent_formatted,n.style.width=t.data.percent,l.textContent=t.data.message})).catch((()=>{s.remove()}))}))}},glossaries:{init:()=>{const e=pllMachineTranslation.glossaries.getElements();e.action&&(pllMachineTranslation.glossaries.fetchData(e),e.apiKeyInput.addEventListener("blur",(()=>{const t=e.apiKeyInput.value.trim();t!==e.apiKey&&(e.apiKey=t,e.hasNewApiKey=!0,pllMachineTranslation.glossaries.fetchData(e))})))},fetchDataOnSave:()=>{const e=pllMachineTranslation.glossaries.getElements();e.action&&pllMachineTranslation.glossaries.fetchData(e)},getElements:()=>{const e=document.getElementById("pll-deepl-glossary");if(!e)return{};const t=e.getAttribute("data-action"),a=e.getAttribute("data-nonce");if(!t||!a)return{};const n=document.getElementById("pll-deepl-api-key");if(!n)return pllMachineTranslation.glossaries.removeOptions(e),{};const s=n.value.trim();return{glossaryInput:e,action:t,nonce:a,apiKeyInput:n,apiKey:s}},fetchData:e=>{if(e.hasNewApiKey&&""===e.apiKey)return void pllMachineTranslation.glossaries.removeOptions(e.glossaryInput);e.glossaryInput.setAttribute("disabled","disabled");const t={action:e.action,_pll_nonce:e.nonce,pll_ajax_settings:1};e.hasNewApiKey&&(t.api_key=e.apiKey);const a=wp.url.addQueryArgs(ajaxurl,t);fetch(a).then((e=>e.json())).then((t=>{pllMachineTranslation.glossaries.removeOptions(e.glossaryInput),t.success&&t.data.glossaries?(Object.entries(t.data.glossaries).forEach((([a,n])=>{const s=document.createElement("option");s.value=a,s.textContent=n,a===t.data.selected&&(s.selected=!0),e.glossaryInput.appendChild(s)})),e.glossaryInput.removeAttribute("disabled")):e.glossaryInput.removeAttribute("disabled")})).catch((()=>{e.glossaryInput.removeAttribute("disabled")}))},removeOptions:e=>{Object.entries(e.children).forEach((([,e])=>{""!==e.value.trim()&&e.remove()}))}}};pllMachineTranslation.init();