Size
1.6 KB
Version
1.0.1
Created
Mar 7, 2026
Updated
about 1 month ago
1// ==UserScript==
2// @name Crosshair Line Tracker
3// @description Draws a red line from screen center to mouse cursor
4// @version 1.0.1
5// @match *://*/*
6// @icon https://chatgpt.com/favicon.ico
7// @grant none
8// ==/UserScript==
9(function() {
10 'use strict';
11
12 function init() {
13 // Create canvas element
14 let canvas = document.createElement("canvas");
15 canvas.width = window.innerWidth;
16 canvas.height = window.innerHeight;
17
18 // Style the canvas
19 canvas.style.position = "fixed";
20 canvas.style.top = "0";
21 canvas.style.left = "0";
22 canvas.style.pointerEvents = "none";
23 canvas.style.zIndex = "9999";
24
25 document.body.appendChild(canvas);
26
27 let ctx = canvas.getContext("2d");
28
29 // Track mouse movement and draw line
30 document.addEventListener("mousemove", function(e) {
31 // Clear previous frame
32 ctx.clearRect(0, 0, canvas.width, canvas.height);
33
34 // Draw line from center to mouse position
35 let bolaBranca = { x: 500, y: 300 };
36
37ctx.moveTo(bolaBranca.x, bolaBranca.y);
38
39 ctx.strokeStyle = "red";
40 ctx.lineWidth = 2;
41 ctx.stroke();
42 });
43
44 // Handle window resize
45 window.addEventListener("resize", function() {
46 canvas.width = window.innerWidth;
47 canvas.height = window.innerHeight;
48 });
49
50 console.log('Crosshair Line Tracker initialized');
51 }
52
53 // Initialize when DOM is ready
54 if (document.body) {
55 init();
56 } else {
57 document.addEventListener('DOMContentLoaded', init);
58 }
59})();