From 1ac0315734ad5e7e5cd176efab2bf784623b6181 Mon Sep 17 00:00:00 2001 From: noface Date: Tue, 11 Dec 2012 11:52:51 +0100 Subject: [PATCH] Remove default settings button when 'Disable 4chan\'s extension' is enabled. --- 4chan_x.user.js | 9 +++++++-- script.coffee | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 31f1bf014..20647b02b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2696,7 +2696,7 @@ return $.ready(Options.initReady); }, initReady: function() { - var a, settings, _i, _len, _ref; + var a, setting, settings, _i, _len, _ref; _ref = ['navtopright', 'navbotright']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { settings = _ref[_i]; @@ -2706,7 +2706,12 @@ textContent: '4chan X Settings' }); $.on(a, 'click', Options.dialog); - $.prepend($.id(settings), [$.tn('['), a, $.tn('] ')]); + setting = $.id(settings); + if (Conf['Disable 4chan\'s extension']) { + $.replace(setting.childNodes[1], a); + continue; + } + $.prepend(setting, [$.tn('['), a, $.tn('] ')]); } if (!$.get('firstrun')) { $.set('firstrun', true); diff --git a/script.coffee b/script.coffee index 405328d7e..0f33a5a8d 100644 --- a/script.coffee +++ b/script.coffee @@ -2148,7 +2148,11 @@ Options = className: 'settingsWindowLink' textContent: '4chan X Settings' $.on a, 'click', Options.dialog - $.prepend $.id(settings), [$.tn('['), a, $.tn('] ')] + setting = $.id settings + if Conf['Disable 4chan\'s extension'] + $.replace setting.childNodes[1], a + continue + $.prepend setting, [$.tn('['), a, $.tn('] ')] unless $.get 'firstrun' $.set 'firstrun', true # Prevent race conditions