Album tooltip improvements

- Only display tooltip when album title too long
- Change title when changing album title
This commit is contained in:
Tobias Reich 2014-01-28 22:22:05 +01:00
parent df77b22bb8
commit 5e43667281
3 changed files with 17 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -24,9 +24,13 @@ build = {
if (!albumJSON) return "";
var album = "",
longTitle = "",
title = albumJSON.title;
if (title.length>18) title = albumJSON.title.substr(0, 18) + "...";
if (title.length>18) {
title = albumJSON.title.substr(0, 18) + "...";
longTitle = albumJSON.title;
}
typeThumb0 = albumJSON.thumb0.split('.').pop();
typeThumb1 = albumJSON.thumb1.split('.').pop();
@ -36,10 +40,10 @@ build = {
album += "<img src='" + albumJSON.thumb2 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb2 + "'>";
album += "<img src='" + albumJSON.thumb1 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb1 + "'>";
album += "<img src='" + albumJSON.thumb0 + "' width='200' height='200' alt='thumb' data-type='" + typeThumb0 + "'>";
album += "<div class='overlay' title='" + albumJSON.title + "'>";
album += "<div class='overlay'>";
if (albumJSON.password&&!lychee.publicMode) album += "<h1><span class='icon-lock'></span> " + title + "</h1>";
else album += "<h1>" + title + "</h1>";
else album += "<h1 title='" + longTitle + "'>" + title + "</h1>";
album += "<a>" + albumJSON.sysdate + "</a>";
album += "</div>";

View File

@ -162,12 +162,18 @@ view = {
title: function(albumID) {
var prefix = "",
longTitle = "",
title = albums.json.content[albumID].title;
if (albums.json.content[albumID].password) prefix = "<span class='icon-lock'></span> ";
if (title.length>18) title = title.substr(0, 18) + "...";
if (title.length>18) {
title = title.substr(0, 18) + "...";
longTitle = albums.json.content[albumID].title;
}
$(".album[data-id='" + albumID + "'] .overlay h1").html(prefix + title);
$(".album[data-id='" + albumID + "'] .overlay h1")
.html(prefix + title)
.attr("title", longTitle);
},