diff --git a/4chan_x.user.js b/4chan_x.user.js index 42e09c9a8..b816074f9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2531,13 +2531,18 @@ Options = { init: function() { - var a, settings, _i, _len, _ref; - _ref = [$.id('navtopr'), $.id('navbotr')]; + var a, el, settings, _i, _len, _ref; + _ref = ['navtopr', 'navbotr']; for (_i = 0, _len = _ref.length; _i < _len; _i++) { settings = _ref[_i]; - a = settings.firstElementChild; - a.textContent = '4chan X Settings'; + a = $.el('a', { + href: 'javascript:;', + textContent: '4chan X Settings' + }); $.on(a, 'click', Options.dialog); + el = $.id(settings).firstElementChild; + el.hidden = true; + $.before(el, a); } if (!$.get('firstrun')) { if (!Favicon.el) { @@ -2547,11 +2552,8 @@ return Options.dialog(); } }, - dialog: function(e) { + dialog: function() { var arr, back, checked, description, dialog, favicon, fileInfo, filter, hiddenNum, hiddenThreads, indicator, indicators, input, key, li, obj, overlay, sauce, time, tr, ul, _i, _len, _ref, _ref1, _ref2; - if (e != null) { - e.stopImmediatePropagation(); - } dialog = $.el('div', { id: 'options', className: 'reply dialog', diff --git a/script.coffee b/script.coffee index ba815e1e0..03bc4d6b8 100644 --- a/script.coffee +++ b/script.coffee @@ -1988,18 +1988,21 @@ QR = Options = init: -> - for settings in [$.id('navtopr'), $.id('navbotr')] - a = settings.firstElementChild - a.textContent = '4chan X Settings' + for settings in ['navtopr', 'navbotr'] + a = $.el 'a', + href: 'javascript:;' + textContent: '4chan X Settings' $.on a, 'click', Options.dialog + el = $.id(settings).firstElementChild + el.hidden = true + $.before el, a unless $.get 'firstrun' # Prevent race conditions Favicon.init() unless Favicon.el $.set 'firstrun', true Options.dialog() - dialog: (e) -> - e?.stopImmediatePropagation() + dialog: -> dialog = $.el 'div' id: 'options' className: 'reply dialog'