Bug 39262: Don't pass string literals to setTimeout
This patch updates a few places in our code where we pass string literals to JavaScript's setTimeout() function. This is not recommended: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout#passing_string_literals To test, apply the patch and clear your browser cache if necessary. - In the OPAC, perform a catalog search. From the search results page, test adding some items to the cart. The "Item has been added to your cart" message should appear and disappear correctly. - In the staff interface, view the contents of a list. Click the "Print list" button in the toolbar. A new tab should load and trigger the browser's print window. Printing the page or cancelling should automatically close the tab. - Go to Acquisitions -> Vendor -> Basket groups. In the "Open" tab, click the "Close and export as PDF" button. This should trigger a page reload and the creation of a PDF. The basket group should now appear under the "Closed" tab. Sponsored-by: Athens County Public Libraries Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
6f084f7f3e
commit
c1b2f62b6b
|
|
@ -410,7 +410,9 @@
|
|||
|
||||
function closeandprint(bg){
|
||||
if(document.location = '/cgi-bin/koha/acqui/basketgroup.pl?op=closeandprint&basketgroupid=' + bg ){
|
||||
setTimeout("window.location.reload();", 3000);
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 3000);
|
||||
} else {
|
||||
alert( _("Error downloading the file") );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -640,7 +640,9 @@
|
|||
window.onafterprint = function () {
|
||||
window.close();
|
||||
};
|
||||
setTimeout("window.close()", 1000); // Hack for Chrome < 63
|
||||
setTimeout(() => {
|
||||
window.close();
|
||||
}, 1000); // Hack for Chrome < 63
|
||||
});
|
||||
</script>
|
||||
[% END #/print %]
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ function showCartUpdate(msg) {
|
|||
// set body of popup window
|
||||
$("#cartDetails").html(msg);
|
||||
showCart();
|
||||
setTimeout("hideCart()", 2000);
|
||||
setTimeout(hideCart, 2000);
|
||||
}
|
||||
|
||||
function showListsUpdate(msg) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue