您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds file size to Steam Workshop items
// ==UserScript== // @name Steam Workshop Items File Size // @namespace steam-workshop-itens-file-size // @version 1.02 // @description Adds file size to Steam Workshop items // @author Pedro Henrique // @match https://steamcommunity.com/workshop/browse* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Função para obter o tamanho do arquivo de um URL function getFileSize(url) { return fetch(url) .then(response => response.text()) .then(html => { const parser = new DOMParser(); const doc = parser.parseFromString(html, "text/html"); const fileSize = doc.getElementsByClassName("detailsStatRight")[0].innerHTML; return fileSize; }) .catch(error => { console.error("Error getting file size:", error); return "N/A"; }); } // Função para adicionar o tamanho do arquivo abaixo de cada item function addFileSizeToItems() { const items = document.getElementsByClassName("workshopItem"); for (let i = 0; i < items.length; i++) { const item = items[i]; const link = item.getElementsByTagName("a")[0]; const url = link.href; getFileSize(url) .then(fileSize => { const fileSizeElement = document.createElement("div"); fileSizeElement.className = "workshopItemFileSize"; fileSizeElement.innerHTML = "Size: " + fileSize; item.appendChild(fileSizeElement); }); } } // Aguarda o carregamento completo da página e adiciona o tamanho do arquivo aos itens window.addEventListener("load", () => { addFileSizeToItems(); }); })();