WaniKani random font

Randomize between Japanese fonts on WaniKani.

目前为 2016-01-27 提交的版本。查看 最新版本

  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
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. $(function() {
  12. // Modify here --------------------------------------------------------
  13. var fonts = [
  14. "Takao Mincho", "Takao P Mincho", "Takao Ex Mincho"
  15. ];
  16. var good = 'Meiryo';
  17. var interval = 60; // Seconds
  18. // No more touchie past this point ------------------------------------
  19.  
  20. var randomFont = function() {
  21. var chosen = fonts[Math.floor(Math.random() * fonts.length)];
  22. $('[lang="ja"], #user-response').css('font-family', chosen).hover(function() {
  23. $(this).css('font-family', good);
  24. }, function() {
  25. $(this).css('font-family', chosen);
  26. });
  27. };
  28. randomFont();
  29. setInterval(randomFont, interval * 1000);
  30. });