Initial commit
This commit is contained in:
commit
6afb792b77
23
example.html
Normal file
23
example.html
Normal 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
27
window-status.js
Normal 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;
|
||||
});
|
Loading…
Reference in New Issue
Block a user