GREEN   87   0
   521 5.3 KB    154

EO chat script

By Guest
Created: 2024-02-01 07:05:16
Expiry: Never

  1. 1.
    // ==UserScript==
  2. 2.
    // @name Everfree Outpost Chat Extensions
  3. 3.
    // @description Adds extra chat functionalities to Everfree Outpost.
  4. 4.
    // @author "Thorn Rose", "Green", "Script Anon", "haypone"
  5. 5.
    // @version 0.5.2
  6. 6.
    // @namespace everfree-outpost
  7. 7.
    // @match *://play.everfree-outpost.com/*
  8. 8.
    // @grant GM_addStyle
  9. 9.
    // @connect play.everfree-outpost.com
  10. 10.
    // @run-at document-start
  11. 11.
  12. 12.
    // ==/UserScript==
  13. 13.
     
  14. 14.
    var my_name="haypone"; //Your name on EO so it won't notify your own messages, it can be changed.
  15. 15.
    //var audio = new Audio("https://notificationsounds.com/storage/sounds/file-sounds-1127-beyond-doubt.mp3"); //The sound it will play, it can be changed
  16. 16.
    //-----------------------------
  17. 17.
     
  18. 18.
    var GREEN="#306030";
  19. 19.
    var PURPLE="#8844CC";
  20. 20.
    var BLUE="#303090";
  21. 21.
    var LIGHTBLUE="#306090";
  22. 22.
    var RED="#903030";
  23. 23.
    var DARKCYAN="#2D5B60";
  24. 24.
    var userMap = { //Change these to actual names and other colors
  25. 25.
    "True Lime": GREEN,
  26. 26.
    "Derpy": "#71797E",
  27. 27.
    "C": "#0047AB",
  28. 28.
    "Stubenhocker": "#f36044",
  29. 29.
    "Z": "#903060",
  30. 30.
    "E": PURPLE,
  31. 31.
    "F": PURPLE,
  32. 32.
    "G": "#686772",
  33. 33.
    "H": "#96663B",
  34. 34.
    "I": "#606090",
  35. 35.
    "J": "#609030",
  36. 36.
    "K": DARKCYAN,
  37. 37.
    "L": RED,
  38. 38.
    "M": "#FFE085",
  39. 39.
    "N": "#FDBFFF",
  40. 40.
    "O": RED,
  41. 41.
    "P": BLUE,
  42. 42.
    "Q": LIGHTBLUE
  43. 43.
    };
  44. 44.
     
  45. 45.
    let lastLine = '';
  46. 46.
     
  47. 47.
    var unreadMessages = 0;
  48. 48.
    var original_title = document.title; //Do not change
  49. 49.
    var blink_interval;
  50. 50.
    var is_blinking=false; //Do not change
  51. 51.
    addEventListener("mousemove", stop_blinking);
  52. 52.
     
  53. 53.
    const config = { attributes: false, childList: true, subtree: false };
  54. 54.
    // Callback function to execute when mutations are observed
  55. 55.
    const callback = (mutationList, observer) => {
  56. 56.
    for (const mutation of mutationList) {
  57. 57.
    if (mutation.type === "childList") {
  58. 58.
    newChatLine();
  59. 59.
    }
  60. 60.
    }};
  61. 61.
    // Create an observer instance linked to the callback function
  62. 62.
    const observer = new MutationObserver(callback);
  63. 63.
     
  64. 64.
    let chat;
  65. 65.
    //UI is created after the site is loaded, so we need to wait for it to exist
  66. 66.
    function init() {
  67. 67.
    let chats = document.getElementsByClassName("chat");
  68. 68.
    if(chats.length >= 2) {
  69. 69.
    chat = chats[1];
  70. 70.
    unreadMessages = 0;
  71. 71.
    const chatMessages = document.getElementsByClassName("chat-line");
  72. 72.
    for(let i = 1; i < chatMessages.length; i++) {
  73. 73.
    unreadMessages++;
  74. 74.
    modifyChatLine(chatMessages[i]);
  75. 75.
    }
  76. 76.
    observer.observe(chat, config);
  77. 77.
    clearInterval(initTimer);
  78. 78.
    }
  79. 79.
    }
  80. 80.
    const initTimer = setInterval(init, 150);
  81. 81.
     
  82. 82.
    window.onfocus = function() {
  83. 83.
    unreadMessages = 0;
  84. 84.
    stop_blinking();
  85. 85.
    }
  86. 86.
     
  87. 87.
    function stop_blinking(_) {
  88. 88.
    document.title = original_title;
  89. 89.
    clearInterval(blink_interval)
  90. 90.
    is_blinking = false;
  91. 91.
    }
  92. 92.
     
  93. 93.
    function blink_title(message) {
  94. 94.
    if (document.title===message) {
  95. 95.
    document.title=original_title;
  96. 96.
    } else {
  97. 97.
    document.title=message;
  98. 98.
    }
  99. 99.
    }
  100. 100.
     
  101. 101.
    function formatDate(date) {
  102. 102.
    var hours = date.getHours();
  103. 103.
    var minutes = date.getMinutes();
  104. 104.
    minutes = minutes < 10 ? '0'+minutes : minutes;
  105. 105.
    var strTime = hours + ':' + minutes;
  106. 106.
    return strTime;
  107. 107.
    }
  108. 108.
     
  109. 109.
    function urlify(text) {
  110. 110.
    var urlRegex = /(((https?:\/\/)|(www\.))[^\s]+)/g;
  111. 111.
    return text.replace(urlRegex, function(url,b,c) {
  112. 112.
    var url2 = (c == 'www.') ? 'http://' +url : url;
  113. 113.
    return '<a href="' +url2+ '" target="_blank">' + url + '</a>';
  114. 114.
    })
  115. 115.
    }
  116. 116.
     
  117. 117.
    function modifyChatLine(lastChatMessage) {
  118. 118.
    const wasScrolled = Math.abs(chat.scrollHeight - chat.scrollTop - chat.clientHeight) <= 5; //how many pixels
  119. 119.
    const user = lastChatMessage.children[0];
  120. 120.
    const text = lastChatMessage.children[1];
  121. 121.
    //lastLine = text;
  122. 122.
     
  123. 123.
    const userInnerText = user.innerText;
  124. 124.
    if(userInnerText.length == 0) return;
  125. 125.
    const username = userInnerText.substr(1, userInnerText.length - 2);
  126. 126.
     
  127. 127.
    if(userInnerText[0] == '[') return;
  128. 128.
    user.innerText = `[${formatDate(new Date)}] ${userInnerText}`;
  129. 129.
     
  130. 130.
    text.innerHTML = urlify(text.innerHTML);
  131. 131.
    if (my_name !== username && username !== "*") {
  132. 132.
    unreadMessages += 1;
  133. 133.
    //audio.play();
  134. 134.
    if (!is_blinking && !document.hasFocus()) { //Title blinks only if it is not currently blinking or if the user is not on EO tab
  135. 135.
    blink_interval = setInterval(function(){blink_title(`${unreadMessages} New message!`);},1000)
  136. 136.
    is_blinking=true
  137. 137.
    }
  138. 138.
    }
  139. 139.
     
  140. 140.
    /*if (username in userMap) {
  141. 141.
    user.css("color", userMap[username]);
  142. 142.
    user.css("font-weight", "bold");
  143. 143.
    user.css("text-shadow", "0px 0px 6px #fff");
  144. 144.
    }*/
  145. 145.
     
  146. 146.
    if(wasScrolled) chat.scrollTop = chat.scrollHeight - chat.clientHeight;
  147. 147.
    }
  148. 148.
     
  149. 149.
    function newChatLine () {
  150. 150.
    stop_blinking();
  151. 151.
    const chatMessages = document.getElementsByClassName("chat-line");
  152. 152.
    const lastChatMessage = chatMessages[chatMessages.length-1];
  153. 153.
    modifyChatLine(lastChatMessage);
  154. 154.
    }

Yandere Thread - Yandere Applejack (completed)

by Guest

Bonding with Nature

by Guest

The Long and Short of It (RGRE)

by Guest

incest relationships piece of the whole pie (lewd) by Frostybox[...]

by Guest

incest thread piece of the (non-canon) pie, limestone's pie by[...]

by Guest