Skip to content

Instantly share code, notes, and snippets.

@Sellyme
Last active January 24, 2019 23:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sellyme/1ca4092058480517f7c255c6555bfe24 to your computer and use it in GitHub Desktop.
Save Sellyme/1ca4092058480517f7c255c6555bfe24 to your computer and use it in GitHub Desktop.
Removes all games from AStats Steam_Games.php under a specific filter (by default games that are not owned or started)
// ==UserScript==
// @name AStats completed filter
// @version 0.3.2
// @description Removes all games from AStats Steam_Games.php that are either owned, or have had at least 1 achievement earned
// @author Sellyme
// @downloadURL https://gist.github.com/Sellyme/1ca4092058480517f7c255c6555bfe24/raw/AStats%2520completed%2520filter.user.js
// @updateURL https://gist.github.com/Sellyme/1ca4092058480517f7c255c6555bfe24/raw/AStats%2520completed%2520filter.user.js
// @match http://astats.astats.nl/astats/Steam_Games.php*
// @match https://astats.astats.nl/astats/Steam_Games.php*
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
//select the filter type you want
//0 - display only unstarted games
//1 - display only games that are both unowned and unstarted
//2 - display only owned but uncompleted games
//3 - display owned but unstarted games
//4 - display only uncompleted games
var filterType = 1;
var grey = ''; //unowned and not started
var red = '#FF0000'; //owned and not started
var green = '#347C17'; //0–24% completed
var lightgreen = '#38d131'; //25–49% completed
var blue = '#42a3ff' //50–74% completed
var cyan = '#20e2e2'; //75–99% completed
var purple = '#B23AEE'; //100% completed
var color;
var filter = [[grey, red], [grey], [red, green, lightgreen, blue, cyan], [red], [grey, red, green, lightgreen, blue, cyan]]
var cells = document.querySelectorAll('table.Coloured > tbody > tr > td');
for (var i = 0; i < cells.length; i++) {
var cell = cells[i];
var cellDeep = cell.querySelector('table.Coloured2 > tbody > tr > td');
var fonts = cellDeep.querySelectorAll('font');
if (fonts.length === 1) {
color = '';
} else {
color = fonts[1].color;
}
if (!filter[filterType].includes(color)) {
cell.style.opacity = 0.1;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment