Changed spaces to tabs for indentation

This commit is contained in:
Roman 2014-09-16 15:20:35 +03:00
parent 1671517f41
commit fa8cad02bb
6 changed files with 124 additions and 124 deletions

View File

@ -114,9 +114,9 @@ album = {
if (data===true) data = 1; // Avoid first album to be true if (data===true) data = 1; // Avoid first album to be true
if (data!==false&&isNumber(data)) { if (data!==false&&isNumber(data)) {
albums.refresh(); albums.refresh();
lychee.goto(data); lychee.goto(data);
} }
else lychee.error(null, params, data); else lychee.error(null, params, data);
}); });
@ -149,7 +149,7 @@ album = {
albumIDs.forEach(function(id, index, array) { albumIDs.forEach(function(id, index, array) {
albums.json.num--; albums.json.num--;
view.albums.content.delete(id); view.albums.content.delete(id);
delete albums.json.content[id] delete albums.json.content[id]
}); });
} else lychee.goto(""); } else lychee.goto("");
@ -293,8 +293,8 @@ album = {
password = "", password = "",
listed = false, listed = false,
downloadable = false; downloadable = false;
albums.refresh(); albums.refresh();
if (!visible.message()&&album.json.public==0) { if (!visible.message()&&album.json.public==0) {
@ -306,7 +306,7 @@ album = {
else $(".message .choice input.text").hide(); else $(".message .choice input.text").hide();
}); });
return true; return true;
} }

View File

@ -17,73 +17,73 @@ albums = {
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut"); lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomOut");
lychee.animate(".divider", "fadeOut"); lychee.animate(".divider", "fadeOut");
startTime = new Date().getTime(); startTime = new Date().getTime();
if(this.json == null) { if(this.json == null) {
lychee.api("getAlbums", function(data) { lychee.api("getAlbums", function(data) {
/* Smart Albums */ /* Smart Albums */
data.unsortedAlbum = { data.unsortedAlbum = {
id: 0, id: 0,
title: "Unsorted", title: "Unsorted",
sysdate: data.unsortedNum + " photos", sysdate: data.unsortedNum + " photos",
unsorted: 1, unsorted: 1,
thumb0: data.unsortedThumb0, thumb0: data.unsortedThumb0,
thumb1: data.unsortedThumb1, thumb1: data.unsortedThumb1,
thumb2: data.unsortedThumb2 thumb2: data.unsortedThumb2
}; };
data.starredAlbum = { data.starredAlbum = {
id: "f", id: "f",
title: "Starred", title: "Starred",
sysdate: data.starredNum + " photos", sysdate: data.starredNum + " photos",
star: 1, star: 1,
thumb0: data.starredThumb0, thumb0: data.starredThumb0,
thumb1: data.starredThumb1, thumb1: data.starredThumb1,
thumb2: data.starredThumb2 thumb2: data.starredThumb2
}; };
data.publicAlbum = { data.publicAlbum = {
id: "s", id: "s",
title: "Public", title: "Public",
sysdate: data.publicNum + " photos", sysdate: data.publicNum + " photos",
public: 1, public: 1,
thumb0: data.publicThumb0, thumb0: data.publicThumb0,
thumb1: data.publicThumb1, thumb1: data.publicThumb1,
thumb2: data.publicThumb2 thumb2: data.publicThumb2
}; };
data.recentAlbum = { data.recentAlbum = {
id: "r", id: "r",
title: "Recent", title: "Recent",
sysdate: data.recentNum + " photos", sysdate: data.recentNum + " photos",
recent: 1, recent: 1,
thumb0: data.recentThumb0, thumb0: data.recentThumb0,
thumb1: data.recentThumb1, thumb1: data.recentThumb1,
thumb2: data.recentThumb2 thumb2: data.recentThumb2
}; };
albums.json = data; albums.json = data;
durationTime = (new Date().getTime() - startTime); durationTime = (new Date().getTime() - startTime);
if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime; if (durationTime>300) waitTime = 0; else waitTime = 300 - durationTime;
if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0; if (!visible.albums()&&!visible.photo()&&!visible.album()) waitTime = 0;
if (visible.album()&&lychee.content.html()==="") waitTime = 0; if (visible.album()&&lychee.content.html()==="") waitTime = 0;
setTimeout(function() { setTimeout(function() {
view.header.mode("albums"); view.header.mode("albums");
view.albums.init(); view.albums.init();
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn"); lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn");
}, waitTime); }, waitTime);
}); });
} else { } else {
view.header.mode("albums"); view.header.mode("albums");
view.albums.init(); view.albums.init();
lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn"); lychee.animate(".album:nth-child(-n+50), .photo:nth-child(-n+50)", "contentZoomIn");
} }
}, },
parse: function(album) { parse: function(album) {
@ -99,9 +99,9 @@ albums = {
} }
}, },
refresh: function() { refresh: function() {
this.json = null; this.json = null;
} }
}; };

View File

