1jQuery(function ($) { 2 3 function sendClick(postId) { 4 if (!postId || !SDK_MEDIATEQUE || !SDK_MEDIATEQUE.ajaxurl) return; 5 6 const data = new URLSearchParams(); 7 data.append('action', 'mediateque_click'); 8 data.append('post_id', postId); 9 data.append('nonce', SDK_MEDIATEQUE.nonce); 10 11 // sendBeacon макÑималÑно надежен Ð´Ð»Ñ ÑлÑÑаев, когда ÑÑÐ°Ð·Ñ ÑÑ Ð¾Ð´Ð¸Ð¼ по ÑÑÑлке / ÑкаÑиваем Ñайл 12 if (navigator.sendBeacon) { 13 const blob = new Blob([data.toString()], { type: 'application/x-www-form-urlencoded; charset=UTF-8' }); 14 navigator.sendBeacon(SDK_MEDIATEQUE.ajaxurl, blob); 15 return; 16 } 17 18 // fallback 19 fetch(SDK_MEDIATEQUE.ajaxurl, { 20 method: 'POST', 21 headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, 22 body: data.toString(), 23 keepalive: true 24 }).catch(() => {}); 25 } 26 27 $(document).on('click', '.mediateque-list__item-button', function () { 28 const postId = $(this).data('post-id'); 29 if (postId) sendClick(postId); 30 }); 31 32});
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.