penguin/AstroJS

Javascript framework for my blog

commit 96380549569427fbcdc86b9e43bed062a2e1d6a8

author斟酌 鵬兄 <tgckpg@gmail.com>
date2016-10-14T02:51:59Z
subjectStyle changes
commit 96380549569427fbcdc86b9e43bed062a2e1d6a8
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2016-10-14T02:51:59Z

    Style changes
    
    Removed margin for code blocks
    Reduce the resouces usage
    Sync color across browsers
    Using sans-serif font for chinese
    Fixed the box-sizing for mbody
---
 botanjs/src/Astro/Blog/Components/Entry/Blog.css |  4 ----
 botanjs/src/Astro/Blog/Layout/MainFrame.css      |  9 ++++-----
 botanjs/src/Astro/Blog/Layout/MainFrame.js       | 11 +----------
 botanjs/src/Astro/Bootstrap.css                  |  4 ++--
 botanjs/src/Astro/Mechanism/Parallax.js          | 10 ++++++++--
 5 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/botanjs/src/Astro/Blog/Components/Entry/Blog.css b/botanjs/src/Astro/Blog/Components/Entry/Blog.css
index 94bba2f..9bd9a3a 100644
--- a/botanjs/src/Astro/Blog/Components/Entry/Blog.css
+++ b/botanjs/src/Astro/Blog/Components/Entry/Blog.css
@@ -99,7 +99,3 @@
 	font-size: 1em;
 	color: #76400C;
 }
-
-.highlighter-wrapper {
-	margin: 0 1em;
-}
diff --git a/botanjs/src/Astro/Blog/Layout/MainFrame.css b/botanjs/src/Astro/Blog/Layout/MainFrame.css
index 3b0fecb..3f1d935 100644
--- a/botanjs/src/Astro/Blog/Layout/MainFrame.css
+++ b/botanjs/src/Astro/Blog/Layout/MainFrame.css
@@ -40,6 +40,7 @@ div#header, div#mbody, div#contact, div#horizon {
 
 .mbody {
 	padding: 0 0.25em;
+	box-sizing: border-box;
 	background-color: rgba( 255, 255, 255, 0.5 );
 }
 
@@ -49,9 +50,7 @@ div#header, div#mbody, div#contact, div#horizon {
 }
 
 .begin-wrapper {
-    background-image: url(/assets/layout-images/home.png);
-    background-position: 50% 0%;
-	background-repeat: no-repeat;
-	background-attachment: fixed;
-	background-size: cover;
+	background-image: linear-gradient( #e2e2e2 .1em, transparent .1em );
+	background-image: -moz-linear-gradient( #eee .1em, transparent .1em );
+	background-size: 100% 1.2em;
 }
diff --git a/botanjs/src/Astro/Blog/Layout/MainFrame.js b/botanjs/src/Astro/Blog/Layout/MainFrame.js
index 831356b..d2748d4 100644
--- a/botanjs/src/Astro/Blog/Layout/MainFrame.js
+++ b/botanjs/src/Astro/Blog/Layout/MainFrame.js
@@ -363,17 +363,8 @@
 		Parallax.attach( window, wsupp, 0.5 );
 
 		var cp = 0;
+		var pp = 0;
 		var bWrapper = Dand.id( "begin-wrapper" );
-		Cycle.perma(
-			"MainBackground"
-			, function()
-			{
-				var p = wsupp.scrollTop / ( wsupp.scrollHeight - wsupp.clientHeight );
-				cp = 0.75 * cp  + 0.25 * p;
-				bWrapper.style.backgroundPosition = "50% " + ( cp * 100 ).toFixed( 2 ) + "%";
-			}
-			, 15
-		);
 	};
 
 	Bootstrap.regInit( init );
diff --git a/botanjs/src/Astro/Bootstrap.css b/botanjs/src/Astro/Bootstrap.css
index fda2212..7f3654d 100644
--- a/botanjs/src/Astro/Bootstrap.css
+++ b/botanjs/src/Astro/Bootstrap.css
@@ -25,11 +25,11 @@
 }
 
 .flsf {
-    font-family: custom-sans;
+    font-family: custom-sans,Helvetica,Arial,STHeiti,"Microsoft JhengHei","微軟正黑體";
 }
 
 .fls {
-    font-family: custom-serif;
+    font-family: custom-serif,Helvetica,Arial,STHeiti,"Microsoft JhengHei","微軟正黑體";
 }
 
 .fsf {
diff --git a/botanjs/src/Astro/Mechanism/Parallax.js b/botanjs/src/Astro/Mechanism/Parallax.js
index 05c3413..d6197e3 100644
--- a/botanjs/src/Astro/Mechanism/Parallax.js
+++ b/botanjs/src/Astro/Mechanism/Parallax.js
@@ -65,22 +65,28 @@
 		}
 
 		var cp = 0;
+		var pp = 0;
 		Cycle.perma(
 			"PARALLAXSCR"
 			, function()
 			{
 				var p = sSupplier.scrollTop/(sSupplier.scrollHeight - sSupplier.clientHeight);
 				cp = 0.85 * cp + p * 0.15;
+				cp = 0.0001 * Math.round( cp * 10000 );
 
-				for(var i = 0; i < l; i ++)
+				if ( pp == cp ) return;
+
+				for( var i = 0; i < l; i ++ )
 				{
 					s = Parallax["s" + i];
-					for(var j = 0, k; j < s.length; j ++)
+					for( var j = 0, k; j < s.length; j ++ )
 					{
 						k = s[j];
 						k.element.style.top = ( -k.verticalRange * ( ( j + 1 ) * cp ) ).toFixed( 2 ) + "%";
 					}
 				}
+
+				pp = cp;
 			}
 			, 15
 		);