前往GreasyFork

吧啦吧啦

当前为 2021-12-10 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         前往GreasyFork
// @namespace    mimiko/greasyfork
// @version      0.0.3
// @description  吧啦吧啦
// @author       Mimiko
// @license      MIT
// @include      *
// @grant        GM.addStyle
// ==/UserScript==

(() => {
    if (window.top !== window.self)
        return;
    const insertHtml = () => {
        const $el = document.createElement('a');
        $el.setAttribute('href', `https://greasyfork.org/zh-CN/scripts/by-site/${window.location.host.split('.').slice(-2).join('.')}?filter_locale=0`);
        $el.setAttribute('id', 'btn-jump-greasyfork');
        $el.setAttribute('target', '_blank');
        document.body.appendChild($el);
        return $el;
    };
    const insertCss = () => {
        GM.addStyle(`
      #btn-jump-greasyfork {
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 65535;
        width: 32px;
        height: 32px;
        background-color: rgb(153, 0, 0);
        border-radius: 0 32px 0 0;
        cursor: pointer;
        transition: all 0.3s ease;
        opacity: 0;
        transform-origin: left bottom;
        transform: scale(0.5);
      }
      #btn-jump-greasyfork:hover {
        opacity: 1;
        transform: scale(1);
      }
    `);
    };
    const main = () => {
        insertCss();
        insertHtml();
    };
    main();
})();