From d32115333e3d35b98b8c09723d563026a34e306d Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 14:07:03 +0200 Subject: [PATCH 01/58] Fixed error when using "Merge All" with one selected album --- dist/main.js | Bin 177367 -> 177620 bytes src/scripts/contextMenu.js | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) mode change 100755 => 100644 dist/main.js diff --git a/dist/main.js b/dist/main.js old mode 100755 new mode 100644 index 71bef1858e22892acb76f7d485263b7d379ca739..f26b800f7f095755de2d03455565a053cdc8be6e GIT binary patch delta 166 zcmccqlIzNAu7)j)w~jEyT2GHV&L}l~!f8gn>AJTWxuzSO19Ih$G75`m>g4Galon@b zr0V6Q=B1Zp*csYSXFSYkK0WIwqY9%Hh+V=JZ4j$dqFGz3se@$FhNFz;OhA##hZ&=$ zE1zIA->z_s@sBREH5b=(nJh($ delta 104 zcmV-u0GI#N>k8ND3V^f$+QgSe&H*8p%fbN=mlVYTCzn{y0V0=h#Q{2(wa)<}mz=`^ z50_xZ0VtP#&;dr5V8Q_fw=Ks3>MfTV^#Q&C3YS3j0U5XP^#L$^mkHhhB$r2W0+<2{ K3b)^K0`)>n-z!A` diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index 69be4ac..c8e3022 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -68,11 +68,19 @@ contextMenu.albumMulti = function(albumIDs, e) { multiselect.stopResize(); - var items = [ - { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }, - { type: 'item', title: build.iconic('collapse-left') + 'Merge All', fn: function () { album.merge(albumIDs) } }, - { type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } } - ]; + var items = []; + + items.push({ type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }); + + // Automatically merge selected albums when albumIDs contains more than one album + // Show list of albums otherwise + if (albumIDs.length>1) items.push({ type: 'item', title: build.iconic('collapse-left') + 'Merge All', fn: function () { album.merge(albumIDs) } }); + else items.push({ type: 'item', title: build.iconic('collapse-left') + 'Merge', fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumIDs[0], e) } }) + + items.push({ type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } }); + + // Remove merge when there is only one album + if (albums.json&&albums.json.albums&&Object.keys(albums.json.albums).length<=1) items.splice(1, 1); basicContext.show(items, e.originalEvent, contextMenu.close); From a4300acc6addd5381876a500042516dc3fbc29f6 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 14:09:16 +0200 Subject: [PATCH 02/58] Removed bower and updated to the new basicModal --- src/bower.json | 7 ------- src/gulpfile.js | 4 ++-- src/package.json | 1 + 3 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 src/bower.json diff --git a/src/bower.json b/src/bower.json deleted file mode 100644 index fcce6c7..0000000 --- a/src/bower.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "Lychee", - "private": true, - "dependencies": { - "basicModal": "~2.0.8" - } -} diff --git a/src/gulpfile.js b/src/gulpfile.js index 544c54b..8e70103 100644 --- a/src/gulpfile.js +++ b/src/gulpfile.js @@ -88,7 +88,7 @@ paths.main = { 'node_modules/mousetrap/mousetrap.min.js', 'node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.min.js', 'node_modules/basiccontext/dist/basicContext.min.js', - 'bower_components/basicModal/dist/basicModal.min.js', + 'node_modules/basicmodal/dist/basicModal.min.js', '../dist/_main--javascript.js' ], scss: [ @@ -96,7 +96,7 @@ paths.main = { ], styles: [ 'node_modules/basiccontext/src/styles/main.scss', - 'bower_components/basicModal/src/styles/main.scss', + 'node_modules/basicmodal/src/styles/main.scss', './styles/main.scss' ], svg: [ diff --git a/src/package.json b/src/package.json index 5c25cf5..3ef181a 100644 --- a/src/package.json +++ b/src/package.json @@ -11,6 +11,7 @@ }, "devDependencies": { "basiccontext": "^3.1.2", + "basicmodal": "^3.1.1", "gulp": "^3.9.0", "gulp-autoprefixer": "2.3.1", "gulp-babel": "^5.1.0", From 82e1d6aa14a0f129fdf460346554256b2ac12110 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 15:48:27 +0200 Subject: [PATCH 03/58] Fixed basicModal style --- dist/main.css | Bin 36228 -> 32817 bytes dist/main.js | Bin 177620 -> 177396 bytes src/styles/_message.scss | 10 ++++++---- 3 files changed, 6 insertions(+), 4 deletions(-) mode change 100755 => 100644 dist/main.css diff --git a/dist/main.css b/dist/main.css old mode 100755 new mode 100644 index 22d2bf3360c57e61c819476635f0b0e3c48b7441..42f538045ea1ca25ff5e2b60a4b9983779ec14c4 GIT binary patch delta 1412 zcmaJ>&u`mQ99PmXC2f+mb<$>K3C@oSD%rtylBTtVV5`&v>!b}$95@g?$IpqW>*v|t zn$;9GX%f>ou<9!$#Fzx)%7G~o7tqAC>!c|MG>HrBzy&zKA25mMWNn?PL+|kXzVCfM z-_Q5+_4j-IcJ%Jm=&kDBdw;-3k+p~dcO&!grI+4Yn_u9nDsqkXS)w6xjaVKsEbOo{ z(!IS?IbK$=P8`g2G192H>Jeh9$njOu<6UFNusX6z9D2o5OaFf4P6WP7q$33@!q-MCbiLS`HiF@!%{C!wUsFVvAukHQB!1>8c|L4RHQFyqTi#7y6 z&K&r~1l;*x623_0;qO%ZgzJYflx;)vy0Rz;i*RbaSQeLdL%FnCZJG_XJl{r|77%SN z?gq5r*4eqjp{ufgE!ONFE3jhS?!iT~0B2Gne4lw29;9X=Kb;B)z+2Pj=&r!S-buPA z;Aw9aJ~WvL8hQv#UP-}crDLl;zm3&R!{dWodAI8r)}|~e{FXbiSh#~c<1(hUu^0O& z8S5wj@dyBM3_w)c#3YVfmR6b#tSQ4Xb&*E4Wy5l@$BM%o1=i`P=rw^0R`rlPlb3bF zaXr4>HB4<(umzVah}YK9D(HTxzvE-1Gd9$Xm$i7?vy?s!e5P zMOx)7+}>f}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_message.scss b/src/styles/_message.scss index 7df5676..17a5d86 100644 --- a/src/styles/_message.scss +++ b/src/styles/_message.scss @@ -9,12 +9,15 @@ .basicModal { background: linear-gradient(to bottom, #444, #333); - border: 1px solid black(.7); - border-bottom: 1px solid black(.8); box-shadow: 0 1px 4px black(.2), inset 0 1px 0 white(.05); + /* Reset default styles ------------------------------------------------*/ + .basicModal__content { padding: 0; } + .basicModal__content p { margin: 0; } + .basicModal__buttons { box-shadow: none; } + + /* Text ------------------------------------------------*/ p { - display: block; padding: 10px 30px; color: white(.9); font-size: 14px; @@ -70,7 +73,6 @@ &#basicModal__action.red { color: $colorRed; } &.hidden { display: none; } - } /* Inputs ------------------------------------------------*/ From 477351438e9741be4e057b33d88a958405dfd37d Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 17:28:32 +0200 Subject: [PATCH 04/58] Fixed width of basicModal elements --- src/styles/_message.scss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/styles/_message.scss b/src/styles/_message.scss index 17a5d86..ae96aa0 100644 --- a/src/styles/_message.scss +++ b/src/styles/_message.scss @@ -77,8 +77,8 @@ /* Inputs ------------------------------------------------*/ input.text { - width: calc(100% - 4px); padding: 9px 2px; + width: 100%; background-color: transparent; color: #fff; text-shadow: $shadow; @@ -102,7 +102,7 @@ /* Radio Buttons ------------------------------------------------*/ .choice { padding: 0 30px 15px; - width: calc(100% - 60px); + width: 100%; color: #fff; &:last-child { padding-bottom: 40px; } @@ -161,7 +161,7 @@ clear: both; padding: 2px 0 0 35px; margin: 0; - width: calc(100% - 35px); + width: 100%; color: white(.6); font-size: 13px; } @@ -170,7 +170,7 @@ display: none; margin-top: 5px; margin-left: 35px; - width: calc(100% - 39px); + width: calc(100% - 35px); } } @@ -317,7 +317,7 @@ display: none; float: left; padding: 2px 10px 5px; - width: calc(100% - 20px); + width: 100%; color: white(.5); font-size: 12px; overflow: hidden; From e36fd87f5a749a41804f83679499a7d381157196 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 17:29:03 +0200 Subject: [PATCH 05/58] Added skipDuplicates to default settings table --- php/database/settings_content.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/php/database/settings_content.sql b/php/database/settings_content.sql index 60d178f..cbcc9d6 100644 --- a/php/database/settings_content.sql +++ b/php/database/settings_content.sql @@ -15,4 +15,5 @@ VALUES ('imagick','1'), ('dropboxKey',''), ('identifier',''), + ('skipDuplicates','0'), ('plugins',''); \ No newline at end of file From f925e118c2f1fecad42a14fbd0f945f50bbb8e58 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 17:47:19 +0200 Subject: [PATCH 06/58] Generate identifier when creating the database, not on update This fixes the broken 'setLogin' when using Lychee for the first time. --- php/database/update_030001.php | 8 -------- php/modules/Database.php | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/php/database/update_030001.php b/php/database/update_030001.php index 24a0191..3147255 100644 --- a/php/database/update_030001.php +++ b/php/database/update_030001.php @@ -54,14 +54,6 @@ if ($result->num_rows===0) { Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')'); return false; } -} else { - $identifier = md5(microtime(true)); - $query = Database::prepare($database, "UPDATE `?` SET `value` = '?' WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS, $identifier)); - $result = $database->query($query); - if (!$result) { - Log::error($database, 'update_030001', __LINE__, 'Could not reset public albums (' . $database->error . ')'); - return false; - } } # Set version diff --git a/php/modules/Database.php b/php/modules/Database.php index 13bcff7..280de73 100755 --- a/php/modules/Database.php +++ b/php/modules/Database.php @@ -198,6 +198,14 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); return false; } + # Generate identifier + $identifier = md5(microtime(true)); + $query = Database::prepare($database, "UPDATE `?` SET `value` = '?' WHERE `key` = 'identifier' LIMIT 1", array(LYCHEE_TABLE_SETTINGS, $identifier)); + if (!$database->query($query)) { + Log::error($database, __METHOD__, __LINE__, $database->error); + return false; + } + } # Create albums From 30e4585146fc856a9cf05c9b12d267d806afe9d3 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 17:47:31 +0200 Subject: [PATCH 07/58] Code adjustment --- src/scripts/albums.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scripts/albums.js b/src/scripts/albums.js index a0288b6..36932bb 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -42,6 +42,7 @@ albums.load = function() { view.albums.init(); lychee.animate('#content', 'contentZoomIn'); }, waitTime); + }); } else { From 53448d1ace51a1b7ad1b5a81060d25036c1fb1e9 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 17:59:37 +0200 Subject: [PATCH 08/58] Rebuild --- dist/main.css | Bin 32817 -> 32766 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/dist/main.css b/dist/main.css index 42f538045ea1ca25ff5e2b60a4b9983779ec14c4..b9c1473de10d2874bca168108fc4257cc7b9f601 100644 GIT binary patch delta 91 zcmdnk!1V7w;|76T-h#xGl+3(zE6aik1*6IL9VI63E)(7yl3UNnVrXEXI@uvpVsc$R p`)20+JuDEBi&>JBUltd#m=;uMPF5%v*<4i8#|f6&ELf+&1OOe_AJ+f? delta 112 zcmezOpK)UY(*}WDmGaD#k_@Zl#GGUeLjwa<1ziP`f(lLRg2a@R%)E3f%Yq68qsf7S z>YM#@D;Otl3KW{`m?=KluYi5?tGqodlhsQECmU5uPL7P`n|!f2nbC5yX~|MfcBpxi NHL49av)27&1OVTrC Date: Sun, 28 Jun 2015 18:33:17 +0200 Subject: [PATCH 09/58] Updated modals to work with the new basicModal (data-name => name) --- src/scripts/album.js | 14 +++++++------- src/scripts/lychee.js | 8 ++++---- src/scripts/password.js | 11 +++++------ src/scripts/photo.js | 6 +++--- src/scripts/settings.js | 22 +++++++++++----------- src/scripts/upload.js | 4 ++-- 6 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/scripts/album.js b/src/scripts/album.js index e1f56b2..11725e7 100644 --- a/src/scripts/album.js +++ b/src/scripts/album.js @@ -138,7 +138,7 @@ album.add = function() { } basicModal.show({ - body: "

Enter a title for the new album:

", + body: "

Enter a title for the new album:

", buttons: { action: { title: 'Create Album', @@ -306,7 +306,7 @@ album.setTitle = function(albumIDs) { } - input = ""; + input = ""; if (albumIDs.length===1) msg = "

Enter a new title for this album: " + input + "

"; else msg = "

Enter a title for all " + albumIDs.length + " selected albums: " + input +"

"; @@ -361,7 +361,7 @@ album.setDescription = function(albumID) { } basicModal.show({ - body: "

Please enter a description for this album:

", + body: "

Please enter a description for this album:

", buttons: { action: { title: 'Set Description', @@ -431,7 +431,7 @@ album.setPublic = function(albumID, modal, e) { Password protected

Only accessible with a valid password.

- + ` @@ -457,8 +457,8 @@ album.setPublic = function(albumID, modal, e) { $('.basicModal .choice input[name="password"]').on('change', function() { - if ($(this).prop('checked')===true) $('.basicModal .choice input[data-name="password"]').show().focus(); - else $('.basicModal .choice input[data-name="password"]').hide(); + if ($(this).prop('checked')===true) $('.basicModal .choice input[name="passwordtext"]').show().focus(); + else $('.basicModal .choice input[name="passwordtext"]').hide(); }); @@ -482,7 +482,7 @@ album.setPublic = function(albumID, modal, e) { // Set password if ($('.basicModal .choice input[name="password"]:checked').length===1) { - password = $('.basicModal .choice input[data-name="password"]').val(); + password = $('.basicModal .choice input[name="passwordtext"]').val(); album.json.password = '1'; } else { password = ''; diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index 8238f18..6e0103d 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -127,8 +127,8 @@ lychee.loginDialog = function() { msg = `

Lychee ${ lychee.version }Update available!

` @@ -150,8 +150,8 @@ lychee.loginDialog = function() { if (localStorage) { localUsername = localStorage.getItem('lychee_username'); if (localUsername!==null) { - if (localUsername.length>0) $('.basicModal input[data-name="username"]').val(localUsername); - $('.basicModal input[data-name="password"]').focus(); + if (localUsername.length>0) $('.basicModal input[name="username"]').val(localUsername); + $('.basicModal input[name="password"]').focus(); } } diff --git a/src/scripts/password.js b/src/scripts/password.js index eed704a..c0440f3 100644 --- a/src/scripts/password.js +++ b/src/scripts/password.js @@ -9,10 +9,9 @@ password = { } -password.get = function(albumID, callback) { +password.get = function(albumID, callback, passwd) { - var passwd = $('.basicModal input.text').val(), - params; + var params; if (lychee.publicMode===false) callback(); else if (album.json&&album.json.password==='0') callback(); @@ -23,7 +22,7 @@ password.get = function(albumID, callback) { album.json = {password: true}; callback(''); - } else if (passwd==undefined) { + } else if (passwd==null) { // Request password password.getDialog(albumID, callback); @@ -59,7 +58,7 @@ password.getDialog = function(albumID, callback) { cancel, msg = ''; - action = function() { password.get(albumID, callback) } + action = function(data) { password.get(albumID, callback, data.password) } cancel = function() { basicModal.close(); @@ -69,7 +68,7 @@ password.getDialog = function(albumID, callback) { msg = `

This album is protected by a password. Enter the password below to view the photos of this album: - +

` diff --git a/src/scripts/photo.js b/src/scripts/photo.js index 58d2d9f..4c3b83e 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -330,7 +330,7 @@ photo.setTitle = function(photoIDs) { } - input = ""; + input = ""; if (photoIDs.length===1) msg = "

Enter a new title for this photo: " + input + "

"; else msg = "

Enter a title for all " + photoIDs.length + " selected photos: " + input + "

"; @@ -509,7 +509,7 @@ photo.setDescription = function(photoID) { } basicModal.show({ - body: "

Enter a description for this photo:

", + body: "

Enter a description for this photo:

", buttons: { action: { title: 'Set Description', @@ -556,7 +556,7 @@ photo.editTags = function(photoIDs) { } - input = ""; + input = ""; if (photoIDs.length===1) msg = "

Enter your tags for this photo. You can add multiple tags by separating them with a comma: " + input + "

"; else msg = "

Enter your tags for all " + photoIDs.length + " selected photos. Existing tags will be overwritten. You can add multiple tags by separating them with a comma: " + input + "

"; diff --git a/src/scripts/settings.js b/src/scripts/settings.js index eda7102..2cc6cf0 100644 --- a/src/scripts/settings.js +++ b/src/scripts/settings.js @@ -117,14 +117,14 @@ settings.createConfig = function() { msg = `

Enter your database connection details below: - - - + + +

Lychee will create its own database. If required, you can enter the name of an existing database instead: - - + +

` @@ -191,8 +191,8 @@ settings.createLogin = function() { msg = `

Enter a username and password for your installation: - - + +

` @@ -254,12 +254,12 @@ settings.setLogin = function() { msg = `

Enter your current password: - +

Your username and password will be changed to the following: - - + +

` @@ -426,7 +426,7 @@ settings.setDropboxKey = function(callback) { msg = `

In order to import photos from your Dropbox, you need a valid drop-ins app key from their website. Generate yourself a personal key and enter it below: - +

