Proofreading. Fixes, improvements.

This commit is contained in:
Nicolas Stepien 2012-01-27 21:52:32 +01:00
parent 65edde7ad1
commit 00246611fa
2 changed files with 33 additions and 31 deletions

View File

@ -968,7 +968,7 @@
if ((_ref2 = $('input[value=Previous]')) != null) _ref2.click(); if ((_ref2 = $('input[value=Previous]')) != null) _ref2.click();
break; break;
case conf.submit: case conf.submit:
if (qr.el) qr.submit(); if (qr.el && !qr.status()) qr.submit();
break; break;
case conf.unreadCountTo0: case conf.unreadCountTo0:
unread.replies = []; unread.replies = [];
@ -1196,7 +1196,7 @@
qr = { qr = {
init: function() { init: function() {
var iframe; var iframe;
if (!$('form[name=post]')) return; if (!$.id('recaptcha_challenge_field_holder')) return;
g.callbacks.push(function(root) { g.callbacks.push(function(root) {
return $.on($('.quotejs + .quotejs', root), 'click', qr.quote); return $.on($('.quotejs + .quotejs', root), 'click', qr.quote);
}); });
@ -1238,28 +1238,23 @@
i = _ref[_i]; i = _ref[_i];
qr.replies[0].rm(); qr.replies[0].rm();
} }
qr.cooldown.auto = false;
qr.status(); qr.status();
qr.resetFileInput(); qr.resetFileInput();
if ((spoiler = $.id('spoiler')).checked) spoiler.click(); if ((spoiler = $.id('spoiler')).checked) spoiler.click();
return qr.cleanError(); return qr.cleanError();
}, },
hide: function() { hide: function() {
var auto; d.activeElement.blur();
auto = $.id('autohide'); $.addClass(qr.el, 'autohide');
if (!auto.checked) return auto.click(); return $.id('autohide').checked = true;
}, },
unhide: function() { unhide: function() {
var auto; $.removeClass(qr.el, 'autohide');
auto = $.id('autohide'); return $.id('autohide').checked = false;
if (auto.checked) return auto.click();
}, },
toggleHide: function() { toggleHide: function() {
if (this.checked) { return this.checked && qr.hide() || qr.unhide();
$.addClass(qr.el, 'autohide');
return d.activeElement.blur();
} else {
return $.removeClass(qr.el, 'autohide');
}
}, },
error: function(err, node) { error: function(err, node) {
var el; var el;
@ -1576,7 +1571,7 @@
return e.stopPropagation(); return e.stopPropagation();
}); });
} }
$.on($('#autohide', qr.el), 'click', qr.toggleHide); $.on($('#autohide', qr.el), 'change', qr.toggleHide);
$.on($('.close', qr.el), 'click', qr.close); $.on($('.close', qr.el), 'click', qr.close);
$.on($('#dump', qr.el), 'click', function() { $.on($('#dump', qr.el), 'click', function() {
return qr.el.classList.toggle('dump'); return qr.el.classList.toggle('dump');
@ -1700,7 +1695,10 @@
})))) { })))) {
err = 'Connection error with sys.4chan.org.'; err = 'Connection error with sys.4chan.org.';
} else if (b.childElementCount) { } else if (b.childElementCount) {
if (b.firstChild.tagName) node = b.firstChild; if (b.firstChild.tagName) {
node = b.firstChild;
node.target = '_blank';
}
err = b.firstChild.textContent; err = b.firstChild.textContent;
} }
if (err) { if (err) {
@ -2287,6 +2285,9 @@
clearTimeout(updater.timeoutID); clearTimeout(updater.timeoutID);
d.title = d.title.match(/^.+-/)[0] + ' 404'; d.title = d.title.match(/^.+-/)[0] + ' 404';
g.dead = true; g.dead = true;
qr.message.send({
abort: true
});
qr.status(); qr.status();
Favicon.update(); Favicon.update();
return; return;

View File

@ -706,7 +706,7 @@ keybinds =
when conf.previousPage when conf.previousPage
$('input[value=Previous]')?.click() $('input[value=Previous]')?.click()
when conf.submit when conf.submit
qr.submit() if qr.el qr.submit() if qr.el and !qr.status()
when conf.unreadCountTo0 when conf.unreadCountTo0
unread.replies = [] unread.replies = []
unread.updateTitle() unread.updateTitle()
@ -860,7 +860,7 @@ nav =
qr = qr =
init: -> init: ->
return unless $ 'form[name=post]' return unless $.id 'recaptcha_challenge_field_holder'
g.callbacks.push (root) -> g.callbacks.push (root) ->
$.on $('.quotejs + .quotejs', root), 'click', qr.quote $.on $('.quotejs + .quotejs', root), 'click', qr.quote
iframe = $.el 'iframe', iframe = $.el 'iframe',
@ -890,25 +890,23 @@ qr =
$.removeClass qr.el, 'dump' $.removeClass qr.el, 'dump'
for i in qr.replies for i in qr.replies
qr.replies[0].rm() qr.replies[0].rm()
qr.cooldown.auto = false
qr.status() qr.status()
qr.resetFileInput() qr.resetFileInput()
spoiler.click() if (spoiler = $.id 'spoiler').checked spoiler.click() if (spoiler = $.id 'spoiler').checked
qr.cleanError() qr.cleanError()
hide: -> hide: ->
auto = $.id('autohide') d.activeElement.blur()
auto.click() unless auto.checked $.addClass qr.el, 'autohide'
$.id('autohide').checked = true
unhide: -> unhide: ->
auto = $.id('autohide') $.removeClass qr.el, 'autohide'
auto.click() if auto.checked $.id('autohide').checked = false
toggleHide: -> toggleHide: ->
if @checked @checked and qr.hide() or qr.unhide()
$.addClass qr.el, 'autohide'
d.activeElement.blur()
else
$.removeClass qr.el, 'autohide'
error: (err, node) -> error: (err, node) ->
el = $('.warning', qr.el) el = $ '.warning', qr.el
el.textContent = err el.textContent = err
$.replace el.firstChild, node if node $.replace el.firstChild, node if node
qr.open() qr.open()
@ -931,7 +929,7 @@ qr =
value = qr.cooldown.seconds or data.progress or value value = qr.cooldown.seconds or data.progress or value
return unless qr.el return unless qr.el
{input} = qr.status {input} = qr.status
input.value = input.value =
if qr.cooldown.auto and conf['Cooldown'] if qr.cooldown.auto and conf['Cooldown']
if value then "Auto #{value}" else 'Auto' if value then "Auto #{value}" else 'Auto'
else else
@ -1169,7 +1167,7 @@ qr =
</form>" </form>"
unless g.REPLY unless g.REPLY
$.on $('select', qr.el), 'mousedown', (e) -> e.stopPropagation() $.on $('select', qr.el), 'mousedown', (e) -> e.stopPropagation()
$.on $('#autohide', qr.el), 'click', qr.toggleHide $.on $('#autohide', qr.el), 'change', qr.toggleHide
$.on $('.close', qr.el), 'click', qr.close $.on $('.close', qr.el), 'click', qr.close
$.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump' $.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump'
$.on $('#addReply', qr.el), 'click', -> new qr.reply().select() $.on $('#addReply', qr.el), 'click', -> new qr.reply().select()
@ -1281,7 +1279,9 @@ qr =
unless b = $ 'td b', $.el('a', innerHTML: html) unless b = $ 'td b', $.el('a', innerHTML: html)
err = 'Connection error with sys.4chan.org.' err = 'Connection error with sys.4chan.org.'
else if b.childElementCount # error! else if b.childElementCount # error!
node = b.firstChild if b.firstChild.tagName # duplicate image link if b.firstChild.tagName # duplicate image link
node = b.firstChild
node.target = '_blank'
err = b.firstChild.textContent err = b.firstChild.textContent
if err if err
@ -1786,6 +1786,7 @@ updater =
clearTimeout updater.timeoutID clearTimeout updater.timeoutID
d.title = d.title.match(/^.+-/)[0] + ' 404' d.title = d.title.match(/^.+-/)[0] + ' 404'
g.dead = true g.dead = true
qr.message.send abort: true
qr.status() qr.status()
Favicon.update() Favicon.update()
return return