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
|
* @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() {}]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
modal.fns = [buttons[0][1], buttons[1][1]];
|
|
||||||
$("body").append(build.modal(title, text, buttons, marginTop, closeButton));
|
|
||||||
$(".message input:first-child").focus().select();
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
close: function() {
|
|
||||||
|
|
||||||
modal.fns = null;
|
|
||||||
$(".message_overlay").removeClass("fadeIn").css("opacity", 0);
|
|
||||||
setTimeout(function() { $(".message_overlay").remove() }, 300);
|
|
||||||
|
|
||||||
|
if (!buttons) {
|
||||||
|
buttons = [
|
||||||
|
['', 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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.close = function() {
|
||||||
|
|
||||||
|
modal.fns = null;
|
||||||
|
$('.message_overlay').removeClass('fadeIn').css('opacity', 0);
|
||||||
|
setTimeout(function() { $('.message_overlay').remove() }, 300);
|
||||||
|
|
||||||
|
}
|
@ -3,59 +3,57 @@
|
|||||||
* @copyright 2014 by Tobias Reich
|
* @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;
|
params;
|
||||||
|
|
||||||
if (!lychee.publicMode) callback();
|
if (!lychee.publicMode) callback();
|
||||||
else if (album.json&&album.json.password==false) callback();
|
else if (album.json&&album.json.password==false) callback();
|
||||||
else if (albums.json&&albums.json.content[albumID].password==false) callback();
|
else if (albums.json&&albums.json.content[albumID].password==false) callback();
|
||||||
else if (!albums.json&&!album.json) {
|
else if (!albums.json&&!album.json) {
|
||||||
|
|
||||||
// Continue without password
|
// Continue without password
|
||||||
album.json = {password: true};
|
album.json = {password: true};
|
||||||
callback("");
|
callback('');
|
||||||
|
|
||||||
} else if (passwd==undefined) {
|
} else if (passwd==undefined) {
|
||||||
|
|
||||||
// Request password
|
// Request password
|
||||||
password.getDialog(albumID, callback);
|
password.getDialog(albumID, callback);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Check password
|
// Check password
|
||||||
params = "checkAlbumAccess&albumID=" + albumID + "&password=" + md5(passwd);
|
params = 'checkAlbumAccess&albumID=' + albumID + '&password=' + md5(passwd);
|
||||||
lychee.api(params, function(data) {
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
if (data===true) {
|
if (data===true) {
|
||||||
password.value = md5(passwd);
|
password.value = md5(passwd);
|
||||||
callback();
|
callback();
|
||||||
} else {
|
} else {
|
||||||
lychee.goto("");
|
lychee.goto('');
|
||||||
loadingBar.show("error", "Access denied. Wrong password!");
|
loadingBar.show('error', 'Access denied. Wrong password!');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
getDialog: function(albumID, callback) {
|
|
||||||
|
|
||||||
var buttons;
|
|
||||||
|
|
||||||
buttons = [
|
|
||||||
["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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
password.getDialog = function(albumID, callback) {
|
||||||
|
|
||||||
|
var buttons;
|
||||||
|
|
||||||
|
buttons = [
|
||||||
|
['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);
|
||||||
|
|
||||||
|
}
|
1180
src/scripts/photo.js
1180
src/scripts/photo.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user