您需要先安装一个扩展,例如 篡改猴、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 // @name:it Esporta Ricerca SteamDB // @name:fr Exporter les recherches SteamDB // @name:de SteamDB-Suchen exportieren // @namespace https://jlcareglio.github.io/ // @version 2.0.0 // @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 // @description:it Aggiunge un pulsante per esportare la ricerca corrente in SteamDB come TSV // @description:fr Ajoute un bouton pour exporter la recherche actuelle dans SteamDB en TSV // @description:de Fügt eine Schaltfläche hinzu, um die aktuelle Suche in SteamDB als TSV zu exportieren // @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() { btnExport.innerText = "Exporting, please wait..."; await new Promise((resolve) => setTimeout(resolve, 50)); try { const shown = document.querySelector("#dt-length-0"); shown.value = -1; shown.dispatchEvent(new Event("change")); } catch (error) { console.error(error); btnExport.style.color = "red"; btnExport.innerText = "Error, please click the search button first"; return; } 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"); btnExport.innerText = "Export 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); })();