Improved notifications for Safari and Chrome

This commit is contained in:
Tobias Reich 2014-02-04 22:08:23 +01:00
parent 671db33e75
commit ea10c68631
3 changed files with 22 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -9,9 +9,6 @@ $(document).ready(function(){
/* Event Name */
var event_name = (mobileBrowser()) ? "touchend" : "click";
/* Notifications */
if (window.webkitNotifications) window.webkitNotifications.requestPermission();
/* Disable ContextMenu */
$(document).bind("contextmenu", function(e) { e.preventDefault() });

View File

@ -36,6 +36,21 @@ upload = {
},
notify: function(title) {
var popup;
if (!window.webkitNotifications) return false;
if (window.webkitNotifications.checkPermission()!=0) window.webkitNotifications.requestPermission();
if (window.webkitNotifications.checkPermission()==0) {
popup = window.webkitNotifications.createNotification("", title, "You can now manage your new photo(s).");
popup.show();
}
},
start: {
local: function(files) {
@ -75,12 +90,7 @@ upload = {
if (xhr.status===200) {
upload.close();
// WebKit Notification
if (window.webkitNotifications&&BrowserDetect.browser==="Safari") {
popup = window.webkitNotifications.createNotification("", "Upload complete", "You can now manage your new photo.");
popup.show();
}
upload.notify("Upload complete");
window.onbeforeunload = null;
@ -146,6 +156,7 @@ upload = {
lychee.api(params, function(data) {
upload.close();
upload.notify("Import complete");
if (album.getID()===false) lychee.goto("0");
else album.load(albumID);
@ -181,6 +192,7 @@ upload = {
lychee.api(params, function(data) {
upload.close();
upload.notify("Import complete");
if (album.getID()===false) lychee.goto("0");
else album.load(albumID);
@ -222,6 +234,7 @@ upload = {
lychee.api(params, function(data) {
upload.close();
upload.notify("Import complete");
if (album.getID()===false) lychee.goto("0");
else album.load(albumID);