is the script only work on currenlty joined giveaway? the green button doesn't appear on View: All page nvm, it already fetch from All, there's just no indicator when it's fetching, thanks for the script! :D
im using firefox 125.0.1 with tampermonkey 5.1.0
Comment has been collapsed.
No. It covers all the giveaways entered.
The green button only appears on the /entered page. The background script loads the data https://www.steamgifts.com/giveaways/entered/search?page=${page}&sort=all , so it includes all giveaways
Comment has been collapsed.
Works great. On another note, I didn't know I entered 44 GAs for The Evil Within lmao.
PS: Great job for creating this mate.
Comment has been collapsed.
You did it finally :)
Thanks for that, i'm already using it since you posted in the whale thread (you can't get enough stats).
I hope it will be useful to others.
Comment has been collapsed.
Comment has been collapsed.
Feel free to use/change/whatever :)
I created a topic based on Swordoffury feedback... since indeed it could be useful for some members.
Also, others could provide feedback on how to improve it... my limited programming knowledge just wouldn't let me go too far,
Comment has been collapsed.
I gotta say, I was pretty confused why is it split into two scripts when both run on the same page. I'd understand if each was running in different tab or something. So I edited it to only use one script/file https://pastebin.com/6p8m9uyn
Edit: i can't change that pastebin since i wasn't logged in, but replace ${heading} with ${heading.replaceAll('<','< ;').replaceAll('>','> ;')} , without the space before semicolon, because i changed textContent to innerHTML to be able to add new lines using <br>
Comment has been collapsed.
Thank you VERY much for the improvement.
It was split into 2 scripts because when I was trying to do in a single one, it would time out and not return any results... that was the way I found to fix it. (needless to say,. I added further changes afterwards).
You also improved the results display! do you mind if I substitute the link from the topic with your script?
Comment has been collapsed.
Sorry, i didn't reload page before editing my comment, so i didn't see the reply. Because I replaced textContent with innerHTML, if some game name contained < or > it could break the layout.
Comment has been collapsed.
I already made new one https://pastebin.com/gDNzfa7j . Sorry for stealing your script like this. I changed it so you can click the button multiple times without having to reload the page.
Comment has been collapsed.
very similar its like you are inside my PC đ¤Ł
// ==UserScript==
// @name Background Script - SteamGifts Giveaways
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Background script for retrieving and counting table column headings from SteamGifts Giveaways page
// @author Your Name
// @match https://www.steamgifts.com/giveaways/entered
// @grant none
// ==/UserScript==
// Console log to indicate that the background script is loaded
console.log('Background script loaded.');
// Create the button
const button = document.createElement('button');
button.classList.add('featured__action-button');
button.textContent = 'Retrieve Column Headings';
button.style.position = 'fixed';
button.style.bottom = '10px';
button.style.left = '10px';
document.body.append(button);
// Create a div element to display the result
const resultDisplay = document.createElement('div');
resultDisplay.classList.add('page__outer-wrap','entrie-results');
resultDisplay.style.position = 'fixed';
resultDisplay.style.backgroundColor = 'var(--SGSP-body-bg-color,#f0f2f5)';
resultDisplay.style.paddingTop = '34px';
resultDisplay.style.bottom = '50px';
resultDisplay.style.zIndex = '9999';
resultDisplay.style.overflow = 'auto';
resultDisplay.style.maxWidth = '600px';
resultDisplay.style.maxHeight = '500px';
resultDisplay.style.border = '1px solid var(--SGSP-sidebar-bg-color,#d2d6e0)';
// Object to store the count of each table column heading across all pages
let headingsCount = {};
// Function to retrieve column headings from a page
async function retrieveColumnHeadings(page, endPage) {
// Hide result display initially
resultDisplay.classList.add('hidden');
// Log to indicate which page's column headings are being retrieved
console.log(`Retrieving column headings for page ${page}.`);
// Update button text to indicate current page being processed
button.textContent = `Retrieving page ${page} of ${endPage}`;
// If all pages are processed, display the final result
if (page > endPage) {
console.log('All pages processed. Displaying result.');
const sortedHeadings = Object.entries(headingsCount)
.sort(([, countA], [, countB]) => countB - countA) // Sort entries by count in descending order
.map(([heading, count]) => `<li>${heading.replaceAll('<','<').replaceAll('>','>')} (Repeated ${count} times)</li>`) // Add line break after each entry
.join(''); // Join entries with line breaks
displayResult(`<div class="markdown"><ol>${sortedHeadings}</ol></div>`);
return;
}
try {
// Fetch the page content
const response = await fetch(`https://www.steamgifts.com/giveaways/entered/search?page=${page}&sort=all`);
// If response is not ok, throw an error
if (!response.ok) {
throw new Error('Network response was not ok');
}
// Parse HTML response
const parser = new DOMParser();
const doc = parser.parseFromString(await response.text(), 'text/html');
// Get all column headings
const columnHeadings = doc.querySelectorAll('.table__column__heading');
// Iterate through column headings and update count in headingsCount object
columnHeadings.forEach(heading => {
const text = heading.textContent.trim();
headingsCount[text] = (headingsCount[text] || 0) + 1;
});
// Continue retrieving column headings from the next page after a delay
setTimeout(() => {
retrieveColumnHeadings(page + 1, endPage);
}, 1000); // 1 second delay
} catch (error) {
// Log any errors during data retrieval
console.error('Error during data retrieval:', error);
}
}
// Function to display the result
function displayResult(result) {
button.textContent = 'Retrieve Column Headings';
resultDisplay.classList.remove('hidden');
resultDisplay.innerHTML = result;
document.body.appendChild(resultDisplay);
button.disabled = false;
// Create the button for copying the result
const copyButton = document.createElement('button');
copyButton.textContent = 'Copy Result';
copyButton.classList.add('page__heading__button--blue');
copyButton.style.borderRadius = '4px';
copyButton.style.border = '1px solid'; // border
copyButton.style.padding = '5px 15px'; // Padding around the text
copyButton.style.fontWeight = 'bold'; // Bold text
copyButton.style.cursor = 'pointer'; // Pointer cursor on hover
copyButton.style.position = 'absolute';
copyButton.style.top = '5px';
copyButton.style.left = '5px';
resultDisplay.appendChild(copyButton);
// Click event handler for the copy button
copyButton.addEventListener('click', () => {
// Remove <div>, <ol>, and <li> tags
const cleanedHtml = result.replace(/<div[^>]*>|<\/div>|<ol[^>]*>|<\/ol>|<li[^>]*>/g, '');
// Preserve line breaks
const cleanedText = cleanedHtml.replace(/<\/li>/g, '\n');
// Copy cleaned text to clipboard
navigator.clipboard.writeText(cleanedText)
.then(() => {
alert('Result copied to clipboard!');
})
.catch(err => {
console.error('Failed to copy result: ', err);
});
});
}
// Click event handler for the button
button.addEventListener('click', () => {
headingsCount = {};
console.log('Button clicked. Initiating data retrieval.');
const endPage = parseInt(prompt('Enter the end page number:'), 10);
if (isNaN(endPage) || endPage < 1) {
alert('Invalid end page number. Please enter a valid number.');
return;
}
button.disabled = true; // Disable the button to prevent multiple clicks
// Start retrieving column headings from the first page
retrieveColumnHeadings(1, endPage);
});
Comment has been collapsed.
Cool. It looks better with the SG styles and the error handling is also nice. Just a small "error" is that you don't clear headingsCount on button click, so if you run it multiple times it keeps adding up.
Comment has been collapsed.
Comment has been collapsed.
Hey there, nice script!
I changed
// @match https://www.steamgifts.com/giveaways/entered
to
// @match https://www.steamgifts.com/giveaways/entered*
so that it'll work on https://www.steamgifts.com/giveaways/entered/search?sort=all
Even though i just noticed it doesn't make a difference, lol, I assumed it'd read from the current page with infinite scrolling, not request from pages itself.
Comment has been collapsed.
Quite the list, i'll only paste those above 100 entries here :D
Sid Meier's CivilizationÂŽ V (30P) (Repeated 240 times)
Evoland 2 (20P) (Repeated 226 times)
Plantera (3P) (Repeated 217 times)
Pony Island (5P) (Repeated 205 times)
Grim Legends 2: Song of the Dark Swan (15P) (Repeated 195 times)
Abyss: The Wraiths of Eden (15P) (Repeated 180 times)
Poker Night at the Inventory (5P) (Repeated 180 times)
Puzzle Agent (5P) (Repeated 172 times)
Puzzle Agent 2 (5P) (Repeated 165 times)
Tomb Raider (15P) (Repeated 164 times)
Skullgirls 2nd Encore (25P) (Repeated 162 times)
Project Druid - 2D Labyrinth Explorer- (2P) (Repeated 160 times)
Witch's Pranks: Frog's Fortune Collector's Edition (7P) (Repeated 156 times)
Dreamscapes: The Sandman - Premium Edition (7P) (Repeated 152 times)
7 Wonders: Ancient Alien Makeover (10P) (Repeated 150 times)
PAYDAY 2 (10P) (Repeated 148 times)
Duke Nukem Forever (20P) (Repeated 144 times)
Luxor 2 HD (10P) (Repeated 142 times)
Little Farm (10P) (Repeated 142 times)
140 (5P) (Repeated 141 times)
Sea Legends: Phantasmal Light Collector's Edition (7P) (Repeated 137 times)
Anna's Quest (20P) (Repeated 136 times)
7 Wonders: Magical Mystery Tour (7P) (Repeated 136 times)
Discovery! A Seek and Find Adventure (10P) (Repeated 133 times)
Clockwork Tales: Of Glass and Ink (15P) (Repeated 131 times)
7 Wonders of the Ancient World (7P) (Repeated 126 times)
Nightmares from the Deep: The Cursed Heart (10P) (Repeated 125 times)
Luxor: Quest for the Afterlife (10P) (Repeated 124 times)
A New Beginning - Final Cut (10P) (Repeated 122 times)
Luxor: Amun Rising HD (10P) (Repeated 122 times)
Balloon Blowout (1P) (Repeated 121 times)
7 Wonders II (10P) (Repeated 121 times)
Bayla Bunny (2P) (Repeated 120 times)
Luxor HD (10P) (Repeated 119 times)
Glowfish (10P) (Repeated 119 times)
Midnight Mysteries: Salem Witch Trials (10P) (Repeated 117 times)
Luxor: 5th Passage (10P) (Repeated 116 times)
The Last Tinkerâ˘: City of Colors (20P) (Repeated 113 times)
The Tower Of Elements (2P) (Repeated 113 times)
Ultimate Word Search 2: Letter Boxed (1P) (Repeated 113 times)
Calcu-Late (2P) (Repeated 113 times)
Adventures of Robinson Crusoe (10P) (Repeated 108 times)
Dreamscapes: Nightmare's Heir - Premium Edition (7P) (Repeated 107 times)
Theatre of War 2: Africa 1943 (5P) (Repeated 106 times)
Purrfect Date - Visual Novel/Dating Simulator (10P) (Repeated 106 times)
9 Clues: The Secret of Serpent Creek (15P) (Repeated 106 times)
Zombie Bowl-o-Rama (10P) (Repeated 104 times)
Luxor 3 (10P) (Repeated 103 times)
Kitty Cat: Jigsaw Puzzles (1P) (Repeated 102 times)
$1 Ride (2P) (Repeated 101 times)
Comment has been collapsed.
Giveaways with the same game but different number of copies are treated as different entries:
Spriter Pro (50P) (Repeated 99 times)
Spriter Pro (2 Copies) (50P) (Repeated 23 times)
Spriter Pro (3 Copies) (50P) (Repeated 17 times)
Spriter Pro (5 Copies) (50P) (Repeated 6 times)
Spriter Pro (4 Copies) (50P) (Repeated 3 times)
My fix for the script https://pastebin.com/iY7jigBy (based on the latest script by missingtexture)
Comment has been collapsed.
Thanks for the fix. I also thought about this problem, but didn't implement it yet. I thought i'd extract appid from .table_image_thumbnail (because there are some games with the same name) and use that as the key for the counter, but some games (or bundles) don't have thumbnail so it wouldn't always work.
Comment has been collapsed.
I just updated my https://pastebin.com/gDNzfa7j to include some ideas from kivan's (https://www.steamgifts.com/go/comment/Xweo1Ws) and SquishedPotatoe's (https://www.steamgifts.com/go/comment/bn3b07X) scripts.
I also turned the list items into links to steam store if the app ID is available. But because of the links, the Steam Web Integration extension which I also use started changing the overflow from 'auto' to 'visible' so i had to add MutationObserver to change it back (or at least I didn't figure out other solution yet)
Comment has been collapsed.
Oh I see what its doing , you will need to use
resultDisplay.classList.add('entries-results');
document.styleSheets[0].insertRule(".entries-results { overflow: auto!important }");
Also you might want a little more max width some games are very long
Example: Tiny Tina's Assault on Dragon Keep: A Wonderlands One-shot Adventure
Comment has been collapsed.
Many thanks. I tried adding !important, which didn't work, but I didn't know about the insertRule function.
Comment has been collapsed.
https://pastebin.com/SUx4sf3S changed the output into a table if you don't mind
Comment has been collapsed.
Hey there! The results do look neater with the table template.
On my screen, I have a bit of trouble to follow what number corresponds to each game, though...
I tried to add the cell borders ( https://pastebin.com/WhET3aGA ).
Although it does make it easier to follow, it does not look as good... allow me to give you extra headache with the question: Would you have an idea how to improve it?
Comment has been collapsed.
how about make it a zebra stripes instead of adding border?
// Add styles for zebra stripes (odd and even rows)
table.style.cssText = `
border-collapse: collapse;
width: 100%;
`;
table.innerHTML = `
<style>
tr:nth-child(odd) {
background-color: #f2f2f2; /* Light gray color for odd rows */
}
tr:nth-child(even) {
background-color: white; /* White color for even rows */
}
</style>
`;
edit: updated https://pastebin.com/SUx4sf3S
Comment has been collapsed.
Huh, some pretty wild results.
Shadow Tactics: Blades of the Shogun (40P) (Repeated 344 times)
Lost Castle / 夹č˝ĺĺ Ą (10P) (Repeated 309 times)
Silence (20P) (Repeated 303 times)
The Sexy Brutale (20P) (Repeated 297 times)
AER Memories of Old (15P) (Repeated 278 times)
Subterrain (17P) (Repeated 260 times)
Gas Guzzlers Extreme (25P) (Repeated 247 times)
Human Resource Machine (15P) (Repeated 241 times)
The Last Door - Collector's Edition (10P) (Repeated 233 times)
Kingdom Rush - Tower Defense (10P) (Repeated 228 times)
Undertale (10P) (Repeated 223 times)
Aarklash: Legacy (16P) (Repeated 213 times)
Niffelheim (20P) (Repeated 211 times)
Crawl (15P) (Repeated 206 times)
Offworld Trading Company (30P) (Repeated 199 times)
Holy Potatoes! A Weapon Shop?! (10P) (Repeated 195 times)
observer_ (30P) (Repeated 194 times)
Caveblazers (10P) (Repeated 193 times)
Joe Dever's Lone Wolf HD Remastered (15P) (Repeated 190 times)
Orwell: Keeping an Eye On You (10P) (Repeated 187 times)
SUPERHOT (25P) (Repeated 186 times)
This Is the Police (15P) (Repeated 185 times)
Hollow Knight (15P) (Repeated 185 times)
Galactic Civilizations III (40P) (Repeated 184 times)
Morningstar: Descent to Deadrock (10P) (Repeated 182 times)
Armello (25P) (Repeated 182 times)
BioShock Infinite (30P) (Repeated 180 times)
The Town of Light (19P) (Repeated 180 times)
Lakeview Cabin Collection (10P) (Repeated 178 times)
Levelhead: Platformer Maker (20P) (Repeated 176 times)
Serial Cleaner (15P) (Repeated 175 times)
Styx: Master of Shadows (20P) (Repeated 171 times)
I actually wouldn't care that much about some of these games. They are/were just too common. ^_^
Comment has been collapsed.
Comment has been collapsed.
See? It would have been a shame that your work was ignored. Great work here.
Thanks to you and all the contributors,I have a new cool tool and I love it
Comment has been collapsed.
I find it interesting that of the top 15 games I entered the most giveaways for I already own 10 nowadays.
Very nice script, it made the process of finding out my most entered GAs much easier, although it took pretty long to go through 1700 pages :P
Comment has been collapsed.
Decided to remove games I already have. Kinda unfortunate that I ended up buying most of them even after joining so many giveaways for those.
Comment has been collapsed.
This got me curious, so I had to try it too. :) Some of the numbers got me quite surprised. xD
Two games made it over 300 entries:
Eight games got over 200 entries:
Comment has been collapsed.
When there was a "Game you entered the most" discussion, I too got curious and started checking the entry count of the won game individually in the entered GA page. Obviously I had to exclude games I entered but didn't win because there was no easier way to check the stats. This script makes it easier now. Thanks for the great work.
The top 5 easiest/luckiest wins for me were:
The top 5 most entered game that I won are:
Comment has been collapsed.
bump https://pastebin.com/kQupr7ZZ
added a copy button like SquishedPotatoe's script
Comment has been collapsed.
Thanks, it worked
Note that, when you try to obtain a range, you need to add a space before and after the - for the copy to be done
Comment has been collapsed.
Indeed, it worked this time.
Weird. It clearly happened only on range records, separate ones worked fine!
Comment has been collapsed.
Would anyone be interested in me making a modification to have an additional column to count by number of entries? Not sure how hard that would be, but I can take a crack at it.
Comment has been collapsed.
Not sure what you mean. That for each game it would sum not only your entries but also all entries, so you would see your "total chance"?
Comment has been collapsed.
Sort of. Let's say I enter one giveaway with 3 copies.
Entry count: 1
Copy count: 3
Comment has been collapsed.
Patch Quest 56
Hot Brass 41
Warhammer 40,000: Space Wolf 40
Calico 36
Lords and Villeins 35
Arcade Paradise 34
Rebel Galaxy Outlaw 34
Golf Gang 30
Aces & Adventures 28
Arcade Spirits 28
Stygian: Reign of the Old Ones 28
Who Pressed Mute on Uncle Marcus? 26
A Plague Tale: Innocence 25
A Juggler's Tale 25
well not bad. its only 200 pages
Comment has been collapsed.
New update to add headers to the columns and add a sort option based on number of copies in entered giveaways:
https://pastebin.com/W5XYX3Et
Comment has been collapsed.
It's a you, Mario!
Writing just to let you know I did not manage to implement your changes to the latest script version (that was ironically posted after yours). https://www.steamgifts.com/go/comment/Thiobzm
I am leaving a link to yours in the description, though.
Comment has been collapsed.
Hey meneldur,
I also made an attempt to reconcile the two scripts, but I ran into an issue where Firefox is not giving permissions for clipboard access via Javascript executed through an extension. If I make any headway, I will post below.
Comment has been collapsed.
https://pastebin.com/LTtEqeaP
I made a few changes and improvements to lav29's latest script
Comment has been collapsed.
I should edit that its the second part that is needed
resultDisplay.classList.add('entries-results');
document.styleSheets[0].insertRule(".entries-results { overflow: auto!important }");
Comment has been collapsed.
When I sit on my pc I will edit the description to add this version as the newest one.
Greatmastermario did a change on the script but my knowledge is not enough to incorporate on your script,.since so many things changed (for the better!). I will leave a link to his as a fork.
Thanks for all the work!
Comment has been collapsed.
Hey kivan,
I tried incorporating your script edits into mine, but I am running into a problem where Firefox is not allowing me to give permission for clipboard access. Not sure if that was tested or not.
Comment has been collapsed.
That gave some really interesting results:
Comment has been collapsed.
We currently have a fork on the ongoing versions
https://www.steamgifts.com/go/comment/lvtid4N
and
https://www.steamgifts.com/go/comment/Thiobzm
Hopefully tomorrow I have time to (try to) merge them
I am not updating the discussion description meanwhile :)
Also, thanks for all the hard work!
Comment has been collapsed.
Thank you bump
just found out about this cool userscript!
Comment has been collapsed.
62 Comments - Last post 8 minutes ago by pb1
887 Comments - Last post 26 minutes ago by MeguminShiro
530 Comments - Last post 26 minutes ago by MeguminShiro
16 Comments - Last post 48 minutes ago by klingki
47,105 Comments - Last post 2 hours ago by Pish4
39 Comments - Last post 6 hours ago by shivam13
1,758 Comments - Last post 7 hours ago by CutieTheRooster
121 Comments - Last post 31 minutes ago by CBlade
1,196 Comments - Last post 41 minutes ago by CBlade
37 Comments - Last post 53 minutes ago by wigglenose
145 Comments - Last post 54 minutes ago by rimvydasm
65 Comments - Last post 1 hour ago by cg
90 Comments - Last post 1 hour ago by cicangkeling
51 Comments - Last post 2 hours ago by Mirzabah
Edit: The script has been drastically improved by other members!! I am cleaning up the description so it is a bit more objective.
Swordoffury suggested I create a discussion on its own for the script since it would have more visibility and members with some programming know-how could help improve it.
We often have discussions with the topic of "what you are trying to win" or "what game you have entered most giveaways", but SG itself doesn't provide us a tool to easily check on that.
So it is up to us unoccupied users to improve our experience with extra tools! :)
The latest script version can be found at https://www.steamgifts.com/go/comment/Thiobzm
Or if you are lazy, here is the pastebin https://pastebin.com/LTtEqeaP
greatmastermario forked on version 3 to add headers to the columns and a sort option based on number of copies in entered giveaways:
https://www.steamgifts.com/go/comment/lvtid4N
I did not manage to implement the same functionalities on Kivan's script because several things were changed and improved...
Keep an eye out for other updates that are not tracked here (yet)... I need a bit of time to check them out myself :)
How to use it:
There is a 1-second delay between fetching each page result. You can open the console on your browser to check the progress or just wait for the results to be displayed.
I would strongly recommend using a small number (1-2 pages) just to ensure everything is working properly.
It is not much, but the regular fee for discussion creation: Mandatory extra link
Thanks to:
missingtexture - massive overall, fusing 2 scripts into one, improving result display and more
SquishedPotatoe - for result display improvements leading to a SG style.
kivan - for detecting an issue with giveaways of multiple copies, improved sorting, grouped entries table and several improvements.
lav29 - for further results display improvements.
greatmastermario- for the fork with the sortng by number of copies and added headers to the column
Comment has been collapsed.