Greasy Fork

Greasy Fork is available in English.

磁力链接提取插件

在网页内添加提取按钮,点击按钮后显示弹窗框包含该网页的磁力链接,并添加复制功能

当前为 2024-01-04 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         磁力链接提取插件
// @author       观察君
// @namespace    http://www.futa404.org/
// @version      1.3.3
// @description  在网页内添加提取按钮,点击按钮后显示弹窗框包含该网页的磁力链接,并添加复制功能
// @match        http://*/*
// @match        https://*/*
// @grant        none
// @license      AGPL-3.0-or-later
// ==/UserScript==




(function() {
    'use strict';

    let isDragging = false;
    let offsetX, offsetY;

    // 在页面加载完成后执行
    window.addEventListener('load', function() {
        addExtractionButton();
    });

    // 添加提取按钮
    function addExtractionButton() {
        const extractionButton = document.createElement('button');
        extractionButton.textContent = '提取磁力链接';
        extractionButton.style.position = 'fixed';
        extractionButton.style.top = '50%';
        extractionButton.style.right = '10px';
        extractionButton.style.transform = 'translateY(-50%)';
        extractionButton.style.padding = '10px';
        extractionButton.style.backgroundColor = '#3498db';
        extractionButton.style.color = '#fff';
        extractionButton.style.border = 'none';
        extractionButton.style.borderRadius = '3px';
        extractionButton.style.cursor = 'move';
        extractionButton.addEventListener('mousedown', startDrag);
        document.body.appendChild(extractionButton);
    }

    // 开始拖动按钮
    function startDrag(e) {
        isDragging = true;
        offsetX = e.clientX - parseFloat(e.target.style.right);
        offsetY = e.clientY - parseFloat(e.target.style.top);

        window.addEventListener('mousemove', drag);
        window.addEventListener('mouseup', stopDrag);
    }

    // 拖动按钮
    function drag(e) {
        if (isDragging) {
            const newX = e.clientX - offsetX;
            const newY = e.clientY - offsetY;

            document.querySelector('button').style.right = `${window.innerWidth - newX}px`;
            document.querySelector('button').style.top = `${newY}px`;
        }
    }

    // 停止拖动按钮
    function stopDrag() {
        isDragging = false;

        window.removeEventListener('mousemove', drag);
        window.removeEventListener('mouseup', stopDrag);
    }

    // 其他函数保持不变...
})();