34413640e4
New: - Protect public albums with passwords - Export to Dropbox - Sharing-Link is displayed directly inside the sharing-dropdown - Delete photos with cmd+backspace Improved: - Massive speed improvements - Changing the title, starring, description, etc. is now instant - Longer filenames for pictures (more security) ShortLinks are removed for more independency and privacy. There are a lot of changes under the hood, including a lot of bug fixes and improvements. Please report every bug you find! How to update: 1. Replace all files, excluding `uploads/` and `php/config.php` 2. Open `php/update.php` in your browser
95 lines
1.9 KiB
JavaScript
Executable File
95 lines
1.9 KiB
JavaScript
Executable File
/**
|
|
* @name search.js
|
|
* @author Philipp Maurer
|
|
* @author Tobias Reich
|
|
* @copyright 2013 by Philipp Maurer, Tobias Reich
|
|
*
|
|
* Search Module
|
|
* Searches through your photos and albums.
|
|
*/
|
|
|
|
search = {
|
|
|
|
code: null,
|
|
|
|
find: function(term) {
|
|
|
|
var params,
|
|
albumsData = "",
|
|
photosData = "",
|
|
code;
|
|
|
|
clearTimeout($(window).data("timeout"));
|
|
$(window).data("timeout", setTimeout(function() {
|
|
|
|
if ($("#search").val().length!=0) {
|
|
|
|
params = "search&term=" + term;
|
|
lychee.api(params, "json", function(data) {
|
|
|
|
if (data&&data.albums) {
|
|
albums.json = { content: data.albums };
|
|
$.each(albums.json.content, function() {
|
|
albums.parse(this);
|
|
albumsData += build.album(this);
|
|
});
|
|
}
|
|
|
|
if (data&&data.photos) {
|
|
album.json = { content: data.photos };
|
|
$.each(album.json.content, function() {
|
|
album.parse(this);
|
|
photosData += build.photo(this);
|
|
});
|
|
}
|
|
|
|
if (albumsData==""&&photosData=="") code = "error";
|
|
else if (albumsData=="") code = build.divider("Photos")+photosData;
|
|
else if (photosData=="") code = build.divider("Albums")+albumsData;
|
|
else code = build.divider("Photos")+photosData+build.divider("Albums")+albumsData;
|
|
|
|
if (search.code!=hex_md5(code)) {
|
|
|
|
$(".no_content").remove();
|
|
|
|
lychee.animate(".album, .photo", "contentZoomOut");
|
|
lychee.animate(".divider", "fadeOut");
|
|
|
|
search.code = hex_md5(code);
|
|
|
|
$.timer(300,function(){
|
|
|
|
if (code=="error") $("body").append(build.no_content("search"));
|
|
else {
|
|
lychee.content.html(code);
|
|
lychee.animate(".album, .photo", "contentZoomIn");
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else search.reset();
|
|
|
|
}, 250));
|
|
|
|
},
|
|
|
|
reset: function() {
|
|
|
|
$("#search").val("");
|
|
$(".no_content").remove();
|
|
|
|
if (search.code!="") {
|
|
|
|
search.code = "";
|
|
lychee.animate(".divider", "fadeOut");
|
|
albums.load();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |