WIP
This commit is contained in:
		@@ -1,17 +1,6 @@
 | 
				
			|||||||
$(function () {
 | 
					$(function () {
 | 
				
			||||||
    var webSocket = getWebSocket(),
 | 
					    const webSocket = window.socket,
 | 
				
			||||||
            queryMap = getQueryMap(),
 | 
					          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 = () => {
 | 
					    const getQueryMap = () => {
 | 
				
			||||||
        let queryString = window.location.search,
 | 
					        let queryString = window.location.search,
 | 
				
			||||||
@@ -26,14 +15,6 @@ $(function () {
 | 
				
			|||||||
        return queryMap;
 | 
					        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 getOrElse = (option, def) => queryMap.has(option) ?  queryMap.get(option): def;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const handleSocketMessage = (e)=>{
 | 
					    const handleSocketMessage = (e)=>{
 | 
				
			||||||
@@ -54,7 +35,7 @@ $(function () {
 | 
				
			|||||||
            } else if(message['eventType'] == 'timer') {
 | 
					            } else if(message['eventType'] == 'timer') {
 | 
				
			||||||
                console.log("New timer !! ", message['data'])
 | 
					                console.log("New timer !! ", message['data'])
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
               
 | 
					
 | 
				
			||||||
        } catch (ex) {
 | 
					        } catch (ex) {
 | 
				
			||||||
            console.log(ex)
 | 
					            console.log(ex)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user