diff options
Diffstat (limited to 'share/www/script/futon.js')
-rw-r--r-- | share/www/script/futon.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/share/www/script/futon.js b/share/www/script/futon.js index f6b1d9f6..31f04a90 100644 --- a/share/www/script/futon.js +++ b/share/www/script/futon.js @@ -159,6 +159,26 @@ }); } + $.fn.enableTabInsertion = function(chars) { + chars = chars || "\t"; + var width = chars.length; + return this.keydown(function(evt) { + if (evt.keyCode == 9) { + var v = this.value; + var start = this.selectionStart; + var scrollTop = this.scrollTop; + if (start !== undefined) { + this.value = v.slice(0, start) + chars + v.slice(start); + this.selectionStart = this.selectionEnd = start + width; + } else { + document.selection.createRange().text = chars; + this.caretPos += width; + } + return false; + } + }); + } + $(document) .ajaxStart(function() { $(this.body).addClass("loading"); }) .ajaxStop(function() { $(this.body).removeClass("loading"); }); |