Greasy Fork

Benben Linker

Make a link to Benben Saver

当前为 2023-07-28 提交的版本,查看 最新版本

// ==UserScript==
// @name         Benben Linker
// @version      0.2
// @description  Make a link to Benben Saver
// @author       AZaphodBeeblebrox
// @match        *://*.luogu.*/user/*
// @license      MIT
// @icon         https://cdn.luogu.com.cn/upload/usericon/3.png
// @grant        none
// @namespace https://greasyfork.org/users/1137586
// ==/UserScript==

(function() {
    'use strict';

    var url = window.location.href;
    var regex = /\/user\/(\d+)/;
    var userid = url.match(regex)[1].toString();
    var button = document.createElement('button');
    button.textContent = '查看历史犇犇';
    button.style.position = "absolute";
    button.style.top = "100px";button.style.left = "100px";
    window.addEventListener('scroll', function() {
        var scrollY = window.scrollY;
        button.style.top = (100 + scrollY) + 'px';
    });
    button.classList.add('button-lgcm');
    button.addEventListener('click', async function() {
        window.location.href="https://lgf.imken.moe/user/"+userid
    });
    document.body.appendChild(button);
})();