UserScript Đăng Script

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

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

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