1// Version: 1.0.0 2(function ($) { 3 let maxWidth = 'max-w-7xl'; 4 const loader = '<div class="wbp-loading absolute inset-0 bg-white/50 backdrop-blur-[1px] flex items-center justify-center z-10">\n' + 5 ' <div role="status" class="flex items-center gap-3">\n' + 6 ' <svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin fill-blue-600"\n' + 7 ' viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">\n' + 8 ' <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"\n' + 9 ' fill="currentColor"></path>\n' + 10 ' <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"\n' + 11 ' fill="currentFill"></path>\n' + 12 ' </svg>\n' + 13 ' <span class="sr-only">Loading...</span>\n' + 14 ' </div>\n' + 15 ' </div>'; 16 $(document).ready(function () { 17 const popupHeader = '<div class="flex items-center justify-between p-6 border-b border-gray-100">' + 18 '<h2 id="wbp_popup_title" class="!text-xl !font-semibold text-gray-900 !m-0"></h2>' + 19 '<button data-target="close-popup" class="p-2 !border-0 text-gray-400 hover:text-gray-500 hover:bg-gray-100 rounded-lg transition-colors duration-200" aria-label="Close modal">' + 20 '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x w-5 h-5"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg></button></div>'; 21 22 let popupHtml = '<div id="popup" class="wbp-popup fixed inset-0 transition-all duration-300 opacity-0 pointer-events-none">'; 23 popupHtml += '<div class="fixed inset-0 bg-gray-900/50 backdrop-blur-sm transition-opacity animate-fade-in" aria-hidden="true"></div>'; 24 popupHtml += '<div class="flex min-h-full items-center justify-center p-4">'; 25 popupHtml += '<div class="wbp-popup-inner-wrap relative w-full min-h-[50vh] bg-white rounded-2xl shadow-xl transform transition-all duration-300 scale-95 translate-y-4 animate-scale-up overflow-hidden">'; 26 popupHtml += popupHeader; 27 popupHtml += '<div id="wbp_popup_content" class="transition-all duration-500 [transition-timing-function:cubic-bezier(0.68,-0.55,0.265,1.55)] max-h-0 overflow-hidden"></div>'; 28 popupHtml += '</div>'; 29 popupHtml += '</div>'; 30 popupHtml += '</div>'; 31 32 $('body').append(popupHtml); 33 const $popup = $('#popup'); 34 35 $(document).on('click', '[data-target="close-popup"]', function (e) { 36 e.stopPropagation(); 37 e.preventDefault(); 38 hideModal($(this).closest('.wbp-popup')); 39 $('body').removeClass('overflow-hidden'); 40 $('.settings-header').addClass('sticky'); 41 }); 42 43 }); 44 45 function showModal($modal) { 46 const $content = $modal.find('.wbp-popup-inner-wrap'); 47 $modal.removeClass('opacity-0 pointer-events-none').addClass('opacity-100 z-1000'); 48 $content.removeClass('scale-95 translate-y-4').addClass('scale-100 translate-y-0'); 49 } 50 51 function hideModal($modal) { 52 const $content = $modal.find('.wbp-popup-inner-wrap'); 53 $modal.removeClass('opacity-100 z-1000').addClass('opacity-0 pointer-events-none'); 54 $content.removeClass('scale-100 translate-y-0').addClass('scale-95 translate-y-4'); 55 } 56 57 $.fn.wbpPopup = function (config = {}) { 58 $('body').addClass('overflow-hidden'); 59 let $popup = null; 60 if (!config.ajaxUrl && !config.content) { 61 $popup = $(this); 62 } else { 63 $popup = $('#popup'); 64 const $content = $popup.find('#wbp_popup_content'); 65 $popup.find('.wbp-popup-inner-wrap').removeClass(maxWidth); 66 if (config.maxWidth) { 67 $popup.find('.wbp-popup-inner-wrap').addClass(config.maxWidth); 68 maxWidth = config.maxWidth; 69 } else { 70 $popup.find('.wbp-popup-inner-wrap').addClass('max-w-7xl'); 71 maxWidth = 'max-w-7xl'; 72 } 73 if (config.title) {
74 $popup.find('#wbp_popup_title').html(config.title); 75 } else { 76 $popup.find('#wbp_popup_title').html(''); 77 } 78 $content.removeClass('!max-h-[calc(100vh)]'); 79 if (config.content) { 80 $content.html($(config.content).html()); 81 $content.addClass('!max-h-[calc(100vh)]'); 82 } 83 84 if (config.autoHeight) { 85 $popup.find('.wbp-popup-inner-wrap').removeClass('min-h-[50vh]'); 86 } else { 87 $popup.find('.wbp-popup-inner-wrap').addClass('min-h-[50vh]'); 88 } 89 if (config.ajaxUrl) { 90 $.ajax({ 91 url: config.ajaxUrl, 92 data: config.data, 93 dataType: 'json', 94 beforeSend: function (xhr) { 95 if (config.nonce) { 96 xhr.setRequestHeader('X-WP-Nonce', config.nonce); 97 } 98 if (typeof config.beforeLoad === 'function') { 99 config.beforeLoad(); 100 } 101 $content.html(loader); 102 }, 103 success: function (response) { 104 if (response.title) { 105 $popup.find('#wbp_popup_title').html(response.title); 106 } 107 if (response.data) { 108 $content.html(response.data); 109 110 setTimeout(() => { 111 $content.addClass('!max-h-[calc(100vh)]'); 112 }, 10); 113 } 114 if (typeof config.afterLoad === 'function') { 115 config.afterLoad(); 116 } 117 } 118 }); 119 } 120 } 121 setTimeout(() => { 122 showModal($popup); 123 }, 200); 124 }; 125 126})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.