` diff --git a/src/scripts/upload.js b/src/scripts/upload.js index 9d5833b..de17f6a 100755 --- a/src/scripts/upload.js +++ b/src/scripts/upload.js @@ -322,7 +322,7 @@ upload.start = { } basicModal.show({ - body: "

Please enter the direct link to a photo to import it:

", + body: "

Please enter the direct link to a photo to import it:

", buttons: { action: { title: 'Import', @@ -389,7 +389,7 @@ upload.start = { } basicModal.show({ - body: "

This action will import all photos, folders and sub-folders which are located in the following directory. The original files will be deleted after the import when possible.

", + body: "

This action will import all photos, folders and sub-folders which are located in the following directory. The original files will be deleted after the import when possible.

", buttons: { action: { title: 'Import', From d7a9d1d1e8fb13ae88a0dc6a3b466fd79f58bb73 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 18:33:22 +0200 Subject: [PATCH 10/58] Rebuild --- dist/main.js | Bin 177396 -> 177218 bytes 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dist/main.js diff --git a/dist/main.js b/dist/main.js old mode 100644 new mode 100755 index 87a74d12becb97a2caa5156cc3d53d9e0809ff7f..b07b3f5be3e42773af7131b8649719a8415c0ad9 GIT binary patch delta 813 zcmYjOT}V@580LMqsarS)<`4em+)W|qa6olI;+l!Bdb)|_=}r(AAlxt-}!1H&$( zASW+fL{J0~T?9kFqKlvc0|Re@3L>ur?W%GVMMU3RQdjTu{(R5-yw8_evpiq5JX$LT zdFE4b6a?z+fXZ}YYt#sGdZqkHHr%fMR%#U*8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YT5_w5O+T^T0j!z`e;f@o)R1kV+i z{K`^p?81{d<_Er%r|j`Q6w_OJzaRG$n`CJK!zLUEV912C0bDTQbTWkFCihpyxU6z*etISR-)L9+s3(ABtgIc^tpV$``%pst5zMAX dI&qMO5?IU@I?-Fc>czxi+>&YH`Vm~V{Q Date: Sun, 28 Jun 2015 18:35:10 +0200 Subject: [PATCH 11/58] Updated file format error --- dist/main.js | Bin 177218 -> 177206 bytes src/scripts/upload.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/main.js b/dist/main.js index b07b3f5be3e42773af7131b8649719a8415c0ad9..2c212661ab7a4207f70e23e8b6ff22b1896d8daa 100755 GIT binary patch delta 39 ucmX@~f@|9gu7(!IElh&F!fu&4sS0WNMY)M33i)XYIhlFc+YNe|gwz2#_6}qK delta 51 zcmdn?g6q%=u7(!IElh&F@*x?i3Tc@+Kq9{=H?c$^KTV+|BePf`Co?ZwA+vb9N-vX; FIsgZ75}5!1 diff --git a/src/scripts/upload.js b/src/scripts/upload.js index de17f6a..9984520 100755 --- a/src/scripts/upload.js +++ b/src/scripts/upload.js @@ -281,7 +281,7 @@ upload.start = { extension = data.link.split('.').pop(); if (extension!=='jpeg'&&extension!=='jpg'&&extension!=='png'&&extension!=='gif'&&extension!=='webp') { - loadingBar.show('error', 'The file format of this link is not supported.'); + loadingBar.show('error', 'File format of link not supported.'); return false; } From 1dece874347e63c340fdae043f79e57fbaa2072b Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 18:58:17 +0200 Subject: [PATCH 12/58] Fixed: Only import urls passend to the function, not existing photos from the temp folder --- php/modules/Import.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/php/modules/Import.php b/php/modules/Import.php index 618e39d..7ab2da9 100644 --- a/php/modules/Import.php +++ b/php/modules/Import.php @@ -32,6 +32,8 @@ class Import extends Module { static function url($urls, $albumID = 0) { + global $database, $plugins, $settings; + $error = false; # Parse @@ -40,6 +42,9 @@ class Import extends Module { foreach ($urls as &$url) { + # Validate photo type and extension even when Import::photo (=> $photo->add) will do the same. + # This prevents us from downloading invalid photos. + # Verify extension $extension = getExtension($url); if (!in_array(strtolower($extension), Photo::$validExtensions, true)) { @@ -58,14 +63,23 @@ class Import extends Module { $filename = $pathinfo['filename'] . '.' . $pathinfo['extension']; $tmp_name = LYCHEE_DATA . $filename; - if (@copy($url, $tmp_name)===false) $error = true; + if (@copy($url, $tmp_name)===false) { + $error = true; + Log::error($database, __METHOD__, __LINE__, 'Could not copy file (' . $tmp_name . ') to temp-folder (' . $tmp_name . ')'); + continue; + } + + # Import photo + if (!Import::photo($database, $plugins, $settings, $tmp_name, $albumID)) { + $error = true; + Log::error($database, __METHOD__, __LINE__, 'Could not import file: ' . $tmp_name); + continue; + } } - $import = Import::server($albumID, LYCHEE_DATA); - - if ($error===false&&$import===true) return true; - else return false; + if ($error===false) return true; + return false; } From 4cff63d500190ae004cdd0d0a09c334e535deaa7 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 18:58:38 +0200 Subject: [PATCH 13/58] Fixed width of rows in upload modal --- dist/main.css | Bin 32766 -> 32740 bytes src/styles/_message.scss | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/main.css b/dist/main.css index b9c1473de10d2874bca168108fc4257cc7b9f601..d89a969ef5ec32d632f30936adc9aa200bf1a0d7 100644 GIT binary patch delta 34 pcmezOpYh3m#toCIn9U7TC+p=)Pu^RV%4`f|U(Ax(>{q>k1ppCc4ov_6 delta 63 zcmaFzpYh*+#toCI1d Date: Sun, 28 Jun 2015 23:09:41 +0200 Subject: [PATCH 14/58] Added returnOnError functionality to Photo::add --- php/modules/Photo.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/php/modules/Photo.php b/php/modules/Photo.php index 0d9eff6..402c42f 100755 --- a/php/modules/Photo.php +++ b/php/modules/Photo.php @@ -37,7 +37,10 @@ class Photo extends Module { } - public function add($files, $albumID, $description = '', $tags = '') { + public function add($files, $albumID = 0, $description = '', $tags = '', $returnOnError = false) { + + # Use $returnOnError if you want to handle errors by your own + # e.g. when calling this functions inside an if-condition # Check dependencies self::dependencies(isset($this->database, $this->settings, $files)); @@ -89,6 +92,7 @@ class Photo extends Module { $extension = getExtension($file['name']); if (!in_array(strtolower($extension), Photo::$validExtensions, true)) { Log::error($this->database, __METHOD__, __LINE__, 'Photo format not supported'); + if ($returnOnError===true) return false; exit('Error: Photo format not supported!'); } @@ -96,6 +100,7 @@ class Photo extends Module { $type = @exif_imagetype($file['tmp_name']); if (!in_array($type, Photo::$validTypes, true)) { Log::error($this->database, __METHOD__, __LINE__, 'Photo type not supported'); + if ($returnOnError===true) return false; exit('Error: Photo type not supported!'); } @@ -112,6 +117,7 @@ class Photo extends Module { $checksum = sha1_file($tmp_name); if ($checksum===false) { Log::error($this->database, __METHOD__, __LINE__, 'Could not calculate checksum for photo'); + if ($returnOnError===true) return false; exit('Error: Could not calculate checksum for photo!'); } @@ -141,11 +147,13 @@ class Photo extends Module { if (!is_uploaded_file($tmp_name)) { if (!@copy($tmp_name, $path)) { Log::error($this->database, __METHOD__, __LINE__, 'Could not copy photo to uploads'); + if ($returnOnError===true) return false; exit('Error: Could not copy photo to uploads!'); } else @unlink($tmp_name); } else { if (!@move_uploaded_file($tmp_name, $path)) { Log::error($this->database, __METHOD__, __LINE__, 'Could not move photo to uploads'); + if ($returnOnError===true) return false; exit('Error: Could not move photo to uploads!'); } } @@ -156,6 +164,7 @@ class Photo extends Module { # Check if the user wants to skip duplicates if ($this->settings['skipDuplicates']==='1') { Log::notice($this->database, __METHOD__, __LINE__, 'Skipped upload of existing photo because skipDuplicates is activated'); + if ($returnOnError===true) return false; exit('Warning: This photo has been skipped because it\'s already in your library.'); } @@ -185,6 +194,7 @@ class Photo extends Module { # Create Thumb if (!$this->createThumb($path, $photo_name, $info['type'], $info['width'], $info['height'])) { Log::error($this->database, __METHOD__, __LINE__, 'Could not create thumbnail for photo'); + if ($returnOnError===true) return false; exit('Error: Could not create thumbnail for photo!'); } @@ -204,6 +214,7 @@ class Photo extends Module { if (!$result) { Log::error($this->database, __METHOD__, __LINE__, $this->database->error); + if ($returnOnError===true) return false; exit('Error: Could not save photo in database!'); } From 61431c6e59426a962e39aacf3087565301e06c13 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 23:13:48 +0200 Subject: [PATCH 15/58] Better error-handling for import.url() and import.dropbox() --- src/scripts/upload.js | 54 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/src/scripts/upload.js b/src/scripts/upload.js index 9984520..1587816 100755 --- a/src/scripts/upload.js +++ b/src/scripts/upload.js @@ -303,7 +303,30 @@ upload.start = { api.post('Import::url', params, function(data) { - basicModal.close(); + // Same code as in import.dropbox() + + if (data!==true) { + + $('.basicModal .rows .row p.notice') + .html('The import has been finished, but returned warnings or errors. Please take a look at the log (Settings -> Show Log) for further details.') + .show(); + + $('.basicModal .rows .row .status') + .html('Finished') + .addClass('warning'); + + // Show close button + $('.basicModal #basicModal__action.hidden').show(); + + // Log error + lychee.error(null, params, data); + + } else { + + basicModal.close(); + + } + upload.notify('Import complete'); albums.refresh(); @@ -311,8 +334,6 @@ upload.start = { if (album.getID()===false) lychee.goto('0'); else album.load(albumID); - if (data!==true) lychee.error(null, params, data); - }); }); @@ -441,7 +462,30 @@ upload.start = { api.post('Import::url', params, function(data) { - basicModal.close(); + // Same code as in import.url() + + if (data!==true) { + + $('.basicModal .rows .row p.notice') + .html('The import has been finished, but returned warnings or errors. Please take a look at the log (Settings -> Show Log) for further details.') + .show(); + + $('.basicModal .rows .row .status') + .html('Finished') + .addClass('warning'); + + // Show close button + $('.basicModal #basicModal__action.hidden').show(); + + // Log error + lychee.error(null, params, data); + + } else { + + basicModal.close(); + + } + upload.notify('Import complete'); albums.refresh(); @@ -449,8 +493,6 @@ upload.start = { if (album.getID()===false) lychee.goto('0'); else album.load(albumID); - if (data!==true) lychee.error(null, params, data); - }); }); From 897fad76cf0f9064729e2270eb35fe1efa6dc45d Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 28 Jun 2015 23:17:09 +0200 Subject: [PATCH 16/58] Added skipDuplicates- and identifier-check to the diagnostics --- plugins/check/index.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/check/index.php b/plugins/check/index.php index 347d975..b21b087 100644 --- a/plugins/check/index.php +++ b/plugins/check/index.php @@ -68,13 +68,15 @@ if (!isset($dbPassword)) $error .= ('Error: No property for $dbPassword in con if (!isset($dbHost)||$dbHost==='') $error .= ('Error: No property for $dbHost in config.php' . PHP_EOL); # Settings -if (!isset($settings['username'])||$settings['username']=='') $error .= ('Error: Username empty or not set in database' . PHP_EOL); -if (!isset($settings['password'])||$settings['password']=='') $error .= ('Error: Password empty or not set in database' . PHP_EOL); -if (!isset($settings['thumbQuality'])||$settings['thumbQuality']=='') $error .= ('Error: No or wrong property for thumbQuality in database' . PHP_EOL); -if (!isset($settings['sortingPhotos'])||$settings['sortingPhotos']=='') $error .= ('Error: Wrong property for sortingPhotos in database' . PHP_EOL); -if (!isset($settings['sortingAlbums'])||$settings['sortingAlbums']=='') $error .= ('Error: Wrong property for sortingAlbums in database' . PHP_EOL); -if (!isset($settings['plugins'])) $error .= ('Error: No property for plugins in database' . PHP_EOL); -if (!isset($settings['imagick'])||$settings['imagick']=='') $error .= ('Error: No or wrong property for imagick in database' . PHP_EOL); +if (!isset($settings['username'])||$settings['username']=='') $error .= ('Error: Username empty or not set in database' . PHP_EOL); +if (!isset($settings['password'])||$settings['password']=='') $error .= ('Error: Password empty or not set in database' . PHP_EOL); +if (!isset($settings['thumbQuality'])||$settings['thumbQuality']=='') $error .= ('Error: No or wrong property for thumbQuality in database' . PHP_EOL); +if (!isset($settings['sortingPhotos'])||$settings['sortingPhotos']=='') $error .= ('Error: Wrong property for sortingPhotos in database' . PHP_EOL); +if (!isset($settings['sortingAlbums'])||$settings['sortingAlbums']=='') $error .= ('Error: Wrong property for sortingAlbums in database' . PHP_EOL); +if (!isset($settings['plugins'])) $error .= ('Error: No property for plugins in database' . PHP_EOL); +if (!isset($settings['imagick'])||$settings['imagick']=='') $error .= ('Error: No or wrong property for imagick in database' . PHP_EOL); +if (!isset($settings['identifier'])||$settings['identifier']=='') $error .= ('Error: No or wrong property for identifier in database' . PHP_EOL); +if (!isset($settings['skipDuplicates'])||$settings['skipDuplicates']=='') $error .= ('Error: No or wrong property for skipDuplicates in database' . PHP_EOL); if (!isset($settings['checkForUpdates'])||($settings['checkForUpdates']!='0'&&$settings['checkForUpdates']!='1')) $error .= ('Error: No or wrong property for checkForUpdates in database' . PHP_EOL); # Check dropboxKey From f1ff8bf2b01e72776a890e93e9410627b02cae78 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 29 Jun 2015 09:45:03 +0200 Subject: [PATCH 17/58] Import module now without static functions --- php/access/Admin.php | 6 ++- php/modules/Import.php | 93 ++++++++++++++++++++++++++++-------------- 2 files changed, 66 insertions(+), 33 deletions(-) diff --git a/php/access/Admin.php b/php/access/Admin.php index f2ba009..e70aa07 100644 --- a/php/access/Admin.php +++ b/php/access/Admin.php @@ -219,14 +219,16 @@ class Admin extends Access { private function importUrl() { Module::dependencies(isset($_POST['url'], $_POST['albumID'])); - echo Import::url($_POST['url'], $_POST['albumID']); + $import = new Import($this->database, $this->plugins, $this->settings); + echo $import->url($_POST['url'], $_POST['albumID']); } private function importServer() { Module::dependencies(isset($_POST['albumID'], $_POST['path'])); - echo Import::server($_POST['albumID'], $_POST['path']); + $import = new Import($this->database, $this->plugins, $this->settings); + echo $import->server($_POST['path'], $_POST['albumID']); } diff --git a/php/modules/Import.php b/php/modules/Import.php index 7ab2da9..381e9b1 100644 --- a/php/modules/Import.php +++ b/php/modules/Import.php @@ -9,14 +9,32 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); class Import extends Module { - static function photo($database, $plugins, $settings, $path, $albumID = 0, $description = '', $tags = '') { + private $database = null; + private $settings = null; + private $albumIDs = null; + + public function __construct($database, $plugins, $settings) { + + # Init vars + $this->database = $database; + $this->plugins = $plugins; + $this->settings = $settings; + + return true; + + } + + private function photo($path, $albumID = 0, $description = '', $tags = '') { + + # Check dependencies + self::dependencies(isset($this->database, $this->plugins, $this->settings, $path)); # No need to validate photo type and extension in this function. # $photo->add will take care of it. $info = getimagesize($path); $size = filesize($path); - $photo = new Photo($database, $plugins, $settings, null); + $photo = new Photo($this->database, $this->plugins, $this->settings, null); $nameFile = array(array()); $nameFile[0]['name'] = $path; @@ -25,30 +43,35 @@ class Import extends Module { $nameFile[0]['error'] = 0; $nameFile[0]['size'] = $size; - if (!$photo->add($nameFile, $albumID, $description, $tags)) return false; + if (!$photo->add($nameFile, $albumID, $description, $tags, true)) return false; return true; } - static function url($urls, $albumID = 0) { + public function url($urls, $albumID = 0) { - global $database, $plugins, $settings; + # Check dependencies + self::dependencies(isset($this->database, $urls)); + + # Call plugins + $this->plugins(__METHOD__, 0, func_get_args()); $error = false; - # Parse + # Parse URLs $urls = str_replace(' ', '%20', $urls); $urls = explode(',', $urls); foreach ($urls as &$url) { - # Validate photo type and extension even when Import::photo (=> $photo->add) will do the same. + # Validate photo type and extension even when $this->photo (=> $photo->add) will do the same. # This prevents us from downloading invalid photos. # Verify extension $extension = getExtension($url); if (!in_array(strtolower($extension), Photo::$validExtensions, true)) { $error = true; + Log::error($this->database, __METHOD__, __LINE__, 'Photo format not supported (' . $url . ')'); continue; } @@ -56,6 +79,7 @@ class Import extends Module { $type = @exif_imagetype($url); if (!in_array($type, Photo::$validTypes, true)) { $error = true; + Log::error($this->database, __METHOD__, __LINE__, 'Photo type not supported (' . $url . ')'); continue; } @@ -65,34 +89,38 @@ class Import extends Module { if (@copy($url, $tmp_name)===false) { $error = true; - Log::error($database, __METHOD__, __LINE__, 'Could not copy file (' . $tmp_name . ') to temp-folder (' . $tmp_name . ')'); + Log::error($this->database, __METHOD__, __LINE__, 'Could not copy file (' . $tmp_name . ') to temp-folder (' . $tmp_name . ')'); continue; } # Import photo - if (!Import::photo($database, $plugins, $settings, $tmp_name, $albumID)) { + if (!$this->photo($tmp_name, $albumID)) { $error = true; - Log::error($database, __METHOD__, __LINE__, 'Could not import file: ' . $tmp_name); + Log::error($this->database, __METHOD__, __LINE__, 'Could not import file: ' . $tmp_name); continue; } } + # Call plugins + $this->plugins(__METHOD__, 1, func_get_args()); + if ($error===false) return true; return false; } - static function server($albumID = 0, $path) { + public function server($path, $albumID = 0) { - global $database, $plugins, $settings; + # Check dependencies + self::dependencies(isset($this->database, $this->plugins, $this->settings)); # Parse path - if (!isset($path)) $path = LYCHEE_UPLOADS_IMPORT; - if (substr($path, -1)==='/') $path = substr($path, 0, -1); + if (!isset($path)) $path = LYCHEE_UPLOADS_IMPORT; + if (substr($path, -1)==='/') $path = substr($path, 0, -1); if (is_dir($path)===false) { - Log::error($database, __METHOD__, __LINE__, 'Given path is not a directory (' . $path . ')'); + Log::error($this->database, __METHOD__, __LINE__, 'Given path is not a directory (' . $path . ')'); return 'Error: Given path is not a directory!'; } @@ -100,7 +128,7 @@ class Import extends Module { if ($path===LYCHEE_UPLOADS_BIG||($path . '/')===LYCHEE_UPLOADS_BIG|| $path===LYCHEE_UPLOADS_MEDIUM||($path . '/')===LYCHEE_UPLOADS_MEDIUM|| $path===LYCHEE_UPLOADS_THUMB||($path . '/')===LYCHEE_UPLOADS_THUMB) { - Log::error($database, __METHOD__, __LINE__, 'The given path is a reserved path of Lychee (' . $path . ')'); + Log::error($this->database, __METHOD__, __LINE__, 'The given path is a reserved path of Lychee (' . $path . ')'); return 'Error: Given path is a reserved path of Lychee!'; } @@ -108,10 +136,10 @@ class Import extends Module { $contains['photos'] = false; $contains['albums'] = false; - # Invoke plugins directly, as instance method not valid here + # Call plugins # Note that updated albumId and path explicitly passed, rather # than using func_get_args() which will only return original ones - $plugins->activate(__METHOD__ . ":before", array($albumID, $path)); + $this->plugins(__METHOD__, 0, array($albumID, $path)); # Get all files $files = glob($path . '/*'); @@ -122,7 +150,7 @@ class Import extends Module { # the file may still be unreadable by the user if (!is_readable($file)) { $error = true; - Log::error($database, __METHOD__, __LINE__, 'Could not read file or directory: ' . $file); + Log::error($this->database, __METHOD__, __LINE__, 'Could not read file or directory: ' . $file); continue; } @@ -130,33 +158,33 @@ class Import extends Module { # Photo - if (!Import::photo($database, $plugins, $settings, $file, $albumID)) { + $contains['photos'] = true; + + if (!$this->photo($file, $albumID)) { $error = true; - Log::error($database, __METHOD__, __LINE__, 'Could not import file: ' . $file); + Log::error($this->database, __METHOD__, __LINE__, 'Could not import file: ' . $file); continue; } - $contains['photos'] = true; } else if (is_dir($file)) { # Folder - $name = mysqli_real_escape_string($database, basename($file)); - $album = new Album($database, null, null, null); - $newAlbumID = $album->add('[Import] ' . $name); + $album = new Album($this->database, $this->plugins, $this->settings, null); + $newAlbumID = $album->add('[Import] ' . basename($file)); $contains['albums'] = true; if ($newAlbumID===false) { $error = true; - Log::error($database, __METHOD__, __LINE__, 'Could not create album in Lychee (' . $newAlbumID . ')'); + Log::error($this->database, __METHOD__, __LINE__, 'Could not create album in Lychee (' . $newAlbumID . ')'); continue; } - $import = Import::server($newAlbumID, $file . '/'); + $import = $this->server($file . '/', $newAlbumID); if ($import!==true&&$import!=='Notice: Import only contains albums!') { $error = true; - Log::error($database, __METHOD__, __LINE__, 'Could not import folder. Function returned warning'); + Log::error($this->database, __METHOD__, __LINE__, 'Could not import folder. Function returned warning.'); continue; } @@ -164,13 +192,16 @@ class Import extends Module { } - # Invoke plugins directly, as instance method not valid here + # Call plugins # Note that updated albumId and path explicitly passed, rather # than using func_get_args() which will only return original ones - $plugins->activate(__METHOD__ . ":after", array($albumID, $path)); + $this->plugins(__METHOD__, 1, array($albumID, $path)); + # The following returns will be caught in the front-end if ($contains['photos']===false&&$contains['albums']===false) return 'Warning: Folder empty or no readable files to process!'; - if ($contains['photos']===false&&$contains['albums']===true) return 'Notice: Import only contains albums!'; + if ($contains['photos']===false&&$contains['albums']===true) return 'Notice: Import only contained albums!'; + + if ($error===true) return false; return true; } From 1bc8c3920976cb982a25d8d65403a1f2faff83e6 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 6 Jul 2015 16:36:18 +0200 Subject: [PATCH 18/58] Added will-change --- src/styles/_content.scss | 1 + src/styles/_imageview.scss | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/styles/_content.scss b/src/styles/_content.scss index 8f1c41d..e78d500 100644 --- a/src/styles/_content.scss +++ b/src/styles/_content.scss @@ -70,6 +70,7 @@ box-shadow: 0 2px 5px black(.5); border: 1px solid white(.5); transition: opacity .3s ease-out, transform .3s ease-out, border-color .3s ease-out; + will-change: transform, opacity, border-color; } &:hover img, diff --git a/src/styles/_imageview.scss b/src/styles/_imageview.scss index 6170470..6e0b926 100644 --- a/src/styles/_imageview.scss +++ b/src/styles/_imageview.scss @@ -32,6 +32,7 @@ animation-name: zoomIn; animation-duration: .3s; animation-timing-function: $timingBounce; + will-change: top, right, bottom, left, margin-top, opacity, transform; &.small { top: 50%; @@ -73,6 +74,7 @@ opacity: .6; z-index: 2; transition: transform .2s ease-out, opacity .2s ease-out; + will-change: transform, opacity; &#previous { left: -1px; From 4a5368247c224113d0acc653df5f83316e12dee4 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 6 Jul 2015 16:54:59 +0200 Subject: [PATCH 19/58] Improved error handling when importing from the server --- dist/main.css | Bin 32740 -> 32876 bytes dist/main.js | Bin 177206 -> 178422 bytes src/scripts/upload.js | 57 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/dist/main.css b/dist/main.css index d89a969ef5ec32d632f30936adc9aa200bf1a0d7..ff7bdcc0ed2ba9f0d053f42610f7907849b616d8 100644 GIT binary patch delta 167 zcmaFzpYcrt(*|KZZR_&PoE+WcjKsY3RI8Gr#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QaE%r3L*PQBfBn*wFaScctMiPR2;^1E%rZZI0F}uNUm?~uehg9TbmM9VM68(w&jN(4XP)>RT4X;Z2FVef zXyX0?HA;mXpQB^E%f;A%d48j(B;j{D#-Lpjj2&k|g+iTm6Pe49S?75UgWen;Z~kGi#?oV88yj z*gDt!hXbPQ%k_uxm@4h80okg^*I=bg%91`Yk?{HU2KH#VRA4}U&hKgUkdjEoq$oQX z4%W$1v08#%4G&@tC30zAR2m~P^C(ZxkB~5tNt`HTD-qasWmS_Z(LhR1ma;TwkSIH- zbc13|E8o?wR0GMhmPz&NDOwcC!>jEv)jHL;1)9{J2YTuEYd+rZ1;JX=4-KeL_pa-; zs?WE{uQG8r@A}6jhS(bn#d|6B#|ahNs+J{px8r`cn>Ic2p*A+PMD1-0hDtGQNRlKK z&vr}_T?`4#j%86U@8J2WXoH&(*AMkz_3@#tutbsEy$8#^K`C@lh=M`?!MqHk51H z8zNL{AKpjH?Ig_9iU=|*R|Mqre&uzXA$H|N$Qu6W0Edw)CwK?8A5P8zn%kf3tjAG# z;fxFUq|fYV!nD)pW0-dNH~t#bK)JxMfj?YW=S0(d>FB&Vl}h_3Nz^)Z`C>z3AZ z;-nagSZ`hX7Vvhl>t1{c?7)l%@%YS9hm6zGdt)h*+IeFdvE^nbV&BcR_x%;@gPU{c zy))}Y{9@KMUk>C8x}h88JSDRA(`*izvMsk3A?~?#4zYFaO=S4l-1CniUB}&3qT=@y z)B2c4B*l!DqTBKzjHJ=~H!`4)jAUp?vDCW*L5P^g+n^P~_JuZh2|%?w+93q4uo1wn z8h#_K6$3e()BZ%3iawt^V!ze_tD#Xgqz)1{s`ppSuY<6!CT@svv#S#-AlsKap%2A2 zTf1No6!Tygdw_@)j8{8eCQC&;$rLLpYL+FA7Q_P cBRNx!a4q$e Show Log) for further details.') + .show(); + + $('.basicModal .rows .row .status') + .html('Failed') + .addClass('error'); + + // Log error + lychee.error('Could not start import because the folder was empty!', params, data); + + } else if (data!==true) { + + // Maybe an error, maybe just some skipped photos + + $('.basicModal .rows .row p.notice') + .html('The import has been finished, but returned warnings or errors. Please take a look at the log (Settings -> Show Log) for further details.') + .show(); + + $('.basicModal .rows .row .status') + .html('Finished') + .addClass('warning'); + + // Log error + lychee.error(null, params, data); + + } else { + + // No error, everything worked fine + + basicModal.close(); + } - else if (album.getID()===false) lychee.goto('0'); + + if (album.getID()===false) lychee.goto('0'); else album.load(albumID); - if (data==='Notice: Import only contains albums!') return true; - else if (data==='Warning: Folder empty!') lychee.error('Folder empty. No photos imported!', params, data); - else if (data!==true) lychee.error(null, params, data); + // Show close button + $('.basicModal #basicModal__action.hidden').show(); }); From 0ad4239b2e5de02be7593a47c50fccc865cbf369 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 6 Jul 2015 17:07:46 +0200 Subject: [PATCH 20/58] Updated build docs --- docs/Build.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/Build.md b/docs/Build.md index 6240701..6d9af87 100644 --- a/docs/Build.md +++ b/docs/Build.md @@ -4,18 +4,17 @@ First you have to install the following dependencies: - `node` [Node.js](http://nodejs.org) v0.10 or later - `npm` [Node Packaged Modules](https://www.npmjs.org) -- `bower` [Bower](http://bower.io) - `gulp` [Gulp.js](http://gulpjs.com) After [installing Node.js](http://nodejs.org) you can use the included `npm` package manager to install the global requirements and Lychee-dependencies with the following command: cd src/ - npm install -g bower gulp - npm install && bower install + npm install -g gulp + npm install ### Build -The Gruntfile is located in `src/` and can be easily executed using the `gulp` command. +The Gulpfile is located in `src/` and can be easily executed using the `gulp` command. ### Watch for changes @@ -23,4 +22,4 @@ While developing, you might want to use the following command to watch for chang gulp watch -`gulp` will automatically build Lychee everytime you save a file. +`gulp watch` will automatically build Lychee everytime you save a file. From 8f02a3f13fe2545547d24cf5ac186abe4430e038 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 7 Jul 2015 10:37:28 +0200 Subject: [PATCH 21/58] Updated deps --- src/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/package.json b/src/package.json index 3ef181a..1d224e9 100644 --- a/src/package.json +++ b/src/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/electerious/Lychee.git" }, "devDependencies": { - "basiccontext": "^3.1.2", + "basiccontext": "^3.2.1", "basicmodal": "^3.1.1", "gulp": "^3.9.0", "gulp-autoprefixer": "2.3.1", @@ -23,6 +23,6 @@ "gulp-sass": "^2.0.3", "gulp-uglify": "^1.2.0", "jquery": "^2.1.4", - "mousetrap": "^1.5.2" + "mousetrap": "^1.5.3" } } From 96d931bb9b70fcb56c7cbc36d137739e6258b3eb Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 7 Jul 2015 10:38:08 +0200 Subject: [PATCH 22/58] Use the visible-property of basicContext to show and hide individual items --- src/scripts/contextMenu.js | 41 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index c8e3022..201caf2 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -49,15 +49,15 @@ contextMenu.album = function(albumID, e) { if (albumID==='0'||albumID==='f'||albumID==='s'||albumID==='r') return false; + // Show merge-item when there's more than one album + var showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1); + var items = [ { type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } }, - { type: 'item', title: build.iconic('collapse-left') + 'Merge', fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumID, e) } }, + { type: 'item', title: build.iconic('collapse-left') + 'Merge', visible: showMerge, fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumID, e) } }, { type: 'item', title: build.iconic('trash') + 'Delete', fn: function() { album.delete([albumID]) } } ]; - // Remove merge when there is only one album - if (albums.json&&albums.json.albums&&Object.keys(albums.json.albums).length<=1) items.splice(1, 1); - $('.album[data-id="' + albumID + '"]').addClass('active'); basicContext.show(items, e.originalEvent, contextMenu.close); @@ -68,19 +68,21 @@ contextMenu.albumMulti = function(albumIDs, e) { multiselect.stopResize(); - var items = []; - - items.push({ type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }); - // Automatically merge selected albums when albumIDs contains more than one album // Show list of albums otherwise - if (albumIDs.length>1) items.push({ type: 'item', title: build.iconic('collapse-left') + 'Merge All', fn: function () { album.merge(albumIDs) } }); - else items.push({ type: 'item', title: build.iconic('collapse-left') + 'Merge', fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumIDs[0], e) } }) + var autoMerge = (albumIDs.length>1 ? true : false); - items.push({ type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } }); + // Show merge-item when there's more than one album + var showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1); - // Remove merge when there is only one album - if (albums.json&&albums.json.albums&&Object.keys(albums.json.albums).length<=1) items.splice(1, 1); + var items = [ + { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }, + { type: 'item', title: build.iconic('collapse-left') + 'Merge All', visible: showMerge && autoMerge, fn: function () { album.merge(albumIDs) } }, + { type: 'item', title: build.iconic('collapse-left') + 'Merge', visible: showMerge && !autoMerge, fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumIDs[0], e) } }, + { type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } } + ]; + + items.push(); basicContext.show(items, e.originalEvent, contextMenu.close); @@ -225,17 +227,16 @@ contextMenu.photoTitle = function(albumID, photoID, e) { contextMenu.photoMore = function(photoID, e) { + // Show download-item when + // a) Public mode is off + // b) Downloadable is 1 and public mode is on + var showDownload = lychee.publicMode===false || ((album.json && album.json.downloadable && album.json.downloadable==='1') && lychee.publicMode===true); + var items = [ { type: 'item', title: build.iconic('fullscreen-enter') + 'Full Photo', fn: function() { window.open(photo.getDirectLink()) } }, - { type: 'item', title: build.iconic('cloud-download') + 'Download', fn: function() { photo.getArchive(photoID) } } + { type: 'item', title: build.iconic('cloud-download') + 'Download', visible: showDownload, fn: function() { photo.getArchive(photoID) } } ]; - // Remove download-item when - // 1) In public mode - // 2) Downloadable not 1 or not found - if (!(album.json&&album.json.downloadable&&album.json.downloadable==='1')&& - lychee.publicMode===true) items.splice(1, 1); - basicContext.show(items, e.originalEvent); } From 46a8beae88dfddd09d919e0b1874963d80a2c1c2 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Tue, 7 Jul 2015 10:38:13 +0200 Subject: [PATCH 23/58] Rebuild --- dist/main.css | Bin 32876 -> 32985 bytes dist/main.js | Bin 178422 -> 178693 bytes 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 dist/main.js diff --git a/dist/main.css b/dist/main.css index ff7bdcc0ed2ba9f0d053f42610f7907849b616d8..34a8c1498ae548102fca17a41a65a3ddfafdad1c 100644 GIT binary patch delta 102 zcmaFUz;v^bX@d$AUs7UmX0mgBUP)?2Nqqcd6{d0}Jyfxj%;LnPoYa)+{DQ>f%#ung ZJ=4k6OwF=ZdHE$8IMixx{>PM83jn*yCiegU delta 22 ecmccF$n>UxX@d&WWFw~X$*-A`H)k{F)dB!%QV7lf diff --git a/dist/main.js b/dist/main.js old mode 100755 new mode 100644 index 1125e0b7dc8b168791ae245b554caff0f1e6aa3c..1c4ecdb35b63dfcba6278c5af7c2846c9d91e273 GIT binary patch delta 1032 zcmZ9Je`p(J7{~cuMr*EV+N@^N+0o>z*`2$kcZhA4S4AC}8v*fxS$?mq~ z5{o8O5dZN93`Uk z^M0Q1^L?K8-W~D7yW(6#gwfn8YFl8O84ACFV)L_bPT=A1&U;<_>2~j}2)|u_#SRAy zwb(p#;L}!){`~qUEe3OwR)wavBid{jN5Sc9hhKe~)9v}0P9DCkJj<2NtW?kQ%Vh0A zA1B&QJT{!Z+P}gNAIXw(1NPn^%9I^;PPBJcy#`O#&~4c)ZY#n>``JWqqR~ zqv_s0wdkGQgVq2HI;Y`d6iLq&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S=7%*qX<`;FH1YxmwVt*r8h?j8s-3|u66TP-<;i6` zc-h$(33sy<^hk1-(tXHXL(dmk^RX%9Q}A`uN3N%*wSLL%B{MYjI$_9rqOdA zR~ye(5@Y@UG#h@2BN|4MDNX;Sq`_rWkl_u|)$&)kr{A1cUc^nRPX;Vlf{DBdO%AOO z!9badD6~bRJ(qmllEm_MvT4QOS*eKqpeq{vcmAaFZuP_xu2|IhRRG#5j#C$YB0oys O&udoLhChZhwuawFkq?&u From bcad26a8d1903a9fe1f271f31468751c5aecdc43 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 14:33:34 +0200 Subject: [PATCH 24/58] Code adjustments and small performance improvements --- src/scripts/multiselect.js | 250 +++++++++++++++------------- src/scripts/sidebar.js | 330 ++++++++++++++++++------------------- 2 files changed, 297 insertions(+), 283 deletions(-) diff --git a/src/scripts/multiselect.js b/src/scripts/multiselect.js index 30afe41..37a85c2 100644 --- a/src/scripts/multiselect.js +++ b/src/scripts/multiselect.js @@ -1,217 +1,231 @@ /** - * @description Select multiple albums or photos. - * @copyright 2015 by Tobias Reich + * @description Select multiple albums or photos. + * @copyright 2015 by Tobias Reich */ multiselect = {} multiselect.position = { - top: null, - right: null, - bottom: null, - left: null + top : null, + right : null, + bottom : null, + left : null } multiselect.bind = function() { - $('#content') .on('mousedown', function(e) { if (e.which===1) multiselect.show(e) }); - $(document) .on('mouseup', function(e) { if (e.which===1) multiselect.getSelection(e) }); + $('#content') .on('mousedown', (e) => { if (e.which===1) multiselect.show(e) }) + $(document) .on('mouseup', (e) => { if (e.which===1) multiselect.getSelection(e) }) - return true; + return true } multiselect.show = function(e) { - if (lychee.publicMode) return false; - if (visible.search()) return false; - if (!visible.albums()&&!visible.album) return false; - if ($('.album:hover, .photo:hover').length!==0) return false; - if (visible.multiselect()) $('#multiselect').remove(); + if (lychee.publicMode) return false + if (visible.search()) return false + if (!visible.albums() && !visible.album) return false + if ($('.album:hover, .photo:hover').length!==0) return false + if (visible.multiselect()) $('#multiselect').remove() - sidebar.setSelectable(false); + sidebar.setSelectable(false) - multiselect.position.top = e.pageY; - multiselect.position.right = -1 * (e.pageX - $(document).width()); - multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height()); - multiselect.position.left = e.pageX; + multiselect.position.top = e.pageY + multiselect.position.right = -1 * (e.pageX - $(document).width()) + multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height()) + multiselect.position.left = e.pageX - $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)); - $(document).on('mousemove', multiselect.resize); + $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)) + $(document).on('mousemove', multiselect.resize) } multiselect.selectAll = function() { - var e, - newWidth, - newHeight; + if (lychee.publicMode) return false + if (visible.search()) return false + if (!visible.albums() && !visible.album) return false + if (visible.multiselect()) $('#multiselect').remove() - if (lychee.publicMode) return false; - if (visible.search()) return false; - if (!visible.albums()&&!visible.album) return false; - if (visible.multiselect()) $('#multiselect').remove(); + sidebar.setSelectable(false) - sidebar.setSelectable(false); + multiselect.position.top = 70 + multiselect.position.right = 40 + multiselect.position.bottom = 90 + multiselect.position.left = 20 - multiselect.position.top = 70; - multiselect.position.right = 40; - multiselect.position.bottom = 90; - multiselect.position.left = 20; + $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)) - $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)); + let documentSize = { + width : $(document).width(), + height : $(document).height() + } - newWidth = $(document).width() - multiselect.position.right + 2; - newHeight = $(document).height() - multiselect.position.bottom; + let newSize = { + width : documentSize.width - multiselect.position.right + 2, + height : documentSize.height - multiselect.position.bottom + } - $('#multiselect').css({ - width: newWidth, - height: newHeight - }); + let e = { + pageX : documentSize.width - (multiselect.position.right / 2), + pageY : documentSize.height - multiselect.position.bottom + } - e = { - pageX: $(document).width() - (multiselect.position.right / 2), - pageY: $(document).height() - multiselect.position.bottom - }; + $('#multiselect').css(newSize) - multiselect.getSelection(e); + multiselect.getSelection(e) } multiselect.resize = function(e) { - var mouse_x = e.pageX, - mouse_y = e.pageY, - newHeight, - newWidth; + if (multiselect.position.top === null || + multiselect.position.right === null || + multiselect.position.bottom === null || + multiselect.position.left === null) return false - if (multiselect.position.top===null|| - multiselect.position.right===null|| - multiselect.position.bottom===null|| - multiselect.position.left===null) return false; + let newSize = {}, + documentSize = {} - if (mouse_y>=multiselect.position.top) { + // Get the position of the mouse + let mousePos = { + x : e.pageX, + y : e.pageY + } + + // Default CSS + let newCSS = { + top : null, + bottom : null, + height : null, + left : null, + right : null, + width : null + } + + if (mousePos.y>=multiselect.position.top) { + + documentSize.height = $(document).height() // Do not leave the screen - newHeight = mouse_y - multiselect.position.top; - if ((multiselect.position.top+newHeight)>=$(document).height()) - newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2; + newSize.height = mousePos.y - multiselect.position.top + if ((multiselect.position.top+newSize.height)>=documentSize.height) { + newSize.height -= (multiselect.position.top + newSize.height) - documentSize.height + 2 + } - $('#multiselect').css({ - top: multiselect.position.top, - bottom: 'inherit', - height: newHeight - }); + newCSS.top = multiselect.position.top + newCSS.bottom = 'inherit' + newCSS.height = newSize.height } else { - $('#multiselect').css({ - top: 'inherit', - bottom: multiselect.position.bottom, - height: multiselect.position.top - e.pageY - }); + newCSS.top = 'inherit' + newCSS.bottom = multiselect.position.bottom + newCSS.height = multiselect.position.top - e.pageY } - if (mouse_x>=multiselect.position.left) { + if (mousePos.x>=multiselect.position.left) { + + documentSize.width = $(document).width() // Do not leave the screen - newWidth = mouse_x - multiselect.position.left; - if ((multiselect.position.left+newWidth)>=$(document).width()) - newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2; + newSize.width = mousePos.x - multiselect.position.left + if ((multiselect.position.left+newSize.width)>=documentSize.width) { + newSize.width -= (multiselect.position.left + newSize.width) - documentSize.width + 2 + } - $('#multiselect').css({ - right: 'inherit', - left: multiselect.position.left, - width: newWidth - }); + newCSS.right = 'inherit' + newCSS.left = multiselect.position.left + newCSS.width = newSize.width } else { - $('#multiselect').css({ - right: multiselect.position.right, - left: 'inherit', - width: multiselect.position.left - e.pageX - }); + newCSS.right = multiselect.position.right + newCSS.left = 'inherit' + newCSS.width = multiselect.position.left - e.pageX } + // Updated all CSS properties at once + $('#multiselect').css(newCSS) + } multiselect.stopResize = function() { - $(document).off('mousemove'); + $(document).off('mousemove') } multiselect.getSize = function() { - if (!visible.multiselect()) return false; + if (!visible.multiselect()) return false + + let $elem = $('#multiselect'), + offset = $elem.offset() return { - top: $('#multiselect').offset().top, - left: $('#multiselect').offset().left, - width: parseInt($('#multiselect').css('width').replace('px', '')), - height: parseInt($('#multiselect').css('height').replace('px', '')) - }; + top : offset.top, + left : offset.left, + width : parseInt($elem.css('width').replace('px', '')), + height : parseInt($elem.css('height').replace('px', '')) + } } multiselect.getSelection = function(e) { - var tolerance = 150, - id, - ids = [], - offset, - size = multiselect.getSize(); + let tolerance = 150, + ids = [], + size = multiselect.getSize() - if (visible.contextMenu()) return false; - if (!visible.multiselect()) return false; + if (visible.contextMenu()) return false + if (!visible.multiselect()) return false $('.photo, .album').each(function() { - offset = $(this).offset(); + let offset = $(this).offset() - if (offset.top>=(size.top-tolerance)&& - offset.left>=(size.left-tolerance)&& - (offset.top+206)<=(size.top+size.height+tolerance)&& + if (offset.top>=(size.top-tolerance) && + offset.left>=(size.left-tolerance) && + (offset.top+206)<=(size.top+size.height+tolerance) && (offset.left+206)<=(size.left+size.width+tolerance)) { - id = $(this).data('id'); + let id = $(this).data('id') - if (id!=='0'&&id!==0&&id!=='f'&&id!=='s'&&id!=='r'&&id!==null&&id!==undefined) { + if (id!=='0' && id!==0 && id!=='f' && id!=='s' && id!=='r' && id!==null) { - ids.push(id); - $(this).addClass('active'); + ids.push(id) + $(this).addClass('active') } - } + } - }); + }) - if (ids.length!==0&&visible.album()) contextMenu.photoMulti(ids, e); - else if (ids.length!==0&&visible.albums()) contextMenu.albumMulti(ids, e); - else multiselect.close(); + if (ids.length!==0 && visible.album()) contextMenu.photoMulti(ids, e) + else if (ids.length!==0 && visible.albums()) contextMenu.albumMulti(ids, e) + else multiselect.close() } multiselect.close = function() { - sidebar.setSelectable(true); + sidebar.setSelectable(true) - multiselect.stopResize(); + multiselect.stopResize() - multiselect.position.top = null; - multiselect.position.right = null; - multiselect.position.bottom = null; - multiselect.position.left = null; + multiselect.position.top = null + multiselect.position.right = null + multiselect.position.bottom = null + multiselect.position.left = null - lychee.animate('#multiselect', 'fadeOut'); - setTimeout(function() { - $('#multiselect').remove(); - }, 300); + lychee.animate('#multiselect', 'fadeOut') + setTimeout(() => $('#multiselect').remove(), 300) } \ No newline at end of file diff --git a/src/scripts/sidebar.js b/src/scripts/sidebar.js index e2ca668..0f66b28 100644 --- a/src/scripts/sidebar.js +++ b/src/scripts/sidebar.js @@ -7,8 +7,8 @@ sidebar = { _dom: $('#sidebar'), types: { - DEFAULT: 0, - TAGS: 1 + DEFAULT : 0, + TAGS : 1 }, createStructure: {} @@ -16,8 +16,9 @@ sidebar = { sidebar.dom = function(selector) { - if (selector===undefined||selector===null||selector==='') return sidebar._dom; - return sidebar._dom.find(selector); + if (selector==null || selector==='') return sidebar._dom + + return sidebar._dom.find(selector) } @@ -29,56 +30,55 @@ sidebar.bind = function() { // event handlers should be removed before binding a new one. // Event Name - var eventName = ('ontouchend' in document.documentElement) ? 'touchend' : 'click'; + let eventName = ('ontouchend' in document.documentElement) ? 'touchend' : 'click' sidebar .dom('#edit_title') .off(eventName) .on(eventName, function() { - if (visible.photo()) photo.setTitle([photo.getID()]); - else if (visible.album()) album.setTitle([album.getID()]); - }); + if (visible.photo()) photo.setTitle([photo.getID()]) + else if (visible.album()) album.setTitle([album.getID()]) + }) sidebar .dom('#edit_description') .off(eventName) .on(eventName, function() { - if (visible.photo()) photo.setDescription(photo.getID()); - else if (visible.album()) album.setDescription(album.getID()); - }); + if (visible.photo()) photo.setDescription(photo.getID()) + else if (visible.album()) album.setDescription(album.getID()) + }) sidebar .dom('#edit_tags') .off(eventName) .on(eventName, function() { photo.editTags([photo.getID()]) - }); + }) sidebar .dom('#tags .tag span') .off(eventName) .on(eventName, function() { photo.deleteTag(photo.getID(), $(this).data('index')) - }); + }) - return true; + return true } sidebar.toggle = function() { - if (visible.sidebar()|| - visible.sidebarbutton()) { + if (visible.sidebar() || visible.sidebarbutton()) { - header.dom('.button--info').toggleClass('active'); - lychee.content.toggleClass('sidebar'); - sidebar.dom().toggleClass('active'); + header.dom('.button--info').toggleClass('active') + lychee.content.toggleClass('sidebar') + sidebar.dom().toggleClass('active') - return true; + return true } - return false; + return false } @@ -88,67 +88,67 @@ sidebar.setSelectable = function(selectable = true) { // Selection needs to be deactivated to prevent an unwanted selection // while using multiselect. - if (selectable===true) sidebar.dom().removeClass('notSelectable'); - else sidebar.dom().addClass('notSelectable'); + if (selectable===true) sidebar.dom().removeClass('notSelectable') + else sidebar.dom().addClass('notSelectable') } sidebar.changeAttr = function(attr, value = '-') { - if (attr===undefined||attr===null||attr==='') return false; + if (attr==null || attr==='') return false // Set a default for the value - if (value===''||value===null) value = '-'; + if (value==null || value==='') value = '-' - sidebar.dom('.attr_' + attr).html(value); + sidebar.dom('.attr_' + attr).html(value) - return true; + return true } sidebar.createStructure.photo = function(data) { - if (data===undefined||data===null||data==='') return false; + if (data==null || data==='') return false - var editable = false, - exifHash = data.takestamp + data.make + data.model + data.shutter + data.aperture + data.focal + data.iso, - structure = {}, - _public = ''; + let editable = false, + exifHash = data.takestamp + data.make + data.model + data.shutter + data.aperture + data.focal + data.iso, + structure = {}, + _public = '' // Enable editable when user logged in - if (lychee.publicMode===false) editable = true; + if (lychee.publicMode===false) editable = true // Set value for public switch (data.public) { - case '0': _public = 'No'; - break; - case '1': _public = 'Yes'; - break; - case '2': _public = 'Yes (Album)'; - break; - default: _public = '-'; - break; + case '0' : _public = 'No' + break + case '1' : _public = 'Yes' + break + case '2' : _public = 'Yes (Album)' + break + default : _public = '-' + break } structure.basics = { - title: 'Basics', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Title', value: data.title, editable }, - { title: 'Uploaded', value: data.sysdate }, - { title: 'Description', value: data.description, editable }, + title : 'Basics', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Title', value: data.title, editable }, + { title: 'Uploaded', value: data.sysdate }, + { title: 'Description', value: data.description, editable } ] } structure.image = { - title: 'Image', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Size', value: data.size }, - { title: 'Format', value: data.type }, - { title: 'Resolution', value: data.width + ' x ' + data.height } + title : 'Image', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Size', value: data.size }, + { title: 'Format', value: data.type }, + { title: 'Resolution', value: data.width + ' x ' + data.height } ] } @@ -156,9 +156,9 @@ sidebar.createStructure.photo = function(data) { if (lychee.publicMode===false) { structure.tags = { - title: 'Tags', - type: sidebar.types.TAGS, - value: build.tags(data.tags), + title : 'Tags', + type : sidebar.types.TAGS, + value : build.tags(data.tags), editable } @@ -172,16 +172,16 @@ sidebar.createStructure.photo = function(data) { if (exifHash!=='0') { structure.exif = { - title: 'Camera', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Captured', value: data.takedate }, - { title: 'Make', value: data.make }, - { title: 'Type/Model', value: data.model }, - { title: 'Shutter Speed', value: data.shutter }, - { title: 'Aperture', value: data.aperture }, - { title: 'Focal Length', value: data.focal }, - { title: 'ISO', value: data.iso } + title : 'Camera', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Captured', value: data.takedate }, + { title: 'Make', value: data.make }, + { title: 'Type/Model', value: data.model }, + { title: 'Shutter Speed', value: data.shutter }, + { title: 'Aperture', value: data.aperture }, + { title: 'Focal Length', value: data.focal }, + { title: 'ISO', value: data.iso } ] } @@ -192,10 +192,10 @@ sidebar.createStructure.photo = function(data) { } structure.sharing = { - title: 'Sharing', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Public', value: _public }, + title : 'Sharing', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Public', value: _public } ] } @@ -208,98 +208,98 @@ sidebar.createStructure.photo = function(data) { structure.sharing ] - return structure; + return structure } sidebar.createStructure.album = function(data) { - if (data===undefined||data===null||data==='') return false; + if (data==null || data==='') return false - var editable = false, - structure = {}, - _public = '', - visible = '', - downloadable = '', - password = ''; + let editable = false, + structure = {}, + _public = '', + visible = '', + downloadable = '', + password = '' // Enable editable when user logged in - if (lychee.publicMode===false) editable = true; + if (lychee.publicMode===false) editable = true // Set value for public switch (data.public) { - case '0': _public = 'No'; - break; - case '1': _public = 'Yes'; - break; - default: _public = '-'; - break; + case '0' : _public = 'No' + break + case '1' : _public = 'Yes' + break + default : _public = '-' + break } // Set value for visible switch (data.visible) { - case '0': visible = 'No'; - break; - case '1': visible = 'Yes'; - break; - default: visible = '-'; - break; + case '0' : visible = 'No' + break + case '1' : visible = 'Yes' + break + default : visible = '-' + break } // Set value for downloadable switch (data.downloadable) { - case '0': downloadable = 'No'; - break; - case '1': downloadable = 'Yes'; - break; - default: downloadable = '-'; - break; + case '0' : downloadable = 'No' + break + case '1' : downloadable = 'Yes' + break + default : downloadable = '-' + break } // Set value for password switch (data.password) { - case '0': password = 'No'; - break; - case '1': password = 'Yes'; - break; - default: password = '-'; - break; + case '0' : password = 'No' + break + case '1' : password = 'Yes' + break + default : password = '-' + break } structure.basics = { - title: 'Basics', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Title', value: data.title, editable }, - { title: 'Description', value: data.description, editable } + title : 'Basics', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Title', value: data.title, editable }, + { title: 'Description', value: data.description, editable } ] } structure.album = { - title: 'Album', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Created', value: data.sysdate }, - { title: 'Images', value: data.num } + title : 'Album', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Created', value: data.sysdate }, + { title: 'Images', value: data.num } ] } structure.share = { - title: 'Share', - type: sidebar.types.DEFAULT, - rows: [ - { title: 'Public', value: _public }, - { title: 'Visible', value: visible }, - { title: 'Downloadable', value: downloadable }, - { title: 'Password', value: password } + title : 'Share', + type : sidebar.types.DEFAULT, + rows : [ + { title: 'Public', value: _public }, + { title: 'Visible', value: visible }, + { title: 'Downloadable', value: downloadable }, + { title: 'Password', value: password } ] } @@ -310,87 +310,87 @@ sidebar.createStructure.album = function(data) { structure.share ] - return structure; + return structure } sidebar.render = function(structure) { - if (structure===undefined||structure===null||structure==='') return false; + if (structure==null || structure==='') return false - var html = ''; + let html = '' - var renderDefault = function(section) { + let renderDefault = function(section) { - let _html = ''; + let _html = '' - _html += ` -
-

${ section.title }

-
- - ` + _html += ` +
+

${ section.title }

+
+
+ ` section.rows.forEach(function(row) { - let value = row.value; + let value = row.value // Set a default for the value - if (value===''||value===null||value===undefined) value = '-'; + if (value==='' || value==null) value = '-' // Wrap span-element around value for easier selecting on change - value = `${ value }`; + value = `${ value }` // Add edit-icon to the value when editable - if (row.editable===true) value += ' ' + build.editIcon('edit_' + row.title.toLowerCase()); + if (row.editable===true) value += ' ' + build.editIcon('edit_' + row.title.toLowerCase()) - _html += ` - - - - - ` + _html += ` + + + + + ` - }); + }) - _html += ` -
${ row.title }${ value }
${ row.title }${ value }
- ` + _html += ` + + ` - return _html; + return _html - }; + } - var renderTags = function(section) { + let renderTags = function(section) { - let _html = ''; + let _html = '' - _html += ` -
-

${ section.title }

-
-
-
${ section.value }
- ` + _html += ` +
+

${ section.title }

+
+
+
${ section.value }
+ ` // Add edit-icon to the value when editable - if (section.editable===true) _html += build.editIcon('edit_tags'); + if (section.editable===true) _html += build.editIcon('edit_tags') - _html += ` -
- ` + _html += ` +
+ ` - return _html; + return _html } structure.forEach(function(section) { - if (section.type===sidebar.types.DEFAULT) html += renderDefault(section); - else if (section.type===sidebar.types.TAGS) html += renderTags(section); + if (section.type===sidebar.types.DEFAULT) html += renderDefault(section) + else if (section.type===sidebar.types.TAGS) html += renderTags(section) - }); + }) - return html; + return html } \ No newline at end of file From 8cbb56cffe208a30d459ce40d8fe1a28182f5b0e Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 14:34:00 +0200 Subject: [PATCH 25/58] Simplified will-change --- src/styles/_content.scss | 2 +- src/styles/_imageview.scss | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/styles/_content.scss b/src/styles/_content.scss index e78d500..944cae2 100644 --- a/src/styles/_content.scss +++ b/src/styles/_content.scss @@ -70,7 +70,7 @@ box-shadow: 0 2px 5px black(.5); border: 1px solid white(.5); transition: opacity .3s ease-out, transform .3s ease-out, border-color .3s ease-out; - will-change: transform, opacity, border-color; + will-change: transform; } &:hover img, diff --git a/src/styles/_imageview.scss b/src/styles/_imageview.scss index 6e0b926..08fcceb 100644 --- a/src/styles/_imageview.scss +++ b/src/styles/_imageview.scss @@ -32,7 +32,7 @@ animation-name: zoomIn; animation-duration: .3s; animation-timing-function: $timingBounce; - will-change: top, right, bottom, left, margin-top, opacity, transform; + will-change: transform; &.small { top: 50%; @@ -74,7 +74,7 @@ opacity: .6; z-index: 2; transition: transform .2s ease-out, opacity .2s ease-out; - will-change: transform, opacity; + will-change: transform; &#previous { left: -1px; From 6118ad5c4a8ba6de2fa7cc968868b6ba48fbbe73 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 15:20:41 +0200 Subject: [PATCH 26/58] Code adjustment --- src/scripts/visible.js | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/scripts/visible.js b/src/scripts/visible.js index bbe34d3..974c78e 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -6,57 +6,57 @@ visible = {} visible.albums = function() { - if ($('#tools_albums').css('display')==='block') return true; - return false; + if ($('#tools_albums').css('display')==='block') return true + return false } visible.album = function() { - if ($('#tools_album').css('display')==='block') return true; - return false; + if ($('#tools_album').css('display')==='block') return true + return false } visible.photo = function() { - if ($('#imageview.fadeIn').length>0) return true; - return false; + if ($('#imageview.fadeIn').length>0) return true + return false } visible.search = function() { - if (search.hash!==null) return true; - return false; + if (search.hash!==null) return true + return false } visible.sidebar = function() { - if (sidebar.dom().hasClass('active')===true) return true; - return false; + if (sidebar.dom().hasClass('active')===true) return true + return false } visible.sidebarbutton = function() { - if (visible.albums()) return false; - if (visible.photo()) return true; - if (visible.album()&&$('#button_info_album:visible').length>0) return true; - return false; + if (visible.albums()) return false + if (visible.photo()) return true + if (visible.album() && $('#button_info_album:visible').length>0) return true + return false } visible.header = function() { - if (header.dom().hasClass('hidden')===true) return false; - return true; + if (header.dom().hasClass('hidden')===true) return false + return true } visible.message = function() { - if ($('.message').length>0) return true; - return false; + if ($('.message').length>0) return true + return false } visible.signin = function() { - if ($('.message .sign_in').length>0) return true; - return false; + if ($('.message .sign_in').length>0) return true + return false } visible.contextMenu = function() { - return basicContext.visible(); + return basicContext.visible() } visible.multiselect = function() { - if ($('#multiselect').length>0) return true; - return false; + if ($('#multiselect').length>0) return true + return false } \ No newline at end of file From cb88c90cbda2e2f2976d8a431fd67804104caf28 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 15:21:19 +0200 Subject: [PATCH 27/58] Only init swiping when eventName is 'touchend' --- src/scripts/init.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/init.js b/src/scripts/init.js index 236cc6a..ff1155c 100755 --- a/src/scripts/init.js +++ b/src/scripts/init.js @@ -76,13 +76,13 @@ $(document).ready(function() { }); - if ('ontouchend' in document.documentElement) { + if (eventName==='touchend') { $(document) /* Fullscreen on mobile */ .on('touchend', '#image', function(e) { - if (swipe.obj===null||(swipe.offset>=-5&&swipe.offset<=5)) { + if (swipe.obj==null||(swipe.offset>=-5&&swipe.offset<=5)) { if (visible.header()) header.hide(e, 0); else header.show(); } From 9a53ab56156f4b7841f20035f4580ca90931ea2c Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 15:22:12 +0200 Subject: [PATCH 28/58] Fixed potential performance bottleneck --- src/scripts/view.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scripts/view.js b/src/scripts/view.js index ead2710..1a8c555 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -143,10 +143,6 @@ view.album = { var photosData = ''; - // Save and reset scroll position - view.albums.content.scrollPosition = $(document).scrollTop(); - $('html, body').scrollTop(0); - if (album.json.content&&album.json.content!==false) { // Build photos @@ -156,6 +152,10 @@ view.album = { } + // Save and reset scroll position + view.albums.content.scrollPosition = $(document).scrollTop(); + requestAnimationFrame(() => $(document).scrollTop(0)); + // Add photos to view lychee.content.html(photosData); From a2b5e48f6db9dbf0654dc5dc75a3e3562a306e74 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 15:23:54 +0200 Subject: [PATCH 29/58] Only listen for mouseup event when multiselect in use --- src/scripts/multiselect.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scripts/multiselect.js b/src/scripts/multiselect.js index 37a85c2..0b84d21 100644 --- a/src/scripts/multiselect.js +++ b/src/scripts/multiselect.js @@ -16,8 +16,7 @@ multiselect.position = { multiselect.bind = function() { - $('#content') .on('mousedown', (e) => { if (e.which===1) multiselect.show(e) }) - $(document) .on('mouseup', (e) => { if (e.which===1) multiselect.getSelection(e) }) + $('#content').on('mousedown', (e) => { if (e.which===1) multiselect.show(e) }) return true @@ -26,9 +25,9 @@ multiselect.bind = function() { multiselect.show = function(e) { if (lychee.publicMode) return false - if (visible.search()) return false - if (!visible.albums() && !visible.album) return false + if (!visible.albums() && !visible.album()) return false if ($('.album:hover, .photo:hover').length!==0) return false + if (visible.search()) return false if (visible.multiselect()) $('#multiselect').remove() sidebar.setSelectable(false) @@ -39,7 +38,10 @@ multiselect.show = function(e) { multiselect.position.left = e.pageX $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)) - $(document).on('mousemove', multiselect.resize) + + $(document) + .on('mousemove', multiselect.resize) + .on('mouseup', (e) => { if (e.which===1) multiselect.getSelection(e) }) } @@ -157,7 +159,7 @@ multiselect.resize = function(e) { multiselect.stopResize = function() { - $(document).off('mousemove') + $(document).off('mousemove mouseup') } From c928c09f8ff3e11316b3d4aadda91bb6654e55e0 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 16:00:37 +0200 Subject: [PATCH 30/58] Updated to basicContext v3.3 --- src/package.json | 2 +- src/styles/_basicContext.custom.scss | 54 ++++++++++++++++ src/styles/_basicContext.extended.scss | 56 +++++++++++++++++ src/styles/_contextmenu.scss | 85 -------------------------- src/styles/main.scss | 3 +- 5 files changed, 113 insertions(+), 87 deletions(-) create mode 100644 src/styles/_basicContext.custom.scss create mode 100644 src/styles/_basicContext.extended.scss delete mode 100644 src/styles/_contextmenu.scss diff --git a/src/package.json b/src/package.json index 1d224e9..6ec908a 100644 --- a/src/package.json +++ b/src/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/electerious/Lychee.git" }, "devDependencies": { - "basiccontext": "^3.2.1", + "basiccontext": "^3.3.0", "basicmodal": "^3.1.1", "gulp": "^3.9.0", "gulp-autoprefixer": "2.3.1", diff --git a/src/styles/_basicContext.custom.scss b/src/styles/_basicContext.custom.scss new file mode 100644 index 0000000..c98df86 --- /dev/null +++ b/src/styles/_basicContext.custom.scss @@ -0,0 +1,54 @@ +// Default Theme ----------------------------------------------------- // +.basicContext { + + padding: 5px 0 6px; + background: linear-gradient(to bottom, #333, #252525); + box-shadow: 0 1px 4px black(.2), inset 0 1px 0 white(.05); + border-radius: 5px; + border: 1px solid black(.7); + border-bottom: 1px solid black(.8); + + &__item { + margin-bottom: 2px; + font-size: 14px; + text-shadow: $shadowLight; + + &--separator { + margin: 4px 0; + height: 2px; + background: black(.2); + border-bottom: 1px solid white(.06); + } + + &--disabled { + opacity: .5; + } + + &:last-child { + margin-bottom: 0; + } + } + + &__data { + min-width: auto; + padding: 6px 25px 7px 12px; + color: white(1); + transition: none; + cursor: default; + } + + &__item:not(.basicContext__item--disabled):hover &__data { + background: linear-gradient(to bottom, $colorBlue, darken($colorBlue, 5%)); + } + + &__item:not(.basicContext__item--disabled):active &__data { + background: linear-gradient(to bottom, darken($colorBlue, 10%), darken($colorBlue, 15%)); + } + + &__icon { + margin-right: 10px; + width: 12px; + text-align: center; + } + +} \ No newline at end of file diff --git a/src/styles/_basicContext.extended.scss b/src/styles/_basicContext.extended.scss new file mode 100644 index 0000000..9a94e50 --- /dev/null +++ b/src/styles/_basicContext.extended.scss @@ -0,0 +1,56 @@ +/** + * @copyright 2015 by Tobias Reich + */ + +/* Context ------------------------------------------------*/ +.basicContext { + + &__data .cover { + position: absolute; + background-color: #222; + border-radius: 2px; + box-shadow: 0 0 0 1px black(.5); + } + + &__data .title { + display: inline-block; + margin: 0 0 3px 26px; + } + + &__data .iconic { + display: inline-block; + margin: 0 10px 0 1px; + width: 11px; + height: 10px; + fill: white(1); + } + + &__data .iconic.ionicons { + margin: 0 8px -2px 0; + width: 14px; + height: 14px; + } + + /* Link ------------------------------------------------*/ + &__data input#link { + margin: -2px 0; + padding: 5px 7px 6px; + width: 100%; + background: #333; + color: #fff; + box-shadow: 0px 1px 0px white(.05); + border: 1px solid black(.4); + border-radius: 3px; + outline: none; + } + + /* No Hover ------------------------------------------------*/ + &__item.noHover &__data { + padding-right: 12px; + } + + &__item.noHover:hover &__data { + background: none; + } + +} \ No newline at end of file diff --git a/src/styles/_contextmenu.scss b/src/styles/_contextmenu.scss deleted file mode 100644 index d6ea470..0000000 --- a/src/styles/_contextmenu.scss +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @copyright 2015 by Tobias Reich - */ - -/* Context ------------------------------------------------*/ -.basicContext { - - padding: 5px 0 6px; - background: linear-gradient(to bottom, #333, #252525); - border: 1px solid black(.7); - border-bottom: 1px solid black(.8); - border-radius: 5px; - box-shadow: 0 1px 4px black(.2), inset 0 1px 0 white(.05); - - /* Item ------------------------------------------------*/ - tr { - margin-bottom: 2px; - color: white(.9); - font-size: 14px; - text-shadow: $shadowLight; - - &.separator { - background: black(.2); - border-bottom: 1px solid white(.06); - } - } - - tr td { - padding: 6px 25px 7px 12px; - min-width: auto; - color: white(1); - border-radius: 0; - transition: none; - cursor: default; - - &:hover { background: linear-gradient(to bottom, $colorBlue, darken($colorBlue, 5%)); } - - &:active { background: linear-gradient(to bottom, darken($colorBlue, 10%), darken($colorBlue, 15%)); } - } - - tr td .cover { - background-color: #222; - border-radius: 2px; - box-shadow: 0 0 0 1px black(.5); - position: absolute; - } - - tr td .title { - display: inline-block; - margin: 0 0 3px 26px; - } - - tr td .iconic { - display: inline-block; - margin: 0 10px 0 1px; - width: 11px; - height: 10px; - fill: white(1); - } - - tr td .iconic.ionicons { - margin: 0 8px -2px 0; - width: 14px; - height: 14px; - } - - /* Link ------------------------------------------------*/ - input#link { - width: 100%; - margin: -2px 0 -1px -2px; - padding: 5px 7px 6px 7px; - background: #333; - color: #fff; - border: 1px solid black(.4); - box-shadow: 0px 1px 0px white(.05); - outline: none; - border-radius: 3px; - } - - /* No Hover ------------------------------------------------*/ - tr.noHover td:hover { - background: none; - } - -} \ No newline at end of file diff --git a/src/styles/main.scss b/src/styles/main.scss index 1560d81..6dc8224 100755 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -48,7 +48,8 @@ input { @import 'animations'; @import 'content'; -@import 'contextmenu'; +@import 'basicContext.custom'; +@import 'basicContext.extended'; @import 'header'; @import 'imageview'; @import 'sidebar'; From 68d9505015644c1ff2cc60c80422e3756e5eb6f1 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 16:00:42 +0200 Subject: [PATCH 31/58] Rebuild --- dist/main.css | Bin 32985 -> 32947 bytes dist/main.js | Bin 178693 -> 179104 bytes dist/view.js | Bin 99957 -> 100013 bytes 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dist/main.css mode change 100644 => 100755 dist/view.js diff --git a/dist/main.css b/dist/main.css old mode 100644 new mode 100755 index 34a8c1498ae548102fca17a41a65a3ddfafdad1c..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!@!u$C6DT8Rw_qV))9KA$yU zW}q|0^0Tr7Dt~`yZ?t0N7lV~P@UNQJwAN8jmpQYv(Dk)|8Ig$NEF))Nq%$D~-q0|a zLzM?JQ(ZH9O(;|aYfx2;%6GJSfR%&!qMl<3wKKS*p^$4PqcTWA|~E#MyWIUQfDE3Zvhf8JJ6U0uTa>CY~~Oun;(w=~${ z7tMv~@b^%ct1lzZ4Na-mo;^y$(~4AE(dlIzX%f`s2~eI9kqbJtXtd^VsR5C%=jr`je};s~eg&M`jh?eOk*bTHhe)f~F`(wLBZ5 W*8~ha{s8_?T*V`1_c!r{_WuGR?RDJ% diff --git a/dist/view.js b/dist/view.js old mode 100644 new mode 100755 index fcc6ebb2173de46faf2e274e335b1656739f60c1..984ed6d8b10b03c623d8726fc8ee43643fd36dd5 GIT binary patch delta 545 zcmey`!?w1UtzipeRX$5zX->}e?tI2@76lN~);6`KMoGyQNZTtKT4`uN1WQ1I(*;Tx z6Tup$J619(Y+qEu_=sux`cg)|>66PDr5L%kuPtY6W`r0CRME~1S1djKOAVtYrveO2 zSEyx_6oB!-v`vQL^g>@oQ3JTBjebgInO#gCCqkc1Nn%n?DyrD@;#x+l>APwfXV)XN zmK1>%A#{SIY)Vq>l(bXzN-|4wQni(A^nrYk@z_-5VU-7JK{r^bR#T@$+g1r^kTSv` zph8TSD%I*_PIvTTloNocM<~Y=9ySP1VF?dl2q|Qy*s7N#rWdQDh6_mFbnkjbMltli@EN%Mc0J=PHUPmufkXfR delta 479 zcmZ46%l5U0tzipeRsQ6zOI*_*#4rkP@5*QNW|@91hEY~f(a=gmLrKZj*0!XkCa*Ln zXZqJ-#zeug{LB;u1E6RsMAUXVPbH(m_No%bM@)=d(__jRHMX~wGd43~s@x7#+0Kk9 z4l+S{`lcF2O=V6_PMeg>GKJ)v#NuLGbs#e{CACQ1E+!8s1Cq=zoL=b5C@G~6l!A%c zlq4qQq{4X9gK8PAxNY-lYM@S?-c`#uw;rUqqzI-6#7VJJ(oWSY$t=l9)mF062l8RI zKqd3ggn?=h1}N2P>Xc~PDna!C<&YhrRI8I|n^u~aT#}ier;(~zJ>AcXQBVs>Ju$xI nLH6bJz Date: Thu, 9 Jul 2015 17:30:31 +0200 Subject: [PATCH 32/58] Only use touchend when really available and on mobile #345 --- src/scripts/header.js | 2 +- src/scripts/init.js | 3 +-- src/scripts/lychee.js | 9 +++++++++ src/scripts/sidebar.js | 2 +- src/scripts/swipe.js | 40 ++++++++++++++++++++-------------------- src/scripts/view/main.js | 12 ++++++------ 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/src/scripts/header.js b/src/scripts/header.js index 2dbea07..213150c 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -19,7 +19,7 @@ header.dom = function(selector) { header.bind = function() { // Event Name - var eventName = ('ontouchend' in document.documentElement) ? 'touchend' : 'click'; + var eventName = lychee.getEventName(); /* Buttons */ header.dom('#title').on(eventName, function(e) { diff --git a/src/scripts/init.js b/src/scripts/init.js index ff1155c..9c90e78 100755 --- a/src/scripts/init.js +++ b/src/scripts/init.js @@ -6,8 +6,7 @@ $(document).ready(function() { /* Event Name */ - var touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement), - eventName = (touchendSupport===true ? 'touchend' : 'click'); + var eventName = lychee.getEventName(); /* Set API error handler */ api.onError = lychee.error; diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index 6e0103d..1448ffb 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -384,6 +384,15 @@ lychee.loadDropbox = function(callback) { } +lychee.getEventName = function() { + + let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement), + eventName = (touchendSupport===true ? 'touchend' : 'click'); + + return eventName; + +} + lychee.removeHTML = function(html = '') { if (html==='') return html; diff --git a/src/scripts/sidebar.js b/src/scripts/sidebar.js index 0f66b28..857c5ad 100644 --- a/src/scripts/sidebar.js +++ b/src/scripts/sidebar.js @@ -30,7 +30,7 @@ sidebar.bind = function() { // event handlers should be removed before binding a new one. // Event Name - let eventName = ('ontouchend' in document.documentElement) ? 'touchend' : 'click' + let eventName = lychee.getEventName(); sidebar .dom('#edit_title') diff --git a/src/scripts/swipe.js b/src/scripts/swipe.js index 54af271..a80df38 100644 --- a/src/scripts/swipe.js +++ b/src/scripts/swipe.js @@ -5,48 +5,48 @@ swipe = { - obj: null, - tolerance: 150, - offset: 0 + obj : null, + tolerance : 150, + offset : 0 } swipe.start = function(obj, tolerance) { - if (obj) swipe.obj = obj; - if (tolerance) swipe.tolerance = tolerance; + if (obj) swipe.obj = obj + if (tolerance) swipe.tolerance = tolerance - return true; + return true } swipe.move = function(e) { - if (swipe.obj===null) return false; + if (swipe.obj===null) return false - swipe.offset = -1 * e.x; + swipe.offset = -1 * e.x swipe.obj.css({ - WebkitTransform: 'translateX(' + swipe.offset + 'px)', - MozTransform: 'translateX(' + swipe.offset + 'px)', - transform: 'translateX(' + swipe.offset + 'px)' - }); + WebkitTransform : 'translateX(' + swipe.offset + 'px)', + MozTransform : 'translateX(' + swipe.offset + 'px)', + transform : 'translateX(' + swipe.offset + 'px)' + }) } swipe.stop = function(e, left, right) { - if (e.x<=-swipe.tolerance) left(true); - else if (e.x>=swipe.tolerance) right(true); + if (e.x<=-swipe.tolerance) left(true) + else if (e.x>=swipe.tolerance) right(true) else if (swipe.obj!==null) { swipe.obj.css({ - WebkitTransform: 'translateX(0px)', - MozTransform: 'translateX(0px)', - transform: 'translateX(0px)' - }); + WebkitTransform : 'translateX(0px)', + MozTransform : 'translateX(0px)', + transform : 'translateX(0px)' + }) } - swipe.obj = null; - swipe.offset = 0; + swipe.obj = null + swipe.offset = 0 } \ No newline at end of file diff --git a/src/scripts/view/main.js b/src/scripts/view/main.js index 30c482a..04f757a 100644 --- a/src/scripts/view/main.js +++ b/src/scripts/view/main.js @@ -9,17 +9,17 @@ var lychee = { content: $('#content') }, $(document).ready(function() { - /* Event Name */ - if ('ontouchend' in document.documentElement) eventName = 'touchend'; - else eventName = 'click'; + // Event Name + var touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement), + eventName = (touchendSupport===true ? 'touchend' : 'click'); - /* Set API error handler */ + // Set API error handler api.onError = error; - /* Infobox */ + // Infobox header.dom('#button_info').on(eventName, sidebar.toggle); - /* Direct Link */ + // Direct Link header.dom('#button_direct').on(eventName, function() { var link = $('#imageview #image').css('background-image').replace(/"/g,'').replace(/url\(|\)$/ig, ''); From d065cd2f52891ac4cdfae68ced695cb037a85cc2 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Thu, 9 Jul 2015 17:52:08 +0200 Subject: [PATCH 33/58] Rebuild --- dist/main.js | Bin 179104 -> 179101 bytes dist/view.js | Bin 100013 -> 100015 bytes 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 dist/view.js diff --git a/dist/main.js b/dist/main.js index f91c9f37815c0db7f5cc696b308af8c4aced8402..6e3333b3643139188b6fa910357f59d284420546 100644 GIT binary patch delta 201 zcmZ4RoonuQu7)j)J@;jEDw8u(Q}xnQOI*uR^Gf^@b5k`mt&37iN{jLorcZdwD6;+0 zeMV~?Jz$Y*M1nm(nF$%~O|`@KS@L!JQU C{!7#V delta 118 zcmbRHoom5&u7)j)J@==-7iLnQE-%6)y?y0<#&EvrGlZFDPZxW~=*L(xJ@p-kmrb{7$*Em26OiRLp^GXXVC OC}i^5e!GzAkS74gq%2zi diff --git a/dist/view.js b/dist/view.js old mode 100755 new mode 100644 index 984ed6d8b10b03c623d8726fc8ee43643fd36dd5..c7e8671e3f64d941555a3928d0c72f923b38101d GIT binary patch delta 1541 zcmZ`(U2GIp6wcjkyIV>VEflsu+wG+6&ZNV3fl5o4*|pLwP7qiXE3z&y?A*OGursrn zo!!!Ot7!-({xk-!b`c^74+0H8;zZX60=|e*16DMmC@%t0!;610F%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Kml-y8E zOvufRIzTr*bHD~9{r>DS*qC?oVldWi{_jSTTf=w2|Y3 zG&rNk*bK^8j#IXsgaJQA{C?s~Yq`9+TGcXgfcP@WyLv)QdOX83aVbpV6$)Wvv((;2 z#Fr}L*Bi2uk7pB*w6ino@yM_s`BwG0{~7;8T?Uo@Q2S?GGGus4`w*^EyS={5=DZz? zs@XucnZ>d#tUKFm4P}R`!T)RFvdt~|^4W}L@*F4l@>zv#Tj*ligfbVOQ`<<{29~`f3pd!J8ijOEJuLwb)h_Knmo>)eF z%Alf~c>#h8_@0GF#sra1f~_WXIir+M?^|rnWHWo`SP{zfPVIwH{c7qcvO|9M!tq58 z0%HY<*x}<(RsbG0|HKq%pPu*;Ug+q_c95T+9Duf#oI1D=p7Y{`I~!t(&&Zl2XB4t{ zM%N5o1kD^U Date: Sat, 11 Jul 2015 13:33:37 +0200 Subject: [PATCH 34/58] Updated album.js (ES2015) --- dist/main.js | Bin 179101 -> 179528 bytes src/scripts/album.js | 501 ++++++++++++++++++------------------- src/scripts/contextMenu.js | 6 +- 3 files changed, 246 insertions(+), 261 deletions(-) diff --git a/dist/main.js b/dist/main.js index 6e3333b3643139188b6fa910357f59d284420546..d2b7bbcb47af858e75face0b82f45af42b18c58c 100644 GIT binary patch delta 2101 zcmbVNYitx%6waB_*Fw|h_JKfWFQvP~PPbbMt?YKTR0~oBtf7WzA#ry1wjJEPQ)j1b zur1FPd9=_6aAL5K786ZOL{egby7g1xFCGR4DapV+LLRPuFFvrUUrk0k4gU)J!m z6HtNUUxKrc$eP^I!y=}pGmj?qYaJfUI|*yDHOZi6kHJK&J_*N<2KffruNq8aodI#b zp|ei0TTLYTbR+5_ilQvMug1bXabHYVqaG@olI*Gp&V>#obf#!FICWWYRV=70YN*!l zZ}bQFf0Zhm{A8EEvNGMnflJu`9@M4rCmfT7Qam;U?V#hsA<)p6g~BZAGc_|t<;zu2 zgd@YS9{n>=l;`J%n7$Zgon}{MrN_kE!>|!dd^`*lz%cI=yZ}K|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R{aDRvNEqa@`)XKY)}~}YdedZ;q*Std=#xF%rL&$bpvgg$(Yy6* z3q3T1;$-$iSWL|gER#+QVIl2mV6JKKi$ieHKm%){>JcszPoR%l8rd$&9maCT=b>U4 zB?W3&6lE*m|S0=fSSHU4h;`O%#WsP6W6usw(!VKHL4psxHEk; zj1BJF+N44gQgfVCmY+mzC7(KRtKr~JZM(2NqFPqCG@@BnX`Se^d}3{RdtF-HW=40X z&knkL68U*4uZY^BMP}p<2MxW5BJz&Fm6cRG$RLE$$I%gZrk%?F=|w+{pe&bL*Os^H zduPD@J4pGR_?}bn-5tOC6hi+KzlfR$bM6dsi4eGZ5aBcenW>ta2l&l*okruLf7Mi5 zKGQ`S+sX={Quk5h=cI2)ZZm?(`=#z0rX+U1gscqc6d2_Mjg3Nrp13-SNif-@m(O4o z*L{2j4P2WWLm^%BupC+%U|CcjLmr>MM`O632?|Zb5Mn}rzKx+ZQ&<_aX;u?kLe^P? zoOYVVbrp2sEUM`02IfvU#^6ShutC}u$DAZn=hJg>%%*SRSWf5SDCF>yaTK}C{rkNp zpHWFRISX$LBA;hfd>Bhe=7i!__2XFRGWcd#og5`m3Z~WFa&R4KPdaQ;os(}g2<-6hO0(9aE z&$r|nhdBQMvgnN|WM{0Dy6CC*P)V0Rg){N{6uw_TYi=Pw!ET`g86l@L@$@g)-$~7T S*uuoUQMM1 diff --git a/src/scripts/album.js b/src/scripts/album.js index 11725e7..d36174f 100644 --- a/src/scripts/album.js +++ b/src/scripts/album.js @@ -1,6 +1,6 @@ /** - * @description Takes care of every action an album can handle and execute. - * @copyright 2015 by Tobias Reich + * @description Takes care of every action an album can handle and execute. + * @copyright 2015 by Tobias Reich */ album = { @@ -11,39 +11,35 @@ album = { album.getID = function() { - var id = null; + let id = null - var isID = function(id) { - if (id==='0'||id==='f'||id==='s'||id==='r') return true; - return $.isNumeric(id); + let isID = (id) => { + if (id==='0' || id==='f' || id==='s' || id==='r') return true + return $.isNumeric(id) } - if (photo.json) id = photo.json.album; - else if (album.json) id = album.json.id; + if (photo.json) id = photo.json.album + else if (album.json) id = album.json.id // Search - if (isID(id)===false) id = $('.album:hover, .album.active').attr('data-id'); - if (isID(id)===false) id = $('.photo:hover, .photo.active').attr('data-album-id'); + if (isID(id)===false) id = $('.album:hover, .album.active').attr('data-id') + if (isID(id)===false) id = $('.photo:hover, .photo.active').attr('data-album-id') - if (isID(id)===true) return id; - else return false; + if (isID(id)===true) return id + else return false } album.load = function(albumID, refresh) { - var startTime, - params, - durationTime, - waitTime; - password.get(albumID, function() { - if (!refresh) lychee.animate('#content', 'contentZoomOut'); + if (!refresh) lychee.animate('#content', 'contentZoomOut') - startTime = new Date().getTime(); + let startTime = new Date().getTime(), + waitTime = 0 - params = { + let params = { albumID, password: password.value } @@ -51,94 +47,88 @@ album.load = function(albumID, refresh) { api.post('Album::get', params, function(data) { if (data==='Warning: Album private!') { + if (document.location.hash.replace('#', '').split('/')[1]!=undefined) { // Display photo only - lychee.setMode('view'); + lychee.setMode('view') } else { // Album not public - lychee.content.show(); - lychee.goto(''); + lychee.content.show() + lychee.goto('') } - return false; + return false } if (data==='Warning: Wrong password!') { - album.load(albumID, refresh); - return false; + album.load(albumID, refresh) + return false } - album.json = data; + album.json = data // Calculate delay - durationTime = (new Date().getTime() - startTime); - if (durationTime>300) waitTime = 0; - else waitTime = 300 - durationTime; + let durationTime = (new Date().getTime() - startTime) + if (durationTime>300) waitTime = 0 + else waitTime = 300 - durationTime // Skip delay when refresh is true // Skip delay when opening a blank Lychee - if (refresh===true) waitTime = 0; - if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0; + if (refresh===true) waitTime = 0 + if (!visible.albums() && !visible.photo() && !visible.album()) waitTime = 0 setTimeout(function() { - view.album.init(); + view.album.init() if (!refresh) { - lychee.animate('#content', 'contentZoomIn'); - header.setMode('album'); + lychee.animate('#content', 'contentZoomIn') + header.setMode('album') } - }, waitTime); + }, waitTime) - }); + }) - }); + }) } album.parse = function() { - if (!album.json.title) album.json.title = 'Untitled'; + if (!album.json.title) album.json.title = 'Untitled' } album.add = function() { - var action; + const action = function(data) { - action = function(data) { + let title = data.title - var isNumber, - title = data.title; + const isNumber = (n) => (!isNaN(parseFloat(n)) && isFinite(n)) - basicModal.close(); + basicModal.close() - isNumber = function(n) { - - return !isNaN(parseFloat(n)) && isFinite(n) - - } - - if (title.length===0) title = 'Untitled'; + if (title.length===0) title = 'Untitled' api.post('Album::add', { title }, function(data) { // Avoid first album to be true - if (data===true) data = 1; + if (data===true) data = 1 - if (data!==false&&isNumber(data)) { - albums.refresh(); - lychee.goto(data); + if (data!==false && isNumber(data)) { + albums.refresh() + lychee.goto(data) } else { - lychee.error(null, params, data); + lychee.error(null, params, data) } - }); + }) } basicModal.show({ - body: "

Enter a title for the new album:

", + body: `

Enter a title for the new album:

`, buttons: { action: { title: 'Create Album', @@ -149,25 +139,24 @@ album.add = function() { fn: basicModal.close } } - }); + }) } album.delete = function(albumIDs) { - var action = {}, - cancel = {}, - msg = '', - albumTitle = ''; + let action = {}, + cancel = {}, + msg = '' - if (!albumIDs) return false; - if (albumIDs instanceof Array===false) albumIDs = [albumIDs]; + if (!albumIDs) return false + if (albumIDs instanceof Array===false) albumIDs = [albumIDs] action.fn = function() { - var params; + let params - basicModal.close(); + basicModal.close() params = { albumIDs: albumIDs.join() @@ -178,48 +167,50 @@ album.delete = function(albumIDs) { if (visible.albums()) { albumIDs.forEach(function(id) { - albums.json.num--; - view.albums.content.delete(id); - albums.deleteByID(id); - }); + albums.json.num-- + view.albums.content.delete(id) + albums.deleteByID(id) + }) } else { - albums.refresh(); - lychee.goto(''); + albums.refresh() + lychee.goto('') } - if (data!==true) lychee.error(null, params, data); + if (data!==true) lychee.error(null, params, data) - }); + }) } if (albumIDs.toString()==='0') { - action.title = 'Clear Unsorted'; - cancel.title = 'Keep Unsorted'; + action.title = 'Clear Unsorted' + cancel.title = 'Keep Unsorted' - msg = "

Are you sure you want to delete all photos from 'Unsorted'?
This action can't be undone!

"; + msg = `

Are you sure you want to delete all photos from 'Unsorted'?
This action can't be undone!

` } else if (albumIDs.length===1) { - action.title = 'Delete Album and Photos'; - cancel.title = 'Keep Album'; + let albumTitle = '' + + action.title = 'Delete Album and Photos' + cancel.title = 'Keep Album' // Get title - if (album.json) albumTitle = album.json.title; - else if (albums.json) albumTitle = albums.getByID(albumIDs).title; + if (album.json) albumTitle = album.json.title + else if (albums.json) albumTitle = albums.getByID(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!

"; + msg = `

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

` } else { - action.title = 'Delete Albums and Photos'; - cancel.title = 'Keep Albums'; + action.title = 'Delete Albums and Photos' + cancel.title = 'Keep Albums' - msg = "

Are you sure you want to delete all " + albumIDs.length + " selected albums and all of the photos they contain? This action can't be undone!

"; + msg = `

Are you sure you want to delete all ${ albumIDs.length } selected albums and all of the photos they contain? This action can't be undone!

` } @@ -236,80 +227,78 @@ album.delete = function(albumIDs) { fn: basicModal.close } } - }); + }) } album.setTitle = function(albumIDs) { - var oldTitle = '', - input = '', - msg = '', - action; + let oldTitle = '', + msg = '' - if (!albumIDs) return false; - if (albumIDs instanceof Array===false) albumIDs = [albumIDs]; + if (!albumIDs) return false + if (albumIDs instanceof Array===false) albumIDs = [albumIDs] if (albumIDs.length===1) { // Get old title if only one album is selected - if (album.json) oldTitle = album.json.title; - else if (albums.json) oldTitle = albums.getByID(albumIDs).title; + if (album.json) oldTitle = album.json.title + else if (albums.json) oldTitle = albums.getByID(albumIDs).title - if (!oldTitle) oldTitle = ''; - oldTitle = oldTitle.replace(/'/g, '''); + if (!oldTitle) oldTitle = '' + oldTitle = oldTitle.replace(/'/g, ''') } - action = function(data) { + const action = function(data) { - var params, - newTitle = data.title; + let newTitle = data.title - basicModal.close(); + basicModal.close() // Remove html from input - newTitle = lychee.removeHTML(newTitle); + newTitle = lychee.removeHTML(newTitle) - // Set to Untitled when empty - newTitle = (newTitle==='') ? 'Untitled' : newTitle; + // Set title to Untitled when empty + newTitle = (newTitle==='') ? 'Untitled' : newTitle if (visible.album()) { - album.json.title = newTitle; - view.album.title(); + // Rename only one album - if (albums.json) { - var id = albumIDs[0]; - albums.getByID(id).title = newTitle; - } + album.json.title = newTitle + view.album.title() + + if (albums.json) albums.getByID(albumIDs[0]).title = newTitle } else if (visible.albums()) { + // Rename all albums + albumIDs.forEach(function(id) { - albums.getByID(id).title = newTitle; - view.albums.content.title(id); - }); + albums.getByID(id).title = newTitle + view.albums.content.title(id) + }) } - params = { - albumIDs: albumIDs.join(), - title: newTitle + let params = { + albumIDs : albumIDs.join(), + title : newTitle } api.post('Album::setTitle', params, function(data) { - if (data!==true) lychee.error(null, params, data); + if (data!==true) lychee.error(null, params, data) - }); + }) } - input = ""; + let input = `` - if (albumIDs.length===1) msg = "

Enter a new title for this album: " + input + "

"; - else msg = "

Enter a title for all " + albumIDs.length + " selected albums: " + input +"

"; + if (albumIDs.length===1) msg = `

Enter a new title for this album: ${ input }

` + else msg = `

Enter a title for all ${ albumIDs.length } selected albums: ${ input }

` basicModal.show({ body: msg, @@ -323,45 +312,43 @@ album.setTitle = function(albumIDs) { fn: basicModal.close } } - }); + }) } album.setDescription = function(albumID) { - var oldDescription = album.json.description.replace(/'/g, '''), - action; + let oldDescription = album.json.description.replace(/'/g, ''') - action = function(data) { + const action = function(data) { - var params, - description = data.description; + let description = data.description - basicModal.close(); + basicModal.close() // Remove html from input - description = lychee.removeHTML(description); + description = lychee.removeHTML(description) if (visible.album()) { - album.json.description = description; - view.album.description(); + album.json.description = description + view.album.description() } - params = { + let params = { albumID, description } api.post('Album::setDescription', params, function(data) { - if (data!==true) lychee.error(null, params, data); + if (data!==true) lychee.error(null, params, data) - }); + }) } basicModal.show({ - body: "

Please enter a description for this album:

", + body: `

Please enter a description for this album:

`, buttons: { action: { title: 'Set Description', @@ -372,69 +359,71 @@ album.setDescription = function(albumID) { fn: basicModal.close } } - }); + }) } album.setPublic = function(albumID, modal, e) { - var params, - password = ''; + let password = '' - albums.refresh(); + albums.refresh() if (modal===true) { - let msg = '', - text = '', - action = {}; + let text = '', + action = {} - action.fn = function() { + action.fn = () => { - // Current function without showing the modal - album.setPublic(album.getID(), false, e); + // setPublic function without showing the modal + album.setPublic(album.getID(), false, e) - }; + } // Album public = Editing a shared album if (album.json.public==='1') { - action.title = 'Edit Sharing'; - text = 'The sharing-properties of this album will be changed to the following:'; + + action.title = 'Edit Sharing' + text = 'The sharing-properties of this album will be changed to the following:' + } else { - action.title = 'Share Album'; - text = 'This album will be shared with the following properties:'; + + action.title = 'Share Album' + text = 'This album will be shared with the following properties:' + } - msg = ` -

${ text }

-
-
- -

Listed to visitors of your Lychee.

-
-
- -

Visitors of your Lychee can download this album.

-
-
- -

Only accessible with a valid password.

- -
-
- ` + let msg = ` +

${ text }

+
+
+ +

Listed to visitors of your Lychee.

+
+
+ +

Visitors of your Lychee can download this album.

+
+
+ +

Only accessible with a valid password.

+ +
+
+ ` basicModal.show({ body: msg, @@ -448,21 +437,20 @@ album.setPublic = function(albumID, modal, e) { fn: basicModal.close } } - }); + }) // Active visible by default (public = 0) - if ((album.json.public==='1'&&album.json.visible==='1')|| - (album.json.public==='0')) $('.basicModal .choice input[name="visible"]').click(); - if (album.json.downloadable==='1') $('.basicModal .choice input[name="downloadable"]').click(); + if ((album.json.public==='1' && album.json.visible==='1') || (album.json.public==='0')) $('.basicModal .choice input[name="visible"]').click() + if (album.json.downloadable==='1') $('.basicModal .choice input[name="downloadable"]').click() $('.basicModal .choice input[name="password"]').on('change', function() { - if ($(this).prop('checked')===true) $('.basicModal .choice input[name="passwordtext"]').show().focus(); - else $('.basicModal .choice input[name="passwordtext"]').hide(); + if ($(this).prop('checked')===true) $('.basicModal .choice input[name="passwordtext"]').show().focus() + else $('.basicModal .choice input[name="passwordtext"]').hide() - }); + }) - return true; + return true } @@ -470,157 +458,154 @@ album.setPublic = function(albumID, modal, e) { if (basicModal.visible()) { // Visible modal => Set album public - album.json.public = '1'; + album.json.public = '1' // Set visible - if ($('.basicModal .choice input[name="visible"]:checked').length===1) album.json.visible = '1'; - else album.json.visible = '0'; + if ($('.basicModal .choice input[name="visible"]:checked').length===1) album.json.visible = '1' + else album.json.visible = '0' // Set downloadable - if ($('.basicModal .choice input[name="downloadable"]:checked').length===1) album.json.downloadable = '1'; - else album.json.downloadable = '0'; + if ($('.basicModal .choice input[name="downloadable"]:checked').length===1) album.json.downloadable = '1' + else album.json.downloadable = '0' // Set password if ($('.basicModal .choice input[name="password"]:checked').length===1) { - password = $('.basicModal .choice input[name="passwordtext"]').val(); - album.json.password = '1'; + password = $('.basicModal .choice input[name="passwordtext"]').val() + album.json.password = '1' } else { - password = ''; - album.json.password = '0'; + password = '' + album.json.password = '0' } // Modal input has been processed, now it can be closed - basicModal.close(); + basicModal.close() } else { // Modal not visible => Set album private - album.json.public = '0'; + album.json.public = '0' } // Set data and refresh view if (visible.album()) { - album.json.visible = (album.json.public==='0') ? '0' : album.json.visible; - album.json.downloadable = (album.json.public==='0') ? '0' : album.json.downloadable; - album.json.password = (album.json.public==='0') ? '0' : album.json.password; + album.json.visible = (album.json.public==='0') ? '0' : album.json.visible + album.json.downloadable = (album.json.public==='0') ? '0' : album.json.downloadable + album.json.password = (album.json.public==='0') ? '0' : album.json.password - view.album.public(); - view.album.visible(); - view.album.downloadable(); - view.album.password(); + view.album.public() + view.album.visible() + view.album.downloadable() + view.album.password() - if (album.json.public==='1') contextMenu.shareAlbum(albumID, e); + if (album.json.public==='1') contextMenu.shareAlbum(albumID, e) } - params = { + let params = { albumID, - public: album.json.public, - password: password, - visible: album.json.visible, - downloadable: album.json.downloadable + public : album.json.public, + password : password, + visible : album.json.visible, + downloadable : album.json.downloadable } api.post('Album::setPublic', params, function(data) { - if (data!==true) lychee.error(null, params, data); + if (data!==true) lychee.error(null, params, data) - }); + }) } album.share = function(service) { - var link = '', - url = location.href; + let link = '', + url = location.href switch (service) { - case 0: - link = 'https://twitter.com/share?url=' + encodeURI(url); - break; - case 1: - link = 'http://www.facebook.com/sharer.php?u=' + encodeURI(url) + '&t=' + encodeURI(album.json.title); - break; - case 2: - link = 'mailto:?subject=' + encodeURI(album.json.title) + '&body=' + encodeURI(url); - break; + case 'twitter': + link = `https://twitter.com/share?url=${ encodeURI(url) }` + break + case 'facebook': + link = `http://www.facebook.com/sharer.php?u=${ encodeURI(url) }&t=${ encodeURI(album.json.title) }` + break + case 'mail': + link = `mailto:?subject=${ encodeURI(album.json.title) }&body=${ encodeURI(url) }` + break default: - link = ''; - break; + link = '' + break } - if (link.length>5) location.href = link; + if (link!=='') location.href = link } album.getArchive = function(albumID) { - var link, - url = api.path + '?function=Album::getArchive&albumID=' + albumID; + let link, + url = `${ api.path }?function=Album::getArchive&albumID=${ 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 (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===true) link += '&password=' + password.value; + if (lychee.publicMode===true) link += `&password=${ password.value }` - location.href = link; + location.href = link } album.merge = function(albumIDs) { - var action, - title = '', - sTitle = '', - msg = ''; + let title = '', + sTitle = '', + msg = '' - if (!albumIDs) return false; - if (albumIDs instanceof Array===false) albumIDs = [albumIDs]; + if (!albumIDs) return false + if (albumIDs instanceof Array===false) albumIDs = [albumIDs] // Get title of first album - if (albums.json) title = albums.getByID(albumIDs[0]).title; + if (albums.json) title = albums.getByID(albumIDs[0]).title + if (!title) title = '' - if (!title) title = ''; - title = title.replace(/'/g, '''); + title = title.replace(/'/g, ''') if (albumIDs.length===2) { // Get title of second album - if (albums.json) sTitle = albums.getByID(albumIDs[1]).title; + if (albums.json) sTitle = albums.getByID(albumIDs[1]).title - if (!sTitle) sTitle = ''; - sTitle = sTitle.replace(/'/g, '''); + if (!sTitle) sTitle = '' + sTitle = sTitle.replace(/'/g, ''') - msg = "

Are you sure you want to merge the album '" + sTitle + "' into the album '" + title + "'?

"; + msg = `

Are you sure you want to merge the album '${ sTitle }' into the album '${ title }'?

` } else { - msg = "

Are you sure you want to merge all selected albums into the album '" + title + "'?

"; + msg = `

Are you sure you want to merge all selected albums into the album '${ title }'?

` } - action = function() { + const action = function() { - var params; + basicModal.close() - basicModal.close(); - - params = { + let params = { albumIDs: albumIDs.join() } api.post('Album::merge', params, function(data) { if (data!==true) { - lychee.error(null, params, data); + lychee.error(null, params, data) } else { - albums.refresh(); - albums.load(); + albums.refresh() + albums.load() } - }); + }) } @@ -637,6 +622,6 @@ album.merge = function(albumIDs) { fn: basicModal.close } } - }); + }) } \ No newline at end of file diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index 201caf2..7648ecc 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -315,9 +315,9 @@ contextMenu.shareAlbum = function(albumID, e) { var items = [ { type: 'item', title: '', fn: function() {}, class: 'noHover' }, { type: 'separator' }, - { type: 'item', title: build.iconic('twitter', iconClass) + 'Twitter', fn: function() { album.share(0) } }, - { type: 'item', title: build.iconic('facebook', iconClass) + 'Facebook', fn: function() { album.share(1) } }, - { type: 'item', title: build.iconic('envelope-closed') + 'Mail', fn: function() { album.share(2) } }, + { type: 'item', title: build.iconic('twitter', iconClass) + 'Twitter', fn: function() { album.share('twitter') } }, + { type: 'item', title: build.iconic('facebook', iconClass) + 'Facebook', fn: function() { album.share('facebook') } }, + { type: 'item', title: build.iconic('envelope-closed') + 'Mail', fn: function() { album.share('mail') } }, { type: 'separator' }, { type: 'item', title: build.iconic('pencil') + 'Edit Sharing', fn: function() { album.setPublic(albumID, true, e) } }, { type: 'item', title: build.iconic('ban') + 'Make Private', fn: function() { album.setPublic(albumID, false) } } From a0ea271bd6628e756f994c5c73eb699149256965 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jul 2015 13:47:43 +0200 Subject: [PATCH 35/58] Updated albums.js (ES2015) --- dist/main.js | Bin 179528 -> 179512 bytes src/scripts/album.js | 7 +- src/scripts/albums.js | 146 +++++++++++++++++++++--------------------- 3 files changed, 76 insertions(+), 77 deletions(-) diff --git a/dist/main.js b/dist/main.js index d2b7bbcb47af858e75face0b82f45af42b18c58c..1da34f14ef98b925ede8042bba1a4475e5f3eb75 100644 GIT binary patch delta 254 zcmX@{i)+U(u7)j)yPBr&Yhtt#%hyRO%}XxH%+J%v*Q_o}EKu znQ;}6y4cL92Bdy8Gs;P2+9ui=8yMIdSOH1hM4b{_TU$i~H8qXQ=>{!~mdrry)9X~3 zB&Ju*XX2XP*TNXcn7REy3!{mGn5{-$YPo_-Vo9o|UV3UtNM>%ThNkuO!X`%T>CsCW zExAe{F31BKA+Uf+a{BtEj8cpx(@y~@_7ZE58yMIdSOH1hM4b{_TU$i~H8qWVTLVp<>F>pvq^27$W0Yph zpPtvkSjw2c{YeX>i2|!miB6vN^ui`aZ6=-6=^vLeicXJQ%4o@)544SO0h7e^txFlD zfSN7 { view.album.init() diff --git a/src/scripts/albums.js b/src/scripts/albums.js index 36932bb..a65363e 100644 --- a/src/scripts/albums.js +++ b/src/scripts/albums.js @@ -11,61 +11,59 @@ albums = { albums.load = function() { - var startTime, - durationTime, - waitTime; + let startTime = new Date().getTime() - lychee.animate('#content', 'contentZoomOut'); - - startTime = new Date().getTime(); + lychee.animate('#content', 'contentZoomOut') if (albums.json===null) { api.post('Album::getAll', {}, function(data) { - /* Smart Albums */ - if (lychee.publicMode===false) albums._createSmartAlbums(data.smartalbums); + let waitTime = 0 - albums.json = data; + // Smart Albums + if (lychee.publicMode===false) albums._createSmartAlbums(data.smartalbums) + + albums.json = data // Calculate delay - durationTime = (new Date().getTime() - startTime); - if (durationTime>300) waitTime = 0; - else waitTime = 300 - durationTime; + let durationTime = (new Date().getTime() - startTime) + if (durationTime>300) waitTime = 0 + else waitTime = 300 - durationTime // Skip delay when opening a blank Lychee - if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0; - if (visible.album()&&lychee.content.html()==='') waitTime = 0; + if (!visible.albums() && !visible.photo() && !visible.album()) waitTime = 0 + if (visible.album() && lychee.content.html()==='') waitTime = 0 - setTimeout(function() { - header.setMode('albums'); - view.albums.init(); - lychee.animate('#content', 'contentZoomIn'); - }, waitTime); + setTimeout(() => { + header.setMode('albums') + view.albums.init() + lychee.animate('#content', 'contentZoomIn') + }, waitTime) - }); + }) } else { - setTimeout(function() { - header.setMode('albums'); - view.albums.init(); - lychee.animate('#content', 'contentZoomIn'); - }, 300); + setTimeout(() => { + header.setMode('albums') + view.albums.init() + lychee.animate('#content', 'contentZoomIn') + }, 300) } } albums.parse = function(album) { - if (album.password==='1'&&lychee.publicMode===true) { - album.thumbs[0] = 'src/images/password.svg'; - album.thumbs[1] = 'src/images/password.svg'; - album.thumbs[2] = 'src/images/password.svg'; + if (album.password==='1' && lychee.publicMode===true) { + album.thumbs[0] = 'src/images/password.svg' + album.thumbs[1] = 'src/images/password.svg' + album.thumbs[2] = 'src/images/password.svg' } else { - if (!album.thumbs[0]) album.thumbs[0] = 'src/images/no_images.svg'; - if (!album.thumbs[1]) album.thumbs[1] = 'src/images/no_images.svg'; - if (!album.thumbs[2]) album.thumbs[2] = 'src/images/no_images.svg'; + if (!album.thumbs[0]) album.thumbs[0] = 'src/images/no_images.svg' + if (!album.thumbs[1]) album.thumbs[1] = 'src/images/no_images.svg' + if (!album.thumbs[2]) album.thumbs[2] = 'src/images/no_images.svg' } } @@ -73,36 +71,36 @@ albums.parse = function(album) { albums._createSmartAlbums = function(data) { data.unsorted = { - id: 0, - title: 'Unsorted', - sysdate: data.unsorted.num + ' photos', - unsorted: '1', - thumbs: data.unsorted.thumbs - }; + id : 0, + title : 'Unsorted', + sysdate : data.unsorted.num + ' photos', + unsorted : '1', + thumbs : data.unsorted.thumbs + } data.starred = { - id: 'f', - title: 'Starred', - sysdate: data.starred.num + ' photos', - star: '1', - thumbs: data.starred.thumbs - }; + id : 'f', + title : 'Starred', + sysdate : data.starred.num + ' photos', + star : '1', + thumbs : data.starred.thumbs + } data.public = { - id: 's', - title: 'Public', - sysdate: data.public.num + ' photos', - public: '1', - thumbs: data.public.thumbs - }; + id : 's', + title : 'Public', + sysdate : data.public.num + ' photos', + public : '1', + thumbs : data.public.thumbs + } data.recent = { - id: 'r', - title: 'Recent', - sysdate: data.recent.num + ' photos', - recent: '1', - thumbs: data.recent.thumbs - }; + id : 'r', + title : 'Recent', + sysdate : data.recent.num + ' photos', + recent : '1', + thumbs : data.recent.thumbs + } } @@ -110,21 +108,21 @@ albums.getByID = function(albumID) { // Function returns the JSON of an album - if (albumID===undefined||albumID===null) return undefined; - if (!albums.json) return undefined; - if (!albums.json.albums) return undefined; + if (albumID==null) return undefined + if (!albums.json) return undefined + if (!albums.json.albums) return undefined - var json = undefined; + let json = undefined $.each(albums.json.albums, function(i) { - let elem = albums.json.albums[i]; + let elem = albums.json.albums[i] - if (elem.id==albumID) json = elem; + if (elem.id==albumID) json = elem - }); + }) - return json; + return json } @@ -132,28 +130,28 @@ albums.deleteByID = function(albumID) { // Function returns the JSON of an album - if (albumID===undefined||albumID===null) return false; - if (!albums.json) return false; - if (!albums.json.albums) return false; + if (albumID==null) return false + if (!albums.json) return false + if (!albums.json.albums) return false - var deleted = false; + var deleted = false $.each(albums.json.albums, function(i) { if (albums.json.albums[i].id==albumID) { - albums.json.albums.splice(i, 1); - deleted = true; - return false; + albums.json.albums.splice(i, 1) + deleted = true + return false } - }); + }) - return deleted; + return deleted } albums.refresh = function() { - albums.json = null; + albums.json = null } \ No newline at end of file From bfe067cc71b40878100b116a6f6645cc8e627dc5 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jul 2015 14:16:11 +0200 Subject: [PATCH 36/58] Updated api.js and build.js (ES2015) --- dist/main.js | Bin 179512 -> 179680 bytes dist/view.js | Bin 100015 -> 100183 bytes src/scripts/albums.js | 4 +- src/scripts/api.js | 46 ++++----- src/scripts/build.js | 229 ++++++++++++++++++------------------------ 5 files changed, 118 insertions(+), 161 deletions(-) diff --git a/dist/main.js b/dist/main.js index 1da34f14ef98b925ede8042bba1a4475e5f3eb75..e9c3526864b2f98ea30a62dc730d5655f0217d8e 100644 GIT binary patch delta 1014 zcmZWoO-~b16wNJ3Ee#4%EEOn@Pm)rnv;rXkW?C^uT_~E6Xkq~4qYUlDG9xnsNCZPn zOx(Caa!ved!p;Wqzknug+~LZF8#KijKN4R%G!&S{-1FYO=gm2H?pytB-~3~r zPQ%9peolbjDvVK$QxTe=3f=SIJfum+sHSk4)_I5l2pC_0Zp@qm=CQjzfrBj^oP}CDa*6@lguwga> zA)KR7jcl*avHKOS(56g$6&gxR-sU@Sb`;g*AmPm^GN-Rm^75olDJ?1@f<7)A;b>9Dm6z9z*+pH-D;;%4%{OMo-9xL0 zr!IAgcu+wHJC(ZWuC9=|=LjMHfT&B?Fv>%9>AO2StAd{1XWsX{$NPNVXTJRlt^W

A+SHG~8Z*h@dirK4`_xMQD5WNoXt$E`koA;`|a^3ua9#$+8jLSpo^)4+|$Q zYPR7{*_Px|HkJ zhlS%IKWS0C^$sQoHFCKOGm}z`QfkN^4c?p4ZBC}b1b2$ip*mx+aam>5iagNWlxlL2 z(wz~*H7(tr$?K~dVe2x;0nQ$;F2l_#SmB_hqKA2ZQgZAB?IjAskIQhOi74hiJwC5O z$1z?g;;R)?jE15wvX#{{m?b8=U3tKq0GWT|HcP7HHacnU5u~69N(zC2IqMAwFWHU zDinv_2=Rc--(Q!YKX%lrl}*{c6Lah-|EB~@;NtNpBlI2O_Y06W;z-192z!c#T&;}p5B1nigOxAW0j*%rPJC3v%__NAL2)TB;WEj z%Q`iy6OF~)NZPO_-IOMq)E#5vDt`X}ce}VP4)*wehltiD^jG-2-GoHdNL^*aN9o%kZcay5M zC|(4?ibQw^K`)-Q2O;1^ym(O1qk8k;zaV&YvgxLqD2Q`;zxO@!oA+Kl41L)S-F*#D zFLf^$nYkiwZpA&2VA{IHwDOr>ow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() => loadingBar.hide(), 100) // Catch errors - if (typeof data==='string'&& - data.substring(0, 7)==='Error: ') { - api.onError(data.substring(7, data.length), params, data); - return false; + if (typeof data==='string' && data.substring(0, 7)==='Error: ') { + api.onError(data.substring(7, data.length), params, data) + return false } // Convert 1 to true and an empty string to false - if (data==='1') data = true; - else if (data==='') data = false; + if (data==='1') data = true + else if (data==='') data = false // Convert to JSON if string start with '{' and ends with '}' - if (typeof data==='string'&& - data.substring(0, 1)==='{'&& - data.substring(data.length-1, data.length)==='}') data = $.parseJSON(data); + if (typeof data==='string' && + data.substring(0, 1)==='{' && + data.substring(data.length-1, data.length)==='}') data = $.parseJSON(data) // Output response when debug mode is enabled - if (lychee.debugMode) console.log(data); + if (lychee.debugMode) console.log(data) - callback(data); + callback(data) } - error = function(jqXHR, textStatus, errorThrown) { + const error = (jqXHR, textStatus, errorThrown) => { - api.onError('Server error or API not found.', params, errorThrown); + api.onError('Server error or API not found.', params, errorThrown) } @@ -59,6 +55,6 @@ api.post = function(fn, params, callback) { dataType: 'text', success, error - }); + }) } \ No newline at end of file diff --git a/src/scripts/build.js b/src/scripts/build.js index ada7012..782ffc6 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -1,123 +1,93 @@ /** - * @description This module is used to generate HTML-Code. - * @copyright 2015 by Tobias Reich + * @description This module is used to generate HTML-Code. + * @copyright 2015 by Tobias Reich */ -window.build = {} +build = {} -build.iconic = function(icon, classes) { +build.iconic = function(icon, classes = '') { - var html = ''; - - classes = classes || ''; - - html = ` - - - - ` - - return html; + return `` } build.divider = function(title) { - var html = ''; - - html = ` -

-

${ title }

-
- ` - - return html; + return `

${ title }

` } build.editIcon = function(id) { - var html = ''; - - html = `
${ build.iconic('pencil') }
` - - return html; + return `
${ build.iconic('pencil') }
` } build.multiselect = function(top, left) { - var html = ''; - - html = `
` - - return html; + return `
` } build.album = function(data) { - if (data===null||data===undefined) return ''; + if (data==null) return '' - var html = ''; + let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbs[0]) - var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbs[0]); - - html = ` -
- - ` + let html = '' if (size==='big') { @@ -119,6 +116,11 @@ build.imageview = function(data, size, visibleControls) { } + html += ` + + + ` + return html } From 050be351e495b63658e0c0f2063ee2c0877235cc Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 12 Jul 2015 14:05:14 +0200 Subject: [PATCH 49/58] Updated version --- dist/main.js | Bin 180889 -> 180889 bytes src/package.json | 2 +- src/scripts/lychee.js | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/main.js b/dist/main.js index 8fb981cbe0273f3d0a59c7fb863ccb6c30eb2d73..0d8ced24aafbeeb9a432b5653d32c502463504d9 100644 GIT binary patch delta 43 ycmbQ)%007{yP<_~3zG(uxQUWZS!z*nW`16La(+sxm6Cz6fq{X^c6%nKr~?2n+6`y` delta 43 ycmbQ)%007{yP<_~3zG(uxUrH>S!z*nW`16La(+sxm6Cz6fq{YXc6%nKr~?2nwhd+g diff --git a/src/package.json b/src/package.json index 6ec908a..9226aed 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "Lychee", - "version": "3.0.3", + "version": "3.0.4", "description": "Self-hosted photo-management done right.", "authors": "Tobias Reich ", "license": "MIT", diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index 908bd52..9851a33 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -6,8 +6,8 @@ lychee = { title : document.title, - version : '3.0.3', - version_code : '030003', + version : '3.0.4', + version_code : '030004', update_path : 'http://lychee.electerious.com/version/index.php', updateURL : 'https://github.com/electerious/Lychee', From f26cb687873936e3e3f321dcd7ce4c50ff8661d2 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 12 Jul 2015 14:47:35 +0200 Subject: [PATCH 50/58] Always add all badges Show & hide them using classes --- dist/main.css | Bin 32947 -> 33047 bytes src/scripts/build.js | 22 +++++++++++++++------- src/scripts/view.js | 12 ++++++++---- src/styles/_content.scss | 16 ++++++++++++---- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/dist/main.css b/dist/main.css index 589cc67a450c6c90f503eda1221c5e13687841cd..f1aada543c87eee67095ca80b4a3438731a77a1b 100755 GIT binary patch delta 138 zcmdno$TYo)X~Ps##^TBR=Hg7n)sqcNB{_8s3n~;0fN=6gW6{a|rm~awxJogaO}=0% zAzPlAQj%e1Xi-pMos^iIonDk*nwMgwoMLH|Y-}?5xv9!zIWvEr#GK6ZJgel?ypq(S f$?0aUoVvPYnZ=n&IjJCfka!>5#5R94JLCxfd4w<2 delta 111 zcmbQ<#I(7QX~PuL$*)W$CLi(}V!3x!lZe z@^v$NKC8Tv4Bh06%$yVrqdd*Y^5){Qs6y4biACv|dAd2NX(d*sCX+9kN^Z_JU*ib? DKj|gu diff --git a/src/scripts/build.js b/src/scripts/build.js index 79dda7a..1da00dc 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -48,11 +48,15 @@ build.album = function(data) { if (lychee.publicMode===false) { - if (data.star==='1') html += `${ build.iconic('star') }` - 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==='1') html += `${ build.iconic('lock-locked') }` + html += ` + + ` } @@ -82,8 +86,12 @@ build.photo = function(data) { if (lychee.publicMode===false) { - if (data.star==='1') html += `${ build.iconic('star') }` - if (data.public==='1' && album.json.public!=='1') html += `` + html += ` + + ` } diff --git a/src/scripts/view.js b/src/scripts/view.js index 5eb7157..01d83bd 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -172,15 +172,19 @@ 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') + "") + let $badge = $('.photo[data-id="' + photoID + '"] .iconic-star') + + if (album.json.content[photoID].star==='1') $badge.addClass('.badge--visible') + else $badge.removeClass('.badge--visible') }, public: function(photoID) { - $('.photo[data-id="' + photoID + '"] .iconic-share').remove() - if (album.json.content[photoID].public==='1') $('.photo[data-id="' + photoID + '"]').append("") + let $badge = $('.photo[data-id="' + photoID + '"] .iconic-share') + + if (album.json.content[photoID].public==='1') $badge.addClass('.badge--visible') + else $badge.removeClass('.badge--visible') }, diff --git a/src/styles/_content.scss b/src/styles/_content.scss index 944cae2..520b4cd 100644 --- a/src/styles/_content.scss +++ b/src/styles/_content.scss @@ -158,21 +158,29 @@ .album img[data-retina='false'] + .overlay a { text-shadow: none; } /* Badges ------------------------------------------------*/ + .album .badges, + .photo .badges { + position: relative; + margin: -1px 0 0 6px; + } + .album .badge, .photo .badge { - position: absolute; - margin: -1px 0 0 12px; + display: none; + margin: 0 0 0 6px; padding: 12px 8px 6px; - box-shadow: 0 0 2px black(.6); + width: 18px; background: $colorRed; + box-shadow: 0 0 2px black(.6); border-radius: 0 0 5px 5px; border: 1px solid #fff; border-top: none; color: #fff; + text-align: center; text-shadow: 0 1px 0 black(.4); opacity: .9; - &:nth-child(2n) { margin-left: 54px; } + &--visible { display: inline-block; } .iconic { fill: #fff; From 4d65819cd9f5be7b64aed5e28f7685c6673cbd68 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 12 Jul 2015 14:47:55 +0200 Subject: [PATCH 51/58] Removed old visible.message()-function --- src/scripts/header.js | 2 +- src/scripts/init.js | 8 ++++---- src/scripts/visible.js | 4 ---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/scripts/header.js b/src/scripts/header.js index e411b30..716a51c 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -80,7 +80,7 @@ header.show = function() { header.hide = function(e, delay = 500) { - if (visible.photo() && !visible.sidebar() && !visible.contextMenu() && !visible.message()) { + if (visible.photo() && !visible.sidebar() && !visible.contextMenu() && basicModal.visible()===false) { clearTimeout($(window).data('timeout')) diff --git a/src/scripts/init.js b/src/scripts/init.js index 39672a3..268a769 100755 --- a/src/scripts/init.js +++ b/src/scripts/init.js @@ -52,12 +52,12 @@ $(document).ready(function() { if (!visible.multiselect()) { sidebar.toggle(); return false } }) .bind(['command+backspace', 'ctrl+backspace'], function() { - if (visible.photo() && !visible.message()) { photo.delete([photo.getID()]); return false } - else if (visible.album() && !visible.message()) { album.delete([album.getID()]); return false } + if (visible.photo() && basicModal.visible()===false) { photo.delete([photo.getID()]); return false } + else if (visible.album() && basicModal.visible()===false) { album.delete([album.getID()]); return false } }) .bind(['command+a', 'ctrl+a'], function() { - if (visible.album() && !visible.message()) { multiselect.selectAll(); return false } - else if (visible.albums() && !visible.message()) { multiselect.selectAll(); return false } + if (visible.album() && basicModal.visible()===false) { multiselect.selectAll(); return false } + else if (visible.albums() && basicModal.visible()===false) { multiselect.selectAll(); return false } }) Mousetrap.bindGlobal('enter', function() { diff --git a/src/scripts/visible.js b/src/scripts/visible.js index 1bc47f6..25eed62 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -41,10 +41,6 @@ visible.header = function() { return true } -visible.message = function() { - return basicModal.visible() -} - visible.contextMenu = function() { return basicContext.visible() } From af45805421457848063262787811b3238538d43c Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 12 Jul 2015 14:48:00 +0200 Subject: [PATCH 52/58] Rebuild --- dist/main.js | Bin 180889 -> 181155 bytes dist/view.js | Bin 100097 -> 100410 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/dist/main.js b/dist/main.js index 0d8ced24aafbeeb9a432b5653d32c502463504d9..b76f1fb2112bc420f79bff295fef864c68bc345e 100644 GIT binary patch delta 8561 zcmcIp3ve98nXX>RvLrub*^(t$wxwOnYQ~yfX=QBeU60n1ANYYR13G+oBPSziv>JIe zv+kaiEVM#4iIWgwARh4GGa+#Zgak-T*2xmWBP3OqBP2l1xui%4n2>{{IN&HA&LtP_ zzV6+X>?Bl?x;j;9rn{&6@9zKk{r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aBVV844I-t|78O{Nl9zSOih%Inf=%6JzZ5Os+o$JfqA%6 zWA?Jco-ASZ@xz`*_f=!RblCHV+pe9lQsk(G<$v}K&ugToxV+WZi~=`20rJzdp)+*= ze{7>Vz#$a3LY@@R)stmIo*Ez>Lo#H)ZsF=IKlcVtoK!lu3g~?8IPgOL3paWy7uqi$ z_bhDi23(zK;}+B+VxwVW1agPD*n8G^7JK}D`@Y|i#f@oPH!ghKy3W=(yXm;6-l1w= ze%v#+;^VaHE6%pP{|{BJoB1b>d)CYW+aGK9RNLN19rp2dDUF6qJN*cR&+-pE>PeN% TC@7EX0sH<2*Vph1&sY8r3v~OS diff --git a/dist/view.js b/dist/view.js index 590f33423d0507d4456b245e00bab2098cb06c23..70e3e205ecb8b8c4fcff6d700236acb555db2c34 100644 GIT binary patch delta 670 zcmZqdW7{=>tziq}6JL%ZZCj<7JWkH(2f`Rd{E`w=(o>7o?LZ<5NWdmhAvq_pxY$-5 ztU^IaTSLiE$=233Rj;@tvB+KtEUc?rmRX#cl#{AtrKF^(tu&p@k5S#5c(bCF3QCi5 zGLw~JaTyp6G|-E91NBPtit~#~Qd4l5x7?3W&VvN=ic*tP^Ga};_QsDgQYIoOrr!-@)D_1S1fU3lIN2wN@vg9BQetst vvTuG$VvZg(ZD?pJ+S)1_ZnsKfG~?L5B9Cz;J0sWjz%oW7#_cWTjJ5m#Y(u%Q delta 428 zcmdlrfvvHRtziq}6JI4ILnT{V+f=>clEfl4HH{)|TP2%Bh2)&X;$mC%q{Ni;)aeg{ z7}d3uGFulX5bXm11$IKj6oxu8B~uSDIIxUsRHsf(}w&&y1n z{xpbDnHlJ|>Ds}Jy0Snw;Zb|Uk5L(9$JSuRyTXEHnZ=n&IjMTNsl~;K>8To;+gGPE tnsKm0`P1LzGfMFL=BFg)=s}eNm0Ztf+|0hcyPVO8k&$cr-U`NAegJH=gFpZP From 5c88b367f0998c28f18a1aeee3f0517134d67d47 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 12 Jul 2015 15:05:36 +0200 Subject: [PATCH 53/58] Updated changelog --- docs/Changelog.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 44f337b..1a4171b 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,9 +1,21 @@ +## v3.0.4 + +Released July ??, 2015 + +- `Improved` Removed bower and updated basicModal & basicContext +- `Improved` Small interface performance improvements +- `Improved` Updated all JS-files to take advantage of ES2015 +- `Improved` Better error-handling for the Dropbox-, URL- and Server-Import +- `Improved` Added skipDuplicates- and identifier-check to the diagnostics +- `Fixed` error when using "Merge All" with one selected album +- `Fixed` error when saving username and password after the initial setup +- `Fixed` Clicks not recognized when using a mouse on a touchscreen-device (#345) + ## v3.0.3 Released June 28, 2015 - `New` Skip duplicates on upload (#367, [How to activate](settings.md)) -- `Fixed` Clicks not recognized when using a mouse on a touchscreen-device (#345) ## v3.0.2 From 632557800c79ba4aa137bbf968c2f73f38b3894f Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 13 Jul 2015 14:29:02 +0200 Subject: [PATCH 54/58] Improved null/undefined checks --- src/scripts/loadingBar.js | 2 +- src/scripts/lychee.js | 10 +++++----- src/scripts/multiselect.js | 2 +- src/scripts/photo.js | 2 +- src/scripts/search.js | 2 +- src/scripts/upload.js | 4 ++-- src/scripts/view.js | 2 +- src/scripts/view/main.js | 2 +- src/scripts/visible.js | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/scripts/loadingBar.js b/src/scripts/loadingBar.js index 83d42d5..f613555 100755 --- a/src/scripts/loadingBar.js +++ b/src/scripts/loadingBar.js @@ -75,7 +75,7 @@ loadingBar.show = function(status, errorText) { loadingBar.hide = function(force) { - if ((loadingBar.status!=='error' && loadingBar.status!==null) || force) { + if ((loadingBar.status!=='error' && loadingBar.status!=null) || force) { // Remove status loadingBar.status = null diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index 9851a33..315ec7b 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -143,7 +143,7 @@ lychee.loginDialog = function() { if (localStorage) { let localUsername = localStorage.getItem('lychee_username') - if (localUsername!==null && localUsername.length>0) { + if (localUsername!=null && localUsername.length>0) { $('.basicModal input[name="username"]').val(localUsername) $('.basicModal input[name="password"]').focus() } @@ -181,8 +181,8 @@ lychee.load = function() { contextMenu.close() multiselect.close() - if (hash[0]!==undefined) albumID = hash[0] - if (hash[1]!==undefined) photoID = hash[1] + if (hash[0]!=null) albumID = hash[0] + if (hash[1]!=null) photoID = hash[1] if (albumID && photoID) { @@ -212,7 +212,7 @@ lychee.load = function() { } else { // Trash albums.json when filled with search results - if (search.hash!==null) { + if (search.hash!=null) { albums.json = null search.hash = null } @@ -327,7 +327,7 @@ lychee.retinize = function(path = '') { extention = path.split('.').pop(), hasRetina = extention!=='svg' - if ((pixelRatio!==undefined && pixelRatio>1) && hasRetina===true) { + if ((pixelRatio!=null && pixelRatio>1) && hasRetina===true) { path = path.replace(/\.[^/.]+$/, '') path = path + '@2x' + '.' + extention diff --git a/src/scripts/multiselect.js b/src/scripts/multiselect.js index 0b84d21..37bc2cb 100644 --- a/src/scripts/multiselect.js +++ b/src/scripts/multiselect.js @@ -199,7 +199,7 @@ multiselect.getSelection = function(e) { let id = $(this).data('id') - if (id!=='0' && id!==0 && id!=='f' && id!=='s' && id!=='r' && id!==null) { + if (id!=='0' && id!==0 && id!=='f' && id!=='s' && id!=='r' && id!=null) { ids.push(id) $(this).addClass('active') diff --git a/src/scripts/photo.js b/src/scripts/photo.js index 46d1d43..46c4fc6 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -659,7 +659,7 @@ photo.getSize = function() { if (photo.json.width>view.width || photo.json.height>view.height) scaled = true // Calculate pixel ratio of screen - if (pixelRatio!==undefined && pixelRatio>1) { + if (pixelRatio!=null && pixelRatio>1) { view.width = view.width * pixelRatio view.height = view.height * pixelRatio } diff --git a/src/scripts/search.js b/src/scripts/search.js index 0aec1aa..b168380 100755 --- a/src/scripts/search.js +++ b/src/scripts/search.js @@ -85,7 +85,7 @@ search.reset = function() { $('#search').val('') $('.no_content').remove() - if (search.hash!==null) { + if (search.hash!=null) { // Trash data albums.json = null diff --git a/src/scripts/upload.js b/src/scripts/upload.js index 75c7fc0..e536a75 100755 --- a/src/scripts/upload.js +++ b/src/scripts/upload.js @@ -88,7 +88,7 @@ upload.start = { if (file.supported===false) { // Skip file - if (file.next!==null) process(files, file.next) + if (file.next!=null) process(files, file.next) else { // Look for supported files @@ -217,7 +217,7 @@ upload.start = { $('.basicModal .rows .row:nth-child(' + (file.num+1) + ') .status').html('Processing') // Upload next file - if (file.next!==null) process(files, file.next) + if (file.next!=null) process(files, file.next) } diff --git a/src/scripts/view.js b/src/scripts/view.js index 01d83bd..537f4ad 100644 --- a/src/scripts/view.js +++ b/src/scripts/view.js @@ -62,7 +62,7 @@ view.albums = { } // Restore scroll position - if (view.albums.content.scrollPosition!==null && view.albums.content.scrollPosition!==0) { + if (view.albums.content.scrollPosition!=null && view.albums.content.scrollPosition!==0) { $(document).scrollTop(view.albums.content.scrollPosition) } diff --git a/src/scripts/view/main.js b/src/scripts/view/main.js index fd09264..c6e8c3e 100644 --- a/src/scripts/view/main.js +++ b/src/scripts/view/main.js @@ -50,7 +50,7 @@ const getPhotoSize = function(photo) { if (photo.json.width>view.width || photo.json.height>view.height) scaled = true // Calculate pixel ratio of screen - if (pixelRatio!==undefined && pixelRatio>1) { + if (pixelRatio!=null && pixelRatio>1) { view.width = view.width * pixelRatio view.height = view.height * pixelRatio } diff --git a/src/scripts/visible.js b/src/scripts/visible.js index 25eed62..3d51d4e 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -21,7 +21,7 @@ visible.photo = function() { } visible.search = function() { - if (search.hash!==null) return true + if (search.hash!=null) return true return false } From 8a940c833a14356736ff7221aecb03c5a73d2ea5 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 13 Jul 2015 14:29:06 +0200 Subject: [PATCH 55/58] Rebuild --- dist/main.js | Bin 181155 -> 181134 bytes dist/view.js | Bin 100410 -> 100406 bytes 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dist/main.js mode change 100644 => 100755 dist/view.js diff --git a/dist/main.js b/dist/main.js old mode 100644 new mode 100755 index b76f1fb2112bc420f79bff295fef864c68bc345e..e4a06248051275f66a55874cc243bb2fc5ae2638 GIT binary patch delta 134 zcmZ47&fV9}-O$3gh3OL0_RCC6w>h@2=VtoND3w>5lcQ*x7i|!$rlye!W@zew1-GB# zWeQ^4F3Zn!o{beE@#brsEWZ8IL8gt206Dxbh5!Hn delta 151 zcmeBc=U&{--O$3gh3OL0_KQqRcR04M;b!{7s8E)lnWA8zXlt7nZ4j%brjZI}XzIYk zw;$qV3SykTGK@)K`pYmTf$h%xObggJ;LA hA5$*d_K2xW3q+>NuVPZ&F0+d1p!oJX2bnf80s!z=Gj;#~ diff --git a/dist/view.js b/dist/view.js old mode 100644 new mode 100755 index 70e3e205ecb8b8c4fcff6d700236acb555db2c34..3d5196dda7ea62ba9418afc9f6567c8b21255041 GIT binary patch delta 29 lcmdlrfo Date: Fri, 17 Jul 2015 09:57:44 +0200 Subject: [PATCH 56/58] Fixed star and share badge --- dist/main.js | Bin 181134 -> 181124 bytes src/scripts/view.js | 12 ++++++------ 2 files changed, 6 insertions(+), 6 deletions(-) mode change 100755 => 100644 dist/main.js diff --git a/dist/main.js b/dist/main.js old mode 100755 new mode 100644 index e4a06248051275f66a55874cc243bb2fc5ae2638..1fe84739a610d4bcea7fe66e8111031bc5c0b0a3 GIT binary patch delta 48 zcmeBc=Wc1|ZfIfL!n9~TW8U;->zPca-&xP3F#Yd(CU2mC&ju!Iu)y|}8nzkx{sNc~vP Date: Fri, 17 Jul 2015 09:58:58 +0200 Subject: [PATCH 57/58] Added date to changelog --- docs/Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 1a4171b..9193c26 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,6 +1,6 @@ ## v3.0.4 -Released July ??, 2015 +Released July 17, 2015 - `Improved` Removed bower and updated basicModal & basicContext - `Improved` Small interface performance improvements From b0300b952a1072a4e23288c1e6addf5d0d551da9 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 17 Jul 2015 10:09:05 +0200 Subject: [PATCH 58/58] Fixed empty entry in photo navigation after moving a photo --- dist/main.js | Bin 181124 -> 181126 bytes src/scripts/photo.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/main.js b/dist/main.js index 1fe84739a610d4bcea7fe66e8111031bc5c0b0a3..15a0ffd9b297c01c90ab829a930e7e08d8fdbe21 100644 GIT binary patch delta 37 scmZo^=Wc7~ZfIfL!t}+CJtZ|KwIo$xx}!6b=yWA>Cgbgn_Ds$#0Qb=h4FCWD delta 30 lcmZo`=Wc1|ZfIfL!t}*%y0bHrD64H=X->{|0ehyh767JE3Qqt4 diff --git a/src/scripts/photo.js b/src/scripts/photo.js index 46c4fc6..4ebdc26 100644 --- a/src/scripts/photo.js +++ b/src/scripts/photo.js @@ -365,7 +365,7 @@ photo.setAlbum = function(photoIDs, albumID) { } - album.json.content[id] = null + delete album.json.content[id] view.album.content.delete(id) })
- thumb - thumb - thumb - - ` + let html = ` +
+ thumb + thumb + thumb +
+

${ data.title }

+ ${ data.sysdate } +
+ ` if (lychee.publicMode===false) { - if (data.star==='1') html += `${ build.iconic('star') }`; - 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==='1') html += `${ build.iconic('lock-locked') }`; + if (data.star==='1') html += `${ build.iconic('star') }` + 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==='1') html += `${ build.iconic('lock-locked') }` } html += '
' - return html; + return html } build.photo = function(data) { - if (data===null||data===undefined) return ''; + if (data==null) return '' - var html = ''; + let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbUrl) - var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbUrl); + let html = ` +
+ thumb +
+

${ data.title }

+ ` - html = ` -
- thumb -
-

${ data.title }

- ` + if (data.cameraDate==='1') html += `${ build.iconic('camera-slr') }${ data.sysdate }` + else html += `${ data.sysdate }` - if (data.cameraDate==='1') html += `${ build.iconic('camera-slr') }${ data.sysdate }`; - else html += `${ data.sysdate }`; - - html += '
'; + html += '
' if (lychee.publicMode===false) { - if (data.star==='1') html += `${ build.iconic('star') }`; - if (data.public==='1'&&album.json.public!=='1') html += ``; + if (data.star==='1') html += `${ build.iconic('star') }` + if (data.public==='1' && album.json.public!=='1') html += `` } - html += '
'; + html += '
' return html @@ -125,127 +95,118 @@ build.photo = function(data) { build.imageview = function(data, size, visibleControls) { - if (data===null||data===undefined) return ''; + if (data==null) return '' - var html = ''; - - html = ` - - - ` + let html = ` + + + ` if (size==='big') { - if (visibleControls===true) - html += `
`; - else - html += `
`; + if (visibleControls===true) html += `
` + else html += `
` } else if (size==='medium') { - if (visibleControls===true) - html += `
`; - else - html += `
`; + if (visibleControls===true) html += `
` + else html += `
` } else if (size==='small') { - if (visibleControls===true) - html += `
`; - else - html += `
`; + if (visibleControls===true) html += `
` + else html += `
` } - return html; + return html } build.no_content = function(typ) { - var html; - - html = ` -
- ${ build.iconic(typ) } - ` + let html = ` +
+ ${ build.iconic(typ) } + ` switch (typ) { - case 'magnifying-glass': html += '

No results

'; - break; - case 'eye': html += '

No public albums

'; - break; - case 'cog': html += '

No configuration

'; - break; - case 'question-mark': html += '

Photo not found

'; - break; + case 'magnifying-glass': + html += '

No results

' + break + case 'eye': + html += '

No public albums

' + break + case 'cog': + html += '

No configuration

' + break + case 'question-mark': + html += '

Photo not found

' + break } - html += '
'; + html += '
' - return html; + return html } build.uploadModal = function(title, files) { - var html = '', - i = 0, - file = null; + let html = ` +

${ title }

+
+ ` - html = ` -

${ title }

-
- ` + let i = 0 while (i40) file.name = file.name.substr(0, 17) + '...' + file.name.substr(file.name.length-20, 20); + if (file.name.length>40) file.name = file.name.substr(0, 17) + '...' + file.name.substr(file.name.length-20, 20) - html += ` -
- ${ lychee.escapeHTML(file.name) } - ` + html += ` +
+ ${ lychee.escapeHTML(file.name) } + ` - if (file.supported===true) html += ``; - else html += `Not supported`; + if (file.supported===true) html += `` + else html += `Not supported` - html += ` -

-
- ` + html += ` +

+
+ ` - i++; + i++ } - html += '
'; + html += '
' - return html; + return html } build.tags = function(tags) { - var html = '', - editTagsHTML = ''; + let html = '' if (tags!=='') { - tags = tags.split(','); + tags = tags.split(',') tags.forEach(function(tag, index, array) { html += `${ tag }${ build.iconic('x') }` - }); + }) } else { - html = `
No Tags
`; + html = `
No Tags
` } - return html; + return html } \ No newline at end of file From 0d583ea34144270053b7006d29cf57e89cdba48b Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jul 2015 14:39:09 +0200 Subject: [PATCH 37/58] Updated contextMenu.js (ES2015) --- dist/main.js | Bin 179680 -> 179967 bytes src/scripts/contextMenu.js | 268 ++++++++++++++++++------------------- 2 files changed, 130 insertions(+), 138 deletions(-) diff --git a/dist/main.js b/dist/main.js index e9c3526864b2f98ea30a62dc730d5655f0217d8e..5161103574d1037f85f380ea40f35904554ba65b 100644 GIT binary patch delta 1067 zcmchWPe_w-7{~c;k}#%D5}hT?z17%gylUB{<;YuPyF`T`i{|#~R@?i^_D(3L{W(M@ z!P7$+L>IeS6mJ(vXjrB69W)({Xdh`%&)RaKu9*5kDCsP7P>&lNF zY~X-dCRPlHLGCbfqRST;cQTH0E#NcvaTbd}GYPa)df@1Gb)Gz8U>;UOrfQ&3RNr9x=)8#UL@O>^zgp+iJes1dfa;>Q}@Uf$<<;Q9T3&*~p8@|$aa zju$;N_8nRJbPp;M=-X!;Bx?|7s3V9*eJO}Lpsrqo^_D&;pv8W;IGfAvb4za7(?~Z% z5U8&gx%6lNon#$^pCV^XN#vM8;dxDpwR+8FO;UaCvLj}*kT1zLhf`QDi48v0!4ypu zn5C`N=E>DcnN#tKN-57 zPNjhfWP6J|%6STodis$>Unj8F;NMSAhOv+ChfzWw2BOu~VWe)7W_o1i^QgJ&R9k>) za0Ue_aUg6HBvoXRLsOZ2on0^p45|`?DL->N5{pO5jvqAmHlnn&QPT)=pi;*O__eJg zBe+QAqo^htMH3~D;Swohc&8tKk0k7Ac4|zMyfUj{HV?IjP(ZEYI7Hp!a8XJKb<`5V z098)lH6>2sb^>p;ttn9G%_R6VW&6GgEluJm)vX{^ub9FKQ2R7)5N7ZxJI?k0H77?s z#>8%wo%XM6dN7Nkg0S0qDITJU^)w<6SQ+KnnKeYYH4^b8c*Rou29!J z{CfIF9dza`aa}a2g3# bj(hnF-EE}FrXBjj7E@#FPv^X*pXdGp6k$=E diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index 7648ecc..255f9ea 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -7,37 +7,37 @@ contextMenu = {} contextMenu.add = function(e) { - var items = [ - { type: 'item', title: build.iconic('image') + 'Upload Photo', fn: function() { $('#upload_files').click() } }, + let items = [ + { type: 'item', title: build.iconic('image') + 'Upload Photo', fn: () => $('#upload_files').click() }, { type: 'separator' }, { type: 'item', title: build.iconic('link-intact') + 'Import from Link', fn: upload.start.url }, { type: 'item', title: build.iconic('dropbox', 'ionicons') + 'Import from Dropbox', fn: upload.start.dropbox }, { type: 'item', title: build.iconic('terminal') + 'Import from Server', fn: upload.start.server }, { type: 'separator' }, { type: 'item', title: build.iconic('folder') + 'New Album', fn: album.add } - ]; + ] - basicContext.show(items, e.originalEvent); + basicContext.show(items, e.originalEvent) - upload.notify(); + upload.notify() } contextMenu.settings = function(e) { - var items = [ + let items = [ { type: 'item', title: build.iconic('person') + 'Change Login', fn: settings.setLogin }, { type: 'item', title: build.iconic('sort-ascending') + 'Change Sorting', fn: settings.setSorting }, { type: 'item', title: build.iconic('dropbox', 'ionicons') + 'Set Dropbox', fn: settings.setDropboxKey }, { type: 'separator' }, - { type: 'item', title: build.iconic('info') + 'About Lychee', fn: function() { window.open(lychee.website) } }, - { type: 'item', title: build.iconic('wrench') + 'Diagnostics', fn: function() { window.open('plugins/check/') } }, - { type: 'item', title: build.iconic('align-left') + 'Show Log', fn: function() { window.open('plugins/displaylog/') } }, + { type: 'item', title: build.iconic('info') + 'About Lychee', fn: () => window.open(lychee.website) }, + { type: 'item', title: build.iconic('wrench') + 'Diagnostics', fn: () => window.open('plugins/check/') }, + { type: 'item', title: build.iconic('align-left') + 'Show Log', fn: () => window.open('plugins/displaylog/') }, { type: 'separator' }, { type: 'item', title: build.iconic('account-logout') + 'Sign Out', fn: lychee.logout } - ]; + ] - basicContext.show(items, e.originalEvent); + basicContext.show(items, e.originalEvent) } @@ -47,107 +47,103 @@ contextMenu.album = function(albumID, e) { // fn must call basicContext.close() first, // in order to keep the selection - if (albumID==='0'||albumID==='f'||albumID==='s'||albumID==='r') return false; + if (albumID==='0' || albumID==='f' || albumID==='s' || albumID==='r') return false // Show merge-item when there's more than one album - var showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1); + let showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1) - var items = [ - { type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } }, - { type: 'item', title: build.iconic('collapse-left') + 'Merge', visible: showMerge, fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumID, e) } }, - { type: 'item', title: build.iconic('trash') + 'Delete', fn: function() { album.delete([albumID]) } } - ]; + let items = [ + { type: 'item', title: build.iconic('pencil') + 'Rename', fn: () => album.setTitle([albumID]) }, + { type: 'item', title: build.iconic('collapse-left') + 'Merge', visible: showMerge, fn: () => { basicContext.close(); contextMenu.mergeAlbum(albumID, e) } }, + { type: 'item', title: build.iconic('trash') + 'Delete', fn: () => album.delete([albumID]) } + ] - $('.album[data-id="' + albumID + '"]').addClass('active'); + $('.album[data-id="' + albumID + '"]').addClass('active') - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) } contextMenu.albumMulti = function(albumIDs, e) { - multiselect.stopResize(); + multiselect.stopResize() // Automatically merge selected albums when albumIDs contains more than one album // Show list of albums otherwise - var autoMerge = (albumIDs.length>1 ? true : false); + let autoMerge = (albumIDs.length>1 ? true : false) // Show merge-item when there's more than one album - var showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1); + let showMerge = (albums.json && albums.json.albums && Object.keys(albums.json.albums).length>1) - var items = [ - { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { album.setTitle(albumIDs) } }, - { type: 'item', title: build.iconic('collapse-left') + 'Merge All', visible: showMerge && autoMerge, fn: function () { album.merge(albumIDs) } }, - { type: 'item', title: build.iconic('collapse-left') + 'Merge', visible: showMerge && !autoMerge, fn: function () { basicContext.close(); contextMenu.mergeAlbum(albumIDs[0], e) } }, - { type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { album.delete(albumIDs) } } - ]; + let items = [ + { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: () => album.setTitle(albumIDs) }, + { type: 'item', title: build.iconic('collapse-left') + 'Merge All', visible: showMerge && autoMerge, fn: () => album.merge(albumIDs) }, + { type: 'item', title: build.iconic('collapse-left') + 'Merge', visible: showMerge && !autoMerge, fn: () => { basicContext.close(); contextMenu.mergeAlbum(albumIDs[0], e) } }, + { type: 'item', title: build.iconic('trash') + 'Delete All', fn: () => album.delete(albumIDs) } + ] - items.push(); + items.push() - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) } contextMenu.albumTitle = function(albumID, e) { - var items = []; - api.post('Album::getAll', {}, function(data) { - if (data.albums&&data.num>1) { + let items = [] + + if (data.albums && data.num>1) { // Generate list of albums - $.each(data.albums, function(index) { + $.each(data.albums, function() { - var that = this, - title = ''; + if (!this.thumbs[0]) this.thumbs[0] = 'src/images/no_cover.svg' - if (!that.thumbs[0]) that.thumbs[0] = 'src/images/no_cover.svg'; + let title = `
${ this.title }
` - title = "
" + that.title + "
"; + if (this.id!=albumID) items.push({ type: 'item', title, fn: () => lychee.goto(this.id) }) - if (that.id!=albumID) items.push({ type: 'item', title, fn: function() { lychee.goto(that.id) } }); + }) - }); - - items.unshift({ type: 'separator' }); + items.unshift({ type: 'separator' }) } - items.unshift({ type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { album.setTitle([albumID]) } }); + items.unshift({ type: 'item', title: build.iconic('pencil') + 'Rename', fn: () => album.setTitle([albumID]) }) - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) - }); + }) } contextMenu.mergeAlbum = function(albumID, e) { - var items = []; - api.post('Album::getAll', {}, function(data) { - if (data.albums&&data.num>1) { + let items = [] - $.each(data.albums, function(){ + if (data.albums && data.num>1) { - var that = this; + $.each(data.albums, function() { - if (!that.thumbs[0]) that.thumbs[0] = 'src/images/no_cover.svg'; - that.contextTitle = "
" + that.title + "
"; + if (!this.thumbs[0]) this.thumbs[0] = 'src/images/no_cover.svg' - if (that.id!=albumID) items.push({ type: 'item', title: that.contextTitle, fn: function() { album.merge([albumID, that.id]) } }); + let title = `
${ this.title }
` - }); + if (this.id!=albumID) items.push({ type: 'item', title, fn: () => album.merge([albumID, this.id]) }) + + }) } - if (items.length===0) return false; + if (items.length===0) return false - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) - }); + }) } @@ -157,19 +153,19 @@ contextMenu.photo = function(photoID, e) { // fn must call basicContext.close() first, // in order to keep the selection - var items = [ - { type: 'item', title: build.iconic('star') + 'Star', fn: function() { photo.setStar([photoID]) } }, - { type: 'item', title: build.iconic('tag') + 'Tags', fn: function() { photo.editTags([photoID]) } }, + let items = [ + { type: 'item', title: build.iconic('star') + 'Star', fn: () => photo.setStar([photoID]) }, + { type: 'item', title: build.iconic('tag') + 'Tags', fn: () => photo.editTags([photoID]) }, { type: 'separator' }, - { type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { photo.setTitle([photoID]) } }, - { type: 'item', title: build.iconic('layers') + 'Duplicate', fn: function() { photo.duplicate([photoID]) } }, - { type: 'item', title: build.iconic('folder') + 'Move', fn: function() { basicContext.close(); contextMenu.move([photoID], e); } }, - { type: 'item', title: build.iconic('trash') + 'Delete', fn: function() { photo.delete([photoID]) } } - ]; + { type: 'item', title: build.iconic('pencil') + 'Rename', fn: () => photo.setTitle([photoID]) }, + { type: 'item', title: build.iconic('layers') + 'Duplicate', fn: () => photo.duplicate([photoID]) }, + { type: 'item', title: build.iconic('folder') + 'Move', fn: () => { basicContext.close(); contextMenu.move([photoID], e) } }, + { type: 'item', title: build.iconic('trash') + 'Delete', fn: () => photo.delete([photoID]) } + ] - $('.photo[data-id="' + photoID + '"]').addClass('active'); + $('.photo[data-id="' + photoID + '"]').addClass('active') - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) } @@ -179,49 +175,46 @@ contextMenu.photoMulti = function(photoIDs, e) { // fn must call basicContext.close() first, // in order to keep the selection and multiselect - multiselect.stopResize(); + multiselect.stopResize() - var items = [ - { type: 'item', title: build.iconic('star') + 'Star All', fn: function() { photo.setStar(photoIDs) } }, - { type: 'item', title: build.iconic('tag') + 'Tag All', fn: function() { photo.editTags(photoIDs) } }, + let items = [ + { type: 'item', title: build.iconic('star') + 'Star All', fn: () => photo.setStar(photoIDs) }, + { type: 'item', title: build.iconic('tag') + 'Tag All', fn: () => photo.editTags(photoIDs) }, { type: 'separator' }, - { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: function() { photo.setTitle(photoIDs) } }, - { type: 'item', title: build.iconic('layers') + 'Duplicate All', fn: function() { photo.duplicate(photoIDs) } }, - { type: 'item', title: build.iconic('folder') + 'Move All', fn: function() { basicContext.close(); contextMenu.move(photoIDs, e); } }, - { type: 'item', title: build.iconic('trash') + 'Delete All', fn: function() { photo.delete(photoIDs) } } - ]; + { type: 'item', title: build.iconic('pencil') + 'Rename All', fn: () => photo.setTitle(photoIDs) }, + { type: 'item', title: build.iconic('layers') + 'Duplicate All', fn: () => photo.duplicate(photoIDs) }, + { type: 'item', title: build.iconic('folder') + 'Move All', fn: () => { basicContext.close(); contextMenu.move(photoIDs, e) } }, + { type: 'item', title: build.iconic('trash') + 'Delete All', fn: () => photo.delete(photoIDs) } + ] - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) } contextMenu.photoTitle = function(albumID, photoID, e) { - var items = [ - { type: 'item', title: build.iconic('pencil') + 'Rename', fn: function() { photo.setTitle([photoID]) } } - ]; + let items = [ + { type: 'item', title: build.iconic('pencil') + 'Rename', fn: () => photo.setTitle([photoID]) } + ] - var data = album.json; + let data = album.json - if (data.content!==false&&data.num>1) { + if (data.content!==false && data.num>1) { - items.push({ type: 'separator' }); + items.push({ type: 'separator' }) // Generate list of albums $.each(data.content, function(index) { - var that = this, - title = ''; + let title = `
${ this.title }
` - title = "
" + that.title + "
"; + if (this.id!=photoID) items.push({ type: 'item', title, fn: () => lychee.goto(albumID + '/' + this.id) }) - if (that.id!=photoID) items.push({ type: 'item', title, fn: function() { lychee.goto(albumID + '/' + that.id) } }); - - }); + }) } - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) } @@ -230,20 +223,20 @@ contextMenu.photoMore = function(photoID, e) { // Show download-item when // a) Public mode is off // b) Downloadable is 1 and public mode is on - var showDownload = lychee.publicMode===false || ((album.json && album.json.downloadable && album.json.downloadable==='1') && lychee.publicMode===true); + let showDownload = lychee.publicMode===false || ((album.json && album.json.downloadable && album.json.downloadable==='1') && lychee.publicMode===true) - var items = [ - { type: 'item', title: build.iconic('fullscreen-enter') + 'Full Photo', fn: function() { window.open(photo.getDirectLink()) } }, - { type: 'item', title: build.iconic('cloud-download') + 'Download', visible: showDownload, fn: function() { photo.getArchive(photoID) } } - ]; + let items = [ + { type: 'item', title: build.iconic('fullscreen-enter') + 'Full Photo', fn: () => window.open(photo.getDirectLink()) }, + { type: 'item', title: build.iconic('cloud-download') + 'Download', visible: showDownload, fn: () => photo.getArchive(photoID) } + ] - basicContext.show(items, e.originalEvent); + basicContext.show(items, e.originalEvent) } contextMenu.move = function(photoIDs, e) { - var items = []; + var items = [] api.post('Album::getAll', {}, function(data) { @@ -252,89 +245,88 @@ contextMenu.move = function(photoIDs, e) { // Show only 'Add album' when no album available items = [ { type: 'item', title: 'New Album', fn: album.add } - ]; + ] } else { // Generate list of albums - $.each(data.albums, function(index) { + $.each(data.albums, function() { - var that = this; + if (!this.thumbs[0]) this.thumbs[0] = 'src/images/no_cover.svg' - if (!that.thumbs[0]) that.thumbs[0] = 'src/images/no_cover.svg'; - that.title = "
" + that.title + "
"; + let title = `
${ this.title }
` - if (that.id!=album.getID()) items.push({ type: 'item', title: that.title, fn: function() { photo.setAlbum(photoIDs, that.id) } }); + if (this.id!=album.getID()) items.push({ type: 'item', title, fn: () => photo.setAlbum(photoIDs, this.id) }) - }); + }) // Show Unsorted when unsorted is not the current album if (album.getID()!=='0') { - items.unshift({ type: 'separator' }); - items.unshift({ type: 'item', title: 'Unsorted', fn: function() { photo.setAlbum(photoIDs, 0) } }); + items.unshift({ type: 'separator' }) + items.unshift({ type: 'item', title: 'Unsorted', fn: () => photo.setAlbum(photoIDs, 0) }) } } - basicContext.show(items, e.originalEvent, contextMenu.close); + basicContext.show(items, e.originalEvent, contextMenu.close) - }); + }) } contextMenu.sharePhoto = function(photoID, e) { - var link = photo.getViewLink(photoID), - iconClass = 'ionicons'; + let link = photo.getViewLink(photoID), + iconClass = 'ionicons' - if (photo.json.public==='2') link = location.href; + if (photo.json.public==='2') link = location.href - var items = [ - { type: 'item', title: '', fn: function() {}, class: 'noHover' }, + let items = [ + { type: 'item', title: ``, fn: () => {}, class: 'noHover' }, { type: 'separator' }, - { type: 'item', title: build.iconic('twitter', iconClass) + 'Twitter', fn: function() { photo.share(photoID, 0) } }, - { type: 'item', title: build.iconic('facebook', iconClass) + 'Facebook', fn: function() { photo.share(photoID, 1) } }, - { type: 'item', title: build.iconic('envelope-closed') + 'Mail', fn: function() { photo.share(photoID, 2) } }, - { type: 'item', title: build.iconic('dropbox', iconClass) + 'Dropbox', fn: function() { photo.share(photoID, 3) } }, - { type: 'item', title: build.iconic('link-intact') + 'Direct Link', fn: function() { window.open(photo.getDirectLink()) } }, + { type: 'item', title: build.iconic('twitter', iconClass) + 'Twitter', fn: () => photo.share(photoID, 0) }, + { type: 'item', title: build.iconic('facebook', iconClass) + 'Facebook', fn: () => photo.share(photoID, 1) }, + { type: 'item', title: build.iconic('envelope-closed') + 'Mail', fn: () => photo.share(photoID, 2) }, + { type: 'item', title: build.iconic('dropbox', iconClass) + 'Dropbox', fn: () => photo.share(photoID, 3) }, + { type: 'item', title: build.iconic('link-intact') + 'Direct Link', fn: () => window.open(photo.getDirectLink()) }, { type: 'separator' }, - { type: 'item', title: build.iconic('ban') + 'Make Private', fn: function() { photo.setPublic(photoID) } } - ]; + { type: 'item', title: build.iconic('ban') + 'Make Private', fn: () => photo.setPublic(photoID) } + ] - basicContext.show(items, e.originalEvent); - $('.basicContext input#link').focus().select(); + basicContext.show(items, e.originalEvent) + $('.basicContext input#link').focus().select() } contextMenu.shareAlbum = function(albumID, e) { - var iconClass = 'ionicons'; + let iconClass = 'ionicons' - var items = [ - { type: 'item', title: '', fn: function() {}, class: 'noHover' }, + let items = [ + { type: 'item', title: ``, fn: () => {}, class: 'noHover' }, { type: 'separator' }, - { type: 'item', title: build.iconic('twitter', iconClass) + 'Twitter', fn: function() { album.share('twitter') } }, - { type: 'item', title: build.iconic('facebook', iconClass) + 'Facebook', fn: function() { album.share('facebook') } }, - { type: 'item', title: build.iconic('envelope-closed') + 'Mail', fn: function() { album.share('mail') } }, + { type: 'item', title: build.iconic('twitter', iconClass) + 'Twitter', fn: () => album.share('twitter') }, + { type: 'item', title: build.iconic('facebook', iconClass) + 'Facebook', fn: () => album.share('facebook') }, + { type: 'item', title: build.iconic('envelope-closed') + 'Mail', fn: () => album.share('mail') }, { type: 'separator' }, - { type: 'item', title: build.iconic('pencil') + 'Edit Sharing', fn: function() { album.setPublic(albumID, true, e) } }, - { type: 'item', title: build.iconic('ban') + 'Make Private', fn: function() { album.setPublic(albumID, false) } } - ]; + { type: 'item', title: build.iconic('pencil') + 'Edit Sharing', fn: () => album.setPublic(albumID, true, e) }, + { type: 'item', title: build.iconic('ban') + 'Make Private', fn: () => album.setPublic(albumID, false) } + ] - basicContext.show(items, e.originalEvent); - $('.basicContext input#link').focus().select(); + basicContext.show(items, e.originalEvent) + $('.basicContext input#link').focus().select() } contextMenu.close = function() { - if (!visible.contextMenu()) return false; + if (!visible.contextMenu()) return false - basicContext.close(); + basicContext.close() - $('.photo.active, .album.active').removeClass('active'); - if (visible.multiselect()) multiselect.close(); + $('.photo.active, .album.active').removeClass('active') + if (visible.multiselect()) multiselect.close() } \ No newline at end of file From 595e40549ac0b86da67fba562fc5efaeb05274a8 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jul 2015 14:47:56 +0200 Subject: [PATCH 38/58] Updated main.js (ES2015) --- dist/main.js | Bin 179967 -> 179941 bytes dist/view.js | Bin 100183 -> 100159 bytes src/scripts/header.js | 164 +++++++++++++++++++++--------------------- 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/dist/main.js b/dist/main.js index 5161103574d1037f85f380ea40f35904554ba65b..21ffdb2cb2e869ebad21ec45b556735fd4d35f47 100644 GIT binary patch delta 166 zcmV;X09pV4{R-v%3V^f$lj4^Oasm*yu;Kw;2$w#u0R{mfmn)_L84Gi1WMyJuawsW$ ze3!xD0Tmd0e0FJbX<}?;E^TFVb75y?C@DW7F*+!h+35i&m%i%(FPEa}0W1MKm+k8T zke8S00UDQ=>;V`7DYv-n0oVr_eJL(tX>MdFB6K1wW_503bZKvHC}k;o3b(8D0q}g6 UZ)E}pm!ok48vzQpzHtIUO@;V@GXk}?j8fOZkKNC0Wp__@BtOKtn2~I2Ms$43VkUqVrgzJ?<VFId{gsEk%e2uIkwxIVi~hIA~Vx8$})>HlX6n^3NrFb@-;No z)D&SN#hEFoNr^=$V#)b=C8-r9zNvYoDB`)P#l?x~sT!J^)n$oA3VG8Pq%mqt-;lzn zKRqW6NSsJxoWPu?X*Jy-ol$&xQ97f<^nz?g(e2aI887lPa!t=DXOy45sgzN3`^Iv{ GK7Ihly+CLH diff --git a/src/scripts/header.js b/src/scripts/header.js index 213150c..4ff9d63 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -11,174 +11,174 @@ header = { header.dom = function(selector) { - if (selector===undefined||selector===null||selector==='') return header._dom; - return header._dom.find(selector); + if (selector==null || selector==='') return header._dom + return header._dom.find(selector) } header.bind = function() { // Event Name - var eventName = lychee.getEventName(); + let eventName = lychee.getEventName() /* Buttons */ header.dom('#title').on(eventName, function(e) { - if (!$(this).hasClass('editable')) return false; - if (visible.photo()) contextMenu.photoTitle(album.getID(), photo.getID(), e); - else contextMenu.albumTitle(album.getID(), e); - }); + if (!$(this).hasClass('editable')) return false + if (visible.photo()) contextMenu.photoTitle(album.getID(), photo.getID(), e) + else contextMenu.albumTitle(album.getID(), e) + }) header.dom('#button_share').on(eventName, function(e) { - if (photo.json.public==='1'||photo.json.public==='2') contextMenu.sharePhoto(photo.getID(), e); - else photo.setPublic(photo.getID(), e); - }); + if (photo.json.public==='1' || photo.json.public==='2') contextMenu.sharePhoto(photo.getID(), e) + else photo.setPublic(photo.getID(), e) + }) header.dom('#button_share_album').on(eventName, function(e) { - if (album.json.public==='1') contextMenu.shareAlbum(album.getID(), e); - else album.setPublic(album.getID(), true, e); - }); - header.dom('#button_signin') .on(eventName, lychee.loginDialog); - header.dom('#button_settings') .on(eventName, contextMenu.settings); - header.dom('#button_info_album') .on(eventName, sidebar.toggle); - header.dom('#button_info') .on(eventName, sidebar.toggle); - header.dom('.button_add') .on(eventName, contextMenu.add); - header.dom('#button_more') .on(eventName, function(e) { contextMenu.photoMore(photo.getID(), e) }); - header.dom('#button_move') .on(eventName, function(e) { contextMenu.move([photo.getID()], e) }); - header.dom('#hostedwith') .on(eventName, function() { window.open(lychee.website) }); - header.dom('#button_trash_album') .on(eventName, function() { album.delete([album.getID()]) }); - header.dom('#button_trash') .on(eventName, function() { photo.delete([photo.getID()]) }); - header.dom('#button_archive') .on(eventName, function() { album.getArchive(album.getID()) }); - header.dom('#button_star') .on(eventName, function() { photo.setStar([photo.getID()]) }); - header.dom('#button_back_home') .on(eventName, function() { lychee.goto('') }); - header.dom('#button_back') .on(eventName, function() { lychee.goto(album.getID()) }); + if (album.json.public==='1') contextMenu.shareAlbum(album.getID(), e) + else album.setPublic(album.getID(), true, e) + }) + header.dom('#button_signin') .on(eventName, lychee.loginDialog) + header.dom('#button_settings') .on(eventName, contextMenu.settings) + header.dom('#button_info_album') .on(eventName, sidebar.toggle) + header.dom('#button_info') .on(eventName, sidebar.toggle) + header.dom('.button_add') .on(eventName, contextMenu.add) + header.dom('#button_more') .on(eventName, function(e) { contextMenu.photoMore(photo.getID(), e) }) + header.dom('#button_move') .on(eventName, function(e) { contextMenu.move([photo.getID()], e) }) + header.dom('#hostedwith') .on(eventName, function() { window.open(lychee.website) }) + header.dom('#button_trash_album') .on(eventName, function() { album.delete([album.getID()]) }) + header.dom('#button_trash') .on(eventName, function() { photo.delete([photo.getID()]) }) + header.dom('#button_archive') .on(eventName, function() { album.getArchive(album.getID()) }) + header.dom('#button_star') .on(eventName, function() { photo.setStar([photo.getID()]) }) + header.dom('#button_back_home') .on(eventName, function() { lychee.goto('') }) + header.dom('#button_back') .on(eventName, function() { lychee.goto(album.getID()) }) /* Search */ - header.dom('#search').on('keyup click', function() { search.find($(this).val()) }); + header.dom('#search').on('keyup click', function() { search.find($(this).val()) }) header.dom('#clearSearch').on(eventName, function () { - header.dom('#search').focus(); - search.reset(); - }); + header.dom('#search').focus() + search.reset() + }) - return true; + return true } header.show = function() { - var newMargin = -1*($('#imageview #image').height()/2)+20; + let newMargin = (-1 * ($('#imageview #image').height()/2) + 20) - clearTimeout($(window).data('timeout')); + clearTimeout($(window).data('timeout')) - lychee.imageview.removeClass('full'); - header.dom().removeClass('hidden'); + lychee.imageview.removeClass('full') + header.dom().removeClass('hidden') // Adjust position or size of photo - if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin); - else $('#imageview #image').removeClass('full'); + if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin) + else $('#imageview #image').removeClass('full') - return true; + return true } header.hide = function(e, delay = 500) { - if (visible.photo()&&!visible.sidebar()&&!visible.contextMenu()&&!visible.message()) { + if (visible.photo() && !visible.sidebar() && !visible.contextMenu() && !visible.message()) { - var newMargin = -1*($('#imageview #image').height()/2); - - clearTimeout($(window).data('timeout')); + clearTimeout($(window).data('timeout')) $(window).data('timeout', setTimeout(function() { - lychee.imageview.addClass('full'); - header.dom().addClass('hidden'); + let newMargin = (-1 * ($('#imageview #image').height()/2)) + + lychee.imageview.addClass('full') + header.dom().addClass('hidden') // Adjust position or size of photo - if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin); - else $('#imageview #image').addClass('full'); + if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin) + else $('#imageview #image').addClass('full') - }, delay)); + }, delay)) - return true; + return true } - return false; + return false } header.setTitle = function(title = 'Untitled') { - var $title = header.dom('#title'); + let $title = header.dom('#title') - $title.html(title + build.iconic('caret-bottom')); + $title.html(title + build.iconic('caret-bottom')) - return true; + return true } header.setMode = function(mode) { - var albumID = album.getID(); + let albumID = album.getID() switch (mode) { case 'albums': - header.dom().removeClass('view'); - $('#tools_album, #tools_photo').hide(); - $('#tools_albums').show(); + header.dom().removeClass('view') + $('#tools_album, #tools_photo').hide() + $('#tools_albums').show() - return true; - break; + return true + break case 'album': - header.dom().removeClass('view'); - $('#tools_albums, #tools_photo').hide(); - $('#tools_album').show(); + header.dom().removeClass('view') + $('#tools_albums, #tools_photo').hide() + $('#tools_album').show() // Hide download button when album empty - album.json.content === false ? $('#button_archive').hide() : $('#button_archive').show(); + album.json.content === false ? $('#button_archive').hide() : $('#button_archive').show() // Hide download button when not logged in and album not downloadable - if (lychee.publicMode===true&&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(); + if (albumID==='s' || albumID==='f' || albumID==='r') { + $('#button_info_album, #button_trash_album, #button_share_album').hide() } else if (albumID==='0') { - $('#button_info_album, #button_share_album').hide(); - $('#button_trash_album').show(); + $('#button_info_album, #button_share_album').hide() + $('#button_trash_album').show() } else { - $('#button_info_album, #button_trash_album, #button_share_album').show(); + $('#button_info_album, #button_trash_album, #button_share_album').show() } - return true; - break; + return true + break case 'photo': - header.dom().addClass('view'); - $('#tools_albums, #tools_album').hide(); - $('#tools_photo').show(); + header.dom().addClass('view') + $('#tools_albums, #tools_album').hide() + $('#tools_photo').show() - return true; - break; + return true + break } - return false; + return false } header.setEditable = function(editable) { - var $title = header.dom('#title'); + let $title = header.dom('#title') // Hide editable icon when not logged in - if (lychee.publicMode===true) editable = false; + if (lychee.publicMode===true) editable = false - if (editable) $title.addClass('editable'); - else $title.removeClass('editable'); + if (editable) $title.addClass('editable') + else $title.removeClass('editable') - return true; + return true } \ No newline at end of file From 63b2a2412d4ec21f00b0f220e12c1554c07a8b85 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jul 2015 14:52:38 +0200 Subject: [PATCH 39/58] Updated loadingBar.js (ES2015) --- dist/main.js | Bin 179941 -> 179942 bytes src/scripts/contextMenu.js | 4 +-- src/scripts/header.js | 4 +-- src/scripts/loadingBar.js | 58 +++++++++++++++++-------------------- 4 files changed, 31 insertions(+), 35 deletions(-) mode change 100644 => 100755 dist/main.js diff --git a/dist/main.js b/dist/main.js old mode 100644 new mode 100755 index 21ffdb2cb2e869ebad21ec45b556735fd4d35f47..6fe25b764d1cd89092ea1703adf74e43b98985dd GIT binary patch delta 49 zcmaF*m+RSIu7)j)NB&O#P{<^({o!B6dyLaR=rgfTH(Sdnu>JghMrI~3fBPjyCgHsR Db*L6U delta 41 zcmV+^0M`HJ{R-v%3V^f$#Ql?s(h3KBd~S7YY(2Ng{Q>F$x4HiT69Tu>0Rj`f%{CMY diff --git a/src/scripts/contextMenu.js b/src/scripts/contextMenu.js index 255f9ea..305456f 100644 --- a/src/scripts/contextMenu.js +++ b/src/scripts/contextMenu.js @@ -1,6 +1,6 @@ /** - * @description This module is used for the context menu. - * @copyright 2015 by Tobias Reich + * @description This module is used for the context menu. + * @copyright 2015 by Tobias Reich */ contextMenu = {} diff --git a/src/scripts/header.js b/src/scripts/header.js index 4ff9d63..e411b30 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -1,6 +1,6 @@ /** - * @description This module takes care of the header. - * @copyright 2015 by Tobias Reich + * @description This module takes care of the header. + * @copyright 2015 by Tobias Reich */ header = { diff --git a/src/scripts/loadingBar.js b/src/scripts/loadingBar.js index 5453996..83d42d5 100755 --- a/src/scripts/loadingBar.js +++ b/src/scripts/loadingBar.js @@ -1,19 +1,19 @@ /** - * @description This module is used to show and hide the loading bar. - * @copyright 2015 by Tobias Reich + * @description This module is used to show and hide the loading bar. + * @copyright 2015 by Tobias Reich */ loadingBar = { - status: null, - _dom: $('#loading') + status : null, + _dom : $('#loading') } loadingBar.dom = function(selector) { - if (selector===undefined||selector===null||selector==='') return loadingBar._dom; - return loadingBar._dom.find(selector); + if (selector==null || selector==='') return loadingBar._dom + return loadingBar._dom.find(selector) } @@ -22,56 +22,52 @@ loadingBar.show = function(status, errorText) { if (status==='error') { // Set status - loadingBar.status = 'error'; + loadingBar.status = 'error' // Parse text - if (errorText) errorText = errorText.replace('
', ''); - if (!errorText) errorText = 'Whoops, it looks like something went wrong. Please reload the site and try again!'; + if (errorText) errorText = errorText.replace('
', '') + if (!errorText) errorText = 'Whoops, it looks like something went wrong. Please reload the site and try again!' // Move header down - if (visible.header()) header.dom().addClass('error'); + if (visible.header()) header.dom().addClass('error') // Modify loading loadingBar.dom() .removeClass('loading uploading error') - .html('

Error: ' + errorText + '

') + .html(`

Error: ${ errorText }

`) .addClass(status) - .show(); + .show() // Set timeout - clearTimeout(loadingBar._timeout); - loadingBar._timeout = setTimeout(function() { + clearTimeout(loadingBar._timeout) + loadingBar._timeout = setTimeout(() => loadingBar.hide(true), 3000) - loadingBar.hide(true) - - }, 3000); - - return true; + return true } if (loadingBar.status===null) { // Set status - loadingBar.status = 'loading'; + loadingBar.status = 'loading' // Set timeout - clearTimeout(loadingBar._timeout); - loadingBar._timeout = setTimeout(function() { + clearTimeout(loadingBar._timeout) + loadingBar._timeout = setTimeout(() => { // Move header down - if (visible.header()) header.dom().addClass('loading'); + if (visible.header()) header.dom().addClass('loading') // Modify loading loadingBar.dom() .removeClass('loading uploading error') .html('') .addClass('loading') - .show(); + .show() - }, 1000); + }, 1000) - return true; + return true } @@ -79,17 +75,17 @@ loadingBar.show = function(status, errorText) { loadingBar.hide = function(force) { - if ((loadingBar.status!=='error'&&loadingBar.status!==null)||force) { + if ((loadingBar.status!=='error' && loadingBar.status!==null) || force) { // Remove status - loadingBar.status = null; + loadingBar.status = null // Move header up - header.dom().removeClass('error loading'); + header.dom().removeClass('error loading') // Set timeout - clearTimeout(loadingBar._timeout); - setTimeout(function() { loadingBar.dom().hide() }, 300); + clearTimeout(loadingBar._timeout) + setTimeout(() => loadingBar.dom().hide(), 300) } From 710aa2bf5281fd22e2d915f8cb30ab9965cae06c Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 11 Jul 2015 16:17:28 +0200 Subject: [PATCH 40/58] Updated lychee.js (ES2015) --- dist/main.js | Bin 179942 -> 179990 bytes src/scripts/lychee.js | 324 ++++++++++++++++++++---------------------- 2 files changed, 158 insertions(+), 166 deletions(-) mode change 100755 => 100644 dist/main.js diff --git a/dist/main.js b/dist/main.js old mode 100755 new mode 100644 index 6fe25b764d1cd89092ea1703adf74e43b98985dd..c0e5848ee1deb17815731422535d07a3b79d7940 GIT binary patch delta 311 zcmaF%muuQTu7(!IElhKnr_X0*l4G>qzK@w{DU+9Ns$OYvYEfQdZmLcmkW-LYTwI=C zl%kVwTMd%1D$#)nS>@GQCl+Mt733F}Xeb4z78hsc=UG|hUV2G}oq?K~#`JHTOgfAu)0MfHj2LUThjTGW Yq%(3&cW7snoZeB$B(r^KA(Nvo0AxO2RsaA1 delta 257 zcmbRCkL%fAu7(!IElhKn8Lg+!VP=wN)Y-m=nQ1B0^a-I%tkeI*F^P$l*jASorxsb| z=@cXu7nkQ3rC8P(-&#w5j9GJQ20lQUPIW^Hm}Npglp$@Cv=Oexdv#WArdl-Mf8 zl+LcLTV(ap&e%A%&Gkvjc3CzFPRPF`tFj-st?Do98#Cp9mMe5 q7n2TS>husUCL<