diff --git a/dist/main.js b/dist/main.js index 06eb4ff..f44d498 100644 Binary files a/dist/main.js and b/dist/main.js differ diff --git a/dist/view.js b/dist/view.js index 3b2d68f..21537be 100644 Binary files a/dist/view.js and b/dist/view.js differ diff --git a/php/modules/Album.php b/php/modules/Album.php index 5c74a84..7ed8d76 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -83,7 +83,7 @@ class Album extends Module { $albums = $this->database->query($query); $return = $albums->fetch_assoc(); $return['sysdate'] = date('d M. Y', $return['sysstamp']); - $return['password'] = ($return['password']=='' ? false : true); + $return['password'] = ($return['password']=='' ? '0' : '1'); $query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs)); break; @@ -180,7 +180,7 @@ class Album extends Module { # Parse info $album['sysdate'] = date('F Y', $album['sysstamp']); - $album['password'] = ($album['password'] != ''); + $album['password'] = ($album['password']=='' ? '0' : '1'); # Thumbs if (($public===true&&$album['password']===false)||($public===false)) { diff --git a/src/scripts/album.js b/src/scripts/album.js index b75460f..cd604bc 100644 --- a/src/scripts/album.js +++ b/src/scripts/album.js @@ -456,10 +456,10 @@ album.setPublic = function(albumID, e) { if ($('.basicModal .choice input[name="password"]:checked').length===1) { password = $('.basicModal .choice input[data-name="password"]').val(); - album.json.password = 1; + album.json.password = '1'; } else { password = ''; - album.json.password = 0; + album.json.password = '0'; } if ($('.basicModal .choice input[name="listed"]:checked').length===1) listed = true; @@ -469,8 +469,8 @@ album.setPublic = function(albumID, e) { if (visible.album()) { - album.json.public = (album.json.public==0) ? 1 : 0; - album.json.password = (album.json.public==0) ? 0 : album.json.password; + album.json.public = (album.json.public==='0') ? '1' : '0'; + album.json.password = (album.json.public==='0') ? '0' : album.json.password; view.album.public(); view.album.password(); @@ -526,7 +526,7 @@ album.getArchive = function(albumID) { if (location.href.indexOf('index.html')>0) link = location.href.replace(location.hash, '').replace('index.html', url); else link = location.href.replace(location.hash, '') + url; - if (lychee.publicMode) link += '&password=' + password.value; + if (lychee.publicMode===true) link += '&password=' + password.value; location.href = link; diff --git a/src/scripts/albums.js b/src/scripts/albums.js index a93f176..b0a0289 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -96,7 +96,7 @@ albums.load = function() { albums.parse = function(album) { - if (album.password&&lychee.publicMode) { + if (album.password==='1'&&lychee.publicMode===true) { album.thumb0 = 'src/images/password.svg'; album.thumb1 = 'src/images/password.svg'; album.thumb2 = 'src/images/password.svg'; diff --git a/src/scripts/build.js b/src/scripts/build.js index 9fcd1c3..15fd865 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -92,7 +92,7 @@ build.album = function(data) { if (data.public==='1') html += `${ build.iconic('eye') }`; if (data.unsorted==='1') html += `${ build.iconic('list') }`; if (data.recent==='1') html += `${ build.iconic('clock') }`; - if (data.password===true) html += `${ build.iconic('lock-locked') }`; + if (data.password==='1') html += `${ build.iconic('lock-locked') }`; } @@ -244,12 +244,12 @@ build.uploadModal = function(title, files) { } -build.tags = function(tags, forView) { +build.tags = function(tags, forView = false) { var html = '', editTagsHTML = ''; - if (forView!==true&&lychee.publicMode!==true) editTagsHTML = ' ' + build.editIcon('edit_tags'); + if (forView===false&&lychee.publicMode===false) editTagsHTML = ' ' + build.editIcon('edit_tags'); if (tags!=='') { @@ -271,7 +271,7 @@ build.tags = function(tags, forView) { } -build.infoboxPhoto = function(data, forView) { +build.infoboxPhoto = function(data, forView = false) { var html = '', visible = '', @@ -293,7 +293,7 @@ build.infoboxPhoto = function(data, forView) { } - if (forView!==true&&lychee.publicMode!==true) { + if (forView===false&&lychee.publicMode===false) { editTitleHTML = ' ' + build.editIcon('edit_title'); editDescriptionHTML = ' ' + build.editIcon('edit_description'); } @@ -355,7 +355,7 @@ build.infoboxPhoto = function(data, forView) { case 'Tags': // Tags - if (forView!==true&&lychee.publicMode===false) { + if (forView===false&&lychee.publicMode===false) { html += ` @@ -395,7 +395,7 @@ build.infoboxPhoto = function(data, forView) { } -build.infoboxAlbum = function(data, forView) { +build.infoboxAlbum = function(data, forView = false) { var html = '', visible = '', @@ -418,9 +418,9 @@ build.infoboxAlbum = function(data, forView) { switch (data.password) { - case false: password = 'No'; + case '0': password = 'No'; break; - case true: password = 'Yes'; + case '1': password = 'Yes'; break; default: password = '-'; break; @@ -438,7 +438,7 @@ build.infoboxAlbum = function(data, forView) { } - if (forView!==true&&lychee.publicMode!==true) { + if (forView===false&&lychee.publicMode===false) { editTitleHTML = ' ' + build.editIcon('edit_title_album'); editDescriptionHTML = ' ' + build.editIcon('edit_description_album'); } diff --git a/src/scripts/header.js b/src/scripts/header.js index 9d4aa90..e03da05 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -91,7 +91,7 @@ header.setMode = function(mode) { album.json.content === false ? $('#button_archive').hide() : $('#button_archive').show(); // Hide download button when not logged in and album not downloadable - if (lychee.publicMode&&album.json.downloadable==='0') $('#button_archive').hide(); + if (lychee.publicMode===true&&album.json.downloadable==='0') $('#button_archive').hide(); if (albumID==='s'||albumID==='f'||albumID==='r') { $('#button_info_album, #button_trash_album, #button_share_album').hide(); diff --git a/src/scripts/password.js b/src/scripts/password.js index 6267559..247c39f 100644 --- a/src/scripts/password.js +++ b/src/scripts/password.js @@ -14,9 +14,9 @@ password.get = function(albumID, callback) { var passwd = $('.basicModal input.text').val(), params; - if (!lychee.publicMode) callback(); - else if (album.json&&album.json.password==false) callback(); - else if (albums.json&&albums.json.albums[albumID].password==false) callback(); + if (lychee.publicMode===false) callback(); + else if (album.json&&album.json.password==='0') callback(); + else if (albums.json&&albums.json.albums[albumID].password==='0') callback(); else if (!albums.json&&!album.json) { // Continue without password diff --git a/src/scripts/photo.js b/src/scripts/photo.js index df69c58..bb9d21a 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -698,7 +698,7 @@ photo.getArchive = function(photoID) { if (location.href.indexOf('index.html')>0) link = location.href.replace(location.hash, '').replace('index.html', url); else link = location.href.replace(location.hash, '') + url; - if (lychee.publicMode) link += '&password=' + password.value; + if (lychee.publicMode===true) link += '&password=' + password.value; location.href = link; diff --git a/src/scripts/view.js b/src/scripts/view.js index 8385358..1b7280e 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -49,7 +49,7 @@ view.albums = { albumsData = ''; /* Smart Albums */ - if (!lychee.publicMode) { + if (lychee.publicMode===false) { albums.parse(albums.json.smartalbums.unsorted); albums.parse(albums.json.smartalbums.public); @@ -70,7 +70,8 @@ view.albums = { albumsData = build.album(this) + albumsData; }); - if (!lychee.publicMode) albumsData = build.divider('Albums') + albumsData; + // Add divider + if (lychee.publicMode===false) albumsData = build.divider('Albums') + albumsData; } @@ -275,8 +276,8 @@ view.album = { password: function() { - if (album.json.password==1) $('#infobox .attr_password').html('Yes'); - else $('#infobox .attr_password').html('No'); + if (album.json.password==='1') $('#infobox .attr_password').html('Yes'); + else $('#infobox .attr_password').html('No'); },