Initial commit

This commit is contained in:
Reimar 2023-12-04 18:16:46 +01:00
commit 6afb792b77
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
2 changed files with 50 additions and 0 deletions

23
example.html Normal file
View File

@ -0,0 +1,23 @@
<ul>
<li>
<a href="https://google.com">This is a link</a>
</li>
<li>
<a href="https://duckduckgo.com">This is another link</a>
</li>
</ul>
<script src="window-status.js"></script>
<script>
var i = 0;
// Switch between "hello" and "Hello there :)" every 2 seconds - user must hover over a link and back for it to update
function update() {
if (i++ % 2 == 0) window.status = "hello";
else window.status = "Hello there :)";
}
update();
setInterval(update, 2000);
</script>

27
window-status.js Normal file
View File

@ -0,0 +1,27 @@
var statusLink = document.createElement("a");
with (statusLink) {
style.position = "fixed";
style.top = "0";
style.bottom = "0";
style.left = "0";
style.right = "0";
style.cursor = "inherit";
style.zIndex = "-100";
onclick = ondragstart = function(e) {
e.preventDefault();
return false;
};
}
window.addEventListener("load", function() {
document.body.appendChild(statusLink);
});
window.__defineSetter__("status", function(value) {
// If value contains uppercase or special characters, it needs to be specified as the path in the URL or it won't show
if (value.match(/^[a-z]+$/))
statusLink.href = "http://" + value;
else
statusLink.href = "http://./ " + value;
});