Disable the QR if the thread 404'd.
This commit is contained in:
parent
c547815b7c
commit
4a9b9b11d3
@ -1196,26 +1196,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
open: function() {
|
open: function() {
|
||||||
var input;
|
|
||||||
if (qr.el) {
|
if (qr.el) {
|
||||||
qr.el.hidden = false;
|
qr.el.hidden = false;
|
||||||
input = $.id('autohide');
|
$.id('autohide').checked = false;
|
||||||
input.checked = false;
|
return qr.hide();
|
||||||
return qr.hide.call(input);
|
|
||||||
} else {
|
} else {
|
||||||
return qr.dialog();
|
return qr.dialog();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
close: function() {
|
||||||
|
return qr.el.hidden = true;
|
||||||
|
},
|
||||||
hide: function() {
|
hide: function() {
|
||||||
if (this.checked) {
|
if ($.id('autohide').checked) {
|
||||||
return $.addClass(qr.el, 'autohide');
|
return $.addClass(qr.el, 'autohide');
|
||||||
} else {
|
} else {
|
||||||
return $.removeClass(qr.el, 'autohide');
|
return $.removeClass(qr.el, 'autohide');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close: function() {
|
|
||||||
return qr.el.hidden = true;
|
|
||||||
},
|
|
||||||
error: function(err) {
|
error: function(err) {
|
||||||
$('.error', qr.el).textContent = err;
|
$('.error', qr.el).textContent = err;
|
||||||
return alert(err);
|
return alert(err);
|
||||||
@ -1344,7 +1342,7 @@ textarea.field {\
|
|||||||
</form>');
|
</form>');
|
||||||
$.on($('#autohide', qr.el), 'click', qr.hide);
|
$.on($('#autohide', qr.el), 'click', qr.hide);
|
||||||
$.on($('.close', qr.el), 'click', qr.close);
|
$.on($('.close', qr.el), 'click', qr.close);
|
||||||
$.on($('button', qr.el), 'click', function() {
|
$.on($('#dump', qr.el), 'click', function() {
|
||||||
return qr.el.classList.toggle('dump');
|
return qr.el.classList.toggle('dump');
|
||||||
});
|
});
|
||||||
$.on($('form', qr.el), 'submit', qr.submit);
|
$.on($('form', qr.el), 'submit', qr.submit);
|
||||||
@ -1377,11 +1375,21 @@ textarea.field {\
|
|||||||
});
|
});
|
||||||
file.max = $('[name=MAX_FILE_SIZE]').value;
|
file.max = $('[name=MAX_FILE_SIZE]').value;
|
||||||
$.on(file, 'change', qr.fileInput);
|
$.on(file, 'change', qr.fileInput);
|
||||||
|
if (g.dead) {
|
||||||
|
$.extend($('[type=submit]', qr.el), {
|
||||||
|
disabled: true,
|
||||||
|
value: 404
|
||||||
|
});
|
||||||
|
}
|
||||||
return $.add(d.body, qr.el);
|
return $.add(d.body, qr.el);
|
||||||
},
|
},
|
||||||
submit: function(e) {
|
submit: function(e) {
|
||||||
if (e != null) e.preventDefault();
|
if (e != null) e.preventDefault();
|
||||||
if (conf['Auto Hide QR']) qr.hide();
|
if (g.dead) return;
|
||||||
|
if (conf['Auto Hide QR']) {
|
||||||
|
$.id('autohide').checked = true;
|
||||||
|
qr.hide();
|
||||||
|
}
|
||||||
return qr.cleanError();
|
return qr.cleanError();
|
||||||
},
|
},
|
||||||
response: function(e) {
|
response: function(e) {
|
||||||
@ -1842,15 +1850,13 @@ textarea.field {\
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: function() {
|
update: function() {
|
||||||
var body, frag, id, input, newPosts, reply, scroll, _i, _j, _len, _len2, _ref, _ref2, _ref3;
|
var body, frag, id, input, newPosts, reply, scroll, _i, _len, _ref, _ref2;
|
||||||
if (this.status === 404) {
|
if (this.status === 404) {
|
||||||
updater.timer.textContent = '';
|
updater.timer.textContent = '';
|
||||||
updater.count.textContent = 404;
|
updater.count.textContent = 404;
|
||||||
updater.count.className = 'error';
|
updater.count.className = 'error';
|
||||||
clearTimeout(updater.timeoutID);
|
clearTimeout(updater.timeoutID);
|
||||||
_ref = $$('#com_submit');
|
if (input = $('#qr [type=submit]', qr.el)) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
||||||
input = _ref[_i];
|
|
||||||
input.disabled = true;
|
input.disabled = true;
|
||||||
input.value = 404;
|
input.value = 404;
|
||||||
}
|
}
|
||||||
@ -1883,11 +1889,11 @@ textarea.field {\
|
|||||||
updater.count.className = 'error';
|
updater.count.className = 'error';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = ((_ref2 = $('td[id]', updater.br.previousElementSibling)) != null ? _ref2.id : void 0) || 0;
|
id = ((_ref = $('td[id]', updater.br.previousElementSibling)) != null ? _ref.id : void 0) || 0;
|
||||||
frag = d.createDocumentFragment();
|
frag = d.createDocumentFragment();
|
||||||
_ref3 = $$('.reply', body).reverse();
|
_ref2 = $$('.reply', body).reverse();
|
||||||
for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) {
|
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||||
reply = _ref3[_j];
|
reply = _ref2[_i];
|
||||||
if (reply.id <= id) break;
|
if (reply.id <= id) break;
|
||||||
$.prepend(frag, reply.parentNode.parentNode.parentNode);
|
$.prepend(frag, reply.parentNode.parentNode.parentNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -872,18 +872,17 @@ qr =
|
|||||||
open: ->
|
open: ->
|
||||||
if qr.el
|
if qr.el
|
||||||
qr.el.hidden = false
|
qr.el.hidden = false
|
||||||
input = $.id 'autohide'
|
$.id('autohide').checked = false
|
||||||
input.checked = false
|
qr.hide()
|
||||||
qr.hide.call input
|
|
||||||
else
|
else
|
||||||
qr.dialog()
|
qr.dialog()
|
||||||
|
close: ->
|
||||||
|
qr.el.hidden = true
|
||||||
hide: ->
|
hide: ->
|
||||||
if this.checked
|
if $.id('autohide').checked
|
||||||
$.addClass qr.el, 'autohide'
|
$.addClass qr.el, 'autohide'
|
||||||
else
|
else
|
||||||
$.removeClass qr.el, 'autohide'
|
$.removeClass qr.el, 'autohide'
|
||||||
close: ->
|
|
||||||
qr.el.hidden = true
|
|
||||||
|
|
||||||
error: (err) ->
|
error: (err) ->
|
||||||
$('.error', qr.el).textContent = err
|
$('.error', qr.el).textContent = err
|
||||||
@ -1009,7 +1008,7 @@ textarea.field {
|
|||||||
</form>'
|
</form>'
|
||||||
$.on $('#autohide', qr.el), 'click', qr.hide
|
$.on $('#autohide', qr.el), 'click', qr.hide
|
||||||
$.on $('.close', qr.el), 'click', qr.close
|
$.on $('.close', qr.el), 'click', qr.close
|
||||||
$.on $('button', qr.el), 'click', -> qr.el.classList.toggle 'dump'
|
$.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump'
|
||||||
$.on $('form', qr.el), 'submit', qr.submit
|
$.on $('form', qr.el), 'submit', qr.submit
|
||||||
|
|
||||||
# save & load inputs' value with localStorage
|
# save & load inputs' value with localStorage
|
||||||
@ -1037,11 +1036,19 @@ textarea.field {
|
|||||||
file.max = $('[name=MAX_FILE_SIZE]').value
|
file.max = $('[name=MAX_FILE_SIZE]').value
|
||||||
$.on file, 'change', qr.fileInput
|
$.on file, 'change', qr.fileInput
|
||||||
|
|
||||||
|
if g.dead
|
||||||
|
$.extend $('[type=submit]', qr.el),
|
||||||
|
disabled: true
|
||||||
|
value: 404
|
||||||
|
|
||||||
$.add d.body, qr.el
|
$.add d.body, qr.el
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
e?.preventDefault()
|
e?.preventDefault()
|
||||||
qr.hide() if conf['Auto Hide QR']
|
return if g.dead
|
||||||
|
if conf['Auto Hide QR']
|
||||||
|
$.id('autohide').checked = true
|
||||||
|
qr.hide()
|
||||||
qr.cleanError()
|
qr.cleanError()
|
||||||
# magical xhr2
|
# magical xhr2
|
||||||
|
|
||||||
@ -1447,7 +1454,7 @@ updater =
|
|||||||
updater.count.textContent = 404
|
updater.count.textContent = 404
|
||||||
updater.count.className = 'error'
|
updater.count.className = 'error'
|
||||||
clearTimeout updater.timeoutID
|
clearTimeout updater.timeoutID
|
||||||
for input in $$ '#com_submit'
|
if input = $ '#qr [type=submit]', qr.el
|
||||||
input.disabled = true
|
input.disabled = true
|
||||||
input.value = 404
|
input.value = 404
|
||||||
d.title = d.title.match(/^.+-/)[0] + ' 404'
|
d.title = d.title.match(/^.+-/)[0] + ' 404'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user