Don't sync personas between tab once we've opened the QR.

This commit is contained in:
Nicolas Stepien 2012-06-08 09:56:50 +02:00
parent 286b704525
commit 0160eb7b9e
2 changed files with 1 additions and 21 deletions

View File

@ -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.input = $('input[type=submit]', QR.el);
QR.status(); QR.status();
QR.cooldown.init(); QR.cooldown.init();

View File

@ -1454,20 +1454,13 @@ QR =
# save selected reply's data # save selected reply's data
for name in ['name', 'email', 'sub', 'com'] for name in ['name', 'email', 'sub', 'com']
# The input event replaces keyup, change and paste events. # The input event replaces keyup, change and paste events.
# Firefox 12 will support the input event. # XXX Opera?
# Oprah?
$.on $("[name=#{name}]", QR.el), 'input keyup change paste', -> $.on $("[name=#{name}]", QR.el), 'input keyup change paste', ->
QR.selected[@name] = @value QR.selected[@name] = @value
# Disable auto-posting if you're typing in the first reply # Disable auto-posting if you're typing in the first reply
# during the last 5 seconds of the cooldown. # 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 if QR.cooldown.auto and QR.selected is QR.replies[0] and 0 < QR.cooldown.seconds < 6
QR.cooldown.auto = false 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.input = $ 'input[type=submit]', QR.el
QR.status() QR.status()