From 452a19254cb659fdefd6335a4782fab6489673a7 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 27 Feb 2015 20:33:03 +0100 Subject: [PATCH 1/5] Fixed move photo --- src/scripts/contextMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index d5a1fa1..9659fb9 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -225,7 +225,7 @@ contextMenu.move = function(photoIDs, e) { var that = this; if (!that.thumb0) that.thumb0 = 'src/images/no_cover.svg'; - that.title = "
" + that.title + "
"; + that.title = "
" + that.title + "
"; if (that.id!=album.getID()) items.push({ type: 'item', title: that.title, fn: function() { photo.setAlbum(photoIDs, that.id) } }); From 67dce773e634c7d00a72e62bedd63c35520e2571 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 27 Feb 2015 20:37:24 +0100 Subject: [PATCH 2/5] Updated Album::getAll --- dist/main.css | Bin 34408 -> 33566 bytes dist/main.js | Bin 173915 -> 174199 bytes php/modules/Album.php | 55 +++++++++++++++++++++++-------------- src/scripts/album.js | 10 +++---- src/scripts/albums.js | 42 ++++++++++++++-------------- src/scripts/contextMenu.js | 4 +-- src/scripts/password.js | 2 +- src/scripts/view.js | 21 ++++++++------ 8 files changed, 77 insertions(+), 57 deletions(-) diff --git a/dist/main.css b/dist/main.css index 932de008b6283b727b67c0616ac301ac92c69699..980c5d30cfaaf386057b24528cb4095c949be54c 100644 GIT binary patch delta 1440 zcmah}TTmNi6rSDGGzm!w0Ry>_4UtQdC4@^9f-saaU@I*KXUgRPyJR=8W5|YNfiPJ=Ng>Tb)CDO&rcI1`*|AolqZDi!tMN{a9@mXE z&YU-<1`A1<^@_>3G%jVC;9QzZrG&JCzgs+OTNEj!JGE%nJ76(*$Tzx|Y4nelSlD2k zt`+@)Boy@89> zAL09G5%jfgd|h*qMC(c@ZEl+awMz$9{5s_PR_1>?%ySgR#z+U{Q}3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G z-PfSK(ETCoI=Cuil4n9kL&XC+pN?mAnO%0Kb^JxF=u|9(BmXn5RQ__5dHG3ZYj2ru z|L0(-y5d3egRM+s1-@PLE9V&Rn&G;7j%i(AMrk6jb$!{jMZi%;$F1I4tYmrK&6)E| Zx9J^aT!l;L84b*P3ye^pUu7zq{|S7gPO<<1 diff --git a/php/modules/Album.php b/php/modules/Album.php index a45d398..5c74a84 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -154,8 +154,15 @@ class Album extends Module { # Call plugins $this->plugins(__METHOD__, 0, func_get_args()); + # Initialize return var + $return = array( + 'smartalbums' => null, + 'albums' => null, + 'num' => 0 + ); + # Get SmartAlbums - if ($public===false) $return = $this->getSmartInfo(); + if ($public===false) $return['smartalbums'] = $this->getSmartInfo(); # Albums query $query = Database::prepare($this->database, 'SELECT id, title, public, sysstamp, password FROM ? WHERE public = 1 AND visible <> 0', array(LYCHEE_TABLE_ALBUMS)); @@ -192,7 +199,7 @@ class Album extends Module { } # Add to return - $return['content'][$album['id']] = $album; + $return['albums'][$album['id']] = $album; } @@ -211,29 +218,25 @@ class Album extends Module { # Check dependencies self::dependencies(isset($this->database, $this->settings)); + # Initialize return var + $return = array( + 'unsorted' => null, + 'public' => null, + 'starred' => null, + 'recent' => null + ); + # Unsorted $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE album = 0 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS)); $unsorted = $this->database->query($query); $i = 0; while($row = $unsorted->fetch_object()) { if ($i<3) { - $return["unsortedThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl; + $return['unsorted']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row->thumbUrl; $i++; } else break; } - $return['unsortedNum'] = $unsorted->num_rows; - - # Public - $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS)); - $public = $this->database->query($query); - $i = 0; - while($row2 = $public->fetch_object()) { - if ($i<3) { - $return["publicThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl; - $i++; - } else break; - } - $return['publicNum'] = $public->num_rows; + $return['unsorted']['num'] = $unsorted->num_rows; # Starred $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE star = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS)); @@ -241,11 +244,23 @@ class Album extends Module { $i = 0; while($row3 = $starred->fetch_object()) { if ($i<3) { - $return["starredThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl; + $return['starred']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl; $i++; } else break; } - $return['starredNum'] = $starred->num_rows; + $return['starred']['num'] = $starred->num_rows; + + # Public + $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE public = 1 ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS)); + $public = $this->database->query($query); + $i = 0; + while($row2 = $public->fetch_object()) { + if ($i<3) { + $return['public']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row2->thumbUrl; + $i++; + } else break; + } + $return['public']['num'] = $public->num_rows; # Recent $query = Database::prepare($this->database, 'SELECT thumbUrl FROM ? WHERE LEFT(id, 10) >= unix_timestamp(DATE_SUB(NOW(), INTERVAL 1 DAY)) ' . $this->settings['sorting'], array(LYCHEE_TABLE_PHOTOS)); @@ -253,11 +268,11 @@ class Album extends Module { $i = 0; while($row3 = $recent->fetch_object()) { if ($i<3) { - $return["recentThumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl; + $return['recent']["thumb$i"] = LYCHEE_URL_UPLOADS_THUMB . $row3->thumbUrl; $i++; } else break; } - $return['recentNum'] = $recent->num_rows; + $return['recent']['num'] = $recent->num_rows; return $return; diff --git a/src/scripts/album.js b/src/scripts/album.js index 61c52b9..b75460f 100644 --- a/src/scripts/album.js +++ b/src/scripts/album.js @@ -179,7 +179,7 @@ album.delete = function(albumIDs) { albumIDs.forEach(function(id) { albums.json.num--; view.albums.content.delete(id); - delete albums.json.content[id]; + delete albums.json.albums[id]; }); } else { @@ -209,7 +209,7 @@ album.delete = function(albumIDs) { // Get title if (album.json) albumTitle = album.json.title; - else if (albums.json) albumTitle = albums.json.content[albumIDs].title; + else if (albums.json) albumTitle = albums.json.albums[albumIDs].title; msg = "