@ -49,19 +49,19 @@ photo = {
}); });
}, },
//preload the next photo for better response time //preload the next photo for better response time
preloadNext: function(photoID) { preloadNext: function(photoID) {
if(album.json && if(album.json &&
album.json.content && album.json.content &&
album.json.content[photoID] && album.json.content[photoID] &&
album.json.content[photoID].nextPhoto!="") { album.json.content[photoID].nextPhoto!="") {
var nextPhoto = album.json.content[photoID].nextPhoto; var nextPhoto = album.json.content[photoID].nextPhoto;
var url = album.json.content[nextPhoto].url; var url = album.json.content[nextPhoto].url;
cache = new Image(); cache = new Image();
cache.src = url; cache.src = url;
} }
}, },
parse: function() { parse: function() {
@ -311,22 +311,22 @@ photo = {
if (data!==true) lychee.error(null, params, data); if (data!==true) lychee.error(null, params, data);
}); });
albums.refresh(); albums.refresh();
}, },
setPublic: function(photoID, e) { setPublic: function(photoID, e) {
var params; var params;
if (photo.json.public==2) { 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() {}]]); 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; return false;
} }
albums.refresh(); albums.refresh();
if (visible.photo()) { if (visible.photo()) {

View File

@ -121,8 +121,8 @@ view = {
}, },
content: { content: {
scroll_pos: 0, scroll_pos: 0,
init: function() { 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); 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 */ /* Albums */
if (albums.json.content) { if (albums.json.content) {
$.each(albums.json.content, function() { $.each(albums.json.content, function() {
albums.parse(this); albums.parse(this);
//display albums in reverse order //display albums in reverse order
albumsData = build.album(this) + albumsData; albumsData = build.album(this) + albumsData;
}); });
if (!lychee.publicMode) albumsData = build.divider("Albums") + albumsData; if (!lychee.publicMode) albumsData = build.divider("Albums") + albumsData;
} }
if (smartData===""&&albumsData==="") { if (smartData===""&&albumsData==="") {
@ -157,12 +157,12 @@ view = {
} }
$("img[data-type!='nonretina']").retina(); $("img[data-type!='nonretina']").retina();
//restore scroll //restore scroll
if (view.albums.content.scroll_pos != null) { if (view.albums.content.scroll_pos != null) {
//$("html, body").setanimate({ scrollTop: view.albums.content.scroll_pos }, "slow"); //$("html, body").setanimate({ scrollTop: view.albums.content.scroll_pos }, "slow");
$("html, body").scrollTop(view.albums.content.scroll_pos); $("html, body").scrollTop(view.albums.content.scroll_pos);
} }
}, },
@ -260,10 +260,10 @@ view = {
lychee.content.html(photosData); lychee.content.html(photosData);
$("img[data-type!='svg']").retina(); $("img[data-type!='svg']").retina();
view.albums.content.scroll_pos = $(document).scrollTop(); view.albums.content.scroll_pos = $(document).scrollTop();
//scroll to top //scroll to top
$("html, body").animate({ scrollTop: 0 }, "slow"); $("html, body").animate({ scrollTop: 0 }, "slow");
}, },
@ -470,7 +470,7 @@ view = {
photo: function() { photo: function() {
lychee.imageview.html(build.imageview(photo.json, photo.isSmall(), visible.controls())); 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()].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(); if ((album.json&&album.json.content&&album.json.content[photo.getID()]&&album.json.content[photo.getID()].previousPhoto==="")||lychee.viewMode) $("a#previous").hide();

View File

@ -13,12 +13,12 @@ if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
function debug_to_console( $data ) { function debug_to_console( $data ) {
if ( is_array( $data ) ) if ( is_array( $data ) )
$output = "<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>"; $output = "<script>console.log( 'Debug Objects: " . implode( ',', $data) . "' );</script>";
else else
$output = "<script>console.log( 'Debug Objects: " . $data . "' );</script>"; $output = "<script>console.log( 'Debug Objects: " . $data . "' );</script>";
echo $output; echo $output;
} }
class Album extends Module { class Album extends Module {
@ -111,9 +111,9 @@ class Album extends Module {
$photo['previousPhoto'] = $previousPhotoID; $photo['previousPhoto'] = $previousPhotoID;
$photo['nextPhoto'] = ''; $photo['nextPhoto'] = '';
$photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $photo['thumbUrl']; $photo['thumbUrl'] = LYCHEE_URL_UPLOADS_THUMB . $photo['thumbUrl'];
# Parse url # Parse url
$photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url']; $photo['url'] = LYCHEE_URL_UPLOADS_BIG . $photo['url'];
if (isset($photo['takestamp'])&&$photo['takestamp']!=='0') { if (isset($photo['takestamp'])&&$photo['takestamp']!=='0') {
$photo['cameraDate'] = 1; $photo['cameraDate'] = 1;
@ -208,7 +208,7 @@ class Album extends Module {
# Call plugins # Call plugins
$this->plugins(__METHOD__, 1, func_get_args()); $this->plugins(__METHOD__, 1, func_get_args());
return $return; return $return;
} }
@ -394,7 +394,7 @@ class Album extends Module {
# Parse # Parse
if (strlen($title)>50) $title = substr($title, 0, 50); if (strlen($title)>50) $title = substr($title, 0, 50);
# Execute query # Execute query
$result = $this->database->query("UPDATE lychee_albums SET title = '$title' WHERE id IN ($this->albumIDs);"); $result = $this->database->query("UPDATE lychee_albums SET title = '$title' WHERE id IN ($this->albumIDs);");

View File

@ -23,9 +23,9 @@ class Database extends Module {
# Avoid sql injection on older MySQL versions by using GBK # Avoid sql injection on older MySQL versions by using GBK
if ($database->server_version<50500) $database->set_charset('GBK'); if ($database->server_version<50500) $database->set_charset('GBK');
else $database->set_charset("utf8"); else $database->set_charset("utf8");
# Set unicode # Set unicode
$database->query('SET NAMES utf8;'); $database->query('SET NAMES utf8;');
# Check database # Check database
if (!$database->select_db($name)) if (!$database->select_db($name))