/** * @name build.js * @author Philipp Maurer * @author Tobias Reich * @copyright 2013 by Philipp Maurer, Tobias Reich * * Build Module * This module is used to generate HTML-Code. */ build = { divider: function(title) { return "

" + title + "

"; }, album: function(albumJSON) { if(!albumJSON) return ""; if(!albumJSON.thumb0) albumJSON.thumb0 = "img/no_images.png"; if(!albumJSON.thumb1) albumJSON.thumb1 = "img/no_images.png"; if(!albumJSON.thumb2) albumJSON.thumb2 = "img/no_images.png"; if(!albumJSON.title) albumJSON.title = "Untitled"; if(albumJSON.title.length>18) albumJSON.title = albumJSON.title.substr(0, 18) + "..."; var album = ""; album += "
"; album += "thumb"; album += "thumb"; album += "thumb"; album += "
"; album += "

" + albumJSON.title + "

"; album += "" + albumJSON.sysdate + ""; album += "
"; if(albumJSON.star=="1") album += ""; if(albumJSON.public=="1") album += ""; if(albumJSON.unsorted=="1") album += ""; album += "
"; return album; }, photo: function(photoJSON) { if(photoJSON=="") return ""; if(!photoJSON.title) photoJSON.title = ""; if(!photoJSON.thumbUrl) photoJSON.thumbUrl = "img/no_image.png"; if(photoJSON.title.length>18) photoJSON.title = photoJSON.title.substr(0, 18) + "..."; var photo = ""; photo += "
"; photo += "thumb"; photo += "
"; photo += "

" + photoJSON.title + "

"; photo += "" + photoJSON.sysdate + ""; photo += "
"; if(photoJSON.star=="1") photo += ""; if(photoJSON.public=="1") photo += ""; photo += "
"; return photo; }, modal: function(title, text, button, func) { var modal = ""; modal += "
"; modal += "
"; modal += "

" + title + "

"; modal += ""; modal += "

" + text + "

"; $.each(button, function(index) { if (index==0) modal += "" + this + ""; else modal += "" + this + ""; }); modal += "
"; modal += ""; modal += "
"; return modal; }, addModal: function() { var modal = ""; modal += "
"; modal += "
"; modal += "

Add Album or Photo

"; modal += ""; modal += "
"; modal += "
"; modal += "Add new Album"; modal += "
"; modal += "
"; modal += "
"; modal += "Upload new Photo"; modal += "
"; modal += "
"; modal += "
"; return modal; }, signInModal: function() { var modal = ""; modal += "
"; modal += "
"; modal += "

Sign in

"; modal += ""; modal += "
Version " + lychee.version + "
"; modal += "Sign in"; modal += "
"; modal += "
"; return modal; }, uploadModal: function() { var modal = ""; modal += "
"; modal += "
"; modal += ""; modal += "
"; modal += "
"; modal += "
"; return modal; }, contextMenu: function(items) { var menu = ""; menu += "
"; menu += "
"; menu += ""; menu += ""; $.each(items, function(index) { if (items[index][1].length!=0) { menu += ""; } }); menu += ""; menu += "
" + items[index][0] + "
"; menu += "
"; return menu; }, infobox: function(photo, forView) { var infobox = ""; infobox += "

About

"; infobox += "
"; if (photo.public==1) photo.public = "Public"; else photo.public = "Private"; if (forView==true) editTitleHTML = ""; else editTitleHTML = "
"; if (forView==true) editDescriptionHTML = ""; else editDescriptionHTML = "
"; infos = [ ["", "Basics"], ["Name", photo.title + editTitleHTML], ["Uploaded", photo.sysdate], ["Description", photo.description + editDescriptionHTML], ["", "Image"], ["Size", photo.size], ["Format", photo.type], ["Resolution", photo.width + " x " + photo.height], ["", "Camera"], ["Captured", photo.takedate], ["Make", photo.make], ["Type/Model", photo.model], ["Shutter Speed", photo.shutter], ["Aperture", photo.aperture], ["Focal Length", photo.focal], ["ISO", photo.iso], ["", "Share"], ["Privacy", photo.public], ["Short Link", photo.shortlink] ]; $.each(infos, function(index) { if (infos[index][1]==""||infos[index][1]==undefined||infos[index][1]==null) infos[index][1] = "-"; if (infos[index][0]=="") { infobox += ""; infobox += "

" + infos[index][1] + "

"; infobox += ""; } else { infobox += ""; infobox += ""; infobox += ""; infobox += ""; } }); infobox += "
" + infos[index][0] + "" + infos[index][1] + "
"; infobox += "
"; infobox += "
"; return infobox; } }