PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / build / assets / dist / js / admin-shortcodes.js

admin-shortcodes.js in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at build/assets/dist/js/admin-shortcodes.js

1 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{let t,e;jQuery((function(o){const n=o(this);window.render_continue_button_title_field=function(){const t=o(".mce-txt",".mce-give-display-style").text();-1!==o.inArray(t,["- Select -","All Fields"])?o(".mce-give-continue-button-title").closest(".mce-container").hide():o(".mce-give-continue-button-title").closest(".mce-container").show()},window.scForm={open:function(e){const n=tinymce.get(e);if(!n)return;let i,c,s,r,d;i={action:"give_shortcode",shortcode:t},o.post(ajaxurl,i,(function(e){if(!e.body)return void console.error("Bad AJAX response!");if(0===e.body.length)return window.send_to_editor("["+e.shortcode+"]"),void scForm.destroy();o.each(e.body,(function(t,o){"display_style"===o.name&&(e.body[t].onselect=function(){render_continue_button_title_field()})}));const i={title:e.title,body:e.body,classes:"sc-popup",minWidth:320,buttons:[{text:e.ok,classes:"primary sc-primary",onclick:function(){d=n.windowManager.getWindows()[0],s=scShortcodes[t],r=!0;for(const t in s)if(s.hasOwnProperty(t)&&(c=d.find("#"+t)[0],void 0!==c&&""===c.state.data.value)){r=!1,new Give.modal.GiveErrorAlert({modalContent:{desc:s[t],cancelBtnTitle:Give.fn.getGlobalVar("ok")}}).render();break}r&&d.submit()}},{text:e.close,onclick:"close"}],onsubmit:function(t){let o="";for(const e in t.data)t.data.hasOwnProperty(e)&&""!==t.data[e]&&(o+=" "+e+'="'+t.data[e]+'"');window.send_to_editor("["+e.shortcode+o+"]")},onclose:function(){scForm.destroy()},onopen:function(){const t=o(".mce-sc-popup");t.css({width:t.width(),height:t.height(),overflow:"auto"}),render_continue_button_title_field()}};e.ok.constructor===Array&&(i.buttons[0].text=e.ok[0],i.buttons[0].onclick="close",delete i.buttons[1]),n.windowManager.open(i)}))},destroy:function(){const t=o("#scTemp");t.length&&(tinymce.get("scTemp").remove(),t.remove())}};const i=function(){void 0!==e&&e.removeClass("active").parent().find(".sc-menu").hide()};n.on("click",(function(t){o(t.target).closest(".sc-wrap").length||i()})),n.on("click",".sc-button",(function(t){t.preventDefault(),e=o(this),e.hasClass("active")?i():e.addClass("active").parent().find(".sc-menu").show()})),n.on("click",".sc-shortcode",(function(e){e.preventDefault(),t=o(this).attr("data-shortcode"),t?(tinymce.get(window.wpActiveEditor)?tinymce.execCommand("Give_Shortcode"):(o("#scTemp").length||(o("body").append('<textarea id="scTemp" style="display: none;" />'),tinymce.init({mode:"exact",elements:"scTemp",plugins:["give_shortcode","wplink"]})),setTimeout((function(){tinymce.execCommand("Give_Shortcode")}),200)),setTimeout((function(){i()}),100)):console.warn("That is not a valid shortcode link.")}))}))})();