window-status/window-status.js

28 lines
690 B
JavaScript
Raw Normal View History

2023-12-04 17:16:46 +00:00
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;
});