From 798fe78d915d2305f70e83d2bee57b6e3041649a Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sat, 27 Aug 2011 20:34:05 +0200 Subject: [PATCH] Simpler selector; shave some lines; make the quick report button less derp. --- 4chan_x.user.js | 21 ++++++++------------- script.coffee | 17 +++++++---------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 32865ac66..dd1b2caa7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1108,7 +1108,7 @@ }); $.append(hidingul, li); $.bind($('button', li), 'click', options.clearHidden); - $.bind($('textarea[name=flavors]', dialog), 'change', $.cb.value); + $.bind($('#flavors', dialog), 'change', $.cb.value); $.bind($('input[name=time]', dialog), 'keyup', options.time); _ref2 = $$('#keybinds input', dialog); for (_i = 0, _len = _ref2.length; _i < _len; _i++) { @@ -2380,20 +2380,15 @@ $.after(span, a); $.after(span, $.tn(' ')); } - return $.bind(a, 'click', reportButton.cb.report); + return $.bind(a, 'click', reportButton.report); }); }, - cb: { - report: function(e) { - return reportButton.report(this); - } - }, - report: function(target) { - var input; - input = $('input', target.parentNode); - input.click(); - $('input[value="Report"]').click(); - return input.click(); + report: function() { + var id, set, url; + url = "http://sys.4chan.org/" + g.BOARD + "/imgboard.php?mode=report&no=" + this.parentNode.id; + id = "" + NAMESPACE + "popup"; + set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=200"; + return window.open(url, id, set); } }; threadStats = { diff --git a/script.coffee b/script.coffee index 0b8201c02..336a68a4f 100644 --- a/script.coffee +++ b/script.coffee @@ -893,7 +893,7 @@ options = $.append hidingul, li $.bind $('button', li), 'click', options.clearHidden - $.bind $('textarea[name=flavors]', dialog), 'change', $.cb.value + $.bind $('#flavors', dialog), 'change', $.cb.value $.bind $('input[name=time]', dialog), 'keyup', options.time for input in $$ '#keybinds input', dialog input.value = conf[input.name] @@ -1855,15 +1855,12 @@ reportButton = innerHTML: '[ ! ]' $.after span, a $.after span, $.tn(' ') - $.bind a, 'click', reportButton.cb.report - cb: - report: (e) -> - reportButton.report @ - report: (target) -> - input = $ 'input', target.parentNode - input.click() - $('input[value="Report"]').click() - input.click() + $.bind a, 'click', reportButton.report + report: -> + url = "http://sys.4chan.org/#{g.BOARD}/imgboard.php?mode=report&no=#{@parentNode.id}" + id = "#{NAMESPACE}popup" + set = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,resizable=1,width=685,height=200" + window.open url, id, set threadStats = init: ->