Last active
March 15, 2026 03:13
-
-
Save Sellyme/509e4bce8f81caa916abfd6316aa4749 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 [SH] Quick Filters+ | |
| // @description Adds more quick filters to user profiles | |
| // @version 0.3 | |
| // @changelog 0.3 - ensure the filters are always injected even if this script runs late | |
| // @changelog 0.3 - add autoupdate URLs | |
| // @author Sellyme | |
| // @match https://steamhunters.com/id/*/games* | |
| // @match https://steamhunters.com/profiles/*/games* | |
| // @downloadURL https://gist.githubusercontent.com/Sellyme/509e4bce8f81caa916abfd6316aa4749/raw | |
| // @updateURL https://gist.githubusercontent.com/Sellyme/509e4bce8f81caa916abfd6316aa4749/raw | |
| // ==/UserScript== | |
| (function(){ | |
| if(typeof sh !== "undefined") { | |
| inject_filters(); | |
| } else { | |
| (new MutationObserver(check)).observe(document.querySelector("#pointsChartCanvas"), {childList: true, subtree: true}); | |
| } | |
| })(); | |
| function check(changes, observer) { | |
| //only run onece profile JSON object is loaded | |
| if (typeof sh !== 'undefined') { | |
| observer.disconnect(); | |
| inject_filters(); | |
| } | |
| } | |
| function inject_filters() { | |
| var quick_filters = document.getElementById("filters").nextElementSibling; | |
| var new_filters = document.createElement('ul'); | |
| new_filters.classList.add('list-unstyled','list-inline'); | |
| var base_url = location.href.split("games")[0]+"games"; | |
| var filter_data = [ | |
| {'desc': "Reset filters", 'link': base_url}, | |
| {'desc': "First completions", 'link': base_url+"?first=true"}, | |
| {'desc': "Fastest completions", 'link': base_url+"?fastest=true"}, | |
| {'desc': "Only completer", 'link': base_url+"?maxPlayersCompleted=1&state=perfect,completedButNotPerfect"}, | |
| {'desc': "Base game completed", 'link': base_url+"?state=baseGameCompleted"}, | |
| {'desc': "Invalidated", 'link': base_url+"?invalidated=true"}, | |
| {'desc': "Previously completed", 'link': base_url+"?state=previouslyCompleted"}, | |
| ] | |
| for (var i = 0; i < filter_data.length; i++) { | |
| var new_filter = filter_data[i]; | |
| var filter_obj = document.createElement('li'); | |
| var filter_link = document.createElement('a'); | |
| filter_link.innerText = new_filter.desc; | |
| filter_link.href = new_filter.link; | |
| filter_obj.appendChild(filter_link); | |
| new_filters.appendChild(filter_obj); | |
| new_filters.appendChild(document.createTextNode(" ")); | |
| } | |
| quick_filters.appendChild(new_filters); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment