Copy Prolific ID to clipboard Button

Adds a copy to clipboard button in the upper right corner of the page

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Copy Prolific ID to clipboard Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a copy to clipboard button in the upper right corner of the page
// @match        *://*/*
// @grant        none
// @license MIT 
// ==/UserScript==

(function() {
    'use strict';

    // Create the button element
    let copyButton = document.createElement('button');
    copyButton.innerHTML = 'Prolific';
    copyButton.style.position = 'fixed';
    copyButton.style.top = '75px';
    copyButton.style.right = '10px';
    copyButton.style.zIndex = '9999';
    copyButton.style.borderRadius = '50%';
    copyButton.style.backgroundColor = 'green';
    copyButton.style.width = '30px';
    copyButton.style.height = '30px';

    // Add hover effect
    copyButton.onmouseover = function() {
        this.style.width = 'auto';
        this.style.height = 'auto';
        this.style.borderRadius = '5px';
        this.style.padding = '5px 10px';
    }
    copyButton.onmouseout = function() {
        this.style.width = '30px';
        this.style.height = '30px';
        this.style.borderRadius = '50%';
        this.style.padding = '0px';
    }

    // Add click event to copy text to clipboard
    copyButton.onclick = function() {
        navigator.clipboard.writeText('ENTERYOURIDHERE');
    }

    // Append the button to the body
    document.body.appendChild(copyButton);
})();