1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-15 11:14:12 +02:00

Update the ProcessWire.alert() javascript function to support an expiration time after which the alert will automatically close.

This commit is contained in:
Ryan Cramer
2024-04-19 11:59:43 -04:00
parent 57b23ef9fe
commit 29ecddadeb
2 changed files with 7 additions and 2 deletions

View File

@@ -491,7 +491,7 @@ if(typeof ProcessWire != "undefined") {
} }
}; };
ProcessWire.alert = function(message, allowMarkup) { ProcessWire.alert = function(message, allowMarkup, expire) {
if(typeof allowMarkup == "undefined") var allowMarkup = false; if(typeof allowMarkup == "undefined") var allowMarkup = false;
if(typeof vex != "undefined") { if(typeof vex != "undefined") {
if(allowMarkup) { if(allowMarkup) {
@@ -505,6 +505,11 @@ if(typeof ProcessWire != "undefined") {
} }
vex.dialog.alert(message); vex.dialog.alert(message);
} }
if(typeof expire !== 'undefined') {
setTimeout(function() {
$('.vex-dialog-button-primary').trigger('click');
}, expire);
}
} else { } else {
alert(message); alert(message);
} }

File diff suppressed because one or more lines are too long