Hide full rooms - bonk.io

Hides rooms that are full in bonk.io.

  1. // ==UserScript==
  2. // @name Hide full rooms - bonk.io
  3. // @namespace left paren
  4. // @match https://bonk.io/gameframe-release.html
  5. // @grant none
  6. // @version 1.0
  7. // @author left paren
  8. // @license Unlicense
  9. // @description Hides rooms that are full in bonk.io.
  10. // ==/UserScript==
  11.  
  12.  
  13. let hfrOldSend = XMLHttpRequest.prototype.send
  14. let hfrOldOpen = XMLHttpRequest.prototype.open
  15.  
  16. XMLHttpRequest.prototype.open = function(_, url) {
  17. if (url.includes("scripts/getrooms.php")) {
  18. this.hfrIsGetRooms = true
  19. }
  20. hfrOldOpen.call(this, ...arguments)
  21. }
  22.  
  23. XMLHttpRequest.prototype.send = function(data) {
  24. if (this.isGetRooms) {
  25. this.hfrOldReadyChange = this.onreadystatechange
  26. this.onreadystatechange = function () {
  27. if (this.readyState == 4) {
  28. var respJson = JSON.parse(this.response)
  29. if (respJson.rooms) {
  30. respJson.rooms = respJson.rooms.filter(room => room.players < room.maxplayers)
  31. }
  32.  
  33. let newText = JSON.stringify(respJson)
  34. var newResp = () => {
  35. return newText
  36. }
  37. this.__defineGetter__("responseText", newResp)
  38. this.__defineGetter__("response", newResp)
  39. }
  40. this.hfrOldReadyChange?.call(this, ...arguments)
  41. }
  42. }
  43. hfrOldSend.call(this, ...arguments)
  44. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址