Added custom "js-links"
This commit is contained in:
parent
6f76428cef
commit
cf1a03d8da
@ -34,8 +34,8 @@
|
||||
<ul>
|
||||
<li><em>A normal person</em></li>
|
||||
</ul>
|
||||
<p>So assuming I've now <em>totally</em> caught your interest, how about you check out my games
|
||||
and my blog, and if you want to get <strong>really</strong> invested, you could check out some of the
|
||||
<p>Assuming I've <em>totally</em> caught your interest (for now at least), how about you check out <a class="js-link" href="/games">my games</a>,
|
||||
<a class="js-link" href="/blog">my blog</a>, and if you want to get <strong>really</strong> invested, you should check out some of the
|
||||
following things:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/teascade">GitHub (Teascade)</a></li>
|
||||
|
@ -34,8 +34,8 @@
|
||||
<ul>
|
||||
<li><em>A normal person</em></li>
|
||||
</ul>
|
||||
<p>So assuming I've now <em>totally</em> caught your interest, how about you check out my games
|
||||
and my blog, and if you want to get <strong>really</strong> invested, you could check out some of the
|
||||
<p>Assuming I've <em>totally</em> caught your interest (for now at least), how about you check out <a class="js-link" href="/games">my games</a>,
|
||||
<a class="js-link" href="/blog">my blog</a>, and if you want to get <strong>really</strong> invested, you should check out some of the
|
||||
following things:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/teascade">GitHub (Teascade)</a></li>
|
||||
|
18
build.py
18
build.py
@ -87,16 +87,28 @@ def build_blogposts():
|
||||
def apply_custom_markdown(markdown):
|
||||
itch_embed_template = '<iframe class="itch-embedded" frameborder="0" src="https://itch.io/embed/$id$?linkback=true&bg_color=222&fg_color=fff&link_color=ff0091&border_color=303030" width="552" height="167"></iframe>'
|
||||
|
||||
regex = re.compile("\[itch\$[0-9]*\]")
|
||||
regex = re.compile(r"\[itch\$[0-9]*\]")
|
||||
|
||||
while regex.search(markdown) is not None:
|
||||
search = regex.search(markdown)
|
||||
split = regex.split(markdown)
|
||||
split = [markdown[:search.start()], markdown[search.end():]]
|
||||
|
||||
curr_id = int(markdown[(search.start() + 6):][:(search.end() - search.start() - 7)])
|
||||
|
||||
markdown = split[0] + itch_embed_template.replace("$id$", str(curr_id)) + split[1]
|
||||
|
||||
link_template = '<a class="js-link" href="$link$">$text$</a>'
|
||||
|
||||
regex = re.compile(r"\[[ -ö]*\]\$\([A-z0-9,./]*\)")
|
||||
|
||||
while regex.search(markdown, re.IGNORECASE) is not None:
|
||||
search = regex.search(markdown)
|
||||
split = [markdown[:search.start()], markdown[search.end():]]
|
||||
|
||||
parts = markdown[(search.start() + 1):][:(search.end() - search.start() - 2)].split("]$(")
|
||||
|
||||
markdown = split[0] + link_template.replace("$text$", parts[0]).replace("$link$", parts[1]) + split[1]
|
||||
|
||||
return markdown
|
||||
|
||||
def generate():
|
||||
@ -113,7 +125,7 @@ def generate():
|
||||
|
||||
template = apply_custom_markdown(template)
|
||||
|
||||
print("Done!n")
|
||||
print("Done!\n")
|
||||
|
||||
print("Generating pages..")
|
||||
with open('index.html', 'w+', encoding="utf-8") as f:
|
||||
|
@ -130,6 +130,10 @@ body, html {
|
||||
background-color: #363636; }
|
||||
.cont .stuffarea iframe.itch-embedded {
|
||||
width: 100%; }
|
||||
.cont .stuffarea .js-link {
|
||||
text-decoration: underline; }
|
||||
.cont .stuffarea .js-link:hover {
|
||||
cursor: pointer; }
|
||||
|
||||
noscript {
|
||||
color: #fff; }
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 3,
|
||||
"mappings": "AAIA,UAAW;EACR,gBAAgB,EAHZ,OAAO;EAIX,WAAW,EAAE,qBAAqB;EAClC,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;;AAGb,yBAA0B;EACvB,KAAM;IACH,OAAO,EAAE,gBAAgB;IACzB,KAAK,EAAE,IAAI;IAEX,aAAQ;MACL,MAAM,EAAE,eAAe;MAEvB,iBAAI;QACD,YAAY,EAAE,GAAG;QACjB,KAAK,EAAE,cAAc;QACrB,MAAM,EAAE,eAAe;QACvB,WAAW,EAAE,GAAG;QAChB,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AU,EAAE,IAAI;QAChB,KAAK,EAAE,OAAe;QACtB,YAAY,EAAE,iBAAsB;QACpC,SAAS,EAAE,aAAa;QAExB,qCAAQ;UACL,SAAS,EAAE,YAAY;MAG7B,2CAAiB;QACd,WAAW,EAAE,iBAAsB;MAEtC,mCAAS;QACN,gBAAgB,EAAE,OAAY;QAC9B,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,OAAO;MAGlB,oCAAU;QACP,gBAAgB,EAAE,OAAe;MAGpC,0CAAgB;QACb,gBAAgB,EAAE,OAAsB;IAI9C,qCAAqB;MAClB,KAAK,EAAE,IAAI;IAGd,yBAAS;MACN,eAAe,EAAE,SAAS;IAG7B,+BAAe;MACZ,MAAM,EAAE,OAAO;;AAKxB,QAAS;EACN,KAAK,EA5LE,IAAI",
|
||||
"sources": ["../scss/main.scss"],
|
||||
"names": [],
|
||||
"file": "main.css"
|
||||
|
@ -34,8 +34,8 @@
|
||||
<ul>
|
||||
<li><em>A normal person</em></li>
|
||||
</ul>
|
||||
<p>So assuming I've now <em>totally</em> caught your interest, how about you check out my games
|
||||
and my blog, and if you want to get <strong>really</strong> invested, you could check out some of the
|
||||
<p>Assuming I've <em>totally</em> caught your interest (for now at least), how about you check out <a class="js-link" href="/games">my games</a>,
|
||||
<a class="js-link" href="/blog">my blog</a>, and if you want to get <strong>really</strong> invested, you should check out some of the
|
||||
following things:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/teascade">GitHub (Teascade)</a></li>
|
||||
|
@ -34,8 +34,8 @@
|
||||
<ul>
|
||||
<li><em>A normal person</em></li>
|
||||
</ul>
|
||||
<p>So assuming I've now <em>totally</em> caught your interest, how about you check out my games
|
||||
and my blog, and if you want to get <strong>really</strong> invested, you could check out some of the
|
||||
<p>Assuming I've <em>totally</em> caught your interest (for now at least), how about you check out <a class="js-link" href="/games">my games</a>,
|
||||
<a class="js-link" href="/blog">my blog</a>, and if you want to get <strong>really</strong> invested, you should check out some of the
|
||||
following things:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/teascade">GitHub (Teascade)</a></li>
|
||||
|
23
js/main.js
23
js/main.js
@ -1,12 +1,24 @@
|
||||
function main(page) {
|
||||
window.currPage = page;
|
||||
window.currOpacity = 1;
|
||||
document.getElementById("about-link").attributes.removeNamedItem("href");
|
||||
document.getElementById("games-link").attributes.removeNamedItem("href");
|
||||
document.getElementById("blog-link").attributes.removeNamedItem("href");
|
||||
document.getElementById("about-link").removeAttribute("href");
|
||||
document.getElementById("games-link").removeAttribute("href");
|
||||
document.getElementById("blog-link").removeAttribute("href");
|
||||
document.getElementById("about-link").onclick = function () { return openPage("about"); };
|
||||
document.getElementById("games-link").onclick = function () { return openPage("games"); };
|
||||
document.getElementById("blog-link").onclick = function () { return openPage("blog"); };
|
||||
var links = document.getElementsByClassName("js-link");
|
||||
var _loop_1 = function(i) {
|
||||
var link = links[i];
|
||||
var href = link.getAttribute("href").split("/").filter(function (f) { return f != ""; })[0];
|
||||
link.removeAttribute("href");
|
||||
link.onclick = function () {
|
||||
openPage(href);
|
||||
};
|
||||
};
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
_loop_1(i);
|
||||
}
|
||||
addBlogposts();
|
||||
var search = window.location.search;
|
||||
if (search != "") {
|
||||
@ -29,9 +41,12 @@ function openPage(page, new_url, renew_history) {
|
||||
}
|
||||
slideOpacity(function () {
|
||||
var link = document.getElementById(window.currPage + "-link");
|
||||
var new_link = document.getElementById(window.currPage);
|
||||
if (link) {
|
||||
link.children[0].className = "";
|
||||
link.children[0].className = "active";
|
||||
}
|
||||
if (new_link) {
|
||||
new_link.children[0].className = "active";
|
||||
}
|
||||
document.getElementById(window.currPage).className = "hiddenarea";
|
||||
window.currPage = page;
|
||||
|
@ -175,6 +175,14 @@ body, html {
|
||||
iframe.itch-embedded {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.js-link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.js-link:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ And a few things I am not;
|
||||
|
||||
- _A normal person_
|
||||
|
||||
So assuming I've now _totally_ caught your interest, how about you check out my games
|
||||
and my blog, and if you want to get **really** invested, you could check out some of the
|
||||
Assuming I've _totally_ caught your interest (for now at least), how about you check out [my games]$(/games),
|
||||
[my blog]$(/blog), and if you want to get **really** invested, you should check out some of the
|
||||
following things:
|
||||
|
||||
- [GitHub (Teascade)](https://github.com/teascade)
|
||||
|
20
ts/main.ts
20
ts/main.ts
@ -11,14 +11,24 @@ function main(page: string) {
|
||||
window.currPage = page;
|
||||
window.currOpacity = 1;
|
||||
|
||||
document.getElementById("about-link").attributes.removeNamedItem("href");
|
||||
document.getElementById("games-link").attributes.removeNamedItem("href");
|
||||
document.getElementById("blog-link").attributes.removeNamedItem("href");
|
||||
document.getElementById("about-link").removeAttribute("href");
|
||||
document.getElementById("games-link").removeAttribute("href");
|
||||
document.getElementById("blog-link").removeAttribute("href");
|
||||
|
||||
document.getElementById("about-link").onclick = () => openPage("about");
|
||||
document.getElementById("games-link").onclick = () => openPage("games");
|
||||
document.getElementById("blog-link").onclick = () => openPage("blog");
|
||||
|
||||
let links = document.getElementsByClassName("js-link");
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
let link: HTMLLinkElement = <HTMLLinkElement>links[i];
|
||||
let href = link.getAttribute("href").split("/").filter(f => f != "")[0];
|
||||
link.removeAttribute("href");
|
||||
link.onclick = () => {
|
||||
openPage(href);
|
||||
}
|
||||
}
|
||||
|
||||
addBlogposts();
|
||||
|
||||
let search = window.location.search;
|
||||
@ -42,9 +52,11 @@ function openPage(page: string, new_url: string = null, renew_history=true) {
|
||||
|
||||
slideOpacity(() => {
|
||||
let link = document.getElementById(window.currPage + "-link");
|
||||
let new_link = document.getElementById(window.currPage);
|
||||
if (link) {
|
||||
link.children[0].className = ""
|
||||
link.children[0].className = "active"
|
||||
} if (new_link) {
|
||||
new_link.children[0].className = "active"
|
||||
}
|
||||
|
||||
document.getElementById(window.currPage).className = "hiddenarea";
|
||||
|
Loading…
Reference in New Issue
Block a user