Wanikani Random Font

Randomize between Japanese fonts on Wanikani.

  1. // ==UserScript==
  2. // @name Wanikani Random Font
  3. // @namespace mempo
  4. // @description Randomize between Japanese fonts on Wanikani.
  5. // @include https://wanikani.com/review/*
  6. // @include https://www.wanikani.com/review/*
  7. // @version 1.1
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. console.log('Start of Wanikani Random Font script');
  12. console.log('////////');
  13.  
  14. $(function() {
  15. // Modify here --------------------------------------------------------
  16. var fonts = [
  17. "Takao Mincho", "Takao P Mincho", "Takao Ex Mincho", "TakaoGothic",
  18. "Takao PGothic","TakaoMincho","Takao PMincho","TakaoExGothic","TakaoExMincho"
  19. ];
  20. var good = 'Meiryo';
  21. var interval = 30; // Seconds
  22. // No more touchie past this point ------------------------------------
  23.  
  24. var randomFont = function() {
  25. var chosen = fonts[Math.floor(Math.random() * fonts.length)];
  26. $('[lang="ja"], #user-response').css('font-family', chosen).hover(function() {
  27. $(this).css('font-family', good);
  28. }, function() {
  29. $(this).css('font-family', chosen);
  30. });
  31. };
  32. randomFont();
  33. setInterval(randomFont, interval * 1000);
  34. });