| 1 |
jQuery(function(t){t("#copy_translations").off("click").on("click",function(e){if(e.preventDefault(),acym_helper.confirm(ACYM_JS_TXT.ACYM_ARE_YOU_SURE+"\n"+ACYM_JS_TXT.ACYM_COPY_DEFAULT_TRANSLATIONS_CONFIRM)){let e=t("#translation"),n=t('textarea[name="customcontent"]'),a=n.val().split("\n");if(0===a.length)return void n.text(e.text());let l={};a.forEach(function(t){if(-1!==t.indexOf("=")){let e=t.split("=");l[e[0]]=e[1]}});let i=[],o=e.text().split("\n");if(o.forEach(function(t){if(-1===t.indexOf("="))i.push(t);else{let e=t.split("=");l.hasOwnProperty(e[0])&&delete l[e[0]],i.push(t)}}),Object.keys(l).length>0){i.unshift("\n");for(let t in l)l.hasOwnProperty(t)&&i.unshift(t+"="+l[t])}n.val(i.join("\n")),n.html(i.join("\n"))}}),jQuery("#load_latest_translation").off("click").on("click",function(e){e.preventDefault();const n=jQuery("#translation"),a=jQuery("#load_latest_spinner"),l={ctrl:"language",task:"getLatestTranslationAjax",code:t(this).attr("data-acym-code")};n.hide(),a.show(),acym_helper.post(ACYM_AJAX_URL,l).then(t=>{n.show(),a.hide(),t.error?alert(t.message):n.text(t.data.translations)})})}); |