diff --git a/endpoint/get.php b/endpoint/get.php new file mode 100644 index 0000000..e69de29 diff --git a/setup-db.sql b/setup-db.sql new file mode 100644 index 0000000..e69de29 diff --git a/userscript-bot/bot.js b/userscript-bot/bot.js new file mode 100644 index 0000000..a30c446 --- /dev/null +++ b/userscript-bot/bot.js @@ -0,0 +1,29 @@ +(function() { + 'use strict'; + + const targetJSName = "FhFdCc"; + let observer = null; + + const receivedMessage = (mutations,observer) => { + const mutation = mutations[3].addedNodes[0]; + console.log(mutations); + } + + function attachObserver() { + const target = document.querySelector(`[jsname="${targetJSName}"]`); + + observer = new MutationObserver(receivedMessage); + observer.observe(target,{ + subtree: true, + childList: true, + attributes: true, + characterData: true + }); + } + + // Start the StadiaAvatar bot with 'window._StadiaAvatar()' + window._StadiaAvatar = () => { + attachObserver(); + console.log("StadiaAvatar bot started."); + } +})(); \ No newline at end of file diff --git a/userscript-client/UserScript.js b/userscript-client/UserScript.js new file mode 100644 index 0000000..437bb8e --- /dev/null +++ b/userscript-client/UserScript.js @@ -0,0 +1,11 @@ +// ==UserScript== +// @name Stadia Avatars +// @namespace https://victorwesterlund.com/ +// @version 0.1 +// @description try to take over the world! +// @author VictorWesterlund +// @match https://stadia.google.com/* +// @grant none +// @require file://C:\path\to\userscript.user.js +// @noframes +// ==/UserScript== \ No newline at end of file diff --git a/userscript-client/script.js b/userscript-client/script.js new file mode 100644 index 0000000..278b13a --- /dev/null +++ b/userscript-client/script.js @@ -0,0 +1,32 @@ +(function() { + 'use strict'; + + function getElementByJSname(name) { + return document.querySelector(`[jsname="${name}"]`); + } + + const myID = () => { + let element = getElementByJSname("HiaYvf"); + return element.getAttribute("data-player-id"); + } + + function locationChanged() { + switch(window.location.pathname) { + case "/home": console.log("home"); break; + case "/settings": console.log("settings"); break; + default: break; + } + } + + let currentLocation = window.location.href; + + // Poll window.location.href for changes + let poll = setInterval(() => { + if(window.location.href != currentLocation) { + currentLocation = window.location.href; + locationChanged(); + } + },500); + + locationChanged(); +})(); \ No newline at end of file