Greasy Fork

Greasy Fork is available in English.

Steam市场cs武器箱批量出售

批量出售cs武器箱

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Steam市场cs武器箱批量出售
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  批量出售cs武器箱
// @author       慌得一批的荒
// @include      https://steamcommunity.com/market/
// @match        https://steamcommunity.com/market/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 初始化脚本状态
    let scriptEnabled = false;

    // 创建按钮和面板
    const panel = document.createElement('div');
    const button = document.createElement('button');

    // 面板样式
    GM_addStyle(`
        #scriptPanel {
            position: fixed;
            bottom: 10px;
            right: 10px;
            background-color: white;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            box-shadow: 0 0 5px rgba(0,0,0,0.2);
            z-index: 10000;
        }

        #scriptToggleButton {
            background-color: #4CAF50;
            color: white;
            padding: 5px 10px;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }
    `);

    // 面板配置
    panel.id = 'scriptPanel';
    button.id = 'scriptToggleButton';
    button.textContent = '批量出售';

    // 按钮点击事件
    button.addEventListener('click', function() {
        scriptEnabled = !scriptEnabled;
        button.textContent = scriptEnabled ? '关闭' : '批量出售';
        if (scriptEnabled) {
            runScript();
        }
    });

    // 将面板和按钮添加到文档中
    panel.appendChild(button);
    document.body.appendChild(panel);

    // 提取地址栏中最后一个 / 后的内容
    function extractLastSegment(url) {
        const parts = url.split('/');
        return parts.pop() || parts.pop();  // 处理潜在的尾部斜杠
    }

    // 脚本启用时的功能
    function runScript() {
        const item = extractLastSegment(window.location.href);
        const steamUrl = `https://steamcommunity.com/market/multisell?appid=730&contextid=2&items[]=${item}`;
        window.open(steamUrl, '_blank');
        console.log("批量出售已打开");
    }
})();