less_retarded_wiki/pimp_my_lrs.html
2024-01-30 09:10:10 +01:00

65 lines
1.7 KiB
HTML

<!-- Fancy consoomer JavaScript version of LRS wiki, allows changing CSS. -->
<html>
<head>
<script>
let thisPage = "pimp_my_lrs.html";
let page = null;
let style = null;
function placeCSS(name, file)
{
var link = document.createElement("a");
link.href = thisPage + "?p=" + page + "&s=" + file;
link.innerHTML = "~" + name + "~";
var elem = document.getElementsByTagName("body")[0];
elem.prepend(link);
}
function load()
{
var url = new URL(window.location.href);
style = url.searchParams.get("s");
page = url.searchParams.get("p");
document.body.innerHTML = "";
var req = new XMLHttpRequest();
req.open("get",page);
req.send();
req.onload = function()
{
document.body.innerHTML =
req.response.toString().replaceAll(
/(<a[^>]*href=\")([^\"]*\.html)\"/g,"$1" + thisPage + "?p=$2&s=" + style + "\"");
var cl = document.getElementsByTagName('link')[0];
cl.parentNode.removeChild(cl);
var link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.media = "all";
link.href = style;
document.getElementsByTagName("head")[0].prepend(link);
var fl = document.getElementById("fancylink");
fl.href = "index.html";
fl.innerHTML = "chad version";
placeCSS("gay","style_gay.css");
placeCSS("90s","style_90s.css");
placeCSS("unix","style_unix.css");
placeCSS("dark","style_dark.css");
placeCSS("fancy","style_fancy.css");
placeCSS("plain","style.css");
};
}
</script>
</head>
<body onload="load()">
<p> u need javascript to consoom this site, wanna go <a href="index.html">back</a>? </p>
</body>
</html>