Dimka69
Nov 17th, 2022
43
-1
Never
This is comment for paste owot cursor
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* I remixed it, in https://pastebin.com/i92ikqhA */
  2. alert('You can change settings in the menu');
  3. console.log("Original from https://github.com/KyleCypher/owot/blob/master/mouseCursor.js")
  4. console.log("Pastebin by Falling1")
  5. window.open('https://pastebin.com/BzSdTnHg')
  6. /* still have no clue how to fix links */
  7. window.addEventListener('beforeunload', (event) => {
  8.     if (getLink(...pos) !== null) return;
  9.     event.preventDefault();
  10.     unloading = true;
  11.     if (!getCharProtection(...cursorCoords)) writeCharTo(erase, erasecolor, ...currentPosition, true);
  12.     owot.removeEventListener("mousemove", showCursor);
  13. });
  14. owot.addEventListener("mousemove", showCursor);
  15. ee = "๐Ÿฎฐ";
  16. rcwo = false;
  17. pos = [0, 0, 0, 0];
  18. color = 0x000000;
  19. erase = getChar(...pos);
  20. erasecolor = getCharColor(...pos);
  21. erasedecorations = getCharDecoration(...pos);
  22. nodecorations = {bold: 0, italic: 0, under: 0, strike: 0};
  23. firstLetter = true;
  24. unloading = false;
  25. oldCoords = [0, 0, 0, 0];
  26. writeFlushRate=40; setWriteInterval();
  27. function showCursor(e) {
  28.     pos = getTileCoordsFromMouseCoords(e.pageX, e.pageY);
  29.     (getCharProtection(...pos) || !getCharInfo(...pos).loaded) ? defaultCursor = "default" : defaultCursor = "none";
  30.     owot.style.cursor = defaultCursor;
  31.     if (!getCharInfo(...pos).loaded) return;
  32.     firstLetter = true;
  33.     olddecorations = textDecorationModes;
  34.     textDecorationModes = erasedecorations ?? nodecorations;
  35.     if (!getCharProtection(...oldCoords) && getLink(...oldCoords) == null) writeCharTo(erase, erasecolor, ...oldCoords, true);
  36.     textDecorationModes = olddecorations;
  37.     erase = getChar(...pos);
  38.     erasecolor = getCharColor(...pos);
  39.     erasedecorations = getCharDecoration(...pos);
  40.     if (!getCharProtection(...pos) && getLink(...pos) == null) writeCharTo(ee, color, ...pos, true);
  41.     oldCoords = pos;
  42. };
  43. document.onkeydown = function(e) {
  44.     if (e.key == "Escape") {
  45.         owot.removeEventListener("mousemove", showCursor);
  46.         location.reload();
  47.     };
  48. };
  49. w.on('tileUpdate', function() {
  50.     if (getChar(...pos) != ee && !unloading && getCharInfo(...pos).loaded) {
  51.         if (!getCharProtection(...pos)) {
  52.             erase = getChar(...pos);
  53.             erasecolor = getCharColor(...pos);
  54.             erasedecorations = getCharDecoration(...pos);
  55.             if (!rcwo) return;
  56.             writeCharTo(ee, color, ...pos, true);
  57.         }
  58.     };
  59. });
  60. w.on('write', function() {
  61.     if (getChar(...pos) != ee && !unloading && getCharInfo(...pos).loaded) {
  62.         if (!getCharProtection(...pos)) {
  63.             erase = getChar(...pos);
  64.             erasecolor = getCharColor(...pos);
  65.             erasedecorations = getCharDecoration(...pos);
  66.             if (!rcwo) return;
  67.             writeCharTo(ee, color, ...pos, true);
  68.         }
  69.     };
  70. });
  71. document.onmousedown = function() {
  72.     owot.removeEventListener("mousemove", showCursor)
  73. };
  74. document.onmouseup = function() {
  75.     owot.addEventListener("mousemove", showCursor)
  76. };
  77.  
  78. 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});
  79. menu.addOption('Change cursor character', function() {I = prompt('Enter new character', ee); if(I == null) return; a = Array.from(I); ee = a[0]});
  80. menu.addCheckboxOption("Rewrite cursor when overwritten", function() {rcwo = true}, function() {rcwo = false}, false);
  81.  
  82. defaultCursor = "none";
Advertisement
Add Comment
Please, Sign In to add comment