Skip to content

Instantly share code, notes, and snippets.

@hashdashme
Last active May 20, 2024 16:04
Show Gist options
  • Select an option

  • Save hashdashme/bb89da35b0d3a5528accbec1a3cc7f89 to your computer and use it in GitHub Desktop.

Select an option

Save hashdashme/bb89da35b0d3a5528accbec1a3cc7f89 to your computer and use it in GitHub Desktop.
// ==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");
}
@DaSimple619
Copy link

thank you brother

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment