Open birjj opened 9 years ago
The div element with bp-header class tells you what kind of inventory it is, you can use that. But yeah it sucks that Chrome extensions don't allow to access a variable from site. You could however run your script in the web pages scope by injecting it.
Another way would be relying on AJAX request URL (betReturns.php / betBackpack.php) and from that figure out what to do. LoungeDestroyer currently observes these requests from background.js and then passes the URL to content script for Inventory class.
I actually overwrite the placeBetnew/addItemsBet functions from Lounge, which is why it's important for me to detect returns. It's a rather touchy way to hook the requests, so I'll probably change it so I overwrite $.ajax instead - but that'll be for later.
Well, I once used to do it your way, but it has it's flaws. You are relying for AJAX URLs for placeBet to be exactly the same.
Story time Some time ago CSGL admins just changed the placeBet AJAX URL for purpose to break LoungeDestroyer during ESL One Cologne tournament, it worked, but was easily fixable. I came up with a different solution (which you can see in old LD user-script file oldshit.js), I used AjaxPrefilter that allowed me to override ajaxSuccess and to resend basically the same request again.
After that was implemented they took another step further and implemented rate-limiting and dealt with it server side, finally.
With that said, I would much rather prefer 'Place bet' to be more future-proof, than to break every time a tiny change is made to overwritten method. But I doubt it they will do any anti-bot measures anymore since they have rate-limit, but just in case.. ?
Yeah, that's the reason I'm going to change it so it overwrites $.ajax instead - that way I can simply look for identifiable patterns (read: url), and save the request if necesarry.
The way it is now, any minor change will break the plugin (not that I don't have plenty of bugs doing that for me already)
If match page is loaded with returns active to begin with, the extension doesn't detect it.