1jQuery(document).ready(function ($) { 2 3 let psWidth = '100%'; 4 5 if ($(window).width() < 530) { 6 psWidth = '100%'; 7 } else { 8 psWidth = '530px'; 9 } 10 11 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¾ÑкÑÑÑÐ¸Ñ iframe 12 function openIframe() { 13 14 if ($('#profsalon-container').length > 0) { 15 $('#profsalon-container').remove(); 16 $('body').removeAttr('style'); 17 } 18 19 const iframeContainer = $('<div>', { 20 id: 'profsalon-container', 21 css: { 22 position: 'fixed', 23 top: 0, 24 right: 0, 25 width: psWidth, 26 height: '100%', 27 backgroundColor: '#fff', 28 zIndex: 99999, 29 overflow: 'hidden', 30 boxShadow: '0px 0px 20px rgba(0, 0, 0, 0.5)' 31 } 32 }); 33 34 const closeBtn = $('<button>', { 35 text: 'Ã', 36 css: { 37 position: 'absolute', 38 top: '0px', 39 right: '0px', 40 width: '40px', 41 height: '40px', 42 border: 'none', 43 backgroundColor: '#333', 44 color: '#ddd', 45 fontSize: '31px', 46 lineHeight: '1', 47 cursor: 'pointer', 48 borderRadius: '0px', 49 zIndex: 100000 50 } 51 }); 52 53 const iframe = $('<iframe>', { 54 id: 'profsalon_iframe_custom', 55 src: 'https://profsalon.org/booking/salonzabava/main?skip_places=true&version=v3&online_booking_app_url=https://profsalon.org/booking&start_host=https://salonzabava.ru&show_close_btn=true', 56 css: { 57 width: '100%', 58 height: '100%', 59 border: 'none' 60 }, 61 scrolling: 'yes', 62 frameborder: '0', 63 zIndex: 99998 64 }); 65 66 iframeContainer.append(iframe).append(closeBtn); 67 $('body').append(iframeContainer).css('overflow', 'hidden'); 68 69 closeBtn.on('click', function () { 70 closeIframe(); 71 }); 72 } 73 74 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð·Ð°ÐºÑÑÑÐ¸Ñ iframe 75 function closeIframe() { 76 $('#profsalon-container').remove(); 77 $('body').removeAttr('style'); 78 79 // ÐозвÑаÑаем пÑедÑдÑÑий URL 80 if (window.history.state && window.history.state.previousUrl) { 81 window.history.pushState({}, '', window.history.state.previousUrl); 82 } else { 83 window.history.pushState({}, '', window.location.pathname.replace('/online-record/', '')); 84 } 85 } 86 87 // ÐбÑабоÑÑик клика по кнопке 88 $('.ps-btn-custom-custom').on('click', function (e) { 89 e.preventDefault(); 90 91 // Ð¡Ð¾Ñ ÑанÑем ÑекÑÑий URL и менÑем на /online-record/ 92 const currentUrl = window.location.pathname; 93 window.history.pushState({ previousUrl: currentUrl }, '', '/online-record/'); 94 95 openIframe(); 96 }); 97 98 // ÐбÑабоÑÑик клика вне iframe Ð´Ð»Ñ ÐµÐ³Ð¾ закÑÑÑÐ¸Ñ 99 $(document).on('click', function (e) { 100 // ÐÑовеÑÑем, оÑкÑÑÑ Ð»Ð¸ iframe 101 if ($('#profsalon-container').length > 0) { 102 // ÐÑовеÑÑем, ÑÑо клик пÑоизоÑел не по iframe и не по кнопке оÑкÑÑÑÐ¸Ñ 103 if (!$(e.target).closest('#profsalon-container').length && 104 !$(e.target).closest('.ps-btn-custom-custom').length) { 105 closeIframe(); 106 } 107 } 108 }); 109 110 // ÐÑовеÑÑем URL пÑи загÑÑзке ÑÑÑаниÑÑ 111 if (window.location.pathname === '/online-record/' || window.location.pathname === '/online-record') { 112 openIframe(); 113 } 114 115 // ÐбÑабоÑка кнопки "Ðазад" в бÑаÑзеÑе 116 window.addEventListener('popstate', function(event) { 117 if ($('#profsalon-container').length > 0) { 118 $('#profsalon-container').remove(); 119 $('body').removeAttr('style'); 120 } else if (window.location.pathname === '/online-record/' || window.location.pathname === '/online-record') { 121 openIframe(); 122 } 123 });
124 125});
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.