From fa8cad02bbed0edd4589fc6f6a766b8e48b94e3a Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 16 Sep 2014 15:20:35 +0300 Subject: [PATCH] Changed spaces to tabs for indentation --- assets/js/album.js | 14 ++-- assets/js/albums.js | 134 +++++++++++++++++++-------------------- assets/js/photo.js | 36 +++++------ assets/js/view.js | 38 +++++------ php/modules/Album.php | 20 +++--- php/modules/Database.php | 6 +- 6 files changed, 124 insertions(+), 124 deletions(-) diff --git a/assets/js/album.js b/assets/js/album.js index 81afbaa..affddad 100644 --- a/assets/js/album.js +++ b/assets/js/album.js @@ -114,9 +114,9 @@ album = { if (data===true) data = 1; // Avoid first album to be true if (data!==false&&isNumber(data)) { - albums.refresh(); - lychee.goto(data); - } + albums.refresh(); + lychee.goto(data); + } else lychee.error(null, params, data); }); @@ -149,7 +149,7 @@ album = { albumIDs.forEach(function(id, index, array) { albums.json.num--; view.albums.content.delete(id); - delete albums.json.content[id] + delete albums.json.content[id] }); } else lychee.goto(""); @@ -293,8 +293,8 @@ album = { password = "", listed = false, downloadable = false; - - albums.refresh(); + + albums.refresh(); if (!visible.message()&&album.json.public==0) { @@ -306,7 +306,7 @@ album = { else $(".message .choice input.text").hide(); }); - + return true; } diff --git a/assets/js/albums.js b/assets/js/albums.js index b7406ec..0f6b5b9 100644 --- a/assets/js/albums.js +++ b/assets/js/albums.js @@ -17,73 +17,73 @@ albums = { lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut"); lychee.animate(".divider", "fadeOut"); - - startTime = new Date().getTime(); + + startTime = new Date().getTime(); - - if(this.json == null) { - lychee.api("getAlbums", function(data) { - - /* Smart Albums */ - data.unsortedAlbum = { - id: 0, - title: "Unsorted", - sysdate: data.unsortedNum + " photos", - unsorted: 1, - thumb0: data.unsortedThumb0, - thumb1: data.unsortedThumb1, - thumb2: data.unsortedThumb2 - }; - - data.starredAlbum = { - id: "f", - title: "Starred", - sysdate: data.starredNum + " photos", - star: 1, - thumb0: data.starredThumb0, - thumb1: data.starredThumb1, - thumb2: data.starredThumb2 - }; - - data.publicAlbum = { - id: "s", - title: "Public", - sysdate: data.publicNum + " photos", - public: 1, - thumb0: data.publicThumb0, - thumb1: data.publicThumb1, - thumb2: data.publicThumb2 - }; - - data.recentAlbum = { - id: "r", - title: "Recent", - sysdate: data.recentNum + " photos", - recent: 1, - thumb0: data.recentThumb0, - thumb1: data.recentThumb1, - thumb2: data.recentThumb2 - }; - - albums.json = data; - - durationTime = (new Date().getTime() - startTime); - if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime; - if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0; - if (visible.album()&&lychee.content.html()==="") waitTime = 0; - - setTimeout(function() { - view.header.mode("albums"); - view.albums.init(); - lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn"); - - }, waitTime); - }); - } else { + + if(this.json == null) { + lychee.api("getAlbums", function(data) { + + /* Smart Albums */ + data.unsortedAlbum = { + id: 0, + title: "Unsorted", + sysdate: data.unsortedNum + " photos", + unsorted: 1, + thumb0: data.unsortedThumb0, + thumb1: data.unsortedThumb1, + thumb2: data.unsortedThumb2 + }; + + data.starredAlbum = { + id: "f", + title: "Starred", + sysdate: data.starredNum + " photos", + star: 1, + thumb0: data.starredThumb0, + thumb1: data.starredThumb1, + thumb2: data.starredThumb2 + }; + + data.publicAlbum = { + id: "s", + title: "Public", + sysdate: data.publicNum + " photos", + public: 1, + thumb0: data.publicThumb0, + thumb1: data.publicThumb1, + thumb2: data.publicThumb2 + }; + + data.recentAlbum = { + id: "r", + title: "Recent", + sysdate: data.recentNum + " photos", + recent: 1, + thumb0: data.recentThumb0, + thumb1: data.recentThumb1, + thumb2: data.recentThumb2 + }; + + albums.json = data; + + durationTime = (new Date().getTime() - startTime); + if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime; + if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0; + if (visible.album()&&lychee.content.html()==="") waitTime = 0; + + setTimeout(function() { + view.header.mode("albums"); + view.albums.init(); + lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn"); + + }, waitTime); + }); + } else { view.header.mode("albums"); view.albums.init(); lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn"); - } + } }, parse: function(album) { @@ -99,9 +99,9 @@ albums = { } }, - - refresh: function() { - this.json = null; - } + + refresh: function() { + this.json = null; + } }; \ No newline at end of file diff --git a/assets/js/photo.js b/assets/js/photo.js index 0f371b1..fe3578a 100644 --- a/assets/js/photo.js +++ b/assets/js/photo.js @@ -49,19 +49,19 @@ photo = { }); }, - - //preload the next photo for better response time - preloadNext: function(photoID) { - if(album.json && - album.json.content && - album.json.content[photoID] && - album.json.content[photoID].nextPhoto!="") { - - var nextPhoto = album.json.content[photoID].nextPhoto; - var url = album.json.content[nextPhoto].url; - cache = new Image(); - cache.src = url; - } + + //preload the next photo for better response time + preloadNext: function(photoID) { + if(album.json && + album.json.content && + album.json.content[photoID] && + album.json.content[photoID].nextPhoto!="") { + + var nextPhoto = album.json.content[photoID].nextPhoto; + var url = album.json.content[nextPhoto].url; + cache = new Image(); + cache.src = url; + } }, parse: function() { @@ -311,22 +311,22 @@ photo = { if (data!==true) lychee.error(null, params, data); }); - - albums.refresh(); + + albums.refresh(); }, setPublic: function(photoID, e) { var params; - + if (photo.json.public==2) { modal.show("Public Album", "This photo is located in a public album. To make this photo private or public, edit the visibility of the associated album.", [["Show Album", function() { lychee.goto(photo.json.original_album) }], ["Close", function() {}]]); return false; } - - albums.refresh(); + + albums.refresh(); if (visible.photo()) { diff --git a/assets/js/view.js b/assets/js/view.js index c886324..170684b 100644 --- a/assets/js/view.js +++ b/assets/js/view.js @@ -121,8 +121,8 @@ view = { }, content: { - - scroll_pos: 0, + + scroll_pos: 0, init: function() { @@ -137,16 +137,16 @@ view = { if (!lychee.publicMode) smartData = build.divider("Smart Albums") + build.album(albums.json.unsortedAlbum) + build.album(albums.json.starredAlbum) + build.album(albums.json.publicAlbum) + build.album(albums.json.recentAlbum); /* Albums */ - - if (albums.json.content) { + + if (albums.json.content) { $.each(albums.json.content, function() { albums.parse(this); - - //display albums in reverse order + + //display albums in reverse order albumsData = build.album(this) + albumsData; }); - - if (!lychee.publicMode) albumsData = build.divider("Albums") + albumsData; + + if (!lychee.publicMode) albumsData = build.divider("Albums") + albumsData; } if (smartData===""&&albumsData==="") { @@ -157,12 +157,12 @@ view = { } $("img[data-type!='nonretina']").retina(); - - //restore scroll - if (view.albums.content.scroll_pos != null) { - //$("html, body").setanimate({ scrollTop: view.albums.content.scroll_pos }, "slow"); - $("html, body").scrollTop(view.albums.content.scroll_pos); - } + + //restore scroll + if (view.albums.content.scroll_pos != null) { + //$("html, body").setanimate({ scrollTop: view.albums.content.scroll_pos }, "slow"); + $("html, body").scrollTop(view.albums.content.scroll_pos); + } }, @@ -260,10 +260,10 @@ view = { lychee.content.html(photosData); $("img[data-type!='svg']").retina(); - - view.albums.content.scroll_pos = $(document).scrollTop(); - //scroll to top - $("html, body").animate({ scrollTop: 0 }, "slow"); + + view.albums.content.scroll_pos = $(document).scrollTop(); + //scroll to top + $("html, body").animate({ scrollTop: 0 }, "slow"); }, @@ -470,7 +470,7 @@ view = { photo: function() { lychee.imageview.html(build.imageview(photo.json, photo.isSmall(), visible.controls())); - + if ((album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].nextPhoto==="")||lychee.viewMode) $("a#next").hide(); if ((album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].previousPhoto==="")||lychee.viewMode) $("a#previous").hide(); diff --git a/php/modules/Album.php b/php/modules/Album.php index 5448858..396ae41 100644 --- a/php/modules/Album.php +++ b/php/modules/Album.php @@ -13,12 +13,12 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); function debug_to_console( $data ) { - if ( is_array( $data ) ) - $output = ""; - else - $output = ""; + if ( is_array( $data ) ) + $output = ""; + else + $output = ""; - echo $output; + echo $output; } class Album extends Module { @@ -111,9 +111,9 @@ class Album extends Module { $photo['previousPhoto'] = $previousPhotoID; $photo['nextPhoto'] = ''; $photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $photo['thumbUrl']; - - # Parse url - $photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url']; + + # Parse url + $photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url']; if (isset($photo['takestamp'])&&$photo['takestamp']!=='0') { $photo['cameraDate'] = 1; @@ -208,7 +208,7 @@ class Album extends Module { # Call plugins $this->plugins(__METHOD__, 1, func_get_args()); - + return $return; } @@ -394,7 +394,7 @@ class Album extends Module { # Parse if (strlen($title)>50) $title = substr($title, 0, 50); - + # Execute query $result = $this->database->query("UPDATE lychee_albums SET title = '$title' WHERE id IN ($this->albumIDs);"); diff --git a/php/modules/Database.php b/php/modules/Database.php index 183aaa5..a286480 100755 --- a/php/modules/Database.php +++ b/php/modules/Database.php @@ -23,9 +23,9 @@ class Database extends Module { # Avoid sql injection on older MySQL versions by using GBK if ($database->server_version<50500) $database->set_charset('GBK'); else $database->set_charset("utf8"); - - # Set unicode - $database->query('SET NAMES utf8;'); + + # Set unicode + $database->query('SET NAMES utf8;'); # Check database if (!$database->select_db($name))