omegafox/patches/cursor-highlighter.patch
2024-10-02 21:15:46 -05:00

36 lines
1.3 KiB
Diff

diff --git a/browser/base/content/browser-init.js b/browser/base/content/browser-init.js
index 63c9c39741..cc7fa914c0 100644
--- a/browser/base/content/browser-init.js
+++ b/browser/base/content/browser-init.js
@@ -292,6 +292,31 @@ var gBrowserInit = {
}
}
+ if (ChromeUtils.camouGetBool("showcursor", true)) {
+ let cursorFollower = document.createElement("div");
+ cursorFollower.id = "cursor-highlighter";
+ cursorFollower.style.cssText = `
+ position: fixed;
+ width: 10px;
+ height: 10px;
+ background-color: rgba(255,105,105,0.8);
+ border-radius: 50%;
+ pointer-events: none;
+ z-index: 2147483647;
+ transform: translate(-50%, -50%);
+ box-shadow:
+ 0 0 0 5px rgba(255,105,105,0.5),
+ 0 0 0 10px rgba(255,105,105,0.3),
+ 0 0 0 15px rgba(255,105,105,0.1);
+ `;
+ document.documentElement.appendChild(cursorFollower);
+
+ window.addEventListener('mousemove', e => {
+ cursorFollower.style.left = `${e.clientX}px`;
+ cursorFollower.style.top = `${e.clientY}px`;
+ });
+ }
+
// Wait until chrome is painted before executing code not critical to making the window visible
this._boundDelayedStartup = this._delayedStartup.bind(this);
window.addEventListener("MozAfterPaint", this._boundDelayedStartup);