window.loadScript = function(el){ // Vendor path is not empty if (a4bjs.vendorJsPath !== '') { // jQuery.getScript(a4bjs.appJsPath) // jQuery.getScript(a4bjs.vendorJsPath, function(){ // el.click(); // }) jQuery.when( jQuery.getScript(a4bjs.appJsPath), jQuery.getScript(a4bjs.vendorJsPath), ).done(function(){ el.click(); }); } else { jQuery.getScript(a4bjs.appJsPath, function(){ el.click(); }) } // jQuery.getScript(a4bjs.pluginUrl +"public/dist/js/app.js") // jQuery.getScript(a4bjs.pluginUrl +"public/dist/js/chunk-vendors.js", function(){ // el.click(); // }) // var script1 = document.createElement('script'); // var script2 = document.createElement('script'); // script1.src = a4bjs.appJsPath; // if (a4bjs.vendorJsPath !== '') { // script2.src = a4bjs.vendorJsPath; // } // // document.head.appendChild(script2); // document.head.appendChild(script1); // script1.onload = function () { // alert('onload'); // script2.onload = function () { // alert('onload2'); // // }; // }; } jQuery(document).ready(function () { var menu = jQuery('#toplevel_page_wpbcu-barcode-generator a') menu.click(function(e){ e.preventDefault(); menu.off('click'); loadScript(this); return false; }) })