Files
wp-multisite-waas/assets/js/view-logs.min.js
David Stone d88e50df38 Prep Plugin for release on WordPress.org (#23)
* Update translation text domain
* Escape everything that should be escaped.
* Add nonce checks where needed.
* Sanitize all inputs.
* Apply Code style changes across the codebase.
* Correct many deprecation notices.
* Optimize load order of many filters.
* Add Proper Build script
* Use emojii flags
* Fix i18n deprecation  notice for translating too early
* Put all scripts in footer and load async
2025-04-14 11:36:46 -06:00

2 lines
938 B
JavaScript

(t=>{t(document).ready(function(){wu_log_payload=new Vue({el:"#wu_payload",data(){return{payload:"",log:t("select[name=log_file]").val(),loading:!0}},watch:{log(){this.get_log_payload()}},methods:{get_log_payload(){let o=wu_block_ui("#wu_payload_content"),l=this;l.loading=!0,t.ajax({method:"post",url:ajaxurl,data:{action:"wu_handle_view_logs",file:l.log},success(e){l.payload=e.data.contents,l.loading=!1,o.unblock();try{history.pushState({},null,"?page=wp-ultimo-view-logs&log_file="+l.log)}catch(e){console.warn("Browser does not support pushState.",e)}}})}},mounted(){this.get_log_payload()}}),t(document).on("change","select[name=log_file]",function(){wu_log_payload.log=t("select[name=log_file]").val()}),new ClipboardJS(".btn-clipboard").on("success",function(e){let o=t(e.trigger),l=o.text();o.attr("disabled","disabled").text(wu_view_logs.i18n.copied),setTimeout(function(){o.text(l).removeAttr("disabled")},3e3)})})})(jQuery);