UserScript Đăng Script

Đưa nút đăng script ra phía tay phải

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         UserScript Đăng Script
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Đưa nút đăng script ra phía tay phải
// @author       Bạn
// @match        https://greatest.deepsurf.us/vi/scripts/*/versions/new
// @match        https://greatest.deepsurf.us/vi/scripts/*/versions
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Thêm CSS để căn chỉnh nút
    GM_addStyle(`
        #submitButtonContainer {
            position: fixed;
            top: 150px; /* Điều chỉnh vị trí theo nhu cầu */
            right: 20px; /* Căn phải */
            z-index: 9999;
        }
        #submitButton {
            background-color: #0076ff;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
        }
        #submitButton:hover {
            background-color: #005bb5;
        }
    `);

    // Tạo nút "Đăng Script"
    const buttonContainer = document.createElement('div');
    buttonContainer.id = 'submitButtonContainer';
    const submitButton = document.createElement('button');
    submitButton.id = 'submitButton';
    submitButton.textContent = 'Đăng Script';

    // Thêm sự kiện click vào nút
    submitButton.addEventListener('click', () => {
        const form = document.querySelector('form.new_script_version');
        if (form) {
            form.submit(); // Gửi form khi nhấn nút
        } else {
            alert('Không tìm thấy form để đăng script.');
        }
    });

    buttonContainer.appendChild(submitButton);
    document.body.appendChild(buttonContainer);
})();