NewCP Play Now!

Replace the "Download App" button with "Play Now!" button on NewCP.net!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         NewCP Play Now!
// @icon         https://cdn2.steamgriddb.com/icon/e5860ae00103b3869a25d940345bf0fd.png
// @version      0.1
// @description  Replace the "Download App" button with "Play Now!" button on NewCP.net!
// @author       Dragon9135
// @match        https://newcp.net/*
// @license MIT
// @grant        none
// @namespace https://greasyfork.org/users/1372128
// ==/UserScript==

(function() {
    'use strict';

    // Start actions after page load
    window.addEventListener('load', function() {
        // Select the element with the "Download App" button
        let downloadButton = document.querySelector('a[href="/download"]');

        if (downloadButton) {
            // The new "Play Now!" create button
            const newPlayButton = document.createElement('a');
            newPlayButton.href = "/plays?force=true#/login";
            newPlayButton.setAttribute('data-rr-ui-event-key', "/plays?force=true#/login");
            newPlayButton.classList.add('nav-link');
            newPlayButton.innerHTML = `
                <button type="submit" id="Navbar_download-btn__6D0hQ" class="btn btn-danger">
                    <div id="Navbar_download-text__FSfPd" style="border: none; position: unset;">Play Now!</div>
                </button>
            `;

            // Replace old button with new button
            downloadButton.replaceWith(newPlayButton);
        }
    }, false);
})();