Browse Source

Code improvements

Tobias Reich 9 years ago
parent
commit
62365a2558
4 changed files with 12 additions and 8 deletions
  1. 4 3
      assets/js/album.js
  2. 8 5
      assets/js/photo.js
  3. 0 0
      assets/min/main.css
  4. 0 0
      assets/min/main.js

+ 4 - 3
assets/js/album.js

@@ -368,10 +368,11 @@ album = {
 
 	getArchive: function(albumID) {
 
-		var link;
+		var link,
+			url = "php/api.php?function=getAlbumArchive&albumID=" + albumID;
 
-		if (location.href.indexOf("index.html")>0) link = location.href.replace(location.hash, "").replace("index.html", "php/api.php?function=getAlbumArchive&albumID=" + albumID);
-		else link = location.href.replace(location.hash, "") + "php/api.php?function=getAlbumArchive&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 (lychee.publicMode) link += "&password=" + password.value;
 

+ 8 - 5
assets/js/photo.js

@@ -520,10 +520,11 @@ photo = {
 
 	getArchive: function(photoID) {
 
-		var link;
+		var link,
+			url = "php/api.php?function=getPhotoArchive&photoID=" + photoID;
 
-		if (location.href.indexOf("index.html")>0) link = location.href.replace(location.hash, "").replace("index.html", "php/api.php?function=getPhotoArchive&photoID=" + photoID);
-		else link = location.href.replace(location.hash, "") + "php/api.php?function=getPhotoArchive&photoID=" + photoID;
+		if (location.href.indexOf("index.html")>0) link = location.href.replace(location.hash, "").replace("index.html", url);
+		else link = location.href.replace(location.hash, "") + url;
 
 		if (lychee.publicMode) link += "&password=" + password.value;
 
@@ -539,8 +540,10 @@ photo = {
 
 	getViewLink: function(photoID) {
 
-		if (location.href.indexOf("index.html")>0) return location.href.replace("index.html" + location.hash, "view.php?p=" + photoID);
-		else return location.href.replace(location.hash, "view.php?p=" + photoID);
+		var url = "view.php?p=" + photoID;
+
+		if (location.href.indexOf("index.html")>0) return location.href.replace("index.html" + location.hash, url);
+		else return location.href.replace(location.hash, url);
 
 	}
 

File diff suppressed because it is too large
+ 0 - 0
assets/min/main.css


File diff suppressed because it is too large
+ 0 - 0
assets/min/main.js


Some files were not shown because too many files changed in this diff