diff options
| author | James Campos <james.r.campos@gmail.com> | 2014-10-05 16:20:25 -0700 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-10-07 03:27:36 +0200 |
| commit | f1b89a5302dbb5016b3ac02b68b1111c99e25dd5 (patch) | |
| tree | 764ae05e1a0067465d7e3314e2c38a67536160c8 /js | |
| parent | 1e04f29485583cd1b85276b2fbfeb47f51473e30 (diff) | |
optional
Diffstat (limited to 'js')
| -rw-r--r-- | js/inline.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/js/inline.js b/js/inline.js index bcbf156f..5399e871 100644 --- a/js/inline.js +++ b/js/inline.js @@ -11,6 +11,37 @@ App.cache[url] = $page cb($page) }) + }, + options: { + add: function(key, description, tab) { + tab || (tab = 'general') + + var checked = App.options.get(key) + var $el = $( + '<div>' + + '<label>' + + '<input type="checkbox">' + + description + + '</label>' + + '</div>') + + $el + .find('input') + .prop('checked', checked) + .on('change', App.options.check(key)) + + window.Options.extend_tab(tab, $el) + }, + get: function(key) { + if (localStorage[key]) + return JSON.parse(localStorage[key]) + }, + check: function(key) { + return function(e) { + var val = this.checked + localStorage[key] = JSON.stringify(val) + } + } } } @@ -70,6 +101,11 @@ $clone.insertAfter(link.node) } + App.options.add('inline', 'Inline quoted posts') + + if (!App.options.get('inline')) + return + $('head').append( '<style>' + '.inline {' + |
