diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-19 16:15:37 -0700 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-19 16:15:37 -0700 |
commit | ba3b4c64f7c3ebd8dceb5db90cef8df7df18232f (patch) | |
tree | d2b0d08551ba66b06560f55d0acce60f6dc8bd3a /js | |
parent | 1ba10751a624a0b94d01aa66c9747fe81cba3e39 (diff) | |
download | bugs-ba3b4c64f7c3ebd8dceb5db90cef8df7df18232f.tar bugs-ba3b4c64f7c3ebd8dceb5db90cef8df7df18232f.tar.gz bugs-ba3b4c64f7c3ebd8dceb5db90cef8df7df18232f.tar.bz2 bugs-ba3b4c64f7c3ebd8dceb5db90cef8df7df18232f.tar.xz bugs-ba3b4c64f7c3ebd8dceb5db90cef8df7df18232f.zip |
Bug 576912: Make the automatic duplicate detection table appear onkeyup
instead of onblur, but give it a delay so that (a) we're not sending
too many queries and (b) so that it doesn't appear at the exact same
time as you click Submit Bug (making the "Submit Bug" click not work)
r=timello, a=mkanat
Diffstat (limited to 'js')
-rw-r--r-- | js/bug.js | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -54,6 +54,22 @@ YAHOO.bugzilla.dupTable = { 'bz_default_hidden'); dataTable.getDataSource().sendRequest(post_data, callback); }, + // This is the keyup event handler. It calls updateTable with a relatively + // long delay, to allow additional input. However, the delay is short + // enough that nobody could get from the summary field to the Submit + // Bug button before the table is shown (which is important, because + // the showing of the table causes the Submit Bug button to move, and + // if the table shows at the exact same time as the button is clicked, + // the click on the button won't register.) + doUpdateTable: function(e, args) { + var dt = args[0]; + var product_name = args[1]; + var summary = YAHOO.util.Event.getTarget(e); + clearTimeout(YAHOO.bugzilla.dupTable.lastTimeout); + YAHOO.bugzilla.dupTable.lastTimeout = setTimeout(function() { + YAHOO.bugzilla.dupTable.updateTable(dt, product_name, summary) }, + 600); + }, formatBugLink: function(el, oRecord, oColumn, oData) { el.innerHTML = '<a href="show_bug.cgi?id=' + oData + '">' + oData + '</a>'; @@ -107,11 +123,7 @@ YAHOO.bugzilla.dupTable = { data.options.initialLoad = false; var dt = new YAHOO.widget.DataTable(data.container, data.columns, this.dataSource, data.options); - YAHOO.util.Event.on(data.summary_field, 'blur', - function(e) { - YAHOO.bugzilla.dupTable.updateTable(dt, data.product_name, - YAHOO.util.Event.getTarget(e)) - } - ); + YAHOO.util.Event.on(data.summary_field, 'keyup', this.doUpdateTable, + [dt, data.product_name]); }, }; |