// ==UserScript== // @name gist-editor-resize-userscript // @namespace https://gist.github.com/ // @version 0.1 // @description Automatically resize the gist editor for easier editing. // @match http*://gist.github.com/* // @copyright 2013+ Joel Day - blog.dayjo.org // ==/UserScript== var textareas = document.querySelectorAll('textarea.file_contents'); var span = document.createElement('div'); span.style.visibility = "hidden"; document.body.appendChild(span); $('textarea.file-contents').keyup(function(){ span.style.width = this.offsetWidth + 'px'; span.style.fontSize = this.style.fontSize; span.innerText = this.value; this.style.height = span.offsetHeight + 'px'; });