Last active
May 20, 2024 16:04
-
-
Save hashdashme/bb89da35b0d3a5528accbec1a3cc7f89 to your computer and use it in GitHub Desktop.
Based off of https://github.com/Dracnea/Backpack.tfSpells/blob/main/BackpackSpells.js. Press raw to install
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 Backpack.tf Buy Order Spells Pruner | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description Purges spell buy orders or something... | |
| // @author hashdash | |
| // @match https://backpack.tf/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| const url = window.location.href; | |
| const badAttributes = ["data-spell_1", "data-spell_2"]; | |
| let listings; | |
| if (url.includes("premium")) listings = document.querySelectorAll("li.item"); | |
| else listings = document.querySelectorAll("div.item"); | |
| if (!listings) return; | |
| for (let l = 0; l < listings.length; l++){ | |
| let listing = listings[l]; | |
| let badListing = false; | |
| for (let i = 0; i < badAttributes.length; i++) { | |
| const badAttribute = badAttributes[i]; | |
| if (listing.getAttribute(badAttribute) != null) { | |
| badListing = true; | |
| break; | |
| } | |
| } | |
| let isBuyOrder = false; | |
| if (listing.getAttribute('data-listing_intent') == 'buy') { | |
| isBuyOrder = true; | |
| } | |
| if (badListing && isBuyOrder) { | |
| console.log(listing); | |
| hideListing(listing); | |
| } | |
| } | |
| })(); | |
| function hideListing(listing) { | |
| const currentStyle = listing.parentNode.parentNode.getAttribute("style"); | |
| listing.parentNode.parentNode.setAttribute("style", currentStyle + ";display: none !important"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you brother