Rewrite #245
This commit is contained in:
parent
95b8664ba1
commit
8378fb24d9
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
@ -3,31 +3,30 @@
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
modal = {
|
||||
modal = {}
|
||||
|
||||
fns: null,
|
||||
modal.fns = null;
|
||||
|
||||
show: function(title, text, buttons, marginTop, closeButton) {
|
||||
modal.show = function(title, text, buttons, marginTop, closeButton) {
|
||||
|
||||
if (!buttons) {
|
||||
buttons = [
|
||||
["", function() {}],
|
||||
["", function() {}]
|
||||
['', function() {}],
|
||||
['', function() {}]
|
||||
];
|
||||
}
|
||||
|
||||
modal.fns = [buttons[0][1], buttons[1][1]];
|
||||
$("body").append(build.modal(title, text, buttons, marginTop, closeButton));
|
||||
$(".message input:first-child").focus().select();
|
||||
|
||||
},
|
||||
$('body').append(build.modal(title, text, buttons, marginTop, closeButton));
|
||||
$('.message input:first-child').focus().select();
|
||||
|
||||
close: function() {
|
||||
}
|
||||
|
||||
modal.close = function() {
|
||||
|
||||
modal.fns = null;
|
||||
$(".message_overlay").removeClass("fadeIn").css("opacity", 0);
|
||||
setTimeout(function() { $(".message_overlay").remove() }, 300);
|
||||
$('.message_overlay').removeClass('fadeIn').css('opacity', 0);
|
||||
setTimeout(function() { $('.message_overlay').remove() }, 300);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
@ -3,13 +3,13 @@
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
password = {
|
||||
password = {}
|
||||
|
||||
value: "",
|
||||
password.value = '';
|
||||
|
||||
get: function(albumID, callback) {
|
||||
password.get = function(albumID, callback) {
|
||||
|
||||
var passwd = $(".message input.text").val(),
|
||||
var passwd = $('.message input.text').val(),
|
||||
params;
|
||||
|
||||
if (!lychee.publicMode) callback();
|
||||
@ -19,7 +19,7 @@ password = {
|
||||
|
||||
// Continue without password
|
||||
album.json = {password: true};
|
||||
callback("");
|
||||
callback('');
|
||||
|
||||
} else if (passwd==undefined) {
|
||||
|
||||
@ -29,33 +29,31 @@ password = {
|
||||
} else {
|
||||
|
||||
// Check password
|
||||
params = "checkAlbumAccess&albumID=" + albumID + "&password=" + md5(passwd);
|
||||
params = 'checkAlbumAccess&albumID=' + albumID + '&password=' + md5(passwd);
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data===true) {
|
||||
password.value = md5(passwd);
|
||||
callback();
|
||||
} else {
|
||||
lychee.goto("");
|
||||
loadingBar.show("error", "Access denied. Wrong password!");
|
||||
lychee.goto('');
|
||||
loadingBar.show('error', 'Access denied. Wrong password!');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
getDialog: function(albumID, callback) {
|
||||
password.getDialog = function(albumID, callback) {
|
||||
|
||||
var buttons;
|
||||
|
||||
buttons = [
|
||||
["Enter", function() { password.get(albumID, callback) }],
|
||||
["Cancel", lychee.goto]
|
||||
['Enter', function() { password.get(albumID, callback) }],
|
||||
['Cancel', lychee.goto]
|
||||
];
|
||||
modal.show("<a class='icon-lock'></a> Enter Password", "This album is protected by a password. Enter the password below to view the photos of this album: <input class='text' type='password' placeholder='password' value=''>", buttons, -110, false);
|
||||
modal.show('<a class="icon-lock"></a> Enter Password', 'This album is protected by a password. Enter the password below to view the photos of this album: <input class="text" type="password" placeholder="password" value="">', buttons, -110, false);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
@ -3,29 +3,29 @@
|
||||
* @copyright 2014 by Tobias Reich
|
||||
*/
|
||||
|
||||
photo = {
|
||||
photo = {}
|
||||
|
||||
json: null,
|
||||
cache: null,
|
||||
photo.json = null;
|
||||
photo.cache = null;
|
||||
|
||||
getID: function() {
|
||||
photo.getID = function() {
|
||||
|
||||
var id;
|
||||
|
||||
if (photo.json) id = photo.json.id;
|
||||
else id = $(".photo:hover, .photo.active").attr("data-id");
|
||||
else id = $('.photo:hover, .photo.active').attr('data-id');
|
||||
|
||||
if (id) return id;
|
||||
else return false;
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
load: function(photoID, albumID) {
|
||||
photo.load = function(photoID, albumID) {
|
||||
|
||||
var params,
|
||||
checkPasswd;
|
||||
|
||||
params = "getPhoto&photoID=" + photoID + "&albumID=" + albumID + "&password=" + password.value;
|
||||
params = 'getPhoto&photoID=' + photoID + '&albumID=' + albumID + '&password=' + password.value;
|
||||
lychee.api(params, function(data) {
|
||||
|
||||
if (data==="Warning: Wrong password!") {
|
||||
@ -49,10 +49,10 @@ photo = {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
// Preload the next photo for better response time
|
||||
preloadNext: function(photoID) {
|
||||
// Preload the next photo for better response time
|
||||
photo.preloadNext = function(photoID) {
|
||||
|
||||
var nextPhoto,
|
||||
url;
|
||||
@ -75,15 +75,15 @@ photo = {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
parse: function() {
|
||||
photo.parse = function() {
|
||||
|
||||
if (!photo.json.title) photo.json.title = "Untitled";
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
previous: function(animate) {
|
||||
photo.previous = function(animate) {
|
||||
|
||||
var delay = 0;
|
||||
|
||||
@ -112,9 +112,9 @@ photo = {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
next: function(animate) {
|
||||
photo.next = function(animate) {
|
||||
|
||||
var delay = 0;
|
||||
|
||||
@ -143,9 +143,9 @@ photo = {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
duplicate: function(photoIDs) {
|
||||
photo.duplicate = function(photoIDs) {
|
||||
|
||||
var params;
|
||||
|
||||
@ -162,9 +162,9 @@ photo = {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
delete: function(photoIDs) {
|
||||
photo.delete = function(photoIDs) {
|
||||
|
||||
var params,
|
||||
buttons,
|
||||
@ -238,9 +238,9 @@ photo = {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
setTitle: function(photoIDs) {
|
||||
photo.setTitle = function(photoIDs) {
|
||||
|
||||
var oldTitle = "",
|
||||
newTitle,
|
||||
@ -290,9 +290,9 @@ photo = {
|
||||
if (photoIDs.length===1) modal.show("Set Title", "Enter a new title for this photo: <input class='text' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>", buttons);
|
||||
else modal.show("Set Titles", "Enter a title for all " + photoIDs.length + " selected photos: <input class='text' type='text' maxlength='30' placeholder='Title' value=''>", buttons);
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
setAlbum: function(photoIDs, albumID) {
|
||||
photo.setAlbum = function(photoIDs, albumID) {
|
||||
|
||||
var params,
|
||||
nextPhoto,
|
||||
@ -329,9 +329,9 @@ photo = {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
setStar: function(photoIDs) {
|
||||
photo.setStar = function(photoIDs) {
|
||||
|
||||
var params;
|
||||
|
||||
@ -355,9 +355,9 @@ photo = {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
setPublic: function(photoID, e) {
|
||||
photo.setPublic = function(photoID, e) {
|
||||
|
||||
var params;
|
||||
|
||||
@ -388,9 +388,9 @@ photo = {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
setDescription: function(photoID) {
|
||||
photo.setDescription = function(photoID) {
|
||||
|
||||
var oldDescription = photo.json.description.replace("'", "'"),
|
||||
description,
|
||||
@ -424,9 +424,9 @@ photo = {
|
||||
|
||||
modal.show("Set Description", "Enter a description for this photo: <input class='text' type='text' maxlength='800' placeholder='Description' value='" + oldDescription + "'>", buttons);
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
editTags: function(photoIDs) {
|
||||
photo.editTags = function(photoIDs) {
|
||||
|
||||
var oldTags = "",
|
||||
tags = "",
|
||||
@ -464,9 +464,9 @@ photo = {
|
||||
if (photoIDs.length===1) modal.show("Set Tags", "Enter your tags for this photo. You can add multiple tags by separating them with a comma: <input class='text' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>", buttons);
|
||||
else modal.show("Set Tags", "Enter your tags for all " + photoIDs.length + " selected photos. Existing tags will be overwritten. You can add multiple tags by separating them with a comma: <input class='text' type='text' maxlength='800' placeholder='Tags' value='" + oldTags + "'>", buttons);
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
setTags: function(photoIDs, tags) {
|
||||
photo.setTags = function(photoIDs, tags) {
|
||||
|
||||
var params;
|
||||
|
||||
@ -496,9 +496,9 @@ photo = {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
deleteTag: function(photoID, index) {
|
||||
photo.deleteTag = function(photoID, index) {
|
||||
|
||||
var tags;
|
||||
|
||||
@ -510,9 +510,9 @@ photo = {
|
||||
photo.json.tags = tags.toString();
|
||||
photo.setTags([photoID], photo.json.tags);
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
share: function(photoID, service) {
|
||||
photo.share = function(photoID, service) {
|
||||
|
||||
var link = "",
|
||||
url = photo.getViewLink(photoID),
|
||||
@ -541,9 +541,9 @@ photo = {
|
||||
|
||||
if (link.length>5) location.href = link;
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
getSize: function() {
|
||||
photo.getSize = function() {
|
||||
|
||||
// Size can be 'big, medium, small'
|
||||
// Default is big
|
||||
@ -581,9 +581,9 @@ photo = {
|
||||
|
||||
return size;
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
getArchive: function(photoID) {
|
||||
photo.getArchive = function(photoID) {
|
||||
|
||||
var link,
|
||||
url = "php/api.php?function=getPhotoArchive&photoID=" + photoID;
|
||||
@ -595,9 +595,9 @@ photo = {
|
||||
|
||||
location.href = link;
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
getDirectLink: function() {
|
||||
photo.getDirectLink = function() {
|
||||
|
||||
var url = "";
|
||||
|
||||
@ -607,15 +607,13 @@ photo = {
|
||||
|
||||
return url;
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
getViewLink: function(photoID) {
|
||||
photo.getViewLink = function(photoID) {
|
||||
|
||||
var url = "view.php?p=" + photoID;
|
||||
|
||||
if (location.href.indexOf("index.html")>0) return location.href.replace("index.html" + location.hash, url);
|
||||
else return location.href.replace(location.hash, url);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user