1/** 2 * Addes onclick attribute to links 3 * @param {*} newcontainer 4 */ 5function addTouchDelayToLinks(newcontainer) { 6 var projectLinks = newcontainer.querySelectorAll(".portfolio-grid .grid-item a, .press-grid .grid-item a"); 7 if (projectLinks !== null && projectLinks.length > 0) { 8 projectLinks.forEach(function (link) { 9 var href = link.href; 10 link.removeAttribute("href"); 11 link.setAttribute("onclick", `delayProjectClick(this, ' ${href}');`); 12 }); 13 } 14} 15 16/** 17 * Creates a "double click" event 18 * @param {*} link - Anchor tag element 19 * @param {*} href - href of anchor tag 20 */ 21function delayProjectClick(link, href) { 22 if (link.classList.contains("touch-active")) { 23 window.location = href; 24 } else { 25 var alreadyActive = document.querySelectorAll(".touch-active"); 26 alreadyActive.forEach(function (active) { 27 active.classList.remove("touch-active"); 28 setTimeout(function () { 29 active.removeAttribute("href"); 30 }, 100); 31 }); 32 link.classList.add("touch-active"); 33 setTimeout(function () { 34 link.setAttribute("href", href); 35 }, 100); 36 } 37}
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.