NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name AC-Global-Socket
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @copyright 2021, Reimu(https://openuserjs.org/users/Reimu)
// @license MIT
// @description Basis-Skript, damit die anderen Skripts fuktionieren. Stellt Socket-Events Global zur Verfügung.
// @author Slash aka. Reimu or Nick S.
// @include https://www.anime.academy/chat?room=*
// @include https://anime.academy/chat?room=*
// @include anime.academy/chat?room=*
// @icon https://www.google.com/s2/favicons?domain=anime.academy
// @grant none
// ==/UserScript==
(function() {
'use strict';
const globalSocketReady = new Event('globalSocketReady');
io.Socket.prototype.o_emit = io.Socket.prototype.o_emit || io.Socket.prototype.emit;
io.Socket.prototype.emit = function (eventName, ...args) {
if(!window.socket) {
window.socket = this
window.dispatchEvent(globalSocketReady);
}
window.dispatchEvent(new CustomEvent('socketEmit', {'detail': {eventName: eventName, args: [...args]}}));
return this.o_emit(eventName, ...args);
}
})();