From a0b80062506b269a9021f523bf4c62926436f239 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 2 Feb 2012 20:01:16 +0100 Subject: [PATCH] Fix #167. keyup isn't triggered when pasting for example. --- 4chan_x.user.js | 10 +++++++--- changelog | 2 ++ script.coffee | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cd8480063..61537f442 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1562,7 +1562,7 @@ } }, dialog: function() { - var e, fileInput, input, mimeTypes, spoiler, thread, threads, _i, _j, _len, _len2, _ref, _ref2; + var e, fileInput, input, mimeTypes, name, spoiler, thread, threads, _i, _j, _len, _len2, _ref, _ref2; qr.el = ui.dialog('qr', 'top:0;right:0;', '\
\ Quick Reply \ @@ -1629,8 +1629,12 @@ new qr.reply().select(); _ref2 = ['name', 'email', 'sub', 'com']; for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - input = _ref2[_j]; - $.on($("[name=" + input + "]", qr.el), 'keyup', function() { + name = _ref2[_j]; + input = $("[name=" + input + "]", qr.el); + $.on(input, 'keyup', function() { + return qr.selected[this.name] = this.value; + }); + $.on(input, 'change', function() { return qr.selected[this.name] = this.value; }); } diff --git a/changelog b/changelog index 462108b6a..85d3929cd 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix text inputs not saved correctly in the QR. 2.25.3 - Mayhem diff --git a/script.coffee b/script.coffee index 2e236083c..7a713487b 100644 --- a/script.coffee +++ b/script.coffee @@ -1201,8 +1201,10 @@ qr = new qr.reply().select() # save selected reply's data - for input in ['name', 'email', 'sub', 'com'] - $.on $("[name=#{input}]", qr.el), 'keyup', -> qr.selected[@name] = @value + for name in ['name', 'email', 'sub', 'com'] + input = $ "[name=#{input}]", qr.el + $.on input, 'keyup', -> qr.selected[@name] = @value + $.on input, 'change', -> qr.selected[@name] = @value # sync between tabs $.sync 'qr.persona', (persona) -> return if qr.replies.length isnt 1