Brick Hill Better Pages

This script allows you to enter a page number in user crates.

// ==UserScript==
// @name         Brick Hill Better Pages
// @version      0.1
// @description  This script allows you to enter a page number in user crates.
// @author       Noah Cool Boy
// @match        https://www.brick-hill.com/user/*
// @match        https://www.brick-hill.com/customize/
// @icon         https://www.google.com/s2/favicons?domain=brick-hill.com
// @grant        none
// @run-at document-end
// @namespace https://gf.qytechs.cn/users/725966
// ==/UserScript==

// Jefemy can cope, don't care if it spam api :trol:

let pages = null

let interval = setInterval(() => {
    let pages = location.href.startsWith("https://www.brick-hill.com/user/") ? document.querySelector("#crate-v .center-text") : document.querySelector(".page-holder")
    if (!pages) return

    clearInterval(interval)

    function hook() {
        pages.children[1].addEventListener("click", () => {
            let pageNum = pages.children[1]
            let pageInput = document.createElement("input")
            pageInput.type = "number"
            pageInput.value = pageNum.value
            pages.insertBefore(pageInput, pageNum)
            pageNum.style.display = "none"
            pageInput.focus()

            pageInput.addEventListener("keyup", function (event) {
                if (event.keyCode === 13) {
                    pageInput.blur()
                }
            });

            pageInput.addEventListener("blur", () => {
                // navigation time
                let currentPage = parseInt(pageNum.innerText)
                let targetPage = parseInt(pageInput.value)
                let previousPage = -1

                pageInput.remove()
                pageNum.style.display = ""

                let interval = setInterval(() => {
                    pageNum = pages.children[1]
                    currentPage = parseInt(pageNum.innerText)
                    console.log(currentPage, targetPage)
                    if (previousPage == currentPage) return
                    if (targetPage == currentPage || (pages.children[0].disabled && targetPage < currentPage) || (pages.children[2].disabled && targetPage > currentPage)) {
                        clearInterval(interval)
                        if (location.href.startsWith("https://www.brick-hill.com/customize")) {
                            hook() // Ok jefemy, why the hell does the crate on the customize page refresh the page number and not on the user page? Why did you have to make the both different?
                        }
                        return
                    } else if (targetPage < currentPage) {
                        pages.children[0].click()
                    } else {
                        pages.children[2].click()
                    }
                    previousPage = currentPage
                }, 250)
            })
        })
    }

    hook()
}, 1000)

QingJ © 2025

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