Skip to content

Instantly share code, notes, and snippets.

@magasine
Last active September 14, 2022 02:10
Show Gist options
  • Save magasine/94f5b70d9f0744a3adfa1212b622dc95 to your computer and use it in GitHub Desktop.
Save magasine/94f5b70d9f0744a3adfa1212b622dc95 to your computer and use it in GitHub Desktop.
! Cursor w/ ruler line - Toggle
javascript : (function () {
if (!document.getElementById("redLine")) {
h = document.createElement("div");
h.setAttribute("id", "redLine");
h.setAttribute("style", "width:100%;height:3px;background-color:red;font-size:inherit;line-height:inherit;position:absolute;left:0px;top:0px;z-index:999;opacity:1;");
document.getElementsByTagName("body")[0].appendChild(h);
window.onmousemove = function (e) {
var h = document.getElementById("redLine");
h.style.top = (e.pageY + 15) + "px";
h.setAttribute("class", e.pageY);
}
} else {
h.remove();
}
})();
// Bookmarklet
// Adapted from https://gist.github.com/bradmontgomery/1787016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment