Click Counter Button

A button that counts clicks

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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
        }
    });
})();