回复
13
查看
933
收藏
44

0

赠楼

0%

赠楼率

734

蒸汽

75

主题

512

帖子

1163

积分
发表于 前天 00:50 · 云南 | 显示全部楼层 |阅读模式
本文为 其乐用户(UID:1501635) 发布的原创文章,转摘前请联系该用户获得许可
本帖最后由 1501635 于 2025-7-14 02:11 编辑






让Gemini写了一个Steam展柜助手
默认只会在Steam主页,艺术作品页面显示
点击对应的窗口会会复制对应的代码 之后按下F12去控制台里面输入就行了
经过本人实测,以及多次修正可以正常使用
greasyfork安装地址



  1. <blockquote>// ==UserScript==
  2. // @name         Steam展柜自定义快速工具
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.0
  5. // @description  快速作品编辑工具
  6. // @author       Your name
  7. // @match        https://steamcommunity.com/id/*/
  8. // @match        https://steamcommunity.com/sharedfiles/edititem/767/3/
  9. // @grant        GM_openInTab
  10. // @grant        GM_setClipboard
  11. // @grant        GM_notification
  12. // @require      https://code.jquery.com/jquery-3.6.0.min.js
  13. // ==/UserScript==


  14. (function() {
  15.     'use strict';


  16.     // 添加自定义样式 - Steam官方风格
  17.     const css = `
  18.         .custom-steam-tool-btn {
  19.             background: linear-gradient(135deg, #67c1f5 0%, #417a9b 100%);
  20.             color: #ffffff;
  21.             border: 1px solid #1999d3;
  22.             border-radius: 3px;
  23.             padding: 8px 16px;
  24.             font-weight: normal;
  25.             cursor: pointer;
  26.             font-family: "Motiva Sans", Arial, sans-serif;
  27.             font-size: 13px;
  28.             text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);
  29.             box-shadow: 0 0 2px rgba(103, 193, 245, 0.3);
  30.             transition: all 0.2s ease;
  31.             position: relative;
  32.             z-index: 9999;
  33.             margin-left: 10px;
  34.         }


  35.         .custom-steam-tool-btn:hover {
  36.             background: linear-gradient(135deg, #78c9f7 0%, #4a8bb5 100%);
  37.             box-shadow: 0 0 5px rgba(103, 193, 245, 0.5);
  38.             transform: translateY(-1px);
  39.         }


  40.         .custom-steam-tool-btn:active {
  41.             background: linear-gradient(135deg, #417a9b 0%, #67c1f5 100%);
  42.             transform: translateY(0);
  43.         }


  44.         .custom-dropdown {
  45.             position: fixed;
  46.             background: linear-gradient(135deg, #1e2328 0%, #2a475e 100%);
  47.             border: 1px solid #67c1f5;
  48.             border-radius: 5px;
  49.             box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 10px rgba(103, 193, 245, 0.3);
  50.             min-width: 300px;
  51.             z-index: 10000;
  52.             display: none;
  53.             overflow: hidden;
  54.             font-family: "Motiva Sans", Arial, sans-serif;
  55.             backdrop-filter: blur(10px);
  56.             transform: scaleY(0);
  57.             transform-origin: top;
  58.             transition: all 0.3s ease-out;
  59.         }


  60.         .custom-dropdown.show {
  61.             transform: scaleY(1);
  62.         }


  63.         .custom-dropdown a {
  64.             display: block;
  65.             padding: 12px 16px;
  66.             color: #c6d4df;
  67.             text-decoration: none;
  68.             border-bottom: 1px solid rgba(42, 71, 94, 0.5);
  69.             transition: all 0.2s ease;
  70.             font-size: 13px;
  71.             position: relative;
  72.         }


  73.         .custom-dropdown a:hover {
  74.             background: linear-gradient(90deg, rgba(103, 193, 245, 0.2) 0%, rgba(103, 193, 245, 0.1) 100%);
  75.             color: #67c1f5;
  76.             padding-left: 20px;
  77.         }


  78.         .custom-dropdown a:last-child {
  79.             border-bottom: none;
  80.         }


  81.         .custom-dropdown a::before {
  82.             content: "▶";
  83.             margin-right: 10px;
  84.             color: #67c1f5;
  85.             font-size: 10px;
  86.             opacity: 0;
  87.             transition: all 0.2s ease;
  88.         }


  89.         .custom-dropdown a:hover::before {
  90.             opacity: 1;
  91.         }


  92.         .code-notification {
  93.             position: fixed;
  94.             bottom: 80px;
  95.             right: 20px;
  96.             background: linear-gradient(135deg, rgba(30, 35, 40, 0.95) 0%, rgba(42, 71, 94, 0.95) 100%);
  97.             border: 1px solid #67c1f5;
  98.             border-radius: 5px;
  99.             padding: 16px 20px;
  100.             color: #c6d4df;
  101.             font-size: 13px;
  102.             z-index: 100000;
  103.             box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 10px rgba(103, 193, 245, 0.3);
  104.             max-width: 400px;
  105.             font-family: "Motiva Sans", Arial, sans-serif;
  106.             animation: slideIn 0.3s ease-out;
  107.             backdrop-filter: blur(10px);
  108.         }


  109.         .code-notification strong {
  110.             color: #67c1f5;
  111.             display: block;
  112.             margin-bottom: 8px;
  113.             font-size: 14px;
  114.             font-weight: normal;
  115.         }


  116.         .code-notification p {
  117.             margin: 6px 0;
  118.             line-height: 1.5;
  119.         }


  120.         .code-notification .hotkey {
  121.             background: rgba(103, 193, 245, 0.3);
  122.             padding: 2px 6px;
  123.             border-radius: 3px;
  124.             font-family: monospace;
  125.             font-size: 12px;
  126.             border: 1px solid rgba(103, 193, 245, 0.5);
  127.         }


  128.         .code-tip {
  129.             padding: 12px 16px;
  130.             color: #a9cf46;
  131.             font-size: 12px;
  132.             line-height: 1.5;
  133.             border-top: 1px solid rgba(42, 71, 94, 0.5);
  134.             background: rgba(42, 71, 94, 0.3);
  135.         }


  136.         .bottom-btn-container {
  137.             position: fixed;
  138.             bottom: 20px;
  139.             right: 20px;
  140.             z-index: 9999;
  141.             display: flex;
  142.             flex-direction: column;
  143.             align-items: flex-end;
  144.         }


  145.         .top-right-btn-container {
  146.             position: fixed;
  147.             top: 20px;
  148.             right: 20px;
  149.             z-index: 9999;
  150.             display: flex;
  151.             flex-direction: row;
  152.             align-items: center;
  153.         }


  154.         .dropdown-top-right {
  155.             transform-origin: top right;
  156.         }


  157.         @keyframes slideIn {
  158.             from {
  159.                 transform: translateY(20px) scale(0.95);
  160.                 opacity: 0;
  161.             }
  162.             to {
  163.                 transform: translateY(0) scale(1);
  164.                 opacity: 1;
  165.             }
  166.         }


  167.         .plugin-check-info {
  168.             position: fixed;
  169.             top: 60px;
  170.             right: 20px;
  171.             background: linear-gradient(135deg, rgba(30, 35, 40, 0.9) 0%, rgba(42, 71, 94, 0.9) 100%);
  172.             border: 1px solid #67c1f5;
  173.             border-radius: 5px;
  174.             padding: 12px 16px;
  175.             color: #c6d4df;
  176.             font-size: 12px;
  177.             z-index: 9998;
  178.             max-width: 300px;
  179.             font-family: "Motiva Sans", Arial, sans-serif;
  180.             backdrop-filter: blur(10px);
  181.             animation: slideIn 0.3s ease-out;
  182.         }


  183.         .plugin-check-info .status-ok {
  184.             color: #a9cf46;
  185.         }


  186.         .plugin-check-info .status-warning {
  187.             color: #ffa500;
  188.         }


  189.         .plugin-check-info .status-error {
  190.             color: #ff6b6b;
  191.         }
  192.     `;
  193.     $('<style>').html(css).appendTo('head');


  194.     // 插件冲突检查功能
  195.     function checkPluginConflicts() {
  196.         const conflicts = [];
  197.         const warnings = [];


  198.         // 检查常见的Steam插件元素
  199.         const steamPluginSelectors = [
  200.             '.custom-steam-tool-btn',
  201.             '[id*="steam"]',
  202.             '[class*="steam"]',
  203.             '[id*="enhance"]',
  204.             '[class*="enhance"]'
  205.         ];


  206.         steamPluginSelectors.forEach(selector => {
  207.             const elements = $(selector);
  208.             if (elements.length > 1 && selector === '.custom-steam-tool-btn') {
  209.                 conflicts.push('检测到多个Steam工具按钮');
  210.             }
  211.         });


  212.         // 检查固定定位元素
  213.         const fixedElements = $('*').filter(function() {
  214.             return $(this).css('position') === 'fixed' &&
  215.                    $(this).css('z-index') > 9000 &&
  216.                    !$(this).hasClass('custom-steam-tool-btn') &&
  217.                    !$(this).hasClass('custom-dropdown');
  218.         });


  219.         if (fixedElements.length > 3) {
  220.             warnings.push('检测到多个固定定位元素,可能存在UI冲突');
  221.         }


  222.         return { conflicts, warnings };
  223.     }


  224.     // 显示插件检查结果
  225.     function showPluginCheckResult(result) {
  226.         if (result.conflicts.length === 0 && result.warnings.length === 0) {
  227.             return;
  228.         }


  229.         let content = '<div class="plugin-check-info">';
  230.         content += '<strong>插件兼容性检查</strong><br>';


  231.         if (result.conflicts.length > 0) {
  232.             content += '<div class="status-error">冲突:</div>';
  233.             result.conflicts.forEach(conflict => {
  234.                 content += `<div>• ${conflict}</div>`;
  235.             });
  236.         }


  237.         if (result.warnings.length > 0) {
  238.             content += '<div class="status-warning">警告:</div>';
  239.             result.warnings.forEach(warning => {
  240.                 content += `<div>• ${warning}</div>`;
  241.             });
  242.         }


  243.         content += '</div>';


  244.         const checkInfo = $(content);
  245.         $('body').append(checkInfo);


  246.         // 5秒后自动关闭
  247.         setTimeout(() => {
  248.             checkInfo.fadeOut(500, () => checkInfo.remove());
  249.         }, 5000);
  250.     }


  251.     // 个人主页功能 - 仅在个人资料主页生效
  252.     if (window.location.href.match(/https:\/\/steamcommunity\.com\/id\/[^\/]+\/?$/)) {
  253.         // 执行插件冲突检查
  254.         setTimeout(() => {
  255.             const checkResult = checkPluginConflicts();
  256.             showPluginCheckResult(checkResult);
  257.         }, 1000);


  258.         // 创建按钮和下拉菜单
  259.         const profileBtn = $(`
  260.             <button class="custom-steam-tool-btn" id="steam-custom-btn">
  261.                 <i class="fa fa-magic" style="margin-right: 5px;"></i> 展柜工具
  262.             </button>
  263.         `);


  264.         const dropdown = $(`
  265.             <div class="custom-dropdown" id="steam-custom-dropdown">
  266.                 <a href="#" class="dropdown-item" data-count="1">打开1个艺术作品编辑界面</a>
  267.                 <a href="#" class="dropdown-item" data-count="3">打开3个艺术作品编辑界面</a>
  268.                 <a href="#" class="dropdown-item" data-count="5">打开5个艺术作品编辑界面</a>
  269.                 <a href="#" class="dropdown-item" data-count="9">打开9个艺术作品编辑界面</a>
  270.             </div>
  271.         `);


  272.         // 添加到页面 - 优先使用页面原有位置,否则使用固定位置
  273.         const headerActions = $('.profile_header_actions');
  274.         if (headerActions.length) {
  275.             const container = $('<div style="position: relative; display: inline-block;">')
  276.                 .append(profileBtn);
  277.             headerActions.append(container);
  278.         } else {
  279.             $('body').append(profileBtn);
  280.             profileBtn.css({
  281.                 position: 'fixed',
  282.                 top: '20px',
  283.                 right: '20px',
  284.                 zIndex: '9999'
  285.             });
  286.         }


  287.         // 将下拉菜单添加到body
  288.         $('body').append(dropdown);


  289.         // 按钮点击事件 - 带边缘检测和渐变动画
  290.         profileBtn.on('click', function(e) {
  291.             e.stopPropagation();


  292.             // 获取按钮位置
  293.             const btnRect = this.getBoundingClientRect();
  294.             const windowWidth = window.innerWidth;
  295.             const windowHeight = window.innerHeight;


  296.             // 计算下拉菜单位置
  297.             let top = btnRect.bottom + 10;
  298.             let left = btnRect.left;


  299.             // 检测底部边缘
  300.             if (top + 250 > windowHeight) {
  301.                 top = btnRect.top - 255;
  302.                 dropdown.addClass('dropdown-top-right');
  303.             } else {
  304.                 dropdown.removeClass('dropdown-top-right');
  305.             }


  306.             // 检测右侧边缘
  307.             if (left + 300 > windowWidth) {
  308.                 left = windowWidth - 310;
  309.             }


  310.             // 应用位置并显示
  311.             dropdown.css({
  312.                 top: top + 'px',
  313.                 left: left + 'px',
  314.                 display: 'block'
  315.             });


  316.             // 触发渐变动画
  317.             setTimeout(() => {
  318.                 dropdown.addClass('show');
  319.             }, 10);
  320.         });


  321.         // 下拉菜单项点击事件
  322.         dropdown.on('click', '.dropdown-item', function(e) {
  323.             e.preventDefault();
  324.             const count = parseInt($(this).data('count'));
  325.             for (let i = 0; i < count; i++) {
  326.                 GM_openInTab('https://steamcommunity.com/sharedfiles/edititem/767/3/', {active: false});
  327.             }
  328.             hideDropdown();
  329.         });


  330.         // 隐藏下拉菜单函数
  331.         function hideDropdown() {
  332.             dropdown.removeClass('show');
  333.             setTimeout(() => {
  334.                 dropdown.hide();
  335.             }, 300);
  336.         }


  337.         // 点击页面其他地方关闭下拉菜单
  338.         $(document).on('click', function() {
  339.             hideDropdown();
  340.         });
  341.     }


  342.     // 展柜编辑页面功能 - 仅在特定URL生效
  343.     if (window.location.href === 'https://steamcommunity.com/sharedfiles/edititem/767/3/') {
  344.         // 执行插件冲突检查
  345.         setTimeout(() => {
  346.             const checkResult = checkPluginConflicts();
  347.             showPluginCheckResult(checkResult);
  348.         }, 1000);


  349.         // 创建按钮和下拉菜单
  350.         const editorBtn = $(`
  351.             <button class="custom-steam-tool-btn" id="steam-code-btn">
  352.                 <i class="fa fa-code" style="margin-right: 5px;"></i> 快速代码
  353.             </button>
  354.         `);


  355.         const codeDropdown = $(`
  356.             <div class="custom-dropdown dropdown-top-right" id="steam-code-dropdown">
  357.                 <a href="#" class="code-item" data-code="unnamed">无名代码</a>
  358.                 <a href="#" class="code-item" data-code="artwork">艺术作品代码</a>
  359.                 <a href="#" class="code-item" data-code="workshop">创意工坊代码</a>
  360.                 <a href="#" class="code-item" data-code="guide">指南代码</a>
  361.                 <a href="#" class="code-item" data-code="screenshot">屏幕截图代码</a>
  362.                 <div class="code-tip">
  363.                     💡 使用提示:无名代码需配合其它代码使用<br>
  364.                     先使用其它代码,再使用无名代码<br>
  365.                     即可无需输入作品名字发布
  366.                 </div>
  367.             </div>
  368.         `);


  369.         // 创建右上角按钮容器
  370.         const topRightContainer = $('<div class="top-right-btn-container"></div>');
  371.         topRightContainer.append(editorBtn);
  372.         $('body').append(topRightContainer);


  373.         // 将下拉菜单添加到body
  374.         $('body').append(codeDropdown);


  375.         // 按钮点击事件 - 右上角位置优化
  376.         editorBtn.on('click', function(e) {
  377.             e.stopPropagation();


  378.             // 获取按钮位置
  379.             const btnRect = this.getBoundingClientRect();
  380.             const windowWidth = window.innerWidth;


  381.             // 计算下拉菜单位置 - 固定在右上角
  382.             let top = btnRect.bottom + 10;
  383.             let left = btnRect.right - 300; // 菜单宽度300px,右对齐


  384.             // 确保不超出窗口边界
  385.             if (left < 10) {
  386.                 left = 10;
  387.             }


  388.             // 应用位置并显示
  389.             codeDropdown.css({
  390.                 top: top + 'px',
  391.                 left: left + 'px',
  392.                 display: 'block'
  393.             });


  394.             // 触发渐变动画
  395.             setTimeout(() => {
  396.                 codeDropdown.addClass('show');
  397.             }, 10);
  398.         });


  399.         // 代码菜单项点击事件
  400.         codeDropdown.on('click', '.code-item', function(e) {
  401.             e.preventDefault();
  402.             const codeType = $(this).data('code');
  403.             let code = '';
  404.             let codeName = '';


  405.             switch(codeType) {
  406.                 case 'unnamed':
  407.                     code = `v_trim=_=>{return _},$J('#title').val(' \\n'+Array.from(Array(126),_=>'\\t').join(''));`;
  408.                     codeName = "无名代码";
  409.                     break;
  410.                 case 'artwork':
  411.                     code = `$J('#image_width').val(1000).attr('id',''),$J('#image_height').val(1).attr('id','');`;
  412.                     codeName = "艺术作品代码";
  413.                     break;
  414.                 case 'workshop':
  415.                     code = `$J('[name=consumer_app_id]').val(480);$J('[name=file_type]').val(0);$J('[name=visibility]').val(0);`;
  416.                     codeName = "创意工坊代码";
  417.                     break;
  418.                 case 'guide':
  419.                     code = `$J('[name=consumer_app_id]').val(480);$J('[name=file_type]').val(9);$J('[name=visibility]').val(0);`;
  420.                     codeName = "指南代码";
  421.                     break;
  422.                 case 'screenshot':
  423.                     code = `$J('#image_width').val(1000).attr('id',''),$J('#image_height').val(1).attr('id',''),$J('[name=file_type]').val(5);`;
  424.                     codeName = "屏幕截图代码";
  425.                     break;
  426.             }


  427.             // 复制代码到剪贴板
  428.             GM_setClipboard(code);


  429.             // 显示通知
  430.             showCodeNotification(codeName, code);


  431.             hideCodeDropdown();
  432.         });


  433.         // 显示代码通知
  434.         function showCodeNotification(name, code) {
  435.             const notification = $(`
  436.                 <div class="code-notification">
  437.                     <strong>✅ ${name} 已复制!</strong>
  438.                     <p>代码内容: <code style="word-break: break-all; display: inline-block; background: rgba(0,0,0,0.4); padding: 4px 8px; border-radius: 3px; margin-top: 5px; border: 1px solid rgba(103, 193, 245, 0.3);">${code}</code></p>
  439.                     <p>📋 请按 <span class="hotkey">F12</span> 打开浏览器开发者工具</p>
  440.                     <p>⚡ 在 Console/控制台 标签页中粘贴代码并回车执行</p>
  441.                 </div>
  442.             `);


  443.             $('body').append(notification);


  444.             // 6秒后自动关闭
  445.             setTimeout(() => {
  446.                 notification.fadeOut(500, () => notification.remove());
  447.             }, 6000);
  448.         }


  449.         // 隐藏代码下拉菜单函数
  450.         function hideCodeDropdown() {
  451.             codeDropdown.removeClass('show');
  452.             setTimeout(() => {
  453.                 codeDropdown.hide();
  454.             }, 300);
  455.         }


  456.         // 点击页面其他地方关闭下拉菜单
  457.         $(document).on('click', function() {
  458.             hideCodeDropdown();
  459.         });
  460.     }
  461. })();
