mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Output: Prevent multiple popups/download with dblClick
This commit is contained in:
parent
245c951659
commit
7cc9508664
2
dist/js/widgets/widget-output.min.js
vendored
2
dist/js/widgets/widget-output.min.js
vendored
File diff suppressed because one or more lines are too long
@ -15,6 +15,13 @@
|
||||
output = ts.output = {
|
||||
|
||||
event : 'outputTable',
|
||||
// Double click time is about 500ms; this value ignores double clicks
|
||||
// and prevents multiple windows from opening - issue in Firefox
|
||||
noDblClick : 600, // ms
|
||||
lastEvent : 0,
|
||||
// prevent overlapping multiple opens in case rendering of content in
|
||||
// popup or download is longer than noDblClick time.
|
||||
busy : false,
|
||||
|
||||
// wrap line breaks & tabs in quotes
|
||||
regexQuote : /([\n\t\x09\x0d\x0a]|<[^<]+>)/, // test if cell needs wrapping quotes
|
||||
@ -34,9 +41,19 @@
|
||||
.off(output.event)
|
||||
.on(output.event, function( e ) {
|
||||
e.stopPropagation();
|
||||
// explicitly use table.config.widgetOptions because we want
|
||||
// the most up-to-date values; not the 'wo' from initialization
|
||||
output.process(c, c.widgetOptions);
|
||||
// prevent multiple windows opening
|
||||
if (
|
||||
!output.busy &&
|
||||
(e.timeStamp - output.lastEvent > output.noDblClick)
|
||||
) {
|
||||
output.lastEvent = e.timeStamp;
|
||||
output.busy = true;
|
||||
// explicitly use table.config.widgetOptions because we want
|
||||
// the most up-to-date values; not the 'wo' from initialization
|
||||
output.process(c, c.widgetOptions);
|
||||
} else {
|
||||
console.log('blocked', output.busy);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -210,6 +227,7 @@
|
||||
} else {
|
||||
output.download(c, wo, mydata);
|
||||
}
|
||||
output.busy = false;
|
||||
|
||||
}, // end process
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user