Merge branch 'master' into getarchivedquotes

This commit is contained in:
Nicolas Stepien 2012-06-08 10:26:02 +02:00
commit bd3122e96d
2 changed files with 23 additions and 42 deletions

View File

@ -1938,7 +1938,7 @@
return new QR.reply().select();
});
$.on($('form', QR.el), 'submit', QR.submit);
$.on($('textarea', QR.el), 'keyup', function() {
$.on($('textarea', QR.el), 'input', function() {
return QR.selected.el.lastChild.textContent = this.value;
});
$.on(fileInput, 'change', QR.fileInput);
@ -1955,7 +1955,7 @@
_ref1 = ['name', 'email', 'sub', 'com'];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
name = _ref1[_j];
$.on($("[name=" + name + "]", QR.el), 'input keyup change paste', function() {
$.on($("[name=" + name + "]", QR.el), 'input', function() {
var _ref2;
QR.selected[this.name] = this.value;
if (QR.cooldown.auto && QR.selected === QR.replies[0] && (0 < (_ref2 = QR.cooldown.seconds) && _ref2 < 6)) {
@ -1963,19 +1963,6 @@
}
});
}
$.sync('QR.persona', function(persona) {
var key, val, _results;
if (!QR.el.hidden) {
return;
}
_results = [];
for (key in persona) {
val = persona[key];
QR.selected[key] = val;
_results.push($("[name=" + key + "]", QR.el).value = val);
}
return _results;
});
QR.status.input = $('input[type=submit]', QR.el);
QR.status();
QR.cooldown.init();
@ -2328,12 +2315,12 @@
(back = $('[name=backlink]', dialog)).value = $.get('backlink', Conf['backlink']);
(time = $('[name=time]', dialog)).value = $.get('time', Conf['time']);
(fileInfo = $('[name=fileInfo]', dialog)).value = $.get('fileInfo', Conf['fileInfo']);
$.on(back, 'keyup', $.cb.value);
$.on(back, 'keyup', Options.backlink);
$.on(time, 'keyup', $.cb.value);
$.on(time, 'keyup', Options.time);
$.on(fileInfo, 'keyup', $.cb.value);
$.on(fileInfo, 'keyup', Options.fileInfo);
$.on(back, 'input', $.cb.value);
$.on(back, 'input', Options.backlink);
$.on(time, 'input', $.cb.value);
$.on(time, 'input', Options.time);
$.on(fileInfo, 'input', $.cb.value);
$.on(fileInfo, 'input', Options.fileInfo);
favicon = $('select', dialog);
favicon.value = $.get('favicon', Conf['favicon']);
$.on(favicon, 'change', $.cb.value);
@ -2460,10 +2447,10 @@
Conf[input.name] = input.checked;
}
} else if (input.name === 'Interval') {
$.on(input, 'change', function() {
return Conf['Interval'] = this.value = parseInt(this.value, 10) || Conf['Interval'];
$.on(input, 'input', function() {
this.value = parseInt(this.value, 10) || Conf['Interval'];
return $.cb.value.call(this);
});
$.on(input, 'change', $.cb.value);
} else if (input.type === 'button') {
$.on(input, 'click', this.update);
}

View File

@ -1444,7 +1444,7 @@ QR =
$.on $('#dump', QR.el), 'click', -> QR.el.classList.toggle 'dump'
$.on $('#addReply', QR.el), 'click', -> new QR.reply().select()
$.on $('form', QR.el), 'submit', QR.submit
$.on $('textarea', QR.el), 'keyup', -> QR.selected.el.lastChild.textContent = @value
$.on $('textarea', QR.el), 'input', -> QR.selected.el.lastChild.textContent = @value
$.on fileInput, 'change', QR.fileInput
$.on fileInput, 'click', (e) -> if e.shiftKey then QR.selected.rmFile() or e.preventDefault()
$.on spoiler.firstChild, 'change', -> $('input', QR.selected.el).click()
@ -1454,20 +1454,13 @@ QR =
# save selected reply's data
for name in ['name', 'email', 'sub', 'com']
# The input event replaces keyup, change and paste events.
# Firefox 12 will support the input event.
# Oprah?
$.on $("[name=#{name}]", QR.el), 'input keyup change paste', ->
# XXX Does Opera support the `input` event?
$.on $("[name=#{name}]", QR.el), 'input', ->
QR.selected[@name] = @value
# Disable auto-posting if you're typing in the first reply
# during the last 5 seconds of the cooldown.
if QR.cooldown.auto and QR.selected is QR.replies[0] and 0 < QR.cooldown.seconds < 6
QR.cooldown.auto = false
# sync between tabs
$.sync 'QR.persona', (persona) ->
return unless QR.el.hidden
for key, val of persona
QR.selected[key] = val
$("[name=#{key}]", QR.el).value = val
QR.status.input = $ 'input[type=submit]', QR.el
QR.status()
@ -1797,12 +1790,12 @@ Options =
(back = $ '[name=backlink]', dialog).value = $.get 'backlink', Conf['backlink']
(time = $ '[name=time]', dialog).value = $.get 'time', Conf['time']
(fileInfo = $ '[name=fileInfo]', dialog).value = $.get 'fileInfo', Conf['fileInfo']
$.on back, 'keyup', $.cb.value
$.on back, 'keyup', Options.backlink
$.on time, 'keyup', $.cb.value
$.on time, 'keyup', Options.time
$.on fileInfo, 'keyup', $.cb.value
$.on fileInfo, 'keyup', Options.fileInfo
$.on back, 'input', $.cb.value
$.on back, 'input', Options.backlink
$.on time, 'input', $.cb.value
$.on time, 'input', Options.time
$.on fileInfo, 'input', $.cb.value
$.on fileInfo, 'input', Options.fileInfo
favicon = $ 'select', dialog
favicon.value = $.get 'favicon', Conf['favicon']
$.on favicon, 'change', $.cb.value
@ -1914,8 +1907,9 @@ Updater =
# Required for the QR's update after posting.
Conf[input.name] = input.checked
else if input.name is 'Interval'
$.on input, 'change', -> Conf['Interval'] = @value = parseInt(@value, 10) or Conf['Interval']
$.on input, 'change', $.cb.value
$.on input, 'input', ->
@value = parseInt(@value, 10) or Conf['Interval']
$.cb.value.call @
else if input.type is 'button'
$.on input, 'click', @update