Skip to content

Instantly share code, notes, and snippets.

@judell
Created July 30, 2015 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save judell/6ec4af6392914e946d3b to your computer and use it in GitHub Desktop.
Save judell/6ec4af6392914e946d3b to your computer and use it in GitHub Desktop.
homepage vs dev env bookmarklets
Homepage:
javascript:(function(){window.hypothesisConfig=function(){return{showHighlights:true};};var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/app/embed.js');d.body.appendChild(s)})();
Dev env:
javascript:%28function %28window%2C document%2C location%29 %7B%0A var embedUrl %3D %27http%3A//localhost%3A5000/embed.js%27%3B%0A var isHTTPS %3D location.protocol.indexOf%28%27https%27%29 %3D%3D%3D 0%3B%0A var isEmbedHTTPS %3D embedUrl.indexOf%28%27https%27%29 %3D%3D%3D 0%3B%0A var isLocal %3D location.protocol %3D%3D%3D %27file%3A%27%3B%0A var isPDF %3D location.pathname.toLowerCase%28%29.indexOf%28%27.pdf%27%29 > 0%3B%0A var hasPDFjs %3D typeof window.PDFJS %21%3D%3D %27undefined%27%3B%0A var embed%3B%0A%0A if %28isLocal %26%26 %21isPDF%29 %7B%0A window.alert%28%27Sorry%2C Hypothesis doesn%5C%27t work on this type of file. Only PDF%5C%27s can be annotated locally.%27%29%3B%0A return%3B%0A %7D%0A if %28isPDF %26%26 %21hasPDFjs%29 %7B%0A window.alert%28%27Sorry%2C this bookmarklet doesn%5C%27t work with PDF documents. Please use one of our browser extensions or the Firefox browser.%27%29%3B%0A return%3B%0A %7D%0A if %28isHTTPS %26%26 %21isEmbedHTTPS%29 %7B%0A window.alert%28%27Sorry%2C but this bookmarklet is unavailable on pages served with HTTPS at this time. Please contact support for further assistance.%27%29%3B%0A return%3B%0A %7D%0A%0A window.hypothesisConfig %3D function %28%29 %7B%0A return %7BshowHighlights%3A true%7D%3B%0A %7D%3B%0A embed %3D document.createElement%28%27script%27%29%3B%0A embed.setAttribute%28%27src%27%2C embedUrl%29%3B%0A document.body.appendChild%28embed%29%3B%0A%7D%29%28this%2C this.document%2C this.location%29%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment