Skip to content

Instantly share code, notes, and snippets.

@tdebarochez
Last active December 19, 2015 12:29
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 tdebarochez/5955513 to your computer and use it in GitHub Desktop.
Save tdebarochez/5955513 to your computer and use it in GitHub Desktop.
Load your current web page source code in an ACE code editor. Bookmark it, now !
// Inspired by work from https://gist.github.com/jdkanani/4670615
javascript:var xmlHttp = new window.XMLHttpRequest(); xmlHttp.open( "GET", document.location.href, false ); xmlHttp.send( null ); var innerHTML=xmlHttp.responseText;document.location.href='data:text/html,<link rel="shortcut icon" href="http://g.etfv.co/http://www.sublimetext.com"/> <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");e.setValue(\''+escape(innerHTML.replace(/'/g, "\\'").replace(/(\r\n|\r|\n)/g, "'$1+'\\n").replace(/script/g, "scri'+'pt"))+'\');</script>';
// URL encoded for Firefox :
javascript:var%20xmlHttp%20=%20new%20window.XMLHttpRequest();%20xmlHttp.open(%20"GET",%20document.location.href,%20false%20);%20xmlHttp.send(%20null%20);%20var%20innerHTML=xmlHttp.responseText;document.location.href='data:text/html,<link%20rel="shortcut%20icon"%20href="http://g.etfv.co/http://www.sublimetext.com"/>%20<style%20type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div%20class="e"%20id="editor"></div><script%20src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"%20type="text/javascript"%20charset="utf-8"></script><script>var%20e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/javascript");e.setValue(\''+escape(innerHTML.replace(/'/g,%20"\\'").replace(/(\r\n|\r|\n)/g,%20"'$1+'\\n").replace(/script/g,%20"scri'+'pt"))+'\');</script>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment