diff --git a/dist/main.js b/dist/main.js index d2808a5..4998b44 100644 Binary files a/dist/main.js and b/dist/main.js differ diff --git a/dist/view.js b/dist/view.js index 1913321..a48a911 100644 Binary files a/dist/view.js and b/dist/view.js differ diff --git a/src/scripts/build.js b/src/scripts/build.js index 5baeeb8..f1c16db 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -5,493 +5,491 @@ * @copyright 2014 by Tobias Reich */ -build = { +build = {}; - divider: function(title) { +build.divider = function(title) { - return "

" + title + "

"; + return "

" + title + "

"; - }, +}, - editIcon: function(id) { +build.editIcon = function(id) { - return "
"; + return "
"; - }, +}, - multiselect: function(top, left) { +build.multiselect = function(top, left) { - return "
"; + return "
"; - }, +}, - album: function(albumJSON) { +build.album = function(albumJSON) { - if (!albumJSON) return ""; + if (!albumJSON) return ""; - var album = "", - longTitle = "", - title = albumJSON.title, - typeThumb = ""; + var album = "", + longTitle = "", + title = albumJSON.title, + typeThumb = ""; - if (title!==null&&title.length>18) { - title = albumJSON.title.substr(0, 18) + "..."; - longTitle = albumJSON.title; - } + if (title!==null&&title.length>18) { + title = albumJSON.title.substr(0, 18) + "..."; + longTitle = albumJSON.title; + } - if (albumJSON.thumb0.split('.').pop()==="svg") typeThumb = "nonretina"; + if (albumJSON.thumb0.split('.').pop()==="svg") typeThumb = "nonretina"; - album += "
"; - album += "thumb"; - album += "thumb"; - album += "thumb"; - album += "
"; + album += "
"; + album += "thumb"; + album += "thumb"; + album += "thumb"; + album += "
"; - if (albumJSON.password&&!lychee.publicMode) album += "

" + title + "

"; - else album += "

" + title + "

"; + if (albumJSON.password&&!lychee.publicMode) album += "

" + title + "

"; + else album += "

" + title + "

"; - album += "" + albumJSON.sysdate + ""; - album += "
"; + album += "" + albumJSON.sysdate + ""; + album += "
"; - if (!lychee.publicMode) { + if (!lychee.publicMode) { - if(albumJSON.star==1) album += ""; - if(albumJSON.public==1) album += ""; - if(albumJSON.unsorted==1) album += ""; - if(albumJSON.recent==1) album += ""; - - } - - album += "
"; - - return album; - - }, - - photo: function(photoJSON) { - - if (!photoJSON) return ""; - - var photo = "", - longTitle = "", - title = photoJSON.title; - - if (title!==null&&title.length>18) { - title = photoJSON.title.substr(0, 18) + "..."; - longTitle = photoJSON.title; - } - - photo += "
"; - photo += "thumb"; - photo += "
"; - photo += "

" + title + "

"; - - if (photoJSON.cameraDate==1) { - photo += "" + photoJSON.sysdate + ""; - } else { - photo += "" + photoJSON.sysdate + ""; - } - - photo += "
"; - - if (photoJSON.star==1) photo += ""; - if (!lychee.publicMode&&photoJSON.public==1&&album.json.public!=1) photo += ""; - - photo += "
"; - - return photo; - - }, - - imageview: function(photoJSON, size, visibleControls) { - - if (!photoJSON) return ""; - - var view = ""; - - view += ""; - view += ""; - - if (size==="big") { - - if (visibleControls) - view += "
"; - else - view += "
"; - - } else if (size==="medium") { - - if (visibleControls) - view += "
"; - else - view += "
"; - - } else if (size==='small') { - - if (visibleControls) - view += "
"; - else - view += "
"; - - - } - - return view; - - }, - - no_content: function(typ) { - - var no_content = ""; - - no_content += "
"; - no_content += ""; - - if (typ==="search") no_content += "

No results

"; - else if (typ==="share") no_content += "

No public albums

"; - else if (typ==="cog") no_content += "

No configuration

"; - - no_content += "
"; - - return no_content; - - }, - - modal: function(title, text, button, marginTop, closeButton) { - - var modal = "", - custom_style = ""; - - if (marginTop) custom_style = "style='margin-top: " + marginTop + "px;'"; - - modal += "
"; - modal += "
"; - modal += "

" + title + "

"; - - if (closeButton!==false) { - - modal += ""; - - } - - modal += "

" + text + "

"; - - $.each(button, function(index) { - - if (this[0]!=="") { - - if (index===0) modal += "" + this[0] + ""; - else modal += "" + this[0] + ""; - - } - - }); - - modal += "
"; - modal += "
"; - - return modal; - - }, - - signInModal: function() { - - var modal = ""; - - modal += "
"; - modal += "
"; - modal += "

Sign In

"; - modal += ""; - modal += ""; - modal += "
Version " + lychee.version + "Update available!
"; - modal += "Sign in"; - modal += "
"; - modal += "
"; - - return modal; - - }, - - uploadModal: function(title, files) { - - var modal = ""; - - modal += "
"; - modal += "
"; - modal += "

" + title + "

"; - modal += ""; - modal += "
"; - - for (var i = 0; i < files.length; i++) { - - if (files[i].name.length>40) files[i].name = files[i].name.substr(0, 17) + "..." + files[i].name.substr(files[i].name.length-20, 20); - - modal += "
"; - modal += "" + lychee.escapeHTML(files[i].name) + ""; - - if (files[i].supported===true) modal += ""; - else modal += "Not supported"; - - modal += "

"; - modal += "
"; - - } - - modal += "
"; - modal += "
"; - modal += "
"; - - return modal; - - }, - - contextMenu: function(items) { - - var menu = ""; - - menu += "
"; - menu += "
"; - menu += ""; - menu += ""; - - $.each(items, function(index) { - - if (items[index][0]==="separator"&&items[index][1]===-1) menu += ""; - else if (items[index][1]===-1) menu += ""; - else if (items[index][2]!=undefined) menu += ""; - else menu += ""; - - }); - - menu += ""; - menu += "
" + items[index][0] + "
" + items[index][0] + "
" + items[index][0] + "
"; - menu += "
"; - - return menu; - - }, - - tags: function(tags, forView) { - - var html = "", - editTagsHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_tags"); - - if (tags!=="") { - - tags = tags.split(","); - - tags.forEach(function(tag, index, array) { - - html += "" + tag + ""; - - }); - - html += editTagsHTML; - - } else { - - - html = "
No Tags" + editTagsHTML + "
"; - - } - - return html; - - }, - - infoboxPhoto: function(photoJSON, forView) { - - if (!photoJSON) return ""; - - var infobox = "", - public, - editTitleHTML, - editDescriptionHTML, - infos, - exifHash = ""; - - infobox += "

About

"; - infobox += "
"; - - switch (photoJSON.public) { - case "0": - public = "No"; - break; - case "1": - public = "Yes"; - break; - case "2": - public = "Yes (Album)"; - break; - default: - public = "-"; - break; - } - - editTitleHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_title"); - editDescriptionHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_description"); - - infos = [ - ["", "Basics"], - ["Title", photoJSON.title + editTitleHTML], - ["Uploaded", photoJSON.sysdate], - ["Description", photoJSON.description + editDescriptionHTML], - ["", "Image"], - ["Size", photoJSON.size], - ["Format", photoJSON.type], - ["Resolution", photoJSON.width + " x " + photoJSON.height], - ["Tags", build.tags(photoJSON.tags, forView)] - ]; - - exifHash = photoJSON.takestamp+photoJSON.make+photoJSON.model+photoJSON.shutter+photoJSON.aperture+photoJSON.focal+photoJSON.iso; - - if (exifHash!="0"&&exifHash!=="null") { - - infos = infos.concat([ - ["", "Camera"], - ["Captured", photoJSON.takedate], - ["Make", photoJSON.make], - ["Type/Model", photoJSON.model], - ["Shutter Speed", photoJSON.shutter], - ["Aperture", photoJSON.aperture], - ["Focal Length", photoJSON.focal], - ["ISO", photoJSON.iso] - ]); - - } - - infos = infos.concat([ - ["", "Share"], - ["Public", public] - ]); - - $.each(infos, function(index) { - - if (infos[index][1]===""||infos[index][1]===undefined||infos[index][1]===null) infos[index][1] = "-"; - - switch (infos[index][0]) { - - case "": // Separator - infobox += ""; - infobox += "

" + infos[index][1] + "

"; - infobox += ""; - break; - - case "Tags": // Tags - if (forView!==true&&!lychee.publicMode) { - infobox += "
"; - infobox += "

" + infos[index][0] + "

"; - infobox += "
" + infos[index][1] + "
"; - } - break; - - default: // Item - infobox += ""; - infobox += "" + infos[index][0] + ""; - infobox += "" + infos[index][1] + ""; - infobox += ""; - break; - - } - - }); - - infobox += ""; - infobox += "
"; - infobox += "
"; - - return infobox; - - }, - - infoboxAlbum: function(albumJSON, forView) { - - if (!albumJSON) return ""; - - var infobox = "", - public = "-", - password = "-", - downloadable = "-", - editTitleHTML, - editDescriptionHTML, - infos; - - infobox += "

About

"; - infobox += "
"; - - switch (albumJSON.public) { - case "0": - public = "No"; - break; - case "1": - public = "Yes"; - break; - } - - switch (albumJSON.password) { - case false: - password = "No"; - break; - case true: - password = "Yes"; - break; - } - - switch (albumJSON.downloadable) { - case "0": - downloadable = "No"; - break; - case "1": - downloadable = "Yes"; - break; - } - - editTitleHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_title_album"); - editDescriptionHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_description_album"); - - infos = [ - ["", "Basics"], - ["Title", albumJSON.title + editTitleHTML], - ["Description", albumJSON.description + editDescriptionHTML], - ["", "Album"], - ["Created", albumJSON.sysdate], - ["Images", albumJSON.num], - ["", "Share"], - ["Public", public], - ["Downloadable", downloadable], - ["Password", password] - ]; - - $.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; + if(albumJSON.star==1) album += ""; + if(albumJSON.public==1) album += ""; + if(albumJSON.unsorted==1) album += ""; + if(albumJSON.recent==1) album += ""; } -}; \ No newline at end of file + album += "
"; + + return album; + +}, + +build.photo = function(photoJSON) { + + if (!photoJSON) return ""; + + var photo = "", + longTitle = "", + title = photoJSON.title; + + if (title!==null&&title.length>18) { + title = photoJSON.title.substr(0, 18) + "..."; + longTitle = photoJSON.title; + } + + photo += "
"; + photo += "thumb"; + photo += "
"; + photo += "

" + title + "

"; + + if (photoJSON.cameraDate==1) { + photo += "" + photoJSON.sysdate + ""; + } else { + photo += "" + photoJSON.sysdate + ""; + } + + photo += "
"; + + if (photoJSON.star==1) photo += ""; + if (!lychee.publicMode&&photoJSON.public==1&&album.json.public!=1) photo += ""; + + photo += "
"; + + return photo; + +}, + +build.imageview = function(photoJSON, size, visibleControls) { + + if (!photoJSON) return ""; + + var view = ""; + + view += ""; + view += ""; + + if (size==="big") { + + if (visibleControls) + view += "
"; + else + view += "
"; + + } else if (size==="medium") { + + if (visibleControls) + view += "
"; + else + view += "
"; + + } else if (size==='small') { + + if (visibleControls) + view += "
"; + else + view += "
"; + + + } + + return view; + +}, + +build.no_content = function(typ) { + + var no_content = ""; + + no_content += "
"; + no_content += ""; + + if (typ==="search") no_content += "

No results

"; + else if (typ==="share") no_content += "

No public albums

"; + else if (typ==="cog") no_content += "

No configuration

"; + + no_content += "
"; + + return no_content; + +}, + +build.modal = function(title, text, button, marginTop, closeButton) { + + var modal = "", + custom_style = ""; + + if (marginTop) custom_style = "style='margin-top: " + marginTop + "px;'"; + + modal += "
"; + modal += "
"; + modal += "

" + title + "

"; + + if (closeButton!==false) { + + modal += ""; + + } + + modal += "

" + text + "

"; + + $.each(button, function(index) { + + if (this[0]!=="") { + + if (index===0) modal += "" + this[0] + ""; + else modal += "" + this[0] + ""; + + } + + }); + + modal += "
"; + modal += "
"; + + return modal; + +}, + +build.signInModal = function() { + + var modal = ""; + + modal += "
"; + modal += "
"; + modal += "

Sign In

"; + modal += ""; + modal += ""; + modal += "
Version " + lychee.version + "Update available!
"; + modal += "Sign in"; + modal += "
"; + modal += "
"; + + return modal; + +}, + +build.uploadModal = function(title, files) { + + var modal = ""; + + modal += "
"; + modal += "
"; + modal += "

" + title + "

"; + modal += ""; + modal += "
"; + + for (var i = 0; i < files.length; i++) { + + if (files[i].name.length>40) files[i].name = files[i].name.substr(0, 17) + "..." + files[i].name.substr(files[i].name.length-20, 20); + + modal += "
"; + modal += "" + lychee.escapeHTML(files[i].name) + ""; + + if (files[i].supported===true) modal += ""; + else modal += "Not supported"; + + modal += "

"; + modal += "
"; + + } + + modal += "
"; + modal += "
"; + modal += "
"; + + return modal; + +}, + +build.contextMenu = function(items) { + + var menu = ""; + + menu += "
"; + menu += "
"; + menu += ""; + menu += ""; + + $.each(items, function(index) { + + if (items[index][0]==="separator"&&items[index][1]===-1) menu += ""; + else if (items[index][1]===-1) menu += ""; + else if (items[index][2]!=undefined) menu += ""; + else menu += ""; + + }); + + menu += ""; + menu += "
" + items[index][0] + "
" + items[index][0] + "
" + items[index][0] + "
"; + menu += "
"; + + return menu; + +}, + +build.tags = function(tags, forView) { + + var html = "", + editTagsHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_tags"); + + if (tags!=="") { + + tags = tags.split(","); + + tags.forEach(function(tag, index, array) { + + html += "" + tag + ""; + + }); + + html += editTagsHTML; + + } else { + + + html = "
No Tags" + editTagsHTML + "
"; + + } + + return html; + +}, + +build.infoboxPhoto = function(photoJSON, forView) { + + if (!photoJSON) return ""; + + var infobox = "", + public, + editTitleHTML, + editDescriptionHTML, + infos, + exifHash = ""; + + infobox += "

About

"; + infobox += "
"; + + switch (photoJSON.public) { + case "0": + public = "No"; + break; + case "1": + public = "Yes"; + break; + case "2": + public = "Yes (Album)"; + break; + default: + public = "-"; + break; + } + + editTitleHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_title"); + editDescriptionHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_description"); + + infos = [ + ["", "Basics"], + ["Title", photoJSON.title + editTitleHTML], + ["Uploaded", photoJSON.sysdate], + ["Description", photoJSON.description + editDescriptionHTML], + ["", "Image"], + ["Size", photoJSON.size], + ["Format", photoJSON.type], + ["Resolution", photoJSON.width + " x " + photoJSON.height], + ["Tags", build.tags(photoJSON.tags, forView)] + ]; + + exifHash = photoJSON.takestamp+photoJSON.make+photoJSON.model+photoJSON.shutter+photoJSON.aperture+photoJSON.focal+photoJSON.iso; + + if (exifHash!="0"&&exifHash!=="null") { + + infos = infos.concat([ + ["", "Camera"], + ["Captured", photoJSON.takedate], + ["Make", photoJSON.make], + ["Type/Model", photoJSON.model], + ["Shutter Speed", photoJSON.shutter], + ["Aperture", photoJSON.aperture], + ["Focal Length", photoJSON.focal], + ["ISO", photoJSON.iso] + ]); + + } + + infos = infos.concat([ + ["", "Share"], + ["Public", public] + ]); + + $.each(infos, function(index) { + + if (infos[index][1]===""||infos[index][1]===undefined||infos[index][1]===null) infos[index][1] = "-"; + + switch (infos[index][0]) { + + case "": // Separator + infobox += ""; + infobox += "

