sys stuff
This commit is contained in:
parent
b141786532
commit
3e24845afb
@ -1227,7 +1227,7 @@
|
|||||||
};
|
};
|
||||||
QR = {
|
QR = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var accept, holder;
|
var accept, holder, m;
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var quote;
|
var quote;
|
||||||
quote = $('a.quotejs + a', root);
|
quote = $('a.quotejs + a', root);
|
||||||
@ -1259,9 +1259,14 @@
|
|||||||
if (conf['Persistent QR']) {
|
if (conf['Persistent QR']) {
|
||||||
QR.dialog();
|
QR.dialog();
|
||||||
if (conf['Auto Hide QR']) {
|
if (conf['Auto Hide QR']) {
|
||||||
return $('#autohide', QR.qr).checked = true;
|
$('#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() {
|
attach: function() {
|
||||||
var div, file;
|
var div, file;
|
||||||
@ -1374,7 +1379,7 @@
|
|||||||
$('[name=pwd]', qr).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
|
$('[name=pwd]', qr).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
|
||||||
$('textarea', qr).value = text;
|
$('textarea', qr).value = text;
|
||||||
if (conf['Cooldown']) {
|
if (conf['Cooldown']) {
|
||||||
QR.cooldown;
|
QR.cooldown();
|
||||||
}
|
}
|
||||||
$.bind($('.close', qr), 'click', QR.close);
|
$.bind($('.close', qr), 'click', QR.close);
|
||||||
$.bind($('form', qr), 'submit', QR.submit);
|
$.bind($('form', qr), 'submit', QR.submit);
|
||||||
@ -1497,7 +1502,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
sys: function() {
|
sys: function() {
|
||||||
return $.globalEval(function() {
|
var c, duration, id, noko, recaptcha, sage, search, thread, url, watch, _, _ref, _ref2;
|
||||||
|
if (recaptcha = $('#recaptcha_response_field')) {
|
||||||
|
$.bind(recaptcha, 'keydown', Recaptcha.listener);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.globalEval(function() {
|
||||||
var data, href, node, textContent, _ref;
|
var data, href, node, textContent, _ref;
|
||||||
if (node = (_ref = document.querySelector('table font b')) != null ? _ref.firstChild : void 0) {
|
if (node = (_ref = document.querySelector('table font b')) != null ? _ref.firstChild : void 0) {
|
||||||
textContent = node.textContent, href = node.href;
|
textContent = node.textContent, href = node.href;
|
||||||
@ -1508,6 +1518,30 @@
|
|||||||
}
|
}
|
||||||
return parent.postMessage(data, '*');
|
return parent.postMessage(data, '*');
|
||||||
});
|
});
|
||||||
|
if (!((c = (_ref = $('b')) != null ? _ref.lastChild : void 0) && c.nodeType === 8)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_ref2 = c.textContent.match(/thread:(\d+),no:(\d+)/), _ = _ref2[0], thread = _ref2[1], id = _ref2[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 = {
|
qr = {
|
||||||
@ -3125,9 +3159,6 @@
|
|||||||
if (conf['Auto Noko'] && canPost) {
|
if (conf['Auto Noko'] && canPost) {
|
||||||
form.action += '?noko';
|
form.action += '?noko';
|
||||||
}
|
}
|
||||||
if (conf['Cooldown'] && canPost) {
|
|
||||||
cooldown.init();
|
|
||||||
}
|
|
||||||
if (conf['Image Expansion']) {
|
if (conf['Image Expansion']) {
|
||||||
imgExpand.init();
|
imgExpand.init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -962,8 +962,9 @@ cooldown =
|
|||||||
|
|
||||||
QR =
|
QR =
|
||||||
#TODO create new thread
|
#TODO create new thread
|
||||||
|
#captcha caching for report form
|
||||||
|
#report queueing
|
||||||
#FIXME DRY
|
#FIXME DRY
|
||||||
#sys normal post form fallback
|
|
||||||
init: ->
|
init: ->
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
quote = $ 'a.quotejs + a', root
|
quote = $ 'a.quotejs + a', root
|
||||||
@ -991,6 +992,10 @@ QR =
|
|||||||
QR.dialog()
|
QR.dialog()
|
||||||
if conf['Auto Hide QR']
|
if conf['Auto Hide QR']
|
||||||
$('#autohide', QR.qr).checked = true
|
$('#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: ->
|
attach: ->
|
||||||
$('#auto', QR.qr).checked = true
|
$('#auto', QR.qr).checked = true
|
||||||
div = $.el 'div',
|
div = $.el 'div',
|
||||||
@ -1082,7 +1087,7 @@ QR =
|
|||||||
$('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
|
$('[name=email]', qr).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
|
||||||
$('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
|
$('[name=pwd]', qr).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
|
||||||
$('textarea', qr).value = text
|
$('textarea', qr).value = text
|
||||||
QR.cooldown if conf['Cooldown']
|
QR.cooldown() if conf['Cooldown']
|
||||||
$.bind $('.close', qr), 'click', QR.close
|
$.bind $('.close', qr), 'click', QR.close
|
||||||
$.bind $('form', qr), 'submit', QR.submit
|
$.bind $('form', qr), 'submit', QR.submit
|
||||||
$.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown
|
$.bind $('#recaptcha_response_field', qr), 'keydown', QR.keydown
|
||||||
@ -1170,11 +1175,33 @@ QR =
|
|||||||
if $('img.favicon', op).src is Favicon.empty
|
if $('img.favicon', op).src is Favicon.empty
|
||||||
watcher.watch op, id
|
watcher.watch op, id
|
||||||
sys: ->
|
sys: ->
|
||||||
|
if recaptcha = $ '#recaptcha_response_field' #post reporting
|
||||||
|
$.bind recaptcha, 'keydown', Recaptcha.listener
|
||||||
|
return
|
||||||
$.globalEval ->
|
$.globalEval ->
|
||||||
if node = document.querySelector('table font b')?.firstChild
|
if node = document.querySelector('table font b')?.firstChild
|
||||||
{textContent, href} = node
|
{textContent, href} = node
|
||||||
data = JSON.stringify {textContent, href}
|
data = JSON.stringify {textContent, href}
|
||||||
parent.postMessage data, '*'
|
parent.postMessage data, '*'
|
||||||
|
return unless (c = $('b')?.lastChild) and c.nodeType is 8 #comment node
|
||||||
|
[_, thread, id] = c.textContent.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 =
|
qr =
|
||||||
# TODO
|
# TODO
|
||||||
@ -2448,9 +2475,6 @@ main =
|
|||||||
if conf['Auto Noko'] and canPost
|
if conf['Auto Noko'] and canPost
|
||||||
form.action += '?noko'
|
form.action += '?noko'
|
||||||
|
|
||||||
if conf['Cooldown'] and canPost
|
|
||||||
cooldown.init()
|
|
||||||
|
|
||||||
if conf['Image Expansion']
|
if conf['Image Expansion']
|
||||||
imgExpand.init()
|
imgExpand.init()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user