Wanikani Block Review Submit

Disable submission of reviews, for debugging purposes

  1. // ==UserScript==
  2. // @name Wanikani Block Review Submit
  3. // @namespace wk_block_submit
  4. // @description Disable submission of reviews, for debugging purposes
  5. // @match https://*.wanikani.com/*
  6. // @version 1.0.1
  7. // @author Robin Findley
  8. // @copyright 2023, Robin Findley
  9. // @license MIT; http://opensource.org/licenses/MIT
  10. // @run-at document-end
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. window.block_submit = {};
  15.  
  16. (function(gobj) {
  17.  
  18. let old_fetch = window.fetch;
  19. window.fetch = new_fetch;
  20.  
  21. function new_fetch(url, data) {
  22. if ((url === '/subjects/review') && (data.method === 'PUT')) {
  23. console.log('Blocking submit: ', JSON.parse(data.body).counts[0]);
  24. return Promise.resolve({ok:true});
  25. }
  26. return old_fetch.apply(window, arguments);
  27. };
  28.  
  29. })(window.block_submit);