PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.15.1
Translate and Go multilingual – Automatic AI translation – wpLingua v2.15.1
2.16.7 2.16.6 2.16.5 2.16.4 2.16.3 2.16.2 2.16.1 2.16.0 2.15.2 2.15.1 2.15.0 2.14.3 2.14.2 2.14.1 2.14.0 2.13.1 2.13.0 2.12.3 2.12.2 2.12.1 trunk 1.0.3 1.0.4 1.0.5 1.1.0 All 112 releases
wplingua / assets / js / admin / option-page-dictionary.js

option-page-dictionary.js in Translate and Go multilingual – Automatic AI translation – wpLingua 2.15.1, at assets/js/admin/option-page-dictionary.js

18 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*!*
2 ** _ _
3 ** __ ___ __ | | (_)_ __ __ _ _ _ __ _
4 ** \ \ /\ / / '_ \| | | | '_ \ / _` | | | |/ _` |
5 ** \ V V /| |_) | |___| | | | | (_| | |_| | (_| |
6 ** \_/\_/ | .__/|_____|_|_| |_|\__, |\__,_|\__,_|
7 ** |_| |___/
8 **
9 ** -- wpLingua | WordPress plugin --
10 ** Translate and make your website multilingual
11 **
12 ** https://github.com/julien-jacob/wplingua
13 ** https://wordpress.org/plugins/wplingua/
14 ** https://wplingua.com/
15 **
16 **/
17 jQuery(document).ready(function(s){let a=JSON.parse(s("#wplng_dictionary_entries").val());function n(e){e.each(function(){var e,t=this,n=(t.style.height="0px",window.getComputedStyle(t));"border-box"===n.boxSizing?(e=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),t.style.height=t.scrollHeight+e+"px"):(e=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),t.style.height=t.scrollHeight-e+"px")})}s("#wplng-new-rule-button").click(function(){s("#wplng-section-entries-all").hide(),s("#wplng-section-entry-new").show(),n(s("#wplng-dictionary-entry-new .wplng-adaptive-textarea")),window.scrollTo(0,0)}),s("#wplng-new-never-translate").change(function(){this.checked?s("#wplng-new-rules").slideUp("fast"):s("#wplng-new-rules").slideDown("fast")}),s("#wplng-new-add-button").click(function(){var e=s("#wplng-new-source").val();let n={};null!=e&&""!=e.trim()&&(s("#wplng-edit-never-translate").prop("checked")||s(".wplng-new-rule").each(function(){var e=s(this).attr("wplng-rule"),t=s("textarea",this).val();null!=t&&""!=t.trim()&&(n[e]=t.trim())}),0==Object.keys(n).length?a.push({source:e}):a.push({source:e,rules:n}),s("#wplng_dictionary_entries").val(JSON.stringify(a)),s("#submit").click())}),s("#wplng-new-cancel-button").click(function(){s("#wplng-section-entries-all").show(),s("#wplng-section-entry-new").hide(),window.scrollTo(0,0)}),s(".wplng-rule-link-remove").click(function(){let t=s(this).attr("wplng-rule"),n=[],i=0;a.forEach(e=>{i!=t&&n.push(e),i++}),s("#wplng_dictionary_entries").val(JSON.stringify(n)),s("#submit").click()}),s(".wplng-rule-link-edit").click(function(){var e=s(this).attr("wplng-rule"),t=a[e];s("#wplng-section-entries-all").hide(),s("#wplng-section-entry-edit").show(),n(s("#wplng-dictionary-entry-edit .wplng-adaptive-textarea")),s("#wplng-edit-source").val(t.source),s("#wplng-edit-save-button").prop("wplng-rule",e),null==t.rules?(s("#wplng-edit-never-translate").prop("checked",!0),s("#wplng-edit-rules").hide()):(s("#wplng-edit-never-translate").prop("checked",!1),s("#wplng-edit-rules").show(),s("#wplng-edit-rules textarea").val(""),s.each(t.rules,function(e,t){s("#wplng-edit-always-translate-"+e).val(t)})),window.scrollTo(0,0)}),s("#wplng-edit-never-translate").change(function(){this.checked?s("#wplng-edit-rules").slideUp("fast"):s("#wplng-edit-rules").slideDown("fast")}),s("#wplng-edit-save-button").click(function(){var e=s("#wplng-edit-source").val();let n={};var t=s(this).prop("wplng-rule");null!=e&&""!=e.trim()&&(s("#wplng-edit-never-translate").prop("checked")||s(".wplng-edit-rule").each(function(){var e=s(this).attr("wplng-rule"),t=s("textarea",this).val();null!=t&&""!=t.trim()&&(n[e]=t.trim())}),a.splice(t,1),0==Object.keys(n).length?a.push({source:e}):a.push({source:e,rules:n}),s("#wplng_dictionary_entries").val(JSON.stringify(a)),s("#submit").click())}),s("#wplng-edit-cancel-button").click(function(){s("#wplng-section-entries-all").show(),s("#wplng-section-entry-edit").hide(),window.scrollTo(0,0)});let e=s("textarea.wplng-adaptive-textarea");e.off("keyup.textarea").on("keyup.textarea",function(){n(s(this))}),s(window).resize(function(){e.each(function(){n(s(this))})}),e.each(function(){n(s(this))}),s(".wplng-dictionary-update-button-start").click(function(){let t=[];s(".wplng-dictionary-text-to-update-entry").each(function(){t.push({postId:s(this).data("post-id"),impactedLanguages:s(this).data("impacted-languages"),check:s(this).data("check"),$el:s(this)})}),0!==t.length&&(s(".wplng-dictionary-update-subsection-info").hide(),s(".wplng-dictionary-update-subsection-launch").hide(),s(".wplng-dictionary-update-subsection-info-progress").show(),s(".wplng-dictionary-update-ajax-error-message").remove(),function l(r){if(s(".wplng-dictionary-update-subsection-info-progress .wplng-count-processed").text(r),r>=t.length)s(".wplng-dictionary-update-subsection-info-progress").hide(),s(".wplng-dictionary-update-subsection-info-end").show();else{let a=t[r];a.$el.addClass("progress");var e="all"===a.impactedLanguages?"all":JSON.stringify(a.impactedLanguages);s.ajax({url:wplngDictionaryAjax.ajaxurl,method:"POST",data:{action:"wplng_dictionary_update_translations",nonce:wplngDictionaryAjax.nonce,post_id:a.postId,check:a.check,impacted_languages:e},success:function(e){e&&!0===e.success?(a.$el.removeClass("progress"),a.$el.addClass("done")):(a.$el.removeClass("progress"),a.$el.addClass("error"),e=e&&e.data&&e.data.message?e.data.message:wplngDictionaryAjax.errorMessageAjax,a.$el.find(".wplng-dictionary-update-ajax-error-message").remove(),a.$el.append('<div class="wplng-dictionary-update-ajax-error-message">'+s("<div>").text(e).html()+"</div>")),l(r+1)},error:function(e,t,n){var i=wplngDictionaryAjax.errorMessageAjax;a.$el.find(".wplng-dictionary-update-ajax-error-message").remove(),a.$el.append('<div class="wplng-dictionary-update-ajax-error-message">'+s("<div>").text(i).html()+"</div>"),a.$el.removeClass("progress"),a.$el.addClass("error"),l(r+1)}})}}(0))}),s(".wplng-dictionary-update-button-end, .wplng-dictionary-update-button-ignore").click(function(){s("#wplng-section-dictionary-update-translations").hide(),s("#wplng-section-entries-all").show()})});//# sourceMappingURL=option-page-dictionary.js.map
18