-
1.
// ==UserScript==
-
2.
// @name Everfree Outpost Chat Extensions
-
3.
// @description Adds extra chat functionalities to Everfree Outpost.
-
4.
// @author "Thorn Rose", "Green", "Script Anon"
-
5.
// @version 0.2.0
-
6.
// @namespace everfree-outpost
-
7.
// @match *://play.everfree-outpost.com/*
-
8.
// @grant GM_addStyle
-
9.
// @connect play.everfree-outpost.com
-
10.
// @run-at document-start
- 11.
- 12.
-
13.
// ==/UserScript==
-
14.
-
15.
-
16.
window.localStorage.setItem("framerate_cap",12);
-
17.
window.localStorage.setItem("scale_ui",2);
-
18.
window.localStorage.setItem("scale_world",1);
-
19.
var my_name="" //Your name on EO so it won't notify your own messages, it can be changed.
-
20.
var audio = new Audio("https://notificationsounds.com/storage/sounds/file-sounds-1148-juntos.mp3"); //The sound it will play, it can be changed
-
21.
//-----------------------------
-
22.
-
23.
var GREEN="#306030";
-
24.
var PURPLE="#8844CC";
-
25.
var BLUE="#303090";
-
26.
var LIGHTBLUE="#306090";
-
27.
var RED="#903030";
-
28.
var DARKCYAN="#2D5B60";
-
29.
var userMap = { //Change these to actual names and other colors
-
30.
"A": GREEN,
-
31.
"B": GREEN,
-
32.
"C": "#0047AB",
-
33.
"D": LIGHTBLUE,
-
34.
"Z": "#903060",
-
35.
"E": PURPLE,
-
36.
"F": PURPLE,
-
37.
"G": "#686772",
-
38.
"H": "#96663B",
-
39.
"I": "#606090",
-
40.
"J": "#609030",
-
41.
"K": DARKCYAN,
-
42.
"L": RED,
-
43.
"M": "#FFE085",
-
44.
"N": "#FDBFFF",
-
45.
"O": RED,
-
46.
"P": BLUE,
-
47.
"Q": LIGHTBLUE
-
48.
};
-
49.
-
50.
var unreadMessages = 0;
-
51.
-
52.
waitForKeyElements("div.chat-line", modifyChatLine);
-
53.
var original_title = document.title; //Do not change
-
54.
var blink_interval;
-
55.
var is_blinking=false; //Do not change
-
56.
$(document).mousemove(function(event) {
-
57.
stop_blinking();
-
58.
});
-
59.
-
60.
window.onfocus = function() {
-
61.
unreadMessages = 0;
-
62.
stop_blinking();
-
63.
}
-
64.
-
65.
function stop_blinking() {
-
66.
document.title = original_title;
-
67.
clearInterval(blink_interval)
-
68.
is_blinking = false;
-
69.
}
-
70.
-
71.
function blink_title(message) {
-
72.
if (document.title===message) {
-
73.
document.title=original_title;
-
74.
} else {
-
75.
document.title=message;
-
76.
}
-
77.
}
-
78.
-
79.
function formatDate(date) {
-
80.
var hours = date.getHours();
-
81.
var minutes = date.getMinutes();
-
82.
var ampm = hours >= 12 ? 'PM' : 'AM';
-
83.
hours = hours % 12;
-
84.
hours = hours ? hours : 12; // the hour '0' should be '12'
-
85.
minutes = minutes < 10 ? '0'+minutes : minutes;
-
86.
var strTime = hours + ':' + minutes + ' ' + ampm;
-
87.
return strTime;
-
88.
}
-
89.
-
90.
-
91.
function modifyChatLine (jNode) {
-
92.
stop_blinking();
-
93.
unreadMessages += 1;
-
94.
var user = jNode.children(".chat-name");
-
95.
var text = jNode.children(".chat-text");
-
96.
lastLine = text;
-
97.
-
98.
var username = user.text().substr(1, user.text().length - 2);
-
99.
var chat = document.getElementsByClassName("chat")[1];
-
100.
-
101.
user.text(`[${formatDate(new Date)}] ${user.text()}`)
-
102.
if (my_name !== username && username !== "*") {
-
103.
audio.play();
-
104.
if (!is_blinking && !document.hasFocus()) { //Title blinks only if it is not currently blinking or if the user is not on EO tab
-
105.
blink_interval = setInterval(function(){blink_title(`${unreadMessages} New message!`);},1000)
-
106.
is_blinking=true
-
107.
}
-
108.
}
-
109.
-
110.
if (username in userMap) {
-
111.
user.css("color", userMap[username]);
-
112.
user.css("font-weight", "bold");
-
113.
user.css("text-shadow", "0px 0px 6px #fff");
-
114.
}
-
115.
-
116.
chat.scrollTop = chat.scrollHeight;
-
117.
}
by Guest
by Guest
by Guest
by Guest
by Guest