From 7c60cf3281b349241f442fec37591d414b649fad Mon Sep 17 00:00:00 2001 From: Forkless Date: Sat, 8 Nov 2014 22:17:33 -0600 Subject: [PATCH] Moved the Options tab stuff to be setup after the document is ready. --- js/comment-toolbar.js | 132 +++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/js/comment-toolbar.js b/js/comment-toolbar.js index 80993cb0..65bdc529 100644 --- a/js/comment-toolbar.js +++ b/js/comment-toolbar.js @@ -251,74 +251,74 @@ if (active_page == 'thread' || active_page == 'index') { // setup default rules for customizing if (!localStorage.formatText_rules) localStorage.formatText_rules = JSON.stringify(self.rules); - // Add settings to Options panel general tab - if (window.Options && Options.get_tab('general')) { - var s1 = '#formatText_keybinds>input', s2 = '#formatText_toolbar>input', e = 'change'; - Options.extend_tab('general', '\ -
\ - Formatting Options\ - \ - \ -
\ - '); - } else { - var s1 = '#formatText_keybinds', s2 = '#formatText_toolbar', e = 'click'; - $('hr:first').before('
'+ _('Enable formatting keybinds') +'
'); - $('hr:first').before('
'+ _('Show formatting toolbar') +'
'); - } - - // add the tab for customizing the format settings - if (window.Options && !Options.get_tab('formatting')) { - Options.add_tab('formatting', 'angle-right', 'Customize Formatting'); - Options.extend_tab('formatting', '\ - \ - '); - - // Data control row - Options.extend_tab('formatting', '\ - \ - \ - \ - \ - '); - - // Descriptor row - Options.extend_tab('formatting', '\ - Name\ - ML\ - EL\ - Prefix\ - Suffix\ - Key\ - '); - - // Rule rows - var rules = JSON.parse(localStorage.formatText_rules); - for (var index in rules){ - if (!rules.hasOwnProperty(index)) continue; - self.add_rule(rules[index], index); - } - } - // setup code to be ran when page is ready (work around for main.js compilation). $(document).ready(function(){ + // Add settings to Options panel general tab + if (window.Options && Options.get_tab('general')) { + var s1 = '#formatText_keybinds>input', s2 = '#formatText_toolbar>input', e = 'change'; + Options.extend_tab('general', '\ +
\ + Formatting Options\ + \ + \ +
\ + '); + } else { + var s1 = '#formatText_keybinds', s2 = '#formatText_toolbar', e = 'click'; + $('hr:first').before('
'+ _('Enable formatting keybinds') +'
'); + $('hr:first').before('
'+ _('Show formatting toolbar') +'
'); + } + + // add the tab for customizing the format settings + if (window.Options && !Options.get_tab('formatting')) { + Options.add_tab('formatting', 'angle-right', 'Customize Formatting'); + Options.extend_tab('formatting', '\ + \ + '); + + // Data control row + Options.extend_tab('formatting', '\ + \ + \ + \ + \ + '); + + // Descriptor row + Options.extend_tab('formatting', '\ + Name\ + ML\ + EL\ + Prefix\ + Suffix\ + Key\ + '); + + // Rule rows + var rules = JSON.parse(localStorage.formatText_rules); + for (var index in rules){ + if (!rules.hasOwnProperty(index)) continue; + self.add_rule(rules[index], index); + } + } + // setting for enabling formatting keybinds $(s1).on(e, function(e) { console.log('Keybind');