From a35f33b1cf1526c4decea30c76af6c4bba34dc93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= <tgckpg@gmail.com>
Date: Thu, 1 Oct 2015 00:43:02 +0800
Subject: [PATCH] Minor bug fixes

---
 .../Blog/AstroEdit/Visualizer/Snippet/SiteFile.js | 15 ++++++++++++---
 botanjs/src/Astro/Blog/Components/Album.js        |  8 ++++++++
 botanjs/src/Astro/Blog/Components/Entry/Block.js  |  2 +-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js
index 15bf019d..58712220 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js
+++ b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js
@@ -175,9 +175,18 @@
 	{
 		stage = IDOMElement( stage );
 		// [html][/html]
-		return "[sitefile"
-			+ " collection=\"" + stage.getDAttribute( "collection" ) + "\""
-			+ " size=\"" + stage.getDAttribute( "size" ) + "\"" +  "]"
+		var options = "";
+		var opt;
+		if( opt = stage.getDAttribute( "collection" ) )
+		{
+			options += " collection=\"1\"";
+		}
+		if( opt = stage.getDAttribute( "size" ) )
+		{
+			options += " size=\"" + opt + "\"";
+		}
+
+		return "[sitefile" + options + "]"
 			+ escapeStr( stage.getDAttribute( "value" ) )
 			+ "[/sitefile]";
 	};
diff --git a/botanjs/src/Astro/Blog/Components/Album.js b/botanjs/src/Astro/Blog/Components/Album.js
index 47530119..0d151e95 100644
--- a/botanjs/src/Astro/Blog/Components/Album.js
+++ b/botanjs/src/Astro/Blog/Components/Album.js
@@ -43,6 +43,14 @@
 
 			var files = finfo.files;
 			var l = files.length;
+
+			// XXX: Not traditional!
+			// Maximum of 4 for listing
+			if( ostage.parentNode.className == "h_img" && 4 < l )
+			{
+				l = 4;
+			}
+
 			for( var i = 0; i < l; i ++ )
 			{
 				/** @type {_AstJson_.SiteFile} */
diff --git a/botanjs/src/Astro/Blog/Components/Entry/Block.js b/botanjs/src/Astro/Blog/Components/Entry/Block.js
index 8df6cdd3..fc79eb0a 100644
--- a/botanjs/src/Astro/Blog/Components/Entry/Block.js
+++ b/botanjs/src/Astro/Blog/Components/Entry/Block.js
@@ -34,7 +34,7 @@
 					delayCont( false );
 				}
 				, firstTime
-					? ( 500 + Math.random()*4500 )
+					? Math.random()*10000
 					: ( 5500 + Math.random()*4500 )
 			);
 		};