|
@@ -5,15 +5,15 @@
|
|
|
|
|
|
search = {
|
|
|
|
|
|
- code: null
|
|
|
+ hash: null
|
|
|
|
|
|
}
|
|
|
|
|
|
search.find = function(term) {
|
|
|
|
|
|
- var albumsData = '',
|
|
|
- photosData = '',
|
|
|
- code;
|
|
|
+ var albumsData = '',
|
|
|
+ photosData = '',
|
|
|
+ html = '';
|
|
|
|
|
|
clearTimeout($(window).data('timeout'));
|
|
|
$(window).data('timeout', setTimeout(function() {
|
|
@@ -24,8 +24,8 @@ search.find = function(term) {
|
|
|
|
|
|
|
|
|
if (data&&data.albums) {
|
|
|
- albums.json = { content: data.albums };
|
|
|
- $.each(albums.json.content, function() {
|
|
|
+ albums.json = { albums: data.albums };
|
|
|
+ $.each(albums.json.albums, function() {
|
|
|
albums.parse(this);
|
|
|
albumsData += build.album(this);
|
|
|
});
|
|
@@ -43,28 +43,28 @@ search.find = function(term) {
|
|
|
|
|
|
|
|
|
|
|
|
- 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 (albumsData===''&&photosData==='') html = 'error';
|
|
|
+ else if (albumsData==='') html = build.divider('Photos') + photosData;
|
|
|
+ else if (photosData==='') html = build.divider('Albums') + albumsData;
|
|
|
+ else html = build.divider('Photos') + photosData + build.divider('Albums') + albumsData;
|
|
|
|
|
|
|
|
|
- if (search.code!==md5(code)) {
|
|
|
+ if (search.hash!==data.hash) {
|
|
|
|
|
|
$('.no_content').remove();
|
|
|
|
|
|
lychee.animate('.album, .photo', 'contentZoomOut');
|
|
|
lychee.animate('.divider', 'fadeOut');
|
|
|
|
|
|
- search.code = md5(code);
|
|
|
+ search.hash = data.hash;
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
|
- if (code==='error') {
|
|
|
+ if (html==='error') {
|
|
|
lychee.content.html('');
|
|
|
$('body').append(build.no_content('magnifying-glass'));
|
|
|
} else {
|
|
|
- lychee.content.html(code);
|
|
|
+ lychee.content.html(html);
|
|
|
lychee.animate('.album, .photo', 'contentZoomIn');
|
|
|
$('img[data-type!="svg"]').retina();
|
|
|
}
|
|
@@ -86,13 +86,13 @@ search.reset = function() {
|
|
|
$('#search').val('');
|
|
|
$('.no_content').remove();
|
|
|
|
|
|
- if (search.code!=='') {
|
|
|
+ if (search.hash!==null) {
|
|
|
|
|
|
|
|
|
albums.json = null;
|
|
|
album.json = null;
|
|
|
photo.json = null;
|
|
|
- search.code = '';
|
|
|
+ search.hash = null;
|
|
|
|
|
|
lychee.animate('.divider', 'fadeOut');
|
|
|
albums.load();
|