less_retarded_wiki/pimp_my_lrs.html

59 lines
1.4 KiB
HTML
Raw Normal View History

2024-01-29 23:38:34 +01:00
<!-- 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");
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 fl = document.getElementById("fancylink");
fl.href = "index.html";
fl.innerHTML = "chad version";
placeCSS("fancy","style_fancy.css");
placeCSS("plain","style.css");
};
var link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.media = "all";
link.href = style;
document.getElementsByTagName("head")[0].appendChild(link);
}
</script>
</head>
<body onload="load()">
<p> u need javascript to consoom this site, wanna go <a href="index.html">back</a>? </p>
</body>
</html>