--- /dev/null
+/**
+* @file main.js
+* @author Ken Grimes
+* @license AGPL-3.0
+* @copyright 2018 - Ken Grimes
+* @summmary Script for populating text to summary box on svg:hover
+*/
+'use strict'
+window.onload = () => {
+ const header = document.body.getElementsByTagName('header').item(0)
+ const nav = document.body.getElementsByTagName('nav').item(0)
+ const main = document.body.getElementsByTagName('main').item(0)
+ const navAnchors = Array.from(nav.getElementsByTagName('div').item(0).getElementsByTagName('a'))
+ const pageDisplay = nav.getElementsByTagName('footer').item(0)
+ const currentPageName = `${pageDisplay.innerHTML}`
+ const updateNav = () => navAnchors.forEach((a) => {
+ const summary = a.getElementsByTagName('summary').item(0).innerHTML
+ const svg = a.getElementsByTagName('svg').item(0)
+ a.addEventListener('mouseover', () => pageDisplay.innerHTML = summary)
+ a.addEventListener('mousedown', () => pageDisplay.innerHTML = summary)
+ a.addEventListener('mouseout', () => pageDisplay.innerHTML = currentPageName)
+ })
+ updateNav()
+
+ let oldScrollY = window.scrollY
+ const _downDelay = 15
+ let downDelay = 0
+ const _upDelay = 5
+ let upDelay = _upDelay
+ const navUp = () => nav.style.top = Math.min(parseInt(nav.style.top,10) + (oldScrollY - window.scrollY), 0) + 'px'
+ const navDown = () => nav.style.top = Math.max(parseInt(nav.style.top,10) - (window.scrollY - oldScrollY), -nav.offsetHeight) + 'px'
+ nav.style.top = 0 + 'px'
+ window.onscroll = () => {
+ if (window.matchMedia("(orientation: portrait)").matches) {
+ if (window.scrollY < oldScrollY) /* up */ {
+ if (upDelay-- <= 0)
+ downDelay = _downDelay
+ navUp()
+ }
+ else {
+ upDelay = _upDelay
+ if(downDelay-- <= 0)
+ navDown()
+ else
+ navUp()
+ }
+ oldScrollY = window.scrollY
+ }
+ }
+}
+
+const resizeIFrame = (iframe) => {
+ iframe.style.height = 0
+ iframe.style.height = (iframe.contentWindow.document.body.scrollHeight * 1.2) + 'px';
+}