bonk.io Account Switcher

Use this script in order to easily switch between your accounts!

// ==UserScript==
// @name         bonk.io Account Switcher
// @namespace    http://tampermonkey.net/
// @version      1.1.1
// @description  Use this script in order to easily switch between your accounts!
// @author       kitaesq
// @match        https://bonk.io/gameframe-release.html
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bonk.io
// @grant        none
// ==/UserScript==
console.log("Loading account switcher...")
if (!window.kitaes) window.kitaes = {}
window.kitaes.accSwitcher = () => {
    const accContainer = document.getElementById("guestOrAccountContainer")
    if (!accContainer) {
        setTimeout(window.kitaes.accSwitcher, 100)
        console.log("trying again")
        return
    }
    accContainer.children[0].style.margin = "0"
    accContainer.children[1].style.margin = "0"
    accContainer.style.height = "425px"
    const main = document.createElement("div")
    main.className = "windowShadow accountContainer"
    main.style.position = "absolute"
    main.style.left = "0"
    main.style.right = "0"
    main.style.bottom = "0"
    main.style.height = "200px"
    main.style.borderRadius = "7px"
    main.style.backgroundColor = "var(--greyWindowBGColor)"
    const mainHeader = document.createElement("div")
    mainHeader.className = "windowTopBar windowTopBar_classic"
    mainHeader.innerText = "Account Switcher"
    main.append(mainHeader)
    const labelBox = document.createElement("div")
    labelBox.className = "guestOrAccountContainerLabelBox guestOrAccountContainerLabelSingleLine"
    labelBox.innerText = "Select an account to play with. New accounts will be added automatically"
    labelBox.style.width = "670px"
    main.append(labelBox)
    const buttonContainer = document.createElement("div")
    const deleteButtonContainer = document.createElement("div")
    function addButton(username,password){
        const button = document.createElement("div")
        button.className = "brownButton brownButton_classic buttonShadow thickerText"
        button.style.height = "40px"
        button.style.lineHeight = "40px"
        button.style.fontSize = "18px"
        button.style.marginLeft = "12px"
        button.style.marginRight = "12px"
        button.style.flexGrow = "1"
        button.style.flexBasis = "0px"
        button.style.overflow = "hidden"
        button.style.textOverflow = "ellipsis"
        button.innerText = username
        button.onclick = () => login(username, password)
        buttonContainer.append(button)
        const deleteButton = document.createElement("div")
        deleteButton.className = "brownButton brownButton_classic buttonShadow mapeditor_leftbox_bottombutton"
        deleteButton.style.backgroundImage = "url(../graphics/delete.png)"
        deleteButton.onclick = () => {
            deleteButton.classList.add("mapeditor_leftbox_deletebuttonconfirm")
            deleteButton.onclick = () => {
                button.remove()
                deleteButton.remove()
                delete accList[username]
                localStorage.kitaes_accSwitcher = JSON.stringify(accList)
            }
        }
        deleteButtonContainer.append(deleteButton)
    }
    buttonContainer.style.position = "absolute"
    deleteButtonContainer.style.position = "absolute"
    buttonContainer.style.bottom = "15px"
    deleteButtonContainer.style.bottom = "-20px"
    buttonContainer.style.left = "12px"
    deleteButtonContainer.style.left = "12px"
    buttonContainer.style.right = "12px"
    deleteButtonContainer.style.right = "12px"
    buttonContainer.style.display = "flex"
    deleteButtonContainer.style.display = "flex"
    buttonContainer.style.justifyContent = "space-between"
    deleteButtonContainer.style.justifyContent = "space-around"
    main.append(buttonContainer)
    main.append(deleteButtonContainer)
    try{
        var accList = JSON.parse(localStorage.kitaes_accSwitcher)
    }
    catch(e){
        var accList = {}
        localStorage.kitaes_accSwitcher = "{}"
    }
    function login(username,password){
        loginwindow_username.value = username
        loginwindow_password.value = password
        accContainer.style.visibility = "hidden"
        loginwindow_submitbutton.click()
        guestOrAccountContainer_accountButton.click()
    }
    for (const a of Object.keys(accList)){
        addButton(a, accList[a])
    }
    accContainer.append(main)
    loginwindow_submitbutton.onclick = () => {
        if (accList[loginwindow_username.value]) return
        accList[loginwindow_username.value] = loginwindow_password.value
        localStorage.kitaes_accSwitcher = JSON.stringify(accList)
        addButton(loginwindow_username.value, loginwindow_password.value)
    }
}
window.kitaes.accSwitcher()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址