Greasy Fork 还支持 简体中文。

Click Counter Button

A button that counts clicks

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Click Counter Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  A button that counts clicks 
// @author       Your Name
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create a button element
    const button = document.createElement('button');
    button.innerText = '0';
    button.style.fontSize = '24px';
    button.style.padding = '10px 20px';
    button.style.cursor = 'pointer';
    document.body.appendChild(button);

    // Click event listener
    let clickCount = 0;
    button.addEventListener('click', function() {
        clickCount++;
        button.innerText = clickCount;

        // Check if click count reaches 1000
        if (clickCount === 1000) {
            // Open YouTube video
            window.open('https://www.youtube.com/embed/NVLAPYx0dc8?', '_blank');

            // Alert message after video ends
            setTimeout(() => {
                alert("Wow! You reached 1000 clicks!!");
            }, 10000); // Assuming the video is approximately 10 seconds long
        }
    });
})();