This is comment for paste
owot cursor
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* I remixed it, in https://pastebin.com/i92ikqhA */
- alert('You can change settings in the menu');
- console.log("Original from https://github.com/KyleCypher/owot/blob/master/mouseCursor.js")
- console.log("Pastebin by Falling1")
- window.open('https://pastebin.com/BzSdTnHg')
- /* still have no clue how to fix links */
- window.addEventListener('beforeunload', (event) => {
- if (getLink(...pos) !== null) return;
- event.preventDefault();
- unloading = true;
- if (!getCharProtection(...cursorCoords)) writeCharTo(erase, erasecolor, ...currentPosition, true);
- owot.removeEventListener("mousemove", showCursor);
- });
- owot.addEventListener("mousemove", showCursor);
- ee = "๐ฎฐ";
- rcwo = false;
- pos = [0, 0, 0, 0];
- color = 0x000000;
- erase = getChar(...pos);
- erasecolor = getCharColor(...pos);
- erasedecorations = getCharDecoration(...pos);
- nodecorations = {bold: 0, italic: 0, under: 0, strike: 0};
- firstLetter = true;
- unloading = false;
- oldCoords = [0, 0, 0, 0];
- writeFlushRate=40; setWriteInterval();
- function showCursor(e) {
- pos = getTileCoordsFromMouseCoords(e.pageX, e.pageY);
- (getCharProtection(...pos) || !getCharInfo(...pos).loaded) ? defaultCursor = "default" : defaultCursor = "none";
- owot.style.cursor = defaultCursor;
- if (!getCharInfo(...pos).loaded) return;
- firstLetter = true;
- olddecorations = textDecorationModes;
- textDecorationModes = erasedecorations ?? nodecorations;
- if (!getCharProtection(...oldCoords) && getLink(...oldCoords) == null) writeCharTo(erase, erasecolor, ...oldCoords, true);
- textDecorationModes = olddecorations;
- erase = getChar(...pos);
- erasecolor = getCharColor(...pos);
- erasedecorations = getCharDecoration(...pos);
- if (!getCharProtection(...pos) && getLink(...pos) == null) writeCharTo(ee, color, ...pos, true);
- oldCoords = pos;
- };
- document.onkeydown = function(e) {
- if (e.key == "Escape") {
- owot.removeEventListener("mousemove", showCursor);
- location.reload();
- };
- };
- w.on('tileUpdate', function() {
- if (getChar(...pos) != ee && !unloading && getCharInfo(...pos).loaded) {
- if (!getCharProtection(...pos)) {
- erase = getChar(...pos);
- erasecolor = getCharColor(...pos);
- erasedecorations = getCharDecoration(...pos);
- if (!rcwo) return;
- writeCharTo(ee, color, ...pos, true);
- }
- };
- });
- w.on('write', function() {
- if (getChar(...pos) != ee && !unloading && getCharInfo(...pos).loaded) {
- if (!getCharProtection(...pos)) {
- erase = getChar(...pos);
- erasecolor = getCharColor(...pos);
- erasedecorations = getCharDecoration(...pos);
- if (!rcwo) return;
- writeCharTo(ee, color, ...pos, true);
- }
- };
- });
- document.onmousedown = function() {
- owot.removeEventListener("mousemove", showCursor)
- };
- document.onmouseup = function() {
- owot.addEventListener("mousemove", showCursor)
- };
- menu.addOption('Change cursor color', function() {I = prompt('Enter new color (hex code)', "000000"); if (I.startsWith('#')) I = I.substr(1); I = parseInt(I, 16); if(isNaN(I)) return; color = I});
- menu.addOption('Change cursor character', function() {I = prompt('Enter new character', ee); if(I == null) return; a = Array.from(I); ee = a[0]});
- menu.addCheckboxOption("Rewrite cursor when overwritten", function() {rcwo = true}, function() {rcwo = false}, false);
- defaultCursor = "none";
Advertisement
Add Comment
Please, Sign In to add comment