复制代码







本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

×
[发帖际遇]: 1501635 千辛万苦抢到的测试 Key 转正了,获得体力 1 点 幸运榜 / 衰神榜

本帖被以下淘专辑推荐:

回复

使用道具 举报

浏览本版块需要:
1. 初阶会员或更高等级;
2. (点击此处)绑定Steam账号
您需要登录后才可以回帖 登录 | 注册

本版积分规则

欢迎发帖参与讨论 o(*≧▽≦)ツ,请注意
1. 寻求帮助或答案的帖子请发到问题互助版块,悬赏有助于问题解决的速度。发错可能失去在该板块发布主题的权限(了解更多
2. 表达观点可以,也请务必注意语气和用词,以免影响他人浏览,特别是针对其他会员的内容。如觉得违规可使用举报功能 交由管理人员处理,请勿引用对方的内容。
3. 开箱晒物交易中心游戏互鉴福利放送版块请注意额外的置顶版规。
4. 除了提问帖和交易帖以外,不确认发在哪个版块的帖子可以先发在谈天说地

  作为民间站点,自 2004 年起为广大中文 Steam 用户提供技术支持与讨论空间。历经二十余载风雨,如今已发展为国内最大的正版玩家据点。

列表模式 · · 微博 · Bilibili频道 · Steam 群组 · 贴吧 · QQ群 
Keylol 其乐 ©2004-2025 Chinese Steam User Fan Site.
Designed by Lee in Balestier, Powered by Discuz!
推荐使用 ChromeMicrosoft Edge 来浏览本站
广告投放|手机版|广州数趣信息科技有限公司 版权所有|其乐 Keylol ( 粤ICP备17068105号 )
GMT+8, 2025-7-16 16:36
快速回复 返回顶部 返回列表