customizer-features-popup.js (1377B)
1 (function (root, CP_Customizer, $) { 2 CP_Customizer.addModule(function (CP_Customizer) { 3 var popup = CP_Customizer.options('featuresPopup', null); 4 var containerID = "cp_feauture_popups_" + Math.round(Math.random() * 10000); 5 var $container = $("<div/>", { 6 id: containerID, 7 style: "display:none" 8 }); 9 10 if (popup) { 11 $container.append(popup.content); 12 CP_Customizer.one(CP_Customizer.events.PREVIEW_LOADED, function () { 13 $('body').append($container); 14 var $tbWindow = CP_Customizer.popUp(popup.title || 'New Feature', containerID, popup.data || { 15 class: "ocdie-tbWindow" 16 }); 17 $tbWindow.find('[id=TB_closeWindowButton]').off('click.feature_popup').on('click.feature_popup', function (event) { 18 jQuery.post( 19 ajaxurl, 20 { 21 value: '1', 22 action: "companion_disable_popup", 23 option: 'feature_popup_' + popup.id + '_disabled', 24 companion_disable_popup_wpnonce: popup.nonce 25 } 26 ); 27 }); 28 }); 29 } 30 31 }); 32 33 })(window, CP_Customizer, jQuery);