From ea76eca01c6f01cfe08a0ef256bb4c97cf689ecf Mon Sep 17 00:00:00 2001 From: James Campos Date: Sat, 3 Sep 2011 23:21:26 -0700 Subject: [PATCH] strip location.search stuff --- 4chan_x.user.js | 37 ++++--------------------------------- script.coffee | 23 ----------------------- 2 files changed, 4 insertions(+), 56 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 3cc5f1c32..ffc07c122 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1224,7 +1224,7 @@ }; QR = { init: function() { - var accept, holder, m; + var accept, holder; g.callbacks.push(function(root) { var quote; quote = $('a.quotejs + a', root); @@ -1257,14 +1257,9 @@ if (conf['Persistent QR']) { QR.dialog(); if (conf['Auto Hide QR']) { - $('#autohide', QR.qr).checked = true; + return $('#autohide', QR.qr).checked = true; } } - if (conf['Cooldown'] && (m = location.search.match(/cooldown=(\d+)/))) { - cooldown = m[1]; - $.set("cooldown/" + g.BOARD, cooldown); - return QR.cooldown(); - } }, attach: function() { var div, file; @@ -1527,12 +1522,12 @@ } }, sys: function() { - var duration, id, noko, recaptcha, sage, search, thread, url, watch, _, _ref; + var recaptcha; if (recaptcha = $('#recaptcha_response_field')) { $.bind(recaptcha, 'keydown', Recaptcha.listener); return; } - $.globalEval(function() { + return $.globalEval(function() { var data, href, node, textContent, _ref; if (node = (_ref = document.querySelector('table font b')) != null ? _ref.firstChild : void 0) { textContent = node.textContent, href = node.href; @@ -1543,30 +1538,6 @@ } return parent.postMessage(data, '*'); }); - if (!(d = $('b').lastChild.data)) { - return; - } - _ref = d.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2]; - search = location.search; - cooldown = /cooldown/.test(search); - noko = /noko/.test(search); - sage = /sage/.test(search); - watch = /watch/.test(search); - url = "http://boards.4chan.org/" + g.BOARD; - if (watch && thread === '0') { - url += "/res/" + id + "?watch"; - } else if (noko) { - url += '/res/'; - url += thread === '0' ? id : thread; - } - if (cooldown) { - duration = Date.now() + (sage ? 60 : 30) * 1000; - url += '?cooldown=' + duration; - } - if (noko) { - url += '#' + id; - } - return window.location = url; } }; qr = { diff --git a/script.coffee b/script.coffee index 9295aabed..170657b8b 100644 --- a/script.coffee +++ b/script.coffee @@ -991,10 +991,6 @@ QR = QR.dialog() if conf['Auto Hide QR'] $('#autohide', QR.qr).checked = true - if conf['Cooldown'] and m = location.search.match /cooldown=(\d+)/ - cooldown = m[1] - $.set "cooldown/#{g.BOARD}", cooldown - QR.cooldown() attach: -> $('#auto', QR.qr).checked = true div = $.el 'div', @@ -1203,25 +1199,6 @@ QR = parent.postMessage data, '*' #parent will blank us on message receival; #if we're not an iframe, we won't get blanked - return unless d = $('b').lastChild.data #html comment - [_, thread, id] = d.match(/thread:(\d+),no:(\d+)/) - {search} = location - cooldown = /cooldown/.test search - noko = /noko/ .test search - sage = /sage/ .test search - watch = /watch/ .test search - url = "http://boards.4chan.org/#{g.BOARD}" - if watch and thread is '0' - url += "/res/#{id}?watch" - else if noko - url += '/res/' - url += if thread is '0' then id else thread - if cooldown - duration = Date.now() + (if sage then 60 else 30) * 1000 - url += '?cooldown=' + duration - if noko - url += '#' + id - window.location = url qr = # TODO