diff --git a/css/default.css b/css/default.css index 3c62bc3..87ad428 100644 --- a/css/default.css +++ b/css/default.css @@ -68,7 +68,6 @@ td, tr, th { /* HEADER */ header { - border: 1px solid black; /*DEBUG*/ position: fixed; box-sizing: border-box; width: 100%; @@ -111,6 +110,16 @@ header img { height: 100%; } +#scrollBar { + box-sizing: border-box; + position: fixed; + left: 0; + top: 57px; + height: 3px; + background: rgb(148, 194, 228); + transition: width 0.5s; +} + /* CONTENT */ h1 { diff --git a/javascript/scroll.js b/javascript/scroll.js new file mode 100644 index 0000000..815c125 --- /dev/null +++ b/javascript/scroll.js @@ -0,0 +1,60 @@ +"use strict"; + +var windowHeight; +var scrollTS = 0; +var lastScroll = 0; + +window.requestAnimationFrame (animateScroll); + +function computeWindowHeight() { + var myHeight = 0; + if( typeof( window.innerWidth ) == 'number' ) { + //Non-IE + myHeight = window.innerHeight; + } else if( document.documentElement && ( document.documentElement.clientHeight ) ) { + //IE 6+ in 'standards compliant mode' + myHeight = document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientHeight ) ) { + //IE 4 compatible + myHeight = document.body.clientHeight; + } + return (myHeight); +} + +windowHeight = computeWindowHeight(); + +function getScroll() { + var scrOfY = 0; + if( typeof( window.pageYOffset ) == 'number' ) { + //Netscape compliant + scrOfY = window.pageYOffset; + } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { + //DOM compliant + scrOfY = document.body.scrollTop; + } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { + //IE6 standards compliant mode + scrOfY = document.documentElement.scrollTop; + } + return (scrOfY); +} + +function computeScroll () { + var percentage = Math.round (getScroll() / (document.body.offsetHeight - windowHeight) * 100); + return (percentage); +} + +function animateScroll (timestamp) { + if (timestamp - scrollTS >= 500) { + scrollTS = timestamp; + + var newScroll = computeScroll(); + + if (newScroll !== lastScroll) { + lastScroll = newScroll; + document.getElementById ("scrollBar").style.width = newScroll + "%"; + } + + } + + window.requestAnimationFrame (animateScroll); +} \ No newline at end of file diff --git a/nschoeslabs.cabal b/nschoeslabs.cabal index 84efd80..155da2c 100644 --- a/nschoeslabs.cabal +++ b/nschoeslabs.cabal @@ -5,7 +5,7 @@ cabal-version: >= 1.10 executable site main-is: site.hs - build-depends: base == 4.* - , hakyll == 4.6.* + build-depends: base + , hakyll ghc-options: -threaded default-language: Haskell2010 diff --git a/site.hs b/site.hs index 075f661..53e8854 100644 --- a/site.hs +++ b/site.hs @@ -15,10 +15,15 @@ main = hakyllWith config $ do route idRoute compile compressCssCompiler + match "javascript/*" $ do + route idRoute + compile copyFileCompiler + match "favicon.gif" $ do route idRoute compile copyFileCompiler + match (fromList ["about.md", "haskell.md", "ai.md", "webrtc.md"]) $ do route $ setExtension "html" compile $ pandocCompiler diff --git a/templates/article.html b/templates/article.html index 1f41815..f914308 100644 --- a/templates/article.html +++ b/templates/article.html @@ -2,4 +2,5 @@ $body$
$date$ - \ No newline at end of file + + \ No newline at end of file diff --git a/templates/default.html b/templates/default.html index 880fe32..91a211a 100644 --- a/templates/default.html +++ b/templates/default.html @@ -27,6 +27,9 @@ RSS feed logo +
+
+

$title$