1 2document.addEventListener('DOMContentLoaded', initFavs); 3 4function initFavs () { 5 var favSpans = document.querySelectorAll('.adkfav-span'); 6 7 if(favSpans) { 8 for (let index = 0; index < favSpans.length; index++) { 9 const favSpan = favSpans[index]; 10 favSpan.addEventListener('click', handleFavsClick, true); 11 } 12 } 13} 14 15function handleFavsClick (event) { 16 // Do some check on target 17 if ( !event.target.classList.contains('page-numbers') ) { 18 event.stopPropagation(); 19 console.log('event.target', event.target); 20 } 21 22 if ( event.target.classList.contains('adkfav-link') ) { 23 event.preventDefault(); 24 var target = event.target; 25 var parent = target.closest('.js-adkfav-remove'); 26 console.log('target', target); 27 28 adkfav_do_js(target, 1); 29 if (parent) { 30 fadeOutEffect(parent); 31 } 32 return false; 33 } 34} 35 36function adkfav_do_js( target, doAjax ) { 37 loadingImg = target.nextSibling; 38 loadingImg.style.display = 'block'; 39 target.style.display = 'none'; 40 41 var location = document.location; 42 var url = location.protocol + '//' + location.host + location.pathname; 43 var params = target.dataset.action.replace('?', '') + '&ajax=1'; 44 console.log('params', url+params); 45 if ( doAjax ) { 46 var req = new XMLHttpRequest(); 47 req.open('GET', url + '?' + params, true); 48 req.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 49 req.onreadystatechange = function() { 50 51 if (this.readyState == 4 && this.status == 200) { 52 console.log('this.responseText', this.responseText) 53 target.parentNode.innerHTML = this.responseText; 54 if(typeof adkfav_after_ajax == 'function') { 55 adkfav_after_ajax( target ); 56 } 57 loadingImg.style.display = 'none'; 58 target.style.display = 'block'; 59 } 60 }; 61 req.send(); 62 } 63} 64 65function fadeOutEffect(target) { 66 var fadeEffect = setInterval(function () { 67 if (!target.style.opacity) { 68 target.style.opacity = 1; 69 } 70 if (target.style.opacity > 0) { 71 target.style.opacity -= 0.1; 72 } else { 73 clearInterval(fadeEffect); 74 } 75 }, 100); 76 var removeEffect = setTimeout(function () { 77 target.parentNode.removeChild(target); 78 }, 1200); 79}
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.