diff --git a/blog/index.html b/blog/index.html
index a03ca7d..46cb6a9 100644
--- a/blog/index.html
+++ b/blog/index.html
@@ -6,6 +6,7 @@
+
Teascade | blog
diff --git a/blogtext/index.html b/blogtext/index.html
index e432176..6df3391 100644
--- a/blogtext/index.html
+++ b/blogtext/index.html
@@ -6,6 +6,7 @@
+
Teascade | blogtext
diff --git a/favicon.png b/favicon.png
new file mode 100644
index 0000000..b0a4031
Binary files /dev/null and b/favicon.png differ
diff --git a/games/index.html b/games/index.html
index 049c78f..5148b72 100644
--- a/games/index.html
+++ b/games/index.html
@@ -6,6 +6,7 @@
+
Teascade | games
diff --git a/index.html b/index.html
index 7bf5195..7d35f40 100644
--- a/index.html
+++ b/index.html
@@ -6,6 +6,7 @@
+
Teascade | about
diff --git a/js/main.js b/js/main.js
index 7bfc598..02e78a5 100644
--- a/js/main.js
+++ b/js/main.js
@@ -10,23 +10,20 @@ function main(page) {
addBlogposts();
var search = window.location.search;
if (search != "") {
- search = search.slice(1, -1);
- var parts = search.split("=");
- if (parts[0] == "id") {
- var timestamp = void 0;
- for (var i in window.blogpostData) {
- console.log(window.blogpostData[i].source);
- console.log(search + ".html");
- if (window.blogpostData[i].source == parts[1] + ".html") {
- timestamp = new Date(window.blogpostData[i].time).toUTCString();
- }
- }
- setBlogText(parts[1] + ".html", timestamp);
- }
+ setBlogTextOnSearch(search);
}
+ window.onpopstate = function () {
+ var page = window.location.pathname.split("/").filter(function (f) { return f != ""; })[0];
+ var search = window.location.search.slice(0, -1);
+ if (page == "blogtext") {
+ setBlogTextOnSearch(search);
+ }
+ openPage(page || "about", page, false);
+ };
}
-function openPage(page, new_url) {
+function openPage(page, new_url, renew_history) {
if (new_url === void 0) { new_url = null; }
+ if (renew_history === void 0) { renew_history = true; }
if (page == window.currPage) {
return;
}
@@ -42,7 +39,10 @@ function openPage(page, new_url) {
targetPg = "";
}
;
- window.history.pushState(target, target, targetPg + "/");
+ if (renew_history) {
+ window.history.pushState(target, target, targetPg + "/");
+ }
+ document.title = "Teascade | " + page;
document.getElementsByClassName("stuffarea")[0].scrollTop = 0;
slideOpacity(function () {
}, 1.5);
@@ -77,6 +77,21 @@ function addBlogposts() {
};
});
}
+function setBlogTextOnSearch(search) {
+ search = search.slice(1, -1);
+ var parts = search.split("=");
+ if (parts[0] == "id") {
+ var timestamp = void 0;
+ for (var i in window.blogpostData) {
+ console.log(window.blogpostData[i].source);
+ console.log(search + ".html");
+ if (window.blogpostData[i].source == parts[1] + ".html") {
+ timestamp = new Date(window.blogpostData[i].time).toUTCString();
+ }
+ }
+ setBlogText(parts[1] + ".html", timestamp);
+ }
+}
function setBlogText(source, time) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
diff --git a/src/template.html b/src/template.html
index be7858a..10aaa63 100644
--- a/src/template.html
+++ b/src/template.html
@@ -6,6 +6,7 @@
+
Teascade | $page$
diff --git a/ts/main.ts b/ts/main.ts
index b8beaec..7b2e6e4 100644
--- a/ts/main.ts
+++ b/ts/main.ts
@@ -23,24 +23,21 @@ function main(page: string) {
let search = window.location.search;
if (search != "") {
- search = search.slice(1, -1);
- let parts = search.split("=");
- if (parts[0] == "id") {
+ setBlogTextOnSearch(search);
+ }
- let timestamp: string;
- for (let i in window.blogpostData) {
- console.log(window.blogpostData[i].source);
- console.log(search + ".html");
- if (window.blogpostData[i].source == parts[1] + ".html") {
- timestamp = new Date(window.blogpostData[i].time).toUTCString();
- }
- }
- setBlogText(parts[1] + ".html", timestamp);
+ window.onpopstate = () => {
+ let page = window.location.pathname.split("/").filter(f => f != "")[0];
+ let search = window.location.search.slice(0, -1);
+
+ if (page == "blogtext") {
+ setBlogTextOnSearch(search);
}
+ openPage(page || "about", page, false);
}
}
-function openPage(page: string, new_url: string = null) {
+function openPage(page: string, new_url: string = null, renew_history=true) {
if (page == window.currPage) { return; }
slideOpacity(() => {
@@ -52,7 +49,10 @@ function openPage(page: string, new_url: string = null) {
let targetPg = "/" + target;
if (target == "about") { target = ""; targetPg = ""; };
- window.history.pushState(target, target, `${targetPg}/`);
+ if (renew_history) {
+ window.history.pushState(target, target, `${targetPg}/`);
+ }
+ document.title = "Teascade | " + page;
document.getElementsByClassName("stuffarea")[0].scrollTop = 0;
@@ -97,6 +97,23 @@ function addBlogposts() {
})
}
+function setBlogTextOnSearch(search: string) {
+ search = search.slice(1, -1);
+ let parts = search.split("=");
+ if (parts[0] == "id") {
+
+ let timestamp: string;
+ for (let i in window.blogpostData) {
+ console.log(window.blogpostData[i].source);
+ console.log(search + ".html");
+ if (window.blogpostData[i].source == parts[1] + ".html") {
+ timestamp = new Date(window.blogpostData[i].time).toUTCString();
+ }
+ }
+ setBlogText(parts[1] + ".html", timestamp);
+ }
+}
+
function setBlogText(source: string, time: string) {
let xmlhttp = new XMLHttpRequest();