您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to export current search in SteamDB as TSV
当前为
// 👋 Hola, usa 🐒Tampermonkey 👇 // https://www.tampermonkey.net/ // ==UserScript== // @name Export SteamDB Search // @name:es Exportar Busquedas de SteamDB // @namespace https://jlcareglio.github.io/ // @version 1.0.1 // @description Adds a button to export current search in SteamDB as TSV // @description:es Agrega un botón para exportar como TSV el listado de busqueda en SteamDB // @icon https://www.google.com/s2/favicons?sz=64&domain=steamdb.info // @grant none // @author Jesús Lautaro Careglio Albornoz // @source https://gist.githubusercontent.com/JLCareglio/3d9c4694430b181d2de2780aa2479572/raw/ // @match https://steamdb.info/search* // @supportURL https://gist.githubusercontent.com/JLCareglio/3d9c4694430b181d2de2780aa2479572/ // ==/UserScript== (async () => { async function HandlerClick() { const shown = document.querySelector("[name='table-sortable_length']"); shown.value = -1; shown.dispatchEvent(new Event("change")); const rows = Array.from( document.querySelectorAll("#table-sortable tbody tr") ); const tsvRows = []; console.log({ rows }); for (const row of rows) { console.log({ row }); const app_id = row.dataset.appid; const name = row .querySelector("td:nth-child(3) > a") .textContent.replaceAll("#", String.raw`\#`); let lastUpdate = row.querySelector("td.timeago").title.replace(/( at)/g, ""); lastUpdate = new Date(lastUpdate).toUTCString().replace(" GMT", ""); tsvRows.push([ app_id, name, lastUpdate, ]); } const headers = [ "AppID", "Name", "Last Update (UTC)", ]; const tsvContent = [headers, ...tsvRows] .map((row) => row.join("\t")) .join("\n"); DownloadTsvFile(tsvContent, "SteamDB_Search.tsv"); } function DownloadTsvFile(data, filename) { const blob = new Blob([data], { type: "text/tab-separated-values" }); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = filename; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url); } const btnExport = document.createElement("a"); btnExport.classList.value = "btn btn-link"; btnExport.style.padding = "11px" btnExport.innerText = "Export TSV"; btnExport.onclick = HandlerClick; document.querySelector("#apps > form > dl:nth-child(6) > dd").appendChild(btnExport); })();