Skip to content

Instantly share code, notes, and snippets.

@elken
Last active August 29, 2015 14:19
Show Gist options
  • Save elken/15619b9be342db1266fe to your computer and use it in GitHub Desktop.
Save elken/15619b9be342db1266fe to your computer and use it in GitHub Desktop.
CSGO Trade Counter
orig = "These are the items you will lose in the trade.";
var total = 0;
document.querySelector(".offerheader").childNodes.item(4).data = orig + " Total: " + total;
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var url = document.querySelector(".nextTarget").childNodes.item(1).innerHTML.split(" ").slice(2);
if (url.length != 0) {
total = Number(document.querySelector(".nextTarget").id.split("_").slice(2)) + 1;
document.querySelector(".offerheader").childNodes.item(4).data = orig + " Total: " + total;
}
});
});
var node = document.getElementById("your_slots");
observer.observe(node, {
attributes: !0,
attributeFilter: ["class", "src"],
attributeOldValue: true,
subtree: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment