MatchBlocker

Block the annoying 'match'-challange

  1. // ==UserScript==
  2. // @license WTFPL
  3. // @name MatchBlocker
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1
  6. // @description Block the annoying 'match'-challange
  7. // @author Me
  8. // @match https://www.duolingo.com/*
  9. // @icon https://www.google.com/s2/favicons?domain=duolingo.com
  10. // @grant none
  11. // ==/UserScript==
  12. (function(send, open) {
  13. 'use strict';
  14. let blockedTypes = ["match"]
  15. // Override send() method to change request body
  16. XMLHttpRequest.prototype.send = function(body) {
  17. let modifiedBody = body;
  18. // Is game session. Modify
  19. if (this.url.endsWith("sessions")) {
  20. let parsedBody = JSON.parse(modifiedBody);
  21. blockedTypes.forEach(type => {
  22. let typeIndex = parsedBody.challengeTypes.indexOf(type);
  23. if (typeIndex != -1) {
  24. console.log("Blocking " + type, parsedBody.challengeTypes);
  25. parsedBody.challengeTypes.splice(typeIndex, 1);
  26. }
  27. });
  28. modifiedBody = JSON.stringify(parsedBody);
  29. }
  30. send.apply(this, [modifiedBody]);
  31. };
  32. // Override open() method to intercept request URL
  33. XMLHttpRequest.prototype.open = function(method, url) {
  34. this.url = url;
  35. open.apply(this, arguments);
  36. }
  37. })(XMLHttpRequest.prototype.send, XMLHttpRequest.prototype.open);

QingJ © 2025

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