This commit is contained in:
Tobias Reich 2014-11-12 17:19:42 +01:00
parent 95b8664ba1
commit 8378fb24d9
4 changed files with 651 additions and 656 deletions

BIN
dist/main.js vendored

Binary file not shown.

View File

@ -3,31 +3,30 @@
* @copyright 2014 by Tobias Reich
*/
modal = {
modal = {}
fns: null,
modal.fns = null;
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);
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();
}
modal.close = function() {
modal.fns = null;
$('.message_overlay').removeClass('fadeIn').css('opacity', 0);
setTimeout(function() { $('.message_overlay').remove() }, 300);
}

View File

@ -3,59 +3,57 @@
* @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(),
params;
var passwd = $('.message input.text').val(),
params;
if (!lychee.publicMode) 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&&!album.json) {
if (!lychee.publicMode) 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&&!album.json) {
// Continue without password
album.json = {password: true};
callback("");
// Continue without password
album.json = {password: true};
callback('');
} else if (passwd==undefined) {
} else if (passwd==undefined) {
// Request password
password.getDialog(albumID, callback);
// Request password
password.getDialog(albumID, callback);
} else {
} else {
// Check password
params = "checkAlbumAccess&albumID=" + albumID + "&password=" + md5(passwd);
lychee.api(params, function(data) {
// Check password
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!");
}
if (data===true) {
password.value = md5(passwd);
callback();
} else {
lychee.goto('');
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);
}

File diff suppressed because it is too large Load Diff