diff --git a/config.toml b/config.toml index 158246d..31df422 100644 --- a/config.toml +++ b/config.toml @@ -3,11 +3,11 @@ website_name = "Test Website Name!" built_pages = ["test_page/about.toml", "test_page/other.toml"] use_default_css = true use_default_js = true -javascript = ["test.js"] -css = ["test.css"] -before_navbar_url = "test_page/resources/before_navbar.html" -before_content_url = "test_page/resources/before_content.html" -after_content_url = "test_page/resources/after_content.html" +javascript = ["/js/loadbar.js"] +css = ["/css/loadbar.css"] +before_navbar_url = "test_page/resources/load_bar.html" +#before_content_url = "test_page/resources/before_content.html" +#after_content_url = "test_page/resources/after_content.html" favicon = "/img/global.png" charset = "utf-8" @@ -41,5 +41,5 @@ items = ["about", "other", "google"] link = "https://google.com" [resource.test] -source = "test_page/resources/img" -destination = "img" \ No newline at end of file +source = "test_page/resources/copied_resources" +destination = "" \ No newline at end of file diff --git a/src/templates/default-css.css b/src/templates/default-css.css index ce5581f..50f60ef 100644 --- a/src/templates/default-css.css +++ b/src/templates/default-css.css @@ -93,6 +93,7 @@ nav li:last-child a { nav ul a:hover { background-color: var(--color-navbar-button-hover); + border-left: solid 5px var(--color-navbar-button-hover); } nav ul a:focus { @@ -132,10 +133,48 @@ article { font-size: var(--content-text-size); } +@media (max-width: 900px) { + :root { + --content-side-padding: 5%; + --content-width: 90%; + --navbar-text-size: 30px; + --content-text-size: 1.5em; + --navbar-width: 100%; + } + + nav { + height: auto; + } + + nav li { + display: block; + } + + nav li a { + text-align: center; + padding-top: 0.2em; + padding-bottom: 0.2em; + border: solid 3px var(--color-navbar-button-hover); + } +} + +@media (max-width: 1500px) and (min-width: 900px) { + :root { + --content-width: 70% !important; + --navbar-text-size: 30px; + --navbar-height: 5vw; + } +} + + article > * { margin: 0; } article a { color: var(--highlight-color); +} + +article img { + max-width: calc(100% - var(--content-side-padding)); } \ No newline at end of file diff --git a/src/templates/default-js.js b/src/templates/default-js.js index 42b3926..49f4d21 100644 --- a/src/templates/default-js.js +++ b/src/templates/default-js.js @@ -2,7 +2,7 @@ var _default_js_pageloader = { begin: (url) => { console.log("Started to load " + url); }, progress: (url, current, total) => { console.log("Progress of " + url + ": " + current + "/" + current + " (" + ((current / total) * 100) + "%)"); }, - loaded: (url) => { console.log("Loaded " + url); } + loaded: (url, after_load) => { console.log("Loaded " + url); after_load(); } } function _default_js_main() { @@ -35,10 +35,11 @@ function _default_js_open_page(url, no_pop_state) { _default_js_pageloader.progress(url, progress.loaded, progress.total); }); request.addEventListener("loadend", (progress) => { - _default_js_pageloader.loaded(url); - let parser = new DOMParser(); - let new_document = parser.parseFromString(request.responseText, "text/html"); - change_page(new_document, url, no_pop_state); + _default_js_pageloader.loaded(url, () => { + let parser = new DOMParser(); + let new_document = parser.parseFromString(request.responseText, "text/html"); + change_page(new_document, url, no_pop_state); + }); }); request.open("GET", url); request.send(); diff --git a/src/templates/meta_tags/js_tag.html b/src/templates/meta_tags/js_tag.html index d10193b..0264858 100644 --- a/src/templates/meta_tags/js_tag.html +++ b/src/templates/meta_tags/js_tag.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/test_page/about.md b/test_page/about.md index c35565e..426555a 100644 --- a/test_page/about.md +++ b/test_page/about.md @@ -1,2 +1,4 @@ # About! -This is the test about for this page! \ No newline at end of file +This is the test about for this page! + +![kitten](/img/kitten.jpg) \ No newline at end of file diff --git a/test_page/other.md b/test_page/other.md index 1d242e1..c0333c3 100644 --- a/test_page/other.md +++ b/test_page/other.md @@ -2,4 +2,8 @@ This page is not like the others Example stuff that makes this site different: -- This list \ No newline at end of file +- This list + +[Hello! This is an internal link](/) + +[from_toml$/test_page/config.toml] \ No newline at end of file diff --git a/test_page/other.toml b/test_page/other.toml index f2b9f86..2988396 100644 --- a/test_page/other.toml +++ b/test_page/other.toml @@ -5,7 +5,7 @@ description = "This is the .. other page" content_path = "other.md" favicon = "/img/square_trans.png" #before_navbar_url = "/navbar.html" -before_content_url = "test_page/resources/before_content_other.html" +#before_content_url = "test_page/resources/before_content_other.html" #after_content_url = "/after_content.html" javascript = ["test_additional.js"] css = ["test_additional.css"] \ No newline at end of file diff --git a/test_page/resources/after_content.html b/test_page/resources/after_content.html deleted file mode 100644 index acfaa7c..0000000 --- a/test_page/resources/after_content.html +++ /dev/null @@ -1 +0,0 @@ -

