Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(d) {
- d.open();
- d.write('<textarea id="input" spellcheck="false" style="flex:1;height:100%;resize:none;outline:none;font:15px monospace;color:#fff;background:#111;padding:10px;"><html>\n<head></head>\n<body>\nClick here to render\n</body>\n</html></textarea>');
- d.write('<iframe id="iframe" style="flex:1;height:100%;"></iframe>');
- d.close();
- var s = d.body.style;
- s.display = 'flex';
- s.margin = 0;
- var i = d.getElementById('input');
- i.onkeydown = function(e) {
- if ((e.keyCode || e.which) != 9) {
- return;
- }
- e.preventDefault();
- var s = this.selectionStart;
- this.value = this.value.substring(0, s) + " " + this.value.substring(this.selectionEnd);
- this.selectionEnd = s + 2;
- };
- i.select();
- var ifr = d.getElementById('iframe');
- i.addEventListener('click', function() {
- var idoc = ifr.contentWindow.document;
- idoc.open();
- idoc.write(i.value);
- idoc.close();
- });
- d.title = 'Textarea';
- }(document));
Add Comment
Please, Sign In to add comment