From fbea4b4dacd47f96a1058d416ce3ca29c2b4f643 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 18 Oct 2014 18:02:06 +0200 Subject: [PATCH] Code adjustments --- dist/main.js | Bin 172092 -> 172266 bytes dist/view.js | Bin 109026 -> 109111 bytes src/scripts/build.js | 934 ++++++++++++++++++++--------------------- src/scripts/visible.js | 96 +++-- 4 files changed, 513 insertions(+), 517 deletions(-) diff --git a/dist/main.js b/dist/main.js index d2808a5c6da1e0b7a5138a4f3b597bcf7aa8af9f..4998b4461de76dc078ea49a0a0509a939b2388f6 100644 GIT binary patch delta 653 zcmY+CKWG#|6vlZk8pClh7cXZF8U!oR<0L_dprcqQqzEWj*qOcC@iMZ1;?C|RM8$|= zrHv^b2$wbGiAcccDE^BeVx@xE30eyQnNctj&Iq9(n1CL)V&ul zglVf8H64y|FJelMD_}1146V8}<+S=5{ua|Gdl&txKYhk5L(kvCes%CI%x>L`Pnryr z#@$=ghmY{7Oh4MtPvd#)q{TKIQa{`9^(y4(Nr2~7USjcpK0-rCQFVC5L@4P-fJHje z#NqBuU_;+U_nSDdJ%dTWbYdR+=}Qy$^<+SDE2vE{`qRYYg-jI5B5b{WgqByJ1dMLY z<4kW>u^vp|JCf117>{i^?Qta QX<;Q3cGBPj9E79)0C9Wv4*&oF delta 531 zcmaELkZaEYu7)j)IxE>zGRrbkQi~=xY6wsFTghm`k(!cO;+dSE2NPkNzH%j_4Oeby zPDy5QYEEkM^oJUZV$-=-F}kuP<|LKoT5XS6#kh}|tso=6B;RT}kYltxVjZIe6IW(# zVtQ&>W@@?B_5~XluQIde<;Md}E}87mE;fC}7RDQ_x%nxHIg{(wNNu0Gm9d(Ur#Le` z&oj>#Bx~rmXZowJ zjNWWqwVHbQdD9Q@Fo|yu{KmMwW;$mvQv@T|_QYZ)VJ&vBmy4~YU!TjQHGTbDCMjqj zfCQXb!C^4@AkbYG<}tBOx1YzP#8#Y|Sd^SGIq;$Q^tO3S8thPq!BnZj9F$aAQUVNi zkY?HWOc@-YkSfa0DF%zIn9roemYZ5!oR~iOV~@!6h6PM4(|^ndS`P}cOo%qHp!otO mWp0q()QS?{)Vxx#cA$(Baui-nVH5#5k!AXs1x&I`wblR_^2##+ diff --git a/dist/view.js b/dist/view.js index 19133217657d0461ccd5b887e1cc3064e573199e..a48a9112aeb8d5513b6114a75b538e6a4ab0d3b1 100644 GIT binary patch delta 3759 zcmai14Qw0L9oK7UN83PCN*a>VBz9Bxu0Ff|OyYRg(6uo%lt5|v70+uges}hj%iYyJ zH}&GOGHIhQSlO;{XyZ$O#$aQ#n9W6+iV&NG_Q5tvnKlhk7-C`{Xw#$(!36ugJ3D-A z(l=fLv5_)gn03YbS)ko%ST!q04P zYooAf@7PvQJ~Z~Z)l}57`5YezaMM{6UpdjoRhwVb?#;xYcYEeihA6{fJf7)VMfnkh zF>MS*!KY?5#w4+c)}PJ%lR)&-SJf~MZk1hi_ierJ5-LX0iYRAkFqlj8s=_Ju#Q1s; zRma22yhFWtsMLQje&q#F_Wncy;fPdSNDj+=fq<5c>(T7Hul4ve1Yh}5g#W&6U zr$EsZBYdq^44a0@@yzL56SBR*Se*S(6^MLL1`t(7M6($Nh)v?$5uR_VR&u;ReGCns z=F=tFs+5pYA+aPVz^K-0%32j4kw8GH+s3Pl;n8w60#`mT`%pjMj-S9JAYMdnJtQCIHR zOP0|vRm;*e@}1|82-JSzYZXY?^7ZFgp=^w-~67&D371KY`_$`(kSG~np}`9Hv%IxJgw@K1p^*3A^-Tv??e=_g7{&B^S;Dv zPEh9gHX9Y)5+ec)m*F55VEe$Ss~4l9DMHOr`^>2kpAs&cnwponPw)kULPW?T-R| z>DK3ph~D3y`*p_vb=?j}o1)w@*xab3m0*xndkLkl*l)iS1Xs_wH!+fz6Bq|yjx1Kt z8cIk#rEa{up$#zZ|IPhKwb9=`v5@trP!#zrBQb@7I2BgQnN|;0?4{>>SED3-SE82X z{0*BmLxyY70M_x>?n)Edc@?XGPW7B za%rG5E#n@PcgVWiX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j@nHwrOT%Q@Y**ax-GlktorBPJvTCJ^xyKP03UxtyC>9LW z^zU;ik8gJbo&^Ks{(3uUhCl@h-`h^wu+y@`5!i>RDlim<#0Vh9BEjBRtcwfe3W%c~#<*?)lGlJF5PU)%C8=dtHfG8`dC!0b}%8Jq$KF08Jz}0CA8Hv@NiAh@d)Cg(hmq$KH@C>g!kR%WC<#j27KQfii zq{#YuEWf)Kr>ye3y(EGsqrDSLntb zey3XGNRvHikzdXpH>i@e`p&deHXg%0Kfj=5^iBFrd^cXXa1Xh&ZeB5$H5BS>Sr0ze zSo!?DBv?1EdNtpq>P3qjUdpAl*vDoxDowO(kQUe5}d-+x_J70!?SesIh;G fi~0Kx6QSZiK@QHY9jtdP!@+`Cl@}i+x7Ga%)%>>q 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