WaniKani Review Wrong Info Click

Automatically click the info button upon wrong review answer.

  1. // ==UserScript==
  2. // @name WaniKani Review Wrong Info Click
  3. // @namespace https://www.wanikani.com
  4. // @description Automatically click the info button upon wrong review answer.
  5. // @version 0.1.0
  6. // @include https://www.wanikani.com/review/session
  7. // @include http://www.wanikani.com/review/session
  8. // @run-at document-end
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. /*global $, console*/
  13.  
  14. /*
  15. hook wrongCount jStorage
  16. upon field update with increased value
  17. automatically click the show info button
  18. after a slight delay (to avoid a display glitch)
  19. */
  20.  
  21. (function () {
  22. 'use strict';
  23.  
  24. var lastWrongCount = 0;
  25. $.jStorage.listenKeyChange('wrongCount', function (key, action) {
  26. var wrongCount;
  27. if (action === 'updated') {
  28. wrongCount = $.jStorage.get('wrongCount');
  29. if (wrongCount > lastWrongCount) {
  30. setTimeout(function () {
  31. $('#option-item-info').click();
  32. }, 100);
  33. }
  34. lastWrongCount = wrongCount;
  35. }
  36. });
  37. console.log('WaniKani Review Wrong Info Click: script load end');
  38. }());