Hi! I'm after the content!

\ No newline at end of file diff --git a/test_page/resources/before_content.html b/test_page/resources/before_content.html deleted file mode 100644 index b6a54d9..0000000 --- a/test_page/resources/before_content.html +++ /dev/null @@ -1 +0,0 @@ -

Hi! I'm before the content!

\ No newline at end of file diff --git a/test_page/resources/before_content_other.html b/test_page/resources/before_content_other.html deleted file mode 100644 index 528c2c6..0000000 --- a/test_page/resources/before_content_other.html +++ /dev/null @@ -1 +0,0 @@ -

I'm different :)

\ No newline at end of file diff --git a/test_page/resources/before_navbar.html b/test_page/resources/before_navbar.html deleted file mode 100644 index 65ada40..0000000 --- a/test_page/resources/before_navbar.html +++ /dev/null @@ -1 +0,0 @@ -

Hi! I'm before the navbar!

\ No newline at end of file diff --git a/test_page/resources/copied_resources/css/loadbar.css b/test_page/resources/copied_resources/css/loadbar.css new file mode 100644 index 0000000..b8740a7 --- /dev/null +++ b/test_page/resources/copied_resources/css/loadbar.css @@ -0,0 +1,16 @@ +#loadbar { + position: absolute; + top: 0; + left: 0; + height: 0.2em; + background-color: rgb(46, 223, 40); + z-index: 1; + transition: 0.1s; + + width: 0%; + opacity: 0; +} + +#loadbar.loading { + opacity: 1; +} \ No newline at end of file diff --git a/test_page/resources/img/global.png b/test_page/resources/copied_resources/img/global.png similarity index 100% rename from test_page/resources/img/global.png rename to test_page/resources/copied_resources/img/global.png diff --git a/test_page/resources/copied_resources/img/kitten.jpg b/test_page/resources/copied_resources/img/kitten.jpg new file mode 100644 index 0000000..588c33d Binary files /dev/null and b/test_page/resources/copied_resources/img/kitten.jpg differ diff --git a/test_page/resources/img/square_trans.png b/test_page/resources/copied_resources/img/square_trans.png similarity index 100% rename from test_page/resources/img/square_trans.png rename to test_page/resources/copied_resources/img/square_trans.png diff --git a/test_page/resources/copied_resources/joku.txt b/test_page/resources/copied_resources/joku.txt deleted file mode 100644 index 05a682b..0000000 --- a/test_page/resources/copied_resources/joku.txt +++ /dev/null @@ -1 +0,0 @@ -Hello! \ No newline at end of file diff --git a/test_page/resources/copied_resources/js/loadbar.js b/test_page/resources/copied_resources/js/loadbar.js new file mode 100644 index 0000000..904bf7c --- /dev/null +++ b/test_page/resources/copied_resources/js/loadbar.js @@ -0,0 +1,19 @@ + +_default_js_pageloader.begin = () => { + let loadbar = document.getElementById("loadbar"); + loadbar.classList = "loading"; + loadbar.style.width = "5%"; +} + +_default_js_pageloader.progress = (url, current, total) => { + let loadbar = document.getElementById("loadbar"); + let percent = (current / total) * 100; + loadbar.style.width = percent + "%"; +} + +_default_js_pageloader.loaded = (url, after_load) => { + let loadbar = document.getElementById("loadbar"); + loadbar.style.width = "100%"; + loadbar.classList = ""; + setTimeout(after_load, 100); +} \ No newline at end of file diff --git a/test_page/resources/copied_resources/toinen.txt b/test_page/resources/copied_resources/toinen.txt deleted file mode 100644 index 90b23d0..0000000 --- a/test_page/resources/copied_resources/toinen.txt +++ /dev/null @@ -1 +0,0 @@ -Toinen! \ No newline at end of file diff --git a/test_page/resources/load_bar.html b/test_page/resources/load_bar.html new file mode 100644 index 0000000..045d0a2 --- /dev/null +++ b/test_page/resources/load_bar.html @@ -0,0 +1 @@ +
\ No newline at end of file