SHOW:
|
|
- or go back to the newest paste.
| 1 | data:text/html, <html> | |
| 2 | <style type="text/css"> | |
| 3 | - | #div{position:absolute;
|
| 3 | + | body{overflow:hidden;}
|
| 4 | - | top:0px; |
| 4 | + | #iframe{display:none;}
|
| 5 | - | left:0px; |
| 5 | + | #div{position:absolute;top:0px;left:0px;width:100%;height:10000px;}
|
| 6 | - | width:100%; |
| 6 | + | #saveButton{z-index:2;position:absolute;top:0px;right:0px;}
|
| 7 | - | height:10000px; |
| 7 | + | |
| 8 | <script> | |
| 9 | - | body{overflow:hidden;}
|
| 9 | + | function save(){
|
| 10 | - | #saveButton{z-index:2;position:absolute;top:0px;right:0px;}
|
| 10 | + | var note = document.getElementById('div').innerHTML;
|
| 11 | - | iframe{width:0; height:0; padding:0;margin:0;border:0;}
|
| 11 | + | note = note.replace(/(<div><br>)*<\/div>/g, '\n'); |
| 12 | note = note.replace(/<div>/g, ''); | |
| 13 | /* replaces some html entities */ | |
| 14 | - | var lastKey = ""; |
| 14 | + | note = note.replace(/ /g, ' '); |
| 15 | - | var keyCount = 0; |
| 15 | + | note = note.replace(/&/g, '&'); |
| 16 | - | function keyPressed(e){
|
| 16 | + | note = note.replace(/</g, '<'); |
| 17 | - | var code; |
| 17 | + | note = note.replace(/>/g, '>'); |
| 18 | - | if(window.event){code = e.keyCode;}
|
| 18 | + | document.getElementById('saveButton').setAttribute(
|
| 19 | - | else{code = e.which;}
|
| 19 | + | 'href', |
| 20 | 'data:Content-type: text/plain, ' + escape(note) | |
| 21 | - | function greeting(){
|
| 21 | + | ); |
| 22 | - | var note = document.getElementById("div").innerHTML;
|
| 22 | + | |
| 23 | - | note = note.replace("data:Content-type: application/octet-stream, Content-Disposition: attachment; filename='note.txt', text/plain, <html contenteditable>", "");
|
| 23 | + | |
| 24 | - | var regex = /(<([^>]+)>)/ig; |
| 24 | + | <a id="saveButton" target="iframe" download="note.txt" href="#" onclick="save();">Save</a> |
| 25 | - | note = note.replace(regex, ""); |
| 25 | + | |
| 26 | - | note = note.replace(" ", "");
|
| 26 | + | <div contenteditable id="div"></div> |
| 27 | - | document.getElementById("iframe").setAttribute("src",
|
| 27 | + |