Improved getID

This commit is contained in:
Tobias Reich 2015-03-15 00:43:28 +01:00
parent 7410cf773e
commit 7314245e60
2 changed files with 10 additions and 11 deletions

View File

@ -11,18 +11,17 @@ album = {
album.getID = function() {
var id;
var id = null;
if (photo.json) id = photo.json.album;
else if (album.json) id = album.json.id;
else id = $('.album:hover, .album.active').attr('data-id');
// Search
if (!id) id = $('.album:hover, .album.active').attr('data-id');
if (!id) id = $('.photo:hover, .photo.active').attr('data-album-id');
if ($.isNumeric(id)===false) id = $('.album:hover, .album.active').attr('data-id');
if ($.isNumeric(id)===false) id = $('.photo:hover, .photo.active').attr('data-album-id');
if (id) return id;
else return false;
if ($.isNumeric(id)===true) return id;
else return false;
}

View File

@ -12,13 +12,13 @@ photo = {
photo.getID = function() {
var id;
var id = null;
if (photo.json) id = photo.json.id;
else id = $('.photo:hover, .photo.active').attr('data-id');
if (photo.json) id = photo.json.id;
else id = $('.photo:hover, .photo.active').attr('data-id');
if (id) return id;
else return false;
if ($.isNumeric(id)===false) return id;
else return false;
}