mirror of
https://ghproxy.net/https://github.com/elementor/wp2static.git
synced 2025-09-01 06:41:42 +08:00
desktop notifications
This commit is contained in:
parent
1e4b803323
commit
3ae612a46d
1 changed files with 29 additions and 0 deletions
|
@ -21,6 +21,34 @@ if ($settings == '') {
|
|||
var settings = '<?php echo $settings; ?>';
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
// request permission on page load
|
||||
if (Notification.permission !== "granted") {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
|
||||
function notifyMe() {
|
||||
if (!Notification) {
|
||||
alert('All exports are complete!.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (Notification.permission !== "granted")
|
||||
Notification.requestPermission();
|
||||
else {
|
||||
var notification = new Notification('WP Static HTML Export', {
|
||||
icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Wordpress_Shiny_Icon.svg/768px-Wordpress_Shiny_Icon.svg.png',
|
||||
body: "Exports have finished!",
|
||||
});
|
||||
|
||||
notification.onclick = function () {
|
||||
parent.focus();
|
||||
window.focus();
|
||||
this.close();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var currentArchive = 1;
|
||||
|
||||
|
@ -58,6 +86,7 @@ jQuery(document).ready(function($){
|
|||
currentArchive = 0;
|
||||
// all archives processed
|
||||
$('#progress').hide();
|
||||
notifyMe();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue