diff --git a/4chan_x.user.js b/4chan_x.user.js index 298d38b48..19097a88a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -944,23 +944,15 @@ a = $.el('a', { textContent: '4chan X' }); - $.bind(a, 'click', options.toggle); + $.bind(a, 'click', options.dialog); $.replace(home, a); home = $('#navbotr a'); a = $.el('a', { textContent: '4chan X' }); - $.bind(a, 'click', options.toggle); + $.bind(a, 'click', options.dialog); return $.replace(home, a); }, - toggle: function() { - var dialog; - if (dialog = $('#options')) { - return $.rm(dialog); - } else { - return options.dialog(); - } - }, dialog: function() { var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, link, main, obj, ul, _i, _j, _len, _len2, _ref, _ref2, _ref3; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); @@ -1011,7 +1003,9 @@ $.bind($('input[name=time]', dialog), 'keyup', options.cb.time); $.append(d.body, dialog); options.cb.time.call($('input[name=time]', dialog)); - $.bind(dialog, 'click', options.toggle); + $.bind(dialog, 'click', function() { + return $.rm(dialog); + }); return $.bind(dialog.firstElementChild, 'click', function(e) { return e.stopPropagation(); }); diff --git a/script.coffee b/script.coffee index ecc766594..a715bbbef 100644 --- a/script.coffee +++ b/script.coffee @@ -707,20 +707,14 @@ options = home = $ '#navtopr a' a = $.el 'a', textContent: '4chan X' - $.bind a, 'click', options.toggle + $.bind a, 'click', options.dialog $.replace home, a home = $ '#navbotr a' a = $.el 'a', textContent: '4chan X' - $.bind a, 'click', options.toggle + $.bind a, 'click', options.dialog $.replace home, a - toggle: -> - if dialog = $ '#options' - $.rm dialog - else - options.dialog() - dialog: -> hiddenThreads = $.getValue "hiddenThreads/#{g.BOARD}/", {} hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length @@ -793,7 +787,7 @@ options = options.cb.time.call $('input[name=time]', dialog) - $.bind dialog, 'click', options.toggle + $.bind dialog, 'click', -> $.rm dialog $.bind dialog.firstElementChild, 'click', (e) -> e.stopPropagation() tab: ->