Copy Password from Ovagames

Copy "password: ###" from ovagames pages

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Copy Password from Ovagames
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  Copy "password: ###" from ovagames pages
// @author       Starbez
// @license      MIT
// @match        https://www.ovagames.com/*.html
// @grant        GM_setClipboard
// ==/UserScript==

(function() {
    'use strict';

    console.log('Tampermonkey script loaded.');

    // Function to create and show a notification
    function showNotification(message) {
        const notification = document.createElement('div');
        notification.innerText = message;
        notification.style.position = 'fixed';
        notification.style.bottom = '10px';
        notification.style.right = '10px';
        notification.style.padding = '10px';
        notification.style.backgroundColor = '#28a745';
        notification.style.color = 'white';
        notification.style.fontSize = '16px';
        notification.style.borderRadius = '5px';
        notification.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
        notification.style.zIndex = '10000';
        document.body.appendChild(notification);

        setTimeout(() => {
            notification.remove();
        }, 3000); // Remove the notification after 3 seconds
    }

    // Function to find and copy the password
    function copyPassword() {
        console.log('Page loaded. Looking for password in #link_download...');

        // Look for the element with ID 'link_download'
        const downloadElement = document.getElementById('link_download');

        if (downloadElement) {
            console.log('#link_download element found:', downloadElement);

            // Look for the specific pattern "password: ###" within the element
            const passwordPattern = /\d{3}/i;
            const elementText = downloadElement.innerText;
            console.log('Element text content:', elementText);

            const passwordText = elementText.match(passwordPattern);
            console.log('Matched password:', passwordText);

            if (passwordText) {
                // Copy the password to the clipboard
                GM_setClipboard(passwordText[0], 'text');
                showNotification('Password copied to clipboard: ' + passwordText[0]);
            } else {
                console.log('Password not found in #link_download.');
            }
        } else {
            console.log('#link_download element not found.');
        }
    }

    // Wait for the page to load
    window.addEventListener('load', copyPassword);
})();