Brick Hill Forum link button

Allows you to link a forum post directly

// ==UserScript==
// @author       Noah Cool Boy
// @name         Brick Hill Forum link button
// @description  Allows you to link a forum post directly
// @version      1.4
// @match        https://www.brick-hill.com/forum/thread/*
// @namespace    https://gf.qytechs.cn/users/725966
// @icon         https://www.google.com/s2/favicons?domain=www.brick-hill.com
// ==/UserScript==

let options = document.querySelectorAll(".forum-options")
for(let x = 1; x < options.length; x++) {
    let option = options[x]
    option.lastElementChild.classList.add("mr4")
    let button = document.createElement("a")
    button.innerText = "LINK"
    button.classList.add("forum-quote")
    button.style.cursor = "pointer"
    option.appendChild(button)
    button.addEventListener("click",()=>{
        try {
            navigator.clipboard.writeText(document.location.href.replace(/#post\d+/,"")+"#"+option.parentElement.id)
        } catch(err) {
            navigator.permissions.query({name: "clipboard-write"}).then(result => {
                if (result.state == "granted" || result.state == "prompt") {
                    navigator.clipboard.writeText(document.location.href.replace(/#post\d+/,"")+"#"+option.parentElement.id)
                }
            });
        }
    })
}

QingJ © 2025

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