From 6f94156cd8c17c81e006af69a1f6fb3a3982c55b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Tue, 10 Jul 2012 23:34:44 +0200 Subject: [PATCH] Don't break 4chan's script. --- 4chan_x.user.js | 16 ++++++++-------- script.coffee | 11 +++++------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 87a7b9a24..657be1609 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2531,16 +2531,13 @@ Options = { init: function() { - var a, home, _i, _len, _ref; + var a, settings, _i, _len, _ref; _ref = [$.id('navtopr'), $.id('navbotr')]; for (_i = 0, _len = _ref.length; _i < _len; _i++) { - home = _ref[_i]; - a = $.el('a', { - textContent: '4chan X Settings', - href: 'javascript:;' - }); + settings = _ref[_i]; + a = settings.firstElementChild; + a.textContent = '4chan X Settings'; $.on(a, 'click', Options.dialog); - $.replace(home.firstElementChild, a); } if (!$.get('firstrun')) { if (!Favicon.el) { @@ -2550,8 +2547,11 @@ return Options.dialog(); } }, - dialog: function() { + dialog: function(e) { 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 e0241584f..86cfec842 100644 --- a/script.coffee +++ b/script.coffee @@ -1988,19 +1988,18 @@ QR = Options = init: -> - for home in [$.id('navtopr'), $.id('navbotr')] - a = $.el 'a', - textContent: '4chan X Settings' - href: 'javascript:;' + for settings in [$.id('navtopr'), $.id('navbotr')] + a = settings.firstElementChild + a.textContent = '4chan X Settings' $.on a, 'click', Options.dialog - $.replace home.firstElementChild, a unless $.get 'firstrun' # Prevent race conditions Favicon.init() unless Favicon.el $.set 'firstrun', true Options.dialog() - dialog: -> + dialog: (e) -> + e?.stopImmediatePropagation() dialog = $.el 'div' id: 'options' className: 'reply dialog'