CS2 Skin Editor

Enhance your CS2 skin experience CS2 Skin Editor! This Script adds a convenient 'Edit Skin' button to every CS2 item link, allowing you to effortlessly modify and personalize your favorite skins on a dedicated website. Customize and experiment with your CS2 skins like never before.

目前為 2023-10-24 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         CS2 Skin Editor
// @namespace    https://www.meckedev.de
// @version      0.2
// @description  Enhance your CS2 skin experience CS2 Skin Editor! This Script adds a convenient 'Edit Skin' button to every CS2 item link, allowing you to effortlessly modify and personalize your favorite skins on a dedicated website. Customize and experiment with your CS2 skins like never before.
// @author       Mecke_Dev
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

// Define a function to add the "Edit Skin" button with styling
function addButton(link) {
    var btn = document.createElement("a");
    btn.innerHTML = "Edit Skin";
    btn.style.display = "inline-block";
    btn.style.margin = "0 10px";
    btn.style.padding = "10px";
    btn.style.backgroundColor = "#4CAF50";
    btn.style.color = "white";
    btn.style.border = "none";
    btn.style.borderRadius = "5px"; // Rounded corners
    btn.style.cursor = "pointer";

    // Adjust other CSS properties as needed

    var url = `https://www.meckedev.de?gen=${encodeURIComponent(link.href)}`;
    btn.onclick = function() {
        window.open(url, '_blank');
    };
    link.parentNode.insertBefore(btn, link.nextSibling);
}

// Function to observe changes in the DOM
function observeDOM() {
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.type === 'childList') {
                mutation.addedNodes.forEach(function(node) {
                    if (node.tagName === 'A' && node.href.includes("+csgo_econ_action_preview")) {
                        addButton(node);
                    }
                });
            }
        });
    });

    var targetNode = document.body; // You can choose the target node as per your requirement
    var config = { childList: true, subtree: true };
    observer.observe(targetNode, config);
}

// Call the function to start observing
observeDOM();