diff options
author | Joakim Reinert <mail@jreinert.com> | 2015-04-19 00:40:45 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-05 12:21:27 +0200 |
commit | 645ac23ebea2ff1fe6f585a4f8fea27c3928be0e (patch) | |
tree | 48a7a74ef530fbb2004fce50115505259cce1177 /data/js/util.js | |
parent | fe68477d8b60bc9303dd2bcd542915ac05e3fac6 (diff) |
Refactor tab width input
Diffstat (limited to 'data/js/util.js')
-rw-r--r-- | data/js/util.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/data/js/util.js b/data/js/util.js index 810bc4167..6c88edb2d 100644 --- a/data/js/util.js +++ b/data/js/util.js @@ -27,6 +27,22 @@ define(['jquery'], function () { } PrivateFunctions.highlightLine(hash); + }, + focusDropdownInput: function (target) { + setTimeout(function () { + var dropDown = $(target).siblings('.dropdown-menu'); + dropDown.find('input').trigger('focus'); + }, 0); + }, + setTabwidth: function (value) { + value = value || 8; + $('span.tabwidth-value').html(value); + $('.tabwidth-form input').val(value); + $('.highlight pre').css('tab-size', value); + localStorage.setItem('tabwidth', value); + }, + setTabwidthFromLocalStorage: function () { + this.setTabwidth(localStorage.getItem('tabwidth')); } }; return Util; |