WIP
This commit is contained in:
parent
1b0878bdc5
commit
b20e90fc60
@ -1,17 +1,6 @@
|
||||
$(function () {
|
||||
var webSocket = getWebSocket(),
|
||||
const webSocket = window.socket,
|
||||
queryMap = getQueryMap(),
|
||||
isDebug = localStorage.getItem('phantombot_overlay_debug') === 'true' || false;
|
||||
queue = [];
|
||||
|
||||
const getWebSocket = () => {
|
||||
let socketUri = ((window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host + '/ws/overlay'), // URI of the socket.
|
||||
reconnectInterval = 5000; // How often in milliseconds we should try reconnecting.
|
||||
|
||||
return new ReconnectingWebSocket(socketUri, null, {
|
||||
reconnectInterval: reconnectInterval
|
||||
});
|
||||
}
|
||||
|
||||
const getQueryMap = () => {
|
||||
let queryString = window.location.search,
|
||||
@ -26,14 +15,6 @@ $(function () {
|
||||
return queryMap;
|
||||
}
|
||||
|
||||
const printDebug = (message, force) => {
|
||||
if (isDebug || force) console.log('%c[PhantomBot Log]', 'color: #6441a5; font-weight: 900;', message);
|
||||
}
|
||||
window.toggleDebug = (toggle) => {
|
||||
localStorage.setItem('phantombot_overlay_debug', toggle.toString());
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const getOrElse = (option, def) => queryMap.has(option) ? queryMap.get(option): def;
|
||||
|
||||
const handleSocketMessage = (e)=>{
|
||||
|
Loading…
x
Reference in New Issue
Block a user