Added history traversing and favicon
This commit is contained in:
parent
e944282185
commit
ba629714b8
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="favicon.png"></link>
|
||||||
|
|
||||||
<title>Teascade | blog</title>
|
<title>Teascade | blog</title>
|
||||||
</head>
|
</head>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="favicon.png"></link>
|
||||||
|
|
||||||
<title>Teascade | blogtext</title>
|
<title>Teascade | blogtext</title>
|
||||||
</head>
|
</head>
|
||||||
|
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="favicon.png"></link>
|
||||||
|
|
||||||
<title>Teascade | games</title>
|
<title>Teascade | games</title>
|
||||||
</head>
|
</head>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="favicon.png"></link>
|
||||||
|
|
||||||
<title>Teascade | about</title>
|
<title>Teascade | about</title>
|
||||||
</head>
|
</head>
|
||||||
|
45
js/main.js
45
js/main.js
@ -10,23 +10,20 @@ function main(page) {
|
|||||||
addBlogposts();
|
addBlogposts();
|
||||||
var search = window.location.search;
|
var search = window.location.search;
|
||||||
if (search != "") {
|
if (search != "") {
|
||||||
search = search.slice(1, -1);
|
setBlogTextOnSearch(search);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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 (new_url === void 0) { new_url = null; }
|
||||||
|
if (renew_history === void 0) { renew_history = true; }
|
||||||
if (page == window.currPage) {
|
if (page == window.currPage) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -42,7 +39,10 @@ function openPage(page, new_url) {
|
|||||||
targetPg = "";
|
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;
|
document.getElementsByClassName("stuffarea")[0].scrollTop = 0;
|
||||||
slideOpacity(function () {
|
slideOpacity(function () {
|
||||||
}, 1.5);
|
}, 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) {
|
function setBlogText(source, time) {
|
||||||
var xmlhttp = new XMLHttpRequest();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
xmlhttp.onreadystatechange = function () {
|
xmlhttp.onreadystatechange = function () {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="favicon.png"></link>
|
||||||
|
|
||||||
<title>Teascade | $page$</title>
|
<title>Teascade | $page$</title>
|
||||||
</head>
|
</head>
|
||||||
|
45
ts/main.ts
45
ts/main.ts
@ -23,24 +23,21 @@ function main(page: string) {
|
|||||||
|
|
||||||
let search = window.location.search;
|
let search = window.location.search;
|
||||||
if (search != "") {
|
if (search != "") {
|
||||||
search = search.slice(1, -1);
|
setBlogTextOnSearch(search);
|
||||||
let parts = search.split("=");
|
}
|
||||||
if (parts[0] == "id") {
|
|
||||||
|
|
||||||
let timestamp: string;
|
window.onpopstate = () => {
|
||||||
for (let i in window.blogpostData) {
|
let page = window.location.pathname.split("/").filter(f => f != "")[0];
|
||||||
console.log(window.blogpostData[i].source);
|
let search = window.location.search.slice(0, -1);
|
||||||
console.log(search + ".html");
|
|
||||||
if (window.blogpostData[i].source == parts[1] + ".html") {
|
if (page == "blogtext") {
|
||||||
timestamp = new Date(window.blogpostData[i].time).toUTCString();
|
setBlogTextOnSearch(search);
|
||||||
}
|
|
||||||
}
|
|
||||||
setBlogText(parts[1] + ".html", timestamp);
|
|
||||||
}
|
}
|
||||||
|
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; }
|
if (page == window.currPage) { return; }
|
||||||
|
|
||||||
slideOpacity(() => {
|
slideOpacity(() => {
|
||||||
@ -52,7 +49,10 @@ function openPage(page: string, new_url: string = null) {
|
|||||||
let targetPg = "/" + target;
|
let targetPg = "/" + target;
|
||||||
if (target == "about") { target = ""; targetPg = ""; };
|
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;
|
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) {
|
function setBlogText(source: string, time: string) {
|
||||||
let xmlhttp = new XMLHttpRequest();
|
let xmlhttp = new XMLHttpRequest();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user