Merge branch 'master' of https://github.com/electerious/Lychee into tags

Conflicts:
	assets/js/modules/contextMenu.js
	assets/js/modules/init.js
This commit is contained in:
Tobias Reich 2014-02-04 22:45:14 +01:00
commit eac2fbab19
4 changed files with 24 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -51,6 +51,8 @@ contextMenu = {
var mouse_x = e.pageX, var mouse_x = e.pageX,
mouse_y = e.pageY - $(document).scrollTop(), mouse_y = e.pageY - $(document).scrollTop(),
items; items;
upload.notify();
contextMenu.fns = [ contextMenu.fns = [
function() { $("#upload_files").click() }, function() { $("#upload_files").click() },

View File

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

View File

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