diff --git a/acelet.bookmarklet b/acelet.bookmarklet index 2faccf3..74addb8 100644 --- a/acelet.bookmarklet +++ b/acelet.bookmarklet @@ -1,71 +1,12 @@ javascript:(function(){ - function encodeString(string) { - return encodeURIComponent(string - .replace(/\\/g,"\\\\") - .replace(/\"/g, '\\"') - .replace(/\n\r?/g, '\\n') - .replace(/%/g, 'U0025') - .replace(//g, '\\>') - .replace(/script/ig, 'scr\"\+\"ipt') - ); - } - var aceletValue = encodeString(window.getSelection().toString()); - window.open(' -data:text/html;charset=utf-8, -Acelet - - - -Syntax: -
- - - -', '_blank');}()); + var aceletTab = window.open('about:blank', 'Acelet'); + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.async = true; + script.onload = function(){ + aceletTab.location = acelet(); + aceletTab.focus(); + }; + script.src = 'acelet.min.js'; + document.body.appendChild(script); +}()); diff --git a/acelet.js b/acelet.js new file mode 100644 index 0000000..4eef0b8 --- /dev/null +++ b/acelet.js @@ -0,0 +1,72 @@ +function acelet() { + function encodeString(string) { + return encodeURIComponent(string + .replace(/\\/g,"\\\\") + .replace(/\"/g, '\\"') + .replace(/\n\r?/g, '\\n') + .replace(/%/g, 'U0025') + .replace(//g, '\\>') + .replace(/script/ig, 'scr\"\+\"ipt') + ); + } + var aceletValue = encodeString(window.getSelection().toString()); + return ' + data:text/html;charset=utf-8, + Acelet + + + + Syntax: +
+ + + + '; +} diff --git a/acelet.min.bookmarklet b/acelet.min.bookmarklet new file mode 100644 index 0000000..9724d7c --- /dev/null +++ b/acelet.min.bookmarklet @@ -0,0 +1 @@ +javascript:(function(){var aceletTab=window.open('about:blank', 'Acelet');var script=document.createElement('script');script.type='text/javascript';script.async=true;script.onload=function(){aceletTab.location=acelet();aceletTab.focus();};script.src='acelet.min.js';document.body.appendChild(script);}()); diff --git a/acelet.min.js b/acelet.min.js new file mode 100644 index 0000000..ccce562 --- /dev/null +++ b/acelet.min.js @@ -0,0 +1 @@ +function acelet(){function encodeString(string){return encodeURIComponent(string .replace(/\\/g,"\\\\") .replace(/\"/g, '\\"') .replace(/\n\r?/g, '\\n') .replace(/%/g, 'U0025') .replace(//g, '\\>') .replace(/script/ig, 'scr\"\+\"ipt') );}var aceletValue=encodeString(window.getSelection().toString());return ' data:text/html;charset=utf-8, AceletSyntax:
';} diff --git a/favicon.ico b/favicon.ico index c65eeab..00879f2 100644 Binary files a/favicon.ico and b/favicon.ico differ diff --git a/index.html b/index.html index 92d349c..765af6d 100644 --- a/index.html +++ b/index.html @@ -18,8 +18,9 @@ - Acelet -

tl;dr - Select some text/code. Press the button. Hack.

+ + Acelet +

tl;dr - Select some text/code. Push the button. Hack.

Ever wished you could just click to edit a code snippet? in the browser??

Acelet is a bookmarklet that allows you to edit selected text and code snippets in an advanced code editor, right in your browser.