" + infos[index][1] + "

"; + infobox += ""; + break; + + case "Tags": // Tags + if (forView!==true&&!lychee.publicMode) { + infobox += "
"; + infobox += "

" + infos[index][0] + "

"; + infobox += "
" + infos[index][1] + "
"; + } + break; + + default: // Item + infobox += ""; + infobox += "" + infos[index][0] + ""; + infobox += "" + infos[index][1] + ""; + infobox += ""; + break; + + } + + }); + + infobox += ""; + infobox += "
"; + infobox += "
"; + + return infobox; + +}, + +build.infoboxAlbum = function(albumJSON, forView) { + + if (!albumJSON) return ""; + + var infobox = "", + public = "-", + password = "-", + downloadable = "-", + editTitleHTML, + editDescriptionHTML, + infos; + + infobox += "

About

"; + infobox += "
"; + + switch (albumJSON.public) { + case "0": + public = "No"; + break; + case "1": + public = "Yes"; + break; + } + + switch (albumJSON.password) { + case false: + password = "No"; + break; + case true: + password = "Yes"; + break; + } + + switch (albumJSON.downloadable) { + case "0": + downloadable = "No"; + break; + case "1": + downloadable = "Yes"; + break; + } + + editTitleHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_title_album"); + editDescriptionHTML = (forView===true||lychee.publicMode) ? "" : " " + build.editIcon("edit_description_album"); + + infos = [ + ["", "Basics"], + ["Title", albumJSON.title + editTitleHTML], + ["Description", albumJSON.description + editDescriptionHTML], + ["", "Album"], + ["Created", albumJSON.sysdate], + ["Images", albumJSON.num], + ["", "Share"], + ["Public", public], + ["Downloadable", downloadable], + ["Password", password] + ]; + + $.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; + +} \ No newline at end of file diff --git a/src/scripts/visible.js b/src/scripts/visible.js index 87f971e..dd88928 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -5,63 +5,61 @@ * @copyright 2014 by Tobias Reich */ -visible = { +visible = {}; - albums: function() { - if ($('#tools_albums').css('display')==='block') return true; - else return false; - }, +visible.albums = function() { + if ($('#tools_albums').css('display')==='block') return true; + else return false; +}, - album: function() { - if ($('#tools_album').css('display')==='block') return true; - else return false; - }, +visible.album = function() { + if ($('#tools_album').css('display')==='block') return true; + else return false; +}, - photo: function() { - if ($('#imageview.fadeIn').length>0) return true; - else return false; - }, +visible.photo = function() { + if ($('#imageview.fadeIn').length>0) return true; + else return false; +}, - search: function() { - if (search.code!==null&&search.code!=='') return true; - else return false; - }, +visible.search = function() { + if (search.code!==null&&search.code!=='') return true; + else return false; +}, - infobox: function() { - if ($('#infobox.active').length>0) return true; - else return false; - }, +visible.infobox = function() { + if ($('#infobox.active').length>0) return true; + else return false; +}, - infoboxbutton: function() { - if (visible.albums()) return false; - if (visible.photo()) return true; - if (visible.album()&&$('#button_info_album:visible').length>0) return true; - else return false; - }, +visible.infoboxbutton = function() { + if (visible.albums()) return false; + if (visible.photo()) return true; + if (visible.album()&&$('#button_info_album:visible').length>0) return true; + else return false; +}, - controls: function() { - if (lychee.loadingBar.css('opacity')<1) return false; - else return true; - }, +visible.controls = function() { + if (lychee.loadingBar.css('opacity')<1) return false; + else return true; +}, - message: function() { - if ($('.message').length>0) return true; - else return false; - }, +visible.message = function() { + if ($('.message').length>0) return true; + else return false; +}, - signin: function() { - if ($('.message .sign_in').length>0) return true; - else return false; - }, +visible.signin = function() { + if ($('.message .sign_in').length>0) return true; + else return false; +}, - contextMenu: function() { - if ($('.contextmenu').length>0) return true; - else return false; - }, +visible.contextMenu = function() { + if ($('.contextmenu').length>0) return true; + else return false; +}, - multiselect: function() { - if ($('#multiselect').length>0) return true; - else return false; - } - -}; \ No newline at end of file +visible.multiselect = function() { + if ($('#multiselect').length>0) return true; + else return false; +} \ No newline at end of file