1//newsletter 2const isEmail = (email) => 3 /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( 4 email 5 ); 6function getemail() { 7 return document.querySelector("#footeremail").value; 8} 9//requires 10//onsubmit="return false;" 11function subscribe(btn) { 12 const ad = getemail(); 13 if (!isEmail(ad)) return; 14 //send ad 15} 16function unsubscribe(btn) { 17 const ad = getemail(); 18 if (!isEmail(ad)) return; 19 //send ad 20} 21 22//videos 23function focusVid(index) { 24 const el = Array.prototype.slice.call( 25 document.querySelectorAll(".vids li") 26 )[index]; 27 if (document.querySelector(".activeVid")) 28 document.querySelector(".activeVid").classList.remove("activeVid"); 29 30 el.classList.add("activeVid"); 31 console.log(index); 32} 33function checkYoutubeClick(tar) { 34 if ( 35 tar.parentNode.parentNode.classList && 36 tar.parentNode.parentNode.classList.contains("labels") 37 ) { 38 if (document.querySelector(".activeLabel")) 39 document 40 .querySelector(".activeLabel") 41 .classList.remove("activeLabel"); 42 tar.classList.add("activeLabel"); 43 focusVid(tar.id); 44 } 45 if (tar.classList.contains("youtubePreviewMode")) { 46 //is either clicking on prevMiewode .vid OR a vid's .labels li 47 tar.classList.remove("youtubePreviewMode"); 48 } 49} 50 51//popups 52let popupClicked; //boolean, default: false 53function popup() { 54 return document.querySelector(".popup"); 55} 56function popupConditionsMet(e) { 57 const tar = (e && e.target) || e; 58 if (!e || !tar || !tar.classList) return false; 59 if (tar.classList.contains("popupLink") || tar.classList.contains("popup")) 60 return true; 61 return popupConditionsMet(tar.parentNode); 62} 63function clickPopupLabel() { 64 popupClicked = true; 65} 66 67//init 68let lastTarget; 69let didScroll; 70let startScrollY1 = 0; 71let startScrollY2 = 0; 72window.onload = function (e) { 73 //listen to events 74 75 //click 76 window.addEventListener("click", function (e) { 77 //youtube vids 78 checkYoutubeClick(e.target); 79 popupClicked = false; 80 }); 81 82 //touch 83 window.addEventListener("touchstart", function (e) { 84 startScrollY1 = window.scrollY; 85 startScrollY2 = document.querySelector(".changelog").scrollTop; 86 }); 87 window.addEventListener("touchmove", function (e) { 88 if ( 89 window.scrollY !== startScrollY1 || 90 document.querySelector(".changelog").scrollY !== startScrollY2 91 ) 92 didScroll = true; 93 startScrollY1 = window.scrollY; 94 startScrollY2 = document.querySelector(".changelog").scrollTop; 95 lastTarget = e.target; 96 }); 97 window.addEventListener("touchend", function (e) { 98 if (!didScroll) { 99 checkYoutubeClick(e.target); 100 showingPopup = false; 101 popup().classList.remove("showing"); 102 } 103 didScroll = false; 104 startScrollY2 = 0; 105 startScrollY1 = 0; 106 }); 107 108 //mousemove 109 //popups / tooltip 110 let showingPopup; 111 window.addEventListener("mousemove", function (e) { 112 if (popupConditionsMet(e)) { 113 if (!showingPopup) { 114 popup().classList.add("showing"); 115 showingPopup = true; 116 } 117 if (!popupClicked) { 118 const x = e.pageX - popup().offsetWidth / 2, 119 y = e.pageY - popup().offsetHeight - 1; 120 popup().style.top = y + "px"; 121 popup().style.left = (x < 0 ? 0 : x) + "px"; 122 } 123 } else { 124 if (showingPopup) { 125 popup().classList.remove("showing"); 126 showingPopup = false; 127 } 128 } 129 }); 130}; 131 132function addCurrentReleaseLabel() { 133 const currentRelease = document.createElement("strong"); 134 currentRelease.style.background = "rgb(83,158,219)"; 135 currentRelease.appendChild(document.createTextNode("(current release)")); 136 const releaseHeader = document.querySelector(".changelog ul h7"); 137 releaseHeader.appendChild(document.createTextNode("\u00A0")); 138 releaseHeader.appendChild(currentRelease); 139}
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.