simple url building
This commit is contained in:
parent
0c0a8c6dbd
commit
b61453fde1
@ -1374,7 +1374,7 @@
|
|||||||
return qr.el = null;
|
return qr.el = null;
|
||||||
},
|
},
|
||||||
sys: function() {
|
sys: function() {
|
||||||
var c, duration, id, noko, recaptcha, thread, _, _ref;
|
var c, duration, id, noko, recaptcha, sage, search, thread, url, watch, _, _ref;
|
||||||
if (recaptcha = $('#recaptcha_response_field')) {
|
if (recaptcha = $('#recaptcha_response_field')) {
|
||||||
$.bind(recaptcha, 'keydown', Recaptcha.listener);
|
$.bind(recaptcha, 'keydown', Recaptcha.listener);
|
||||||
return;
|
return;
|
||||||
@ -1402,28 +1402,27 @@
|
|||||||
c = $('b').lastChild;
|
c = $('b').lastChild;
|
||||||
if (c.nodeType === 8) {
|
if (c.nodeType === 8) {
|
||||||
_ref = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2];
|
_ref = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref[0], thread = _ref[1], id = _ref[2];
|
||||||
noko = /noko/.test(location.search);
|
search = location.search;
|
||||||
if (thread === '0') {
|
cooldown = /cooldown/.test(search);
|
||||||
if (/watch/.test(location.search)) {
|
noko = /noko/.test(search);
|
||||||
return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id + "#watch";
|
sage = /sage/.test(search);
|
||||||
} else if (noko) {
|
watch = /watch/.test(search);
|
||||||
return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + id;
|
url = "http://boards.4chan.org/" + g.BOARD;
|
||||||
|
if (noko) {
|
||||||
|
url += '/res/';
|
||||||
|
url += thread === 0 ? id : thread;
|
||||||
|
if (watch) {
|
||||||
|
url += '?watch';
|
||||||
}
|
}
|
||||||
} else if (/cooldown/.test(location.search)) {
|
|
||||||
duration = Date.now() + 30000;
|
|
||||||
if (/sage/.test(location.search)) {
|
|
||||||
duration += 30000;
|
|
||||||
}
|
|
||||||
if (noko) {
|
|
||||||
return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + thread + "?cooldown=" + duration + "#" + id;
|
|
||||||
} else {
|
|
||||||
return window.location = "http://boards.4chan.org/" + g.BOARD + "?cooldown=" + duration;
|
|
||||||
}
|
|
||||||
} else if (noko) {
|
|
||||||
return window.location = "http://boards.4chan.org/" + g.BOARD + "/res/" + thread + "#" + id;
|
|
||||||
} else {
|
|
||||||
return window.location = "http://boards.4chan.org/" + g.BOARD;
|
|
||||||
}
|
}
|
||||||
|
if (cooldown) {
|
||||||
|
duration = Date.now() + (sage ? 60 : 30) * 1000;
|
||||||
|
url += '?cooldown=' + duration;
|
||||||
|
}
|
||||||
|
if (noko) {
|
||||||
|
url += '#' + id;
|
||||||
|
}
|
||||||
|
return window.location = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1127,23 +1127,26 @@ qr =
|
|||||||
if c.nodeType is 8 #comment node
|
if c.nodeType is 8 #comment node
|
||||||
[_, thread, id] = c.textContent.match(/thread:(\d+),no:(\d+)/)
|
[_, thread, id] = c.textContent.match(/thread:(\d+),no:(\d+)/)
|
||||||
|
|
||||||
noko = /noko/.test location.search
|
{search} = location
|
||||||
if thread is '0'
|
cooldown = /cooldown/.test search
|
||||||
if /watch/.test location.search
|
noko = /noko/ .test search
|
||||||
window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}#watch"
|
sage = /sage/ .test search
|
||||||
else if noko
|
watch = /watch/ .test search
|
||||||
window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{id}"
|
|
||||||
else if /cooldown/.test location.search
|
url = "http://boards.4chan.org/#{g.BOARD}"
|
||||||
duration = Date.now() + 30000
|
|
||||||
duration += 30000 if /sage/.test location.search
|
if noko
|
||||||
if noko
|
url += '/res/'
|
||||||
window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{thread}?cooldown=#{duration}##{id}"
|
url += if thread is 0 then id else thread
|
||||||
else
|
if watch
|
||||||
window.location = "http://boards.4chan.org/#{g.BOARD}?cooldown=#{duration}"
|
url += '?watch'
|
||||||
else if noko
|
if cooldown
|
||||||
window.location = "http://boards.4chan.org/#{g.BOARD}/res/#{thread}##{id}"
|
duration = Date.now() + (if sage then 60 else 30) * 1000
|
||||||
else
|
url += '?cooldown=' + duration
|
||||||
window.location = "http://boards.4chan.org/#{g.BOARD}"
|
if noko
|
||||||
|
url += '#' + id
|
||||||
|
|
||||||
|
window.location = url
|
||||||
|
|
||||||
threading =
|
threading =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user