Are you sure you want to delete the album '" + albumTitle + "' and all of the photos it contains? This action can't be undone!

"; @@ -253,7 +253,7 @@ album.setTitle = function(albumIDs) { // Get old title if only one album is selected if (album.json) oldTitle = album.json.title; - else if (albums.json) oldTitle = albums.json.content[albumIDs].title; + else if (albums.json) oldTitle = albums.json.albums[albumIDs].title; if (!oldTitle) oldTitle = ''; oldTitle = oldTitle.replace("'", '''); @@ -280,13 +280,13 @@ album.setTitle = function(albumIDs) { if (albums.json) { var id = albumIDs[0]; - albums.json.content[id].title = newTitle; + albums.json.albums[id].title = newTitle; } } else if (visible.albums()) { albumIDs.forEach(function(id) { - albums.json.content[id].title = newTitle; + albums.json.albums[id].title = newTitle; view.albums.content.title(id); }); diff --git a/src/scripts/albums.js b/src/scripts/albums.js index 8a447ea..a93f176 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -25,44 +25,44 @@ albums.load = function() { api.post('Album::getAll', {}, function(data) { /* Smart Albums */ - data.unsortedAlbum = { + data.smartalbums.unsorted = { id: 0, title: 'Unsorted', - sysdate: data.unsortedNum + ' photos', + sysdate: data.smartalbums.unsorted.num + ' photos', unsorted: '1', - thumb0: data.unsortedThumb0, - thumb1: data.unsortedThumb1, - thumb2: data.unsortedThumb2 + thumb0: data.smartalbums.unsorted.thumb0, + thumb1: data.smartalbums.unsorted.thumb1, + thumb2: data.smartalbums.unsorted.thumb2 }; - data.starredAlbum = { + data.smartalbums.starred = { id: 'f', title: 'Starred', - sysdate: data.starredNum + ' photos', + sysdate: data.smartalbums.starred.num + ' photos', star: '1', - thumb0: data.starredThumb0, - thumb1: data.starredThumb1, - thumb2: data.starredThumb2 + thumb0: data.smartalbums.starred.thumb0, + thumb1: data.smartalbums.starred.thumb1, + thumb2: data.smartalbums.starred.thumb2 }; - data.publicAlbum = { + data.smartalbums.public = { id: 's', title: 'Public', - sysdate: data.publicNum + ' photos', + sysdate: data.smartalbums.public.num + ' photos', public: '1', - thumb0: data.publicThumb0, - thumb1: data.publicThumb1, - thumb2: data.publicThumb2 + thumb0: data.smartalbums.public.thumb0, + thumb1: data.smartalbums.public.thumb1, + thumb2: data.smartalbums.public.thumb2 }; - data.recentAlbum = { + data.smartalbums.recent = { id: 'r', title: 'Recent', - sysdate: data.recentNum + ' photos', + sysdate: data.smartalbums.recent.num + ' photos', recent: '1', - thumb0: data.recentThumb0, - thumb1: data.recentThumb1, - thumb2: data.recentThumb2 + thumb0: data.smartalbums.recent.thumb0, + thumb1: data.smartalbums.recent.thumb1, + thumb2: data.smartalbums.recent.thumb2 }; albums.json = data; @@ -79,7 +79,7 @@ albums.load = function() { setTimeout(function() { header.setMode('albums'); view.albums.init(); - lychee.animate('.album, .photo', 'contentZoomIn'); + lychee.animate('.album', 'contentZoomIn'); }, waitTime); }); diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index 9659fb9..2a3e70f 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -82,7 +82,7 @@ contextMenu.albumTitle = function(albumID, e) { items.push({ type: 'separator' }); // Generate list of albums - $.each(data.content, function(index) { + $.each(data.albums, function(index) { var that = this, title = ''; @@ -220,7 +220,7 @@ contextMenu.move = function(photoIDs, e) { } else { // Generate list of albums - $.each(data.content, function(index) { + $.each(data.albums, function(index) { var that = this; diff --git a/src/scripts/password.js b/src/scripts/password.js index 10440c6..6267559 100644 --- a/src/scripts/password.js +++ b/src/scripts/password.js @@ -16,7 +16,7 @@ password.get = function(albumID, callback) { if (!lychee.publicMode) callback(); else if (album.json&&album.json.password==false) callback(); - else if (albums.json&&albums.json.content[albumID].password==false) callback(); + else if (albums.json&&albums.json.albums[albumID].password==false) callback(); else if (!albums.json&&!album.json) { // Continue without password diff --git a/src/scripts/view.js b/src/scripts/view.js index 2668b71..8385358 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -49,16 +49,21 @@ view.albums = { albumsData = ''; /* Smart Albums */ - albums.parse(albums.json.unsortedAlbum); - albums.parse(albums.json.publicAlbum); - albums.parse(albums.json.starredAlbum); - albums.parse(albums.json.recentAlbum); - if (!lychee.publicMode) smartData = build.divider('Smart Albums') + build.album(albums.json.unsortedAlbum) + build.album(albums.json.starredAlbum) + build.album(albums.json.publicAlbum) + build.album(albums.json.recentAlbum); + if (!lychee.publicMode) { + + albums.parse(albums.json.smartalbums.unsorted); + albums.parse(albums.json.smartalbums.public); + albums.parse(albums.json.smartalbums.starred); + albums.parse(albums.json.smartalbums.recent); + + smartData = build.divider('Smart Albums') + build.album(albums.json.smartalbums.unsorted) + build.album(albums.json.smartalbums.public) + build.album(albums.json.smartalbums.starred) + build.album(albums.json.smartalbums.recent); + + } /* Albums */ - if (albums.json.content&&albums.json.num!==0) { + if (albums.json.albums&&albums.json.num!==0) { - $.each(albums.json.content, function() { + $.each(albums.json.albums, function() { albums.parse(this); // Display albums in reverse order @@ -88,7 +93,7 @@ view.albums = { title: function(albumID) { var longTitle = '', - title = albums.json.content[albumID].title; + title = albums.json.albums[albumID].title; if (title!==null&&title.length>18) { longTitle = title; From b226f879b0027a13bbe9548c9aa4e051f6d6be6e Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 27 Feb 2015 21:16:22 +0100 Subject: [PATCH 3/5] Streamlines type of password --- dist/main.js | Bin 174199 -> 174382 bytes dist/view.js | Bin 93496 -> 93613 bytes php/modules/Album.php | 4 ++-- src/scripts/album.js | 10 +++++----- src/scripts/albums.js | 2 +- src/scripts/build.js | 20 ++++++++++---------- src/scripts/header.js | 2 +- src/scripts/password.js | 6 +++--- src/scripts/photo.js | 2 +- src/scripts/view.js | 9 +++++---- 10 files changed, 28 insertions(+), 27 deletions(-) diff --git a/dist/main.js b/dist/main.js index 06eb4ff8f62df1e85e1b8aedeacc41d9b87efeb7..f44d49812ebb8888fc76ccc2aee145048a7be943 100644 GIT binary patch delta 616 zcmex;k%a{yIZ0eKK*tRQ6&31%Q`yTCF=KW0{2TU$kg?Qts^x!Bl%%7NVJ8S5EkIl$uf z8mZF{Tw@g3K4(2+I;Q|cK2@(EvADQAzbIw;=^cz3+pTsoT5wJF3FNRX%g;R5YnX5*exzkr4VeA3>2idGlh*=G%8CkcNA7xa4_!y#MJJ7ZoMpCRWKE>G1 z3Jg4}%;^u0Fp5mSc#5$E!^&c?mD_<<_9{cem-juR1MBp4Ul}E~r+i`bVw}Dm7(LsM zePxWW0C|~J+`dFZ(<(71sWewFt2jSTO$`)Rz_JqvzX-g0EgAc{{R30 delta 407 zcmZ2?iR=3Xu7)j)&zCS7PJgw8QD%DJQbw)mMoSrIG8#-Tn8_s0Y-nXL{o@iwQ7E6$ zV7tOHMnC51DWOaz+n29oyv8bz)hDx@!wyAmriN(d``9;$O{Ta2kANOZ8=bG#j$YEcWpP8ay z0927!lwO*fnpaXBZ5V5>XlRAZ*U7V0Qqsu;64phjC8b4q3MD`tiiT=x(|!CHB^fiP zOD8c(O%IM@yaO^+jW|Q6?@wTqnC>6VSi+8M+V;oMj1J7GLeBAwC5$8*-7cYIpk!5K jtK^rjWSvx$nwV{!oLHO+43FtCiHxPF7JN)(bms;D2F78z delta 251 zcmZ2`n{~%6)`l&N{r>!^dIgEa#pU@$DYmw@iU!jQ{TRij=lU}WZ9neMXu&nvdlr|W zl9EoQt&);;QEEwPQJzAHB1om0T25thMk-K$X;MyRvTuG$DpXt}bGl&+qxAIZD8}0$ z{nOi`8M|chYTB+F!|2S+3RW}SJBd+x`-FJL5=O9YlSIZ=F-1eGB3mWDd?o9oqSVA} g>*U1ZRG@1wCNh>P;x$=KO(PNH9Qo~SNsQ{;0Mg7(SO5S3 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'); }, From 138bf714c5d938bb7aa4266ac70f3aa75659827b Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 27 Feb 2015 22:14:19 +0100 Subject: [PATCH 4/5] Streamlined type of star and public --- dist/main.js | Bin 174382 -> 174298 bytes src/scripts/album.js | 4 +- src/scripts/albums.js | 84 ++++++++++++++++++++++-------------------- src/scripts/photo.js | 10 ++--- src/scripts/view.js | 8 ++-- 5 files changed, 56 insertions(+), 50 deletions(-) diff --git a/dist/main.js b/dist/main.js index f44d49812ebb8888fc76ccc2aee145048a7be943..922236e310c5a11b59c4a7eb87e124364af9091f 100644 GIT binary patch delta 661 zcmZ2?iR;!yu7)j)=JQyT43uoA7tCZ5o4((biEVqxJVrha79~Td;P%R8jNB~KAD(8E z&`8WlD$Om{i%%{}O)NtaY76c2u1rb>(-RjniBF#}jftHDF165_Nq9R@)|3ev*$bG&5VHJpm?WU_4HTaa zjBnxTQ{0(!rk`HQC@?*LF%#$XsOd~R2n|5vM7RHTXZohO{Zk>+LqJ2M$jGAad zuh%l_7@?@rE6pp;FDgk*(JRR)%}p}U0aJ!nD2k>Vu49zYK@mdJXH<(SJw0|EhUM++ z7}e3-vwj_;xIe17#U+VFMKI?WLY!lS>Kr{3H5gWZT*s(|W{=EzM%`Q#d!m&JN|SOj zla*rec^q98cK4vG0=a1V#6BkB=`+_eDlkIX2iG$yLfHc7c7jzyMG3l9suFOEW=?g8H#HQ!FFtIWNg|}C`FnKUB8cb(&XA+YIDby*;OfA;~ zn}G0_hNg}oNJ%Kn1kvgLr!jG{fK8USW)j^#!=34yCL`DOzCxyljN1!}nU*Ut8^UZe sp2oBh#uMER)G5paOtWG$nf|jeg3T41p8J_mYP#-BCc*8o3z%v-08@V!Z diff --git a/src/scripts/album.js b/src/scripts/album.js index cd604bc..00ced60 100644 --- a/src/scripts/album.js +++ b/src/scripts/album.js @@ -384,7 +384,7 @@ album.setPublic = function(albumID, e) { albums.refresh(); - if (!basicModal.visible()&&album.json.public==0) { + if (!basicModal.visible()&&album.json.public==='0') { var msg = '', action; @@ -475,7 +475,7 @@ album.setPublic = function(albumID, e) { view.album.public(); view.album.password(); - if (album.json.public==1) contextMenu.shareAlbum(albumID, e); + if (album.json.public==='1') contextMenu.shareAlbum(albumID, e); } diff --git a/src/scripts/albums.js b/src/scripts/albums.js index b0a0289..72dbb81 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -25,45 +25,7 @@ albums.load = function() { api.post('Album::getAll', {}, function(data) { /* Smart Albums */ - data.smartalbums.unsorted = { - id: 0, - title: 'Unsorted', - sysdate: data.smartalbums.unsorted.num + ' photos', - unsorted: '1', - thumb0: data.smartalbums.unsorted.thumb0, - thumb1: data.smartalbums.unsorted.thumb1, - thumb2: data.smartalbums.unsorted.thumb2 - }; - - data.smartalbums.starred = { - id: 'f', - title: 'Starred', - sysdate: data.smartalbums.starred.num + ' photos', - star: '1', - thumb0: data.smartalbums.starred.thumb0, - thumb1: data.smartalbums.starred.thumb1, - thumb2: data.smartalbums.starred.thumb2 - }; - - data.smartalbums.public = { - id: 's', - title: 'Public', - sysdate: data.smartalbums.public.num + ' photos', - public: '1', - thumb0: data.smartalbums.public.thumb0, - thumb1: data.smartalbums.public.thumb1, - thumb2: data.smartalbums.public.thumb2 - }; - - data.smartalbums.recent = { - id: 'r', - title: 'Recent', - sysdate: data.smartalbums.recent.num + ' photos', - recent: '1', - thumb0: data.smartalbums.recent.thumb0, - thumb1: data.smartalbums.recent.thumb1, - thumb2: data.smartalbums.recent.thumb2 - }; + if (lychee.publicMode===false) albums._createSmartAlbums(data.smartalbums); albums.json = data; @@ -108,6 +70,50 @@ albums.parse = function(album) { } +albums._createSmartAlbums = function(data) { + + data.unsorted = { + id: 0, + title: 'Unsorted', + sysdate: data.unsorted.num + ' photos', + unsorted: '1', + thumb0: data.unsorted.thumb0, + thumb1: data.unsorted.thumb1, + thumb2: data.unsorted.thumb2 + }; + + data.starred = { + id: 'f', + title: 'Starred', + sysdate: data.starred.num + ' photos', + star: '1', + thumb0: data.starred.thumb0, + thumb1: data.starred.thumb1, + thumb2: data.starred.thumb2 + }; + + data.public = { + id: 's', + title: 'Public', + sysdate: data.public.num + ' photos', + public: '1', + thumb0: data.public.thumb0, + thumb1: data.public.thumb1, + thumb2: data.public.thumb2 + }; + + data.recent = { + id: 'r', + title: 'Recent', + sysdate: data.recent.num + ' photos', + recent: '1', + thumb0: data.recent.thumb0, + thumb1: data.recent.thumb1, + thumb2: data.recent.thumb2 + }; + +} + albums.refresh = function() { albums.json = null; diff --git a/src/scripts/photo.js b/src/scripts/photo.js index bb9d21a..9755c44 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -393,12 +393,12 @@ photo.setStar = function(photoIDs) { if (!photoIDs) return false; if (visible.photo()) { - photo.json.star = (photo.json.star==0) ? 1 : 0; + photo.json.star = (photo.json.star==='0') ? '1' : '0'; view.photo.star(); } photoIDs.forEach(function(id, index, array) { - album.json.content[id].star = (album.json.content[id].star==0) ? 1 : 0; + album.json.content[id].star = (album.json.content[id].star==='0') ? '1' : '0'; view.album.content.star(id); }); @@ -449,13 +449,13 @@ photo.setPublic = function(photoID, e) { if (visible.photo()) { - photo.json.public = (photo.json.public==0) ? 1 : 0; + photo.json.public = (photo.json.public==='0') ? '1' : '0'; view.photo.public(); - if (photo.json.public==1) contextMenu.sharePhoto(photoID, e); + if (photo.json.public==='1') contextMenu.sharePhoto(photoID, e); } - album.json.content[photoID].public = (album.json.content[photoID].public==0) ? 1 : 0; + album.json.content[photoID].public = (album.json.content[photoID].public==='0') ? '1' : '0'; view.album.content.public(photoID); albums.refresh(); diff --git a/src/scripts/view.js b/src/scripts/view.js index 1b7280e..745087a 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -209,14 +209,14 @@ view.album = { star: function(photoID) { $('.photo[data-id="' + photoID + '"] .iconic-star').remove(); - if (album.json.content[photoID].star==1) $('.photo[data-id="' + photoID + '"]').append("" + build.iconic('star') + ""); + if (album.json.content[photoID].star==='1') $('.photo[data-id="' + photoID + '"]').append("" + build.iconic('star') + ""); }, public: function(photoID) { $('.photo[data-id="' + photoID + '"] .iconic-share').remove(); - if (album.json.content[photoID].public==1) $('.photo[data-id="' + photoID + '"]').append(""); + if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append(""); }, @@ -253,7 +253,7 @@ view.album = { public: function() { - if (album.json.public==1) { + if (album.json.public==='1') { $('#button_share_album') .addClass('active') @@ -378,7 +378,7 @@ view.photo = { public: function() { - if (photo.json.public==1||photo.json.public==2) { + if (photo.json.public==='1'||photo.json.public==='2') { // Photo public $('#button_share') .addClass('active') From 1490dcbe9e34b2a12154371498b48de3efc80dee Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 27 Feb 2015 22:39:07 +0100 Subject: [PATCH 5/5] Removed md5 from search, renamed code var to hash --- php/modules/misc.php | 10 ++++++++++ src/bower.json | 1 - src/gulpfile.js | 1 - src/scripts/lychee.js | 4 ++-- src/scripts/search.js | 32 ++++++++++++++++---------------- src/scripts/visible.js | 2 +- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/php/modules/misc.php b/php/modules/misc.php index c449e4a..2094790 100755 --- a/php/modules/misc.php +++ b/php/modules/misc.php @@ -13,6 +13,13 @@ function search($database, $settings, $term) { $return['albums'] = ''; + # Initialize return var + $return = array( + 'photos' => null, + 'albums' => null, + 'hash' => '' + ); + # Photos $query = Database::prepare($database, "SELECT id, title, tags, public, star, album, thumbUrl FROM ? WHERE title LIKE '%?%' OR description LIKE '%?%' OR tags LIKE '%?%'", array(LYCHEE_TABLE_PHOTOS, $term, $term, $term)); $result = $database->query($query); @@ -48,6 +55,9 @@ function search($database, $settings, $term) { } + # Hash + $return['hash'] = md5(json_encode($return)); + return $return; } diff --git a/src/bower.json b/src/bower.json index 13a28eb..892d78a 100644 --- a/src/bower.json +++ b/src/bower.json @@ -3,7 +3,6 @@ "private": true, "dependencies": { "jQuery": "~2.1.3", - "js-md5": "~1.1.0", "mousetrap": "~1.4.6", "basicContext": "~2.0.2", "basicModal": "~2.0.3" diff --git a/src/gulpfile.js b/src/gulpfile.js index fbec696..08ba53a 100644 --- a/src/gulpfile.js +++ b/src/gulpfile.js @@ -59,7 +59,6 @@ paths.main = { ], scripts: [ 'bower_components/jQuery/dist/jquery.min.js', - 'bower_components/js-md5/js/md5.min.js', 'bower_components/mousetrap/mousetrap.min.js', 'bower_components/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js', 'bower_components/basicContext/dist/basicContext.min.js', diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index af2d130..6cda479 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -201,9 +201,9 @@ lychee.load = function() { } else { // Trash albums.json when filled with search results - if (search.code!=='') { + if (search.hash!==null) { albums.json = null; - search.code = ''; + search.hash = null; } // Trash data diff --git a/src/scripts/search.js b/src/scripts/search.js index 987d569..10c181c 100755 --- a/src/scripts/search.js +++ b/src/scripts/search.js @@ -5,15 +5,15 @@ search = { - code: null + hash: null } search.find = function(term) { - var albumsData = '', - photosData = '', - code; + var albumsData = '', + photosData = '', + html = ''; clearTimeout($(window).data('timeout')); $(window).data('timeout', setTimeout(function() { @@ -24,8 +24,8 @@ search.find = function(term) { // Build albums if (data&&data.albums) { - albums.json = { content: data.albums }; - $.each(albums.json.content, function() { + albums.json = { albums: data.albums }; + $.each(albums.json.albums, function() { albums.parse(this); albumsData += build.album(this); }); @@ -43,28 +43,28 @@ search.find = function(term) { // 2. Only photos found // 3. Only albums found // 4. Albums and photos found - if (albumsData===''&&photosData==='') code = 'error'; - else if (albumsData==='') code = build.divider('Photos') + photosData; - else if (photosData==='') code = build.divider('Albums') + albumsData; - else code = build.divider('Photos') + photosData + build.divider('Albums') + albumsData; + if (albumsData===''&&photosData==='') html = 'error'; + else if (albumsData==='') html = build.divider('Photos') + photosData; + else if (photosData==='') html = build.divider('Albums') + albumsData; + else html = build.divider('Photos') + photosData + build.divider('Albums') + albumsData; // Only refresh view when search results are different - if (search.code!==md5(code)) { + if (search.hash!==data.hash) { $('.no_content').remove(); lychee.animate('.album, .photo', 'contentZoomOut'); lychee.animate('.divider', 'fadeOut'); - search.code = md5(code); + search.hash = data.hash; setTimeout(function() { - if (code==='error') { + if (html==='error') { lychee.content.html(''); $('body').append(build.no_content('magnifying-glass')); } else { - lychee.content.html(code); + lychee.content.html(html); lychee.animate('.album, .photo', 'contentZoomIn'); $('img[data-type!="svg"]').retina(); } @@ -86,13 +86,13 @@ search.reset = function() { $('#search').val(''); $('.no_content').remove(); - if (search.code!=='') { + if (search.hash!==null) { // Trash data albums.json = null; album.json = null; photo.json = null; - search.code = ''; + search.hash = null; lychee.animate('.divider', 'fadeOut'); albums.load(); diff --git a/src/scripts/visible.js b/src/scripts/visible.js index 15ad6d3..58a40ca 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -21,7 +21,7 @@ visible.photo = function() { } visible.search = function() { - if (search.code!==null&&search.code!=='') return true; + if (search.hash!==null) return true; return false; }