1function modalClose(cont) { 2 cont.addClass('zs-modal-popup--hide'); 3 4 setTimeout(() => { 5 cont.remove(); 6 }, 1000); 7} 8 9function modalCreate(content, callback, templateName) { 10 const text = $('<div>', {class: 'zs-modal-popup__text'}).append(content); 11 const modal = $('<div>', { 12 class: `zs-modal-popup zs-modal-popup--hide ${templateName}` 13 }).append( 14 $('<div>', { 15 class: 'zs-modal-popup__item' 16 }).append( 17 $('<div>', { 18 class: 'zs-modal-popup__modalent' 19 // css: { width: param.width || '' }, 20 }) 21 // .append($('<div>', { class: 'zs-modal-popup__close' })) 22 .append( 23 '<svg class="zs-modal-popup__close" className="icon header-content_menu-phone__popup-close">' + 24 '<use xlink:href="/local/templates/zs_2022/assets/images/sprite.svg#close"></use>' + 25 '</svg>' 26 ).append(text) 27 ) 28 ); 29 30 $("body .site").append(modal); 31 32 // modal.find('.zs-modal-popup__close').click(() => { 33 // modalClose(modal); 34 // }); 35 $(document).on('click', '.zs-modal-popup__close', () => { 36 modalClose(modal) 37 }) 38 if (typeof callback === 'function') { 39 callback(text); 40 } 41 modal.removeClass('zs-modal-popup--hide'); 42 return modal; 43} 44 45function modalGet(e) { 46 e.preventDefault(); 47 48 const type = this.dataset.type; 49 const path = '/local/ajax/ajax_core.php'; 50 const params = new URLSearchParams(this.dataset).toString(); 51 const templateName = this.dataset.template; 52 53 fetch(path, { 54 method: 'POST', 55 headers: { 56 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' 57 }, 58 body: params 59 }).then((response) => response.text()).then((result) => { 60 let modal = modalCreate(result, null, templateName); 61 62 if (type === 'form') { 63 const container = modal.find('.form-container'); 64 initForm(container); 65 } 66 }); 67 68 return false; 69} 70 71$(function() { 72 73 $('.modal-button').on('click', modalGet); 74 const cont = '.zs-modal-popup'; 75 //const pop = '.zs-modal-popup__modalent'; 76 const pop = '.ajax_cont_form'; 77 const pop2 = ".zs-modal-popup__content"; 78 79 $(document).on('click', (event) => { 80 if ($(event.target).closest(pop).length) return; 81 if ($(event.target).closest(pop2).length) return; 82 modalClose($(cont)); 83 event.stopPropagation(); 84 }); 85});
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.