From 5dc8660a6178ae4150e44fd428994375727effc2 Mon Sep 17 00:00:00 2001 From: "adamlui@protonmail.com" Date: Thu, 14 Nov 2024 08:26:04 -0800 Subject: [PATCH] Shortened regex --- chatgpt.js | 4 ++-- docs/assets/js/min/onload-hacks.min.js | 2 +- docs/assets/js/src/onload-hacks.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chatgpt.js b/chatgpt.js index 9e94f95e0..80135320c 100644 --- a/chatgpt.js +++ b/chatgpt.js @@ -606,7 +606,7 @@ const chatgpt = { } else { // auto-save to file if (format == 'md') { // remove extraneous HTML + fix file extension - const mdMatch = /<.*(?:.*?)<[^/]/.exec(transcript)[1]; + const mdMatch = /<.*.*?<[^/]/.exec(transcript)[1]; transcript = mdMatch || transcript; filename = filename.replace('.html', '.md'); } const blob = new Blob([transcript], @@ -1255,7 +1255,7 @@ const chatgpt = { + 'opacity: 0 ; position: fixed ; z-index: 9999 ; font-size: 1.8rem ; color: white ;' // visibility + '-webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ;' + `transform: translateX(${ !notificationDiv.isRight ? '-' : '' }35px) ;` // init off-screen for transition fx - + ( shadow ? ( 'box-shadow: -8px 13px 25px 0 ' + ( /\b(?:shadow|on)\b/gi.test(shadow) ? 'gray' : shadow )) : '' ) + '}' + + ( shadow ? ( 'box-shadow: -8px 13px 25px 0 ' + ( /\b(?:shadow|on)\b/i.test(shadow) ? 'gray' : shadow )) : '' ) + '}' + '.notif-close-btn { cursor: pointer ; float: right ; position: relative ; right: -4px ; margin-left: -3px ;' + 'display: grid }' // top-align for non-OpenAI sites + '@keyframes notif-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }' // transition out keyframes diff --git a/docs/assets/js/min/onload-hacks.min.js b/docs/assets/js/min/onload-hacks.min.js index a49569346..df8a20108 100644 --- a/docs/assets/js/min/onload-hacks.min.js +++ b/docs/assets/js/min/onload-hacks.min.js @@ -1,3 +1,3 @@ let taglineWords=[],features=[">> Feature-rich",">> Object-oriented",">> Easy-to-use",">> Lightweight (yet optimally performant)"],visibilityMap=[],sectionColors=["#64ffff","#f9ee16","lime","orange","#b981f9","#f581f9","#81f9c3"],iniStarZvelocity=window.starVelocity.z,warpDuration=1600,hiWarpDuration=1400,starResetDelay=15,mdLoaded=new Promise(resolve=>{new MutationObserver((mutationsList,observer)=>{document.querySelector("#shields")&&(observer.disconnect(),resolve())}).observe(document.body,{childList:!0,subtree:!0})}),iObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{var key=entry.target.id||entry.target.className;if(visibilityMap[key]=entry.isIntersecting,"cover-main"===entry.target.className)if(entry.isIntersecting){document.querySelector("#kudoai a").style.color="white",window.starColor="white",(document.querySelector("#scrollbar-style")||{}).innerText=":root { scrollbar-color: rgb(210,210,210) #1a1a1a }body::-webkit-scrollbar-thumb { background-color: white }";let kudo=document.querySelector(".kudo");kudo.classList.add("hover"),setTimeout(()=>{kudo.classList.remove("hover")},955),Array.from(document.querySelectorAll('span[id^="tagline"]')).forEach(span=>{span.textContent=""}),scrambleText([taglineWords[0]],document.querySelector("#tagline-pre-adj")),scrambleText(taglineWords[1],document.querySelector("#tagline-adj"),750),scrambleText([taglineWords[2]],document.querySelector("#tagline-post-adj")),randomizeCase(document.querySelector("#tagline-pre-adj")),randomizeCase(document.querySelector("#tagline-post-adj")),window.starVelocity.z<=iniStarZvelocity&&(window.starVelocity.z+=.024,setTimeout(()=>{window.starVelocity.z-=.02},1155),setTimeout(()=>{window.starVelocity.z=iniStarZvelocity},1355))}else clearTimeout(scrambleText.timeoutID);else"feature-list"===entry.target.id&&(entry.isIntersecting?typeText(features,entry.target,20):(entry.target.innerHTML="",clearTimeout(typeText.timeoutID)))})}),onLoadObserver=new MutationObserver(()=>{if(document.querySelector(".cover-main blockquote p")){if(smoothScroll(document,155,9),/#\/(?:\w{2}(?:-\w{2})?\/)?$/.test(location.hash)){isMobileDevice()||(document.body.className="ready close");var taglineSpans=Array.from(document.querySelectorAll('span[id^="tagline"]'));taglineSpans.map(span=>{taglineWords.push(/pre|post/.exec(span.id)?span.textContent:span.textContent.split("|"))}),taglineSpans.forEach(span=>{span.textContent=""}),iObserver.observe(document.querySelector(".cover-main"));let cover=document.querySelector(".cover"),topGradient=document.createElement("div");function updateTGvisibility(){topGradient.style.display=window.scrollY>.85*cover.offsetHeight?"":"none"}topGradient.classList.add("top-gradient"),document.body.append(topGradient),updateTGvisibility(),mdLoaded.then(()=>{navigator.userAgent.includes("Chrome")&&window.scrollBy(0,200),setTimeout(()=>window.scrollBy(0,-200),600),document.querySelector(".search").style.display="none",document.querySelector(".sidebar-nav").style.paddingTop="102px";var featureListDiv=document.querySelector("#feature-list")||document.createElement("div"),introDiv=(featureListDiv.parentElement||(featureListDiv.setAttribute("id","feature-list"),(introDiv=document.querySelector("#intro")).parentElement.insertBefore(featureListDiv,introDiv.nextElementSibling.nextElementSibling)),iObserver.observe(featureListDiv),document.querySelector("article")),featureListDiv=document.createElement("div"),introDiv=(featureListDiv.id="copyright-footer",featureListDiv.innerHTML='Copyright © 2023–'+(new Date).getFullYear()+' KudoAI.
Designed by Adam Lui / Powered by Docsify / Hosted by GitHub',introDiv.append(featureListDiv),document.querySelector('a[href*="/assets/10906554/f53c740f-d5e0-49b6-ae02-3b3140b0f8a4"]')),featureListDiv=document.createElement("iframe"),introDiv=(featureListDiv.setAttribute("width","855"),featureListDiv.setAttribute("height","455"),featureListDiv.setAttribute("src","https://www.youtube.com/embed/yG8DtsEo0PM?rel=0"),featureListDiv.allow="web-share"+(navigator.userAgent.includes("Firefox")?"":"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"),featureListDiv.setAttribute("allowfullscreen",""),featureListDiv.style.minWidth="fit-content",featureListDiv.style.width="855px",featureListDiv.style.marginBottom="30px",introDiv.parentNode.replaceChild(featureListDiv,introDiv),featureListDiv.parentNode.style.textAlign="center",document.querySelectorAll("blockquote").forEach(blockquote=>{var parent=blockquote.parentNode,content=blockquote.innerHTML;parent.replaceChild(document.createRange().createContextualFragment(content),blockquote)}),[]),featureListDiv=[],fadeLeftElements=[],introDiv=(introDiv.push(...document.querySelectorAll(".cover-main img, .cover-main a,h2, h3, p, pre, main li,div#partners-collage, #copyright-footer")),introDiv.forEach(element=>{element.classList.add("content-fadeup")}),introDiv.push(document.querySelector("#language-menu")),introDiv[introDiv.length-1].classList.add("menu-fadeup"),featureListDiv.push(...document.querySelectorAll(`#showcase ~ h3:nth-of-type(odd):not(#contributors ~ *), #showcase ~ h3 + p:nth-of-type(odd):not(#contributors ~ *`)),featureListDiv.forEach(element=>{element.classList.add("content-faderight")}),fadeLeftElements.push(...document.querySelectorAll(`#showcase ~ h3:nth-of-type(even):not(#contributors ~ *), - #showcase ~ h3 + p:nth-of-type(even):not(#contributors ~ *`)),fadeLeftElements.forEach(element=>{element.classList.add("content-fadeleft")}),[...introDiv,...featureListDiv,...fadeLeftElements]);let sideNavItems=[...document.querySelectorAll(".sidebar-nav li")],fadeObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{var headingText;entry.isIntersecting?(entry.target.classList.add("visible"),entry.target.tagName.startsWith("H")&&(headingText=entry.target.querySelector("a").textContent,headingText=(document.querySelector(`a[title="${headingText}"]`)||{}).parentElement)&&(sideNavItems.forEach(item=>item.classList.remove("nav-active")),headingText.classList.add("nav-active"))):entry.target.classList.remove("visible")})},{root:null,threshold:.02});introDiv.forEach(element=>{fadeObserver.observe(element)});featureListDiv=document.querySelector('a[href$="stargazers"]'),fadeLeftElements=featureListDiv.getAttribute("href");featureListDiv.setAttribute("href",fadeLeftElements.replace("/stargazers",""));let triggerElements=[],triggerPoints=[],partnersCollage=(triggerElements.push(...document.querySelectorAll("h2")),triggerElements.push(document.querySelector("h3#-greasemonkey")),triggerElements.push(document.querySelector("h3#-chrome")),triggerElements.push(document.querySelector('img[src*="chatgpt-infinity"]')),triggerElements.forEach(element=>{var elementPos=element.getBoundingClientRect().top,element=element.id.includes("⚡")?1.5:"IMG"===element.tagName?.8:8.8;triggerPoints.push(elementPos-window.innerHeight/element)}),triggerPoints.sort((a,b)=>a-b),window.addEventListener("scroll",()=>{if(!visibilityMap["cover-main"]&&!visibilityMap["feature-list"]){let currentSection=0;for(;window.scrollY>triggerPoints[currentSection]&¤tSection{window.starVelocity.z<=iniStarZvelocity&&(window.starColor="white")},warpDuration+starResetDelay),window.starVelocity.z+=.0045,setTimeout(()=>{window.starVelocity.z=Math.max(iniStarZvelocity,window.starVelocity.z-.0025)},hiWarpDuration),setTimeout(()=>{window.starVelocity.z=Math.max(iniStarZvelocity,window.starVelocity.z-.002)},warpDuration);let kudoAIlogo=document.querySelector("#kudoai a"),kudo=document.querySelector(".kudo"),scrollbarStyle=(kudoAIlogo.style.color=sectionColor,kudo.classList.add("hover"),setTimeout(()=>{window.starVelocity.z<=iniStarZvelocity&&(kudoAIlogo.style.color="white",kudo.classList.remove("hover"))},warpDuration+5),document.querySelector("#scrollbar-style")||document.createElement("style"));scrollbarStyle.parentElement||(scrollbarStyle.setAttribute("id","scrollbar-style"),document.head.append(scrollbarStyle)),scrollbarStyle.innerText=`:root { scrollbar-color: ${sectionColor} #1a1a1a }`+`body::-webkit-scrollbar-thumb { background-color: ${sectionColor} }`,setTimeout(()=>{window.starVelocity.z<=iniStarZvelocity&&(scrollbarStyle.innerText=":root { scrollbar-color: rgb(210,210,210) #1a1a1a }body::-webkit-scrollbar-thumb { background-color: white }")},warpDuration+5)}}}),document.querySelectorAll("picture").forEach(picture=>{var srcSet=picture.querySelector("source").getAttribute("srcset"),imgElement=document.createElement("img");imgElement.setAttribute("src",srcSet),picture.parentNode.replaceChild(imgElement,picture)}),document.getElementById("partners-collage")),emailFooter=document.createElement("div");fetch("assets/html/footer.html").then(response=>response.text()).then(html=>{emailFooter.innerHTML=html,partnersCollage.insertAdjacentElement("afterend",emailFooter)});introDiv=[...document.querySelectorAll("a")].find(link=>link.textContent.includes("↑"));introDiv?.previousSibling.remove(),introDiv?.remove(),setTimeout(()=>{let parallaxTriggers=[];document.querySelectorAll('#main, h2:not([id="about"])').forEach(trigger=>{var y=trigger.getBoundingClientRect().top-window.innerHeight/1.2,trigger="H2"===trigger.tagName?trigger.parentElement:trigger;parallaxTriggers.push({element:trigger,y:y})}),window.addEventListener("scroll",()=>{updateTGvisibility(),parallaxTriggers.forEach(trigger=>{if(window.scrollY>=trigger.y&&window.scrollY{var topGap=trigger.y-window.scrollY,newOpacity=1-Math.abs(topGap)/(window.innerHeight-5),blurAmount=Math.min(4.5,Math.abs(topGap)/(window.innerHeight/4.5)),parallaxOffset=-.55*topGap,topGap=-285{var lang;for(lang of document.querySelectorAll("h5 a"))lang.href=lang.href.replace(/(.*\/\/.*?\/)((\w{2}(-\w{2})?\/)?.*)\.md/,"$1#/$2")})),onLoadObserver.disconnect()}});function isMobileDevice(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function validateIntArg(arg,name,defaultVal){if(void 0===arg)return defaultVal;if(Number.isInteger(arg)||/^\d+$/.test(arg))return parseInt(arg,10);throw new Error(name+" must be an integer.")}function smoothScroll(target,speed,smooth){target===document&&(target=document.scrollingElement||document.documentElement||document.body.parentNode||document.body);let moving=!1,pos=target.scrollTop,frame=target===document.body&&document.documentElement?document.documentElement:target;function scrolled(e){e.preventDefault();e=(e=>e.detail?e.wheelDelta?e.wheelDelta/e.detail/40*(0{delayBetweenWords&&visibilityMap["cover-main"]&&(scrambleText.timeoutID=setTimeout(()=>{scrambleText(text,destination,delayBetweenWords,(textIdx+1)%text.length)},delayBetweenWords))})}function randomizeCase(targetNode,iniDelay,finalDelay,incrementA,incrementB,inflectionPt){if(!targetNode?.nodeName)throw new Error("Target node (1st arg) must be a DOM element");iniDelay=validateIntArg(iniDelay,"Initial delay",5),finalDelay=validateIntArg(finalDelay,"Final delay",1e3),incrementA=validateIntArg(incrementA,"Increment A",10),incrementB=validateIntArg(incrementB,"Increment B",111),inflectionPt=validateIntArg(inflectionPt,"Inflection point",265),targetNode.textContent=targetNode.textContent.split("").map(letter=>Math.random()<.5?letter.toUpperCase():letter.toLowerCase()).join(""),randomizeCase.iniDelay=randomizeCase.iniDelay||iniDelay,randomizeCase.iniDelay+=randomizeCase.iniDelay{randomizeCase(targetNode,iniDelay,finalDelay,incrementA,incrementB,inflectionPt)},randomizeCase.iniDelay)}function typeText(txtToType,destination,typeDelay,iniTxtToType,iniTxtPos,linesToScrollAt){if("string"==typeof txtToType&&(txtToType=[txtToType]),!destination?.nodeName)throw new Error("Destination must be a DOM element");typeDelay=validateIntArg(typeDelay,"Typing delay",30),iniTxtToType=validateIntArg(iniTxtToType,"Initial text array index",0),iniTxtPos=validateIntArg(iniTxtPos,"Initial text string position",3),linesToScrollAt=validateIntArg(linesToScrollAt,"Lines to scroll at",5);let typeContent=" ",iniRow=Math.max(0,iniTxtToType-linesToScrollAt);for(;iniRow
";destination.innerHTML=typeContent+txtToType[iniTxtToType].substring(0,iniTxtPos)+"_",iniTxtPos++==txtToType[iniTxtToType].length?(iniTxtPos=0,++iniTxtToType!=txtToType.length&&(typeText.timeoutID=setTimeout(()=>{typeText(txtToType,destination,typeDelay,iniTxtToType,iniTxtPos)},88))):typeText.timeoutID=setTimeout(()=>{typeText(txtToType,destination,typeDelay,iniTxtToType,iniTxtPos)},typeDelay+220*Math.random()-110)}class Scramble{constructor(el){this.el=el,this.chars="!<>-_\\/[]{}—=+*^?#________",this.update=this.update.bind(this)}setText(newText){var oldText=this.el.innerText,length=Math.max(oldText.length,newText.length),promise=new Promise(resolve=>this.resolve=resolve);this.queue=[];for(let i=0;i=end?(complete++,output+=to):this.frame>=start?((!char||Math.random()<.28)&&(char=this.randomChar(),this.queue[i].char=char),output+=`${char}`):output+=from}this.el.innerHTML=output,complete===this.queue.length?this.resolve():(this.frameRequest=requestAnimationFrame(this.update),this.frame++)}randomChar(){return this.chars[Math.floor(Math.random()*this.chars.length)]}}let langMenu=document.getElementById("language-menu"),langSelector=document.getElementById("language-selector"),hideTimeout,fromUnhashedURL=(langSelector.onmouseover=langSelector.onmouseout=langMenu.onmouseover=langMenu.onmouseout=event=>{clearTimeout(hideTimeout),"mouseover"==event.type?langMenu.style.display="block":"mouseout"==event.type&&(hideTimeout=setTimeout(()=>langMenu.style.display="none",55))},document.querySelectorAll("#language-selector a").forEach(link=>{link.addEventListener("mouseenter",()=>{link.removeAttribute("title")})}),document.querySelectorAll(".dropdown-link").forEach(link=>{link.addEventListener("click",()=>langMenu.style.display="none")}),onLoadObserver.observe(document.body,{childList:!0,subtree:!0}),window.location.href.includes("#"));window.addEventListener("hashchange",()=>{fromUnhashedURL?(fromUnhashedURL,onLoadObserver.observe(document.body,{childList:!0,subtree:!0})):fromUnhashedURL=!0}); \ No newline at end of file + #showcase ~ h3 + p:nth-of-type(even):not(#contributors ~ *`)),fadeLeftElements.forEach(element=>{element.classList.add("content-fadeleft")}),[...introDiv,...featureListDiv,...fadeLeftElements]);let sideNavItems=[...document.querySelectorAll(".sidebar-nav li")],fadeObserver=new IntersectionObserver(entries=>{entries.forEach(entry=>{var headingText;entry.isIntersecting?(entry.target.classList.add("visible"),entry.target.tagName.startsWith("H")&&(headingText=entry.target.querySelector("a").textContent,headingText=(document.querySelector(`a[title="${headingText}"]`)||{}).parentElement)&&(sideNavItems.forEach(item=>item.classList.remove("nav-active")),headingText.classList.add("nav-active"))):entry.target.classList.remove("visible")})},{root:null,threshold:.02});introDiv.forEach(element=>{fadeObserver.observe(element)});featureListDiv=document.querySelector('a[href$="stargazers"]'),fadeLeftElements=featureListDiv.getAttribute("href");featureListDiv.setAttribute("href",fadeLeftElements.replace("/stargazers",""));let triggerElements=[],triggerPoints=[],partnersCollage=(triggerElements.push(...document.querySelectorAll("h2")),triggerElements.push(document.querySelector("h3#-greasemonkey")),triggerElements.push(document.querySelector("h3#-chrome")),triggerElements.push(document.querySelector('img[src*="chatgpt-infinity"]')),triggerElements.forEach(element=>{var elementPos=element.getBoundingClientRect().top,element=element.id.includes("⚡")?1.5:"IMG"===element.tagName?.8:8.8;triggerPoints.push(elementPos-window.innerHeight/element)}),triggerPoints.sort((a,b)=>a-b),window.addEventListener("scroll",()=>{if(!visibilityMap["cover-main"]&&!visibilityMap["feature-list"]){let currentSection=0;for(;window.scrollY>triggerPoints[currentSection]&¤tSection{window.starVelocity.z<=iniStarZvelocity&&(window.starColor="white")},warpDuration+starResetDelay),window.starVelocity.z+=.0045,setTimeout(()=>{window.starVelocity.z=Math.max(iniStarZvelocity,window.starVelocity.z-.0025)},hiWarpDuration),setTimeout(()=>{window.starVelocity.z=Math.max(iniStarZvelocity,window.starVelocity.z-.002)},warpDuration);let kudoAIlogo=document.querySelector("#kudoai a"),kudo=document.querySelector(".kudo"),scrollbarStyle=(kudoAIlogo.style.color=sectionColor,kudo.classList.add("hover"),setTimeout(()=>{window.starVelocity.z<=iniStarZvelocity&&(kudoAIlogo.style.color="white",kudo.classList.remove("hover"))},warpDuration+5),document.querySelector("#scrollbar-style")||document.createElement("style"));scrollbarStyle.parentElement||(scrollbarStyle.setAttribute("id","scrollbar-style"),document.head.append(scrollbarStyle)),scrollbarStyle.innerText=`:root { scrollbar-color: ${sectionColor} #1a1a1a }`+`body::-webkit-scrollbar-thumb { background-color: ${sectionColor} }`,setTimeout(()=>{window.starVelocity.z<=iniStarZvelocity&&(scrollbarStyle.innerText=":root { scrollbar-color: rgb(210,210,210) #1a1a1a }body::-webkit-scrollbar-thumb { background-color: white }")},warpDuration+5)}}}),document.querySelectorAll("picture").forEach(picture=>{var srcSet=picture.querySelector("source").getAttribute("srcset"),imgElement=document.createElement("img");imgElement.setAttribute("src",srcSet),picture.parentNode.replaceChild(imgElement,picture)}),document.getElementById("partners-collage")),emailFooter=document.createElement("div");fetch("assets/html/footer.html").then(response=>response.text()).then(html=>{emailFooter.innerHTML=html,partnersCollage.insertAdjacentElement("afterend",emailFooter)});introDiv=[...document.querySelectorAll("a")].find(link=>link.textContent.includes("↑"));introDiv?.previousSibling.remove(),introDiv?.remove(),setTimeout(()=>{let parallaxTriggers=[];document.querySelectorAll('#main, h2:not([id="about"])').forEach(trigger=>{var y=trigger.getBoundingClientRect().top-window.innerHeight/1.2,trigger="H2"===trigger.tagName?trigger.parentElement:trigger;parallaxTriggers.push({element:trigger,y:y})}),window.addEventListener("scroll",()=>{updateTGvisibility(),parallaxTriggers.forEach(trigger=>{if(window.scrollY>=trigger.y&&window.scrollY{var topGap=trigger.y-window.scrollY,newOpacity=1-Math.abs(topGap)/(window.innerHeight-5),blurAmount=Math.min(4.5,Math.abs(topGap)/(window.innerHeight/4.5)),parallaxOffset=-.55*topGap,topGap=-285{var lang;for(lang of document.querySelectorAll("h5 a"))lang.href=lang.href.replace(/(.*\/\/.*?\/)(.*)\.md/,"$1#/$2")})),onLoadObserver.disconnect()}});function isMobileDevice(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function validateIntArg(arg,name,defaultVal){if(void 0===arg)return defaultVal;if(Number.isInteger(arg)||/^\d+$/.test(arg))return parseInt(arg,10);throw new Error(name+" must be an integer.")}function smoothScroll(target,speed,smooth){target===document&&(target=document.scrollingElement||document.documentElement||document.body.parentNode||document.body);let moving=!1,pos=target.scrollTop,frame=target===document.body&&document.documentElement?document.documentElement:target;function scrolled(e){e.preventDefault();e=(e=>e.detail?e.wheelDelta?e.wheelDelta/e.detail/40*(0{delayBetweenWords&&visibilityMap["cover-main"]&&(scrambleText.timeoutID=setTimeout(()=>{scrambleText(text,destination,delayBetweenWords,(textIdx+1)%text.length)},delayBetweenWords))})}function randomizeCase(targetNode,iniDelay,finalDelay,incrementA,incrementB,inflectionPt){if(!targetNode?.nodeName)throw new Error("Target node (1st arg) must be a DOM element");iniDelay=validateIntArg(iniDelay,"Initial delay",5),finalDelay=validateIntArg(finalDelay,"Final delay",1e3),incrementA=validateIntArg(incrementA,"Increment A",10),incrementB=validateIntArg(incrementB,"Increment B",111),inflectionPt=validateIntArg(inflectionPt,"Inflection point",265),targetNode.textContent=targetNode.textContent.split("").map(letter=>Math.random()<.5?letter.toUpperCase():letter.toLowerCase()).join(""),randomizeCase.iniDelay=randomizeCase.iniDelay||iniDelay,randomizeCase.iniDelay+=randomizeCase.iniDelay{randomizeCase(targetNode,iniDelay,finalDelay,incrementA,incrementB,inflectionPt)},randomizeCase.iniDelay)}function typeText(txtToType,destination,typeDelay,iniTxtToType,iniTxtPos,linesToScrollAt){if("string"==typeof txtToType&&(txtToType=[txtToType]),!destination?.nodeName)throw new Error("Destination must be a DOM element");typeDelay=validateIntArg(typeDelay,"Typing delay",30),iniTxtToType=validateIntArg(iniTxtToType,"Initial text array index",0),iniTxtPos=validateIntArg(iniTxtPos,"Initial text string position",3),linesToScrollAt=validateIntArg(linesToScrollAt,"Lines to scroll at",5);let typeContent=" ",iniRow=Math.max(0,iniTxtToType-linesToScrollAt);for(;iniRow
";destination.innerHTML=typeContent+txtToType[iniTxtToType].substring(0,iniTxtPos)+"_",iniTxtPos++==txtToType[iniTxtToType].length?(iniTxtPos=0,++iniTxtToType!=txtToType.length&&(typeText.timeoutID=setTimeout(()=>{typeText(txtToType,destination,typeDelay,iniTxtToType,iniTxtPos)},88))):typeText.timeoutID=setTimeout(()=>{typeText(txtToType,destination,typeDelay,iniTxtToType,iniTxtPos)},typeDelay+220*Math.random()-110)}class Scramble{constructor(el){this.el=el,this.chars="!<>-_\\/[]{}—=+*^?#________",this.update=this.update.bind(this)}setText(newText){var oldText=this.el.innerText,length=Math.max(oldText.length,newText.length),promise=new Promise(resolve=>this.resolve=resolve);this.queue=[];for(let i=0;i=end?(complete++,output+=to):this.frame>=start?((!char||Math.random()<.28)&&(char=this.randomChar(),this.queue[i].char=char),output+=`${char}`):output+=from}this.el.innerHTML=output,complete===this.queue.length?this.resolve():(this.frameRequest=requestAnimationFrame(this.update),this.frame++)}randomChar(){return this.chars[Math.floor(Math.random()*this.chars.length)]}}let langMenu=document.getElementById("language-menu"),langSelector=document.getElementById("language-selector"),hideTimeout,fromUnhashedURL=(langSelector.onmouseover=langSelector.onmouseout=langMenu.onmouseover=langMenu.onmouseout=event=>{clearTimeout(hideTimeout),"mouseover"==event.type?langMenu.style.display="block":"mouseout"==event.type&&(hideTimeout=setTimeout(()=>langMenu.style.display="none",55))},document.querySelectorAll("#language-selector a").forEach(link=>{link.addEventListener("mouseenter",()=>{link.removeAttribute("title")})}),document.querySelectorAll(".dropdown-link").forEach(link=>{link.addEventListener("click",()=>langMenu.style.display="none")}),onLoadObserver.observe(document.body,{childList:!0,subtree:!0}),window.location.href.includes("#"));window.addEventListener("hashchange",()=>{fromUnhashedURL?(fromUnhashedURL,onLoadObserver.observe(document.body,{childList:!0,subtree:!0})):fromUnhashedURL=!0}); \ No newline at end of file diff --git a/docs/assets/js/src/onload-hacks.js b/docs/assets/js/src/onload-hacks.js index b4beb8c35..82b8f2e30 100644 --- a/docs/assets/js/src/onload-hacks.js +++ b/docs/assets/js/src/onload-hacks.js @@ -372,7 +372,7 @@ const onLoadObserver = new MutationObserver(() => { mdLoaded.then(() => { const docLangSelector = document.querySelectorAll('h5 a'); for (const lang of docLangSelector) - lang.href = lang.href.replace(/(.*\/\/.*?\/)((\w{2}(-\w{2})?\/)?.*)\.md/, '$1#/$2'); + lang.href = lang.href.replace(/(.*\/\/.*?\/)(.*)\.md/, '$1#/$2'); }); }