Last active
September 12, 2024 14:30
-
-
Save GalvinGao/3ee1734db890e33112eeec81ba47366e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Gekichumai JP NET Auto Login | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-03-30 | |
// @description try to take over the world! | |
// @author You | |
// @match https://maimaidx.jp/* | |
// @match https://new.chunithm-net.com/* | |
// @match https://ongeki-net.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=maimaidx.jp | |
// @grant none | |
// ==/UserScript== | |
const SEGAID_USERNAME = "YOUR_USERNAME"; | |
const SEGAID_PASSWORD = "YOUR_PASSWORD"; | |
function getPageState() { | |
const haveError = document.location.href.endsWith("/error/") || document.location.href.endsWith("/error") || document.location.href.endsWith("/nError/") || document.location.href.endsWith("/nError") | |
if (haveError) return "error" | |
const haveLoginField = !!document.querySelector("input[name=segaId]") | |
if (haveLoginField) return "auth" | |
const isAimeSelection = !!document.querySelector("img[src*=title_course\\.png]") || !!document.querySelector("button.btn_select_aime") || !!document.querySelector(".aime_main_block > form > button[type=submit]") | |
if (isAimeSelection) return "aimeSelection" | |
return null | |
} | |
function getGame() { | |
if (document.location.hostname.includes("chunithm")) return "chunithm"; | |
if (document.location.hostname.includes("maimai")) return "maimai"; | |
if (document.location.hostname.includes("ongeki")) return "ongeki"; | |
return null; | |
} | |
(function() { | |
'use strict'; | |
const page = getPageState(); | |
const game = getGame(); | |
console.log("[segaAutoLogin] page state", page); | |
console.log("[segaAutoLogin] game", game); | |
switch (page) { | |
case "error": | |
if (game === "chunithm") { | |
document.querySelector("div.btn_back").click(); | |
} else if (game === "maimai") { | |
document.querySelector("div.t_c > button.f_0").click(); | |
} else if (game === "ongeki") { | |
document.querySelector("div.t_c > button.f_0").click(); | |
} | |
break; | |
case "auth": | |
document.querySelector("input[name=segaId]").value = SEGAID_USERNAME; | |
document.querySelector("input[name=password]").value = SEGAID_PASSWORD; | |
document.querySelector("button[type=submit]").click(); | |
break; | |
case "aimeSelection": | |
if (game === "chunithm") { | |
document.querySelector("button.btn_select_aime").click(); | |
} else if (game === "maimai") { | |
document.querySelector("form > button[type=submit] > img.h_55").click(); | |
} else if (game === "ongeki") { | |
document.querySelector(".aime_main_block > form > button[type=submit]").click(); | |
} | |
break; | |
case null: | |
console.log("null page state") | |
break; | |
default: | |
console.warn("entered unknown page state:", page); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment