Last active
November 15, 2022 19:07
-
-
Save sylbru/ef963f0dceb7f0026978b69a4dd7b805 to your computer and use it in GitHub Desktop.
Elm detector (bookmarklet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(async function(){let elmDetected;if(typeof window.Elm==="object"){elmDetected=true}else{let scriptTags=document.scripts;let scriptIsElm=script=>script.match(/throw (new )?Error\([\'\"]https:\/\/github\.com\/elm\/core\/blob\/1\.0\.0\/hints\//);for(scriptTag of scriptTags){let scriptContents;if(!scriptTag.src){scriptContents=scriptTag.textContent}else{await fetch(scriptTag.src).then(response=>response.text()).then(text=>scriptContents=text).catch(err=>{console.error(err); scriptContents=null;})}if(scriptContents===null){continue;}if(scriptIsElm(scriptContents)){elmDetected=true;break}}}if(elmDetected){alert("%F0%9F%8C%B3 Yep, seems to be an Elm app! \\o/ %F0%9F%8C%B3")}else{alert("Nope, doesn%E2%80%99t seem to be Elm (but I might be wrong).")}})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment