Created
March 31, 2024 16:56
-
-
Save ntnbrtnkv/595d62205a368488cb2413711b1d01e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name My EGS games | |
// @namespace https://gist.github.com/ntnbrtnkv | |
// @version 0.1 | |
// @description Export epic games store games/translactions | |
// @author ntnbrtnkv | |
// @match *://www.epicgames.com/account/transactions* | |
// @grant GM_setClipboard | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
const loadMoreQ = '#payment-history-show-more-button'; | |
const transactionListQ = 'table'; | |
const transactionQ = 'tbody tr td:nth-child(2)'; | |
const sheetsURL = 'https://docs.google.com/spreadsheets/d/1eWZcEebfS8CxV4CtKwzmir08mI5Z6xs6Ll7DyHllD5Q/edit#gid=0'; | |
function doExport() { | |
const btn = document.querySelector(loadMoreQ); | |
if (btn) { | |
btn.click(); | |
setTimeout(doExport, 3000); | |
return; | |
} | |
const trs = document.querySelector(transactionListQ).querySelectorAll(transactionQ); | |
const list = [...trs].map(e => e.textContent); | |
GM_setClipboard(list.join('\n')) | |
window.open(sheetsURL, '_blank').focus(); | |
} | |
function addButton() { | |
const transactionListEl = document.querySelector(transactionListQ); | |
if (!transactionListEl) { | |
setTimeout(addButton, 1000); | |
} | |
const buttonsContainerEl = transactionListEl.parentElement.nextSibling; | |
const btn = buttonsContainerEl.firstChild.cloneNode(); | |
btn.id = ''; | |
btn.innerText = 'Export all'; | |
btn.onclick = doExport; | |
buttonsContainerEl.appendChild(btn); | |
} | |
addButton(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment