J-CAT HTML5

Use the site without having to install Adobe Flash Player.

当前为 2017-04-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name J-CAT HTML5
  3. // @description Use the site without having to install Adobe Flash Player.
  4. // @namespace swyter
  5. // @match *://www.j-cat.org/*/page/check/ind
  6. // @match *://www.j-cat.org/*/page/test_check
  7. // @version 1
  8. // @grant none
  9. // @ruffn-at document-start
  10. // ==/UserScript==
  11.  
  12. window.flashVersion = 9;
  13.  
  14. Object.defineProperty(window, "swfobject",
  15. {
  16. value:
  17. {
  18. embedSWF: function(swf, target)
  19. {
  20. console.log(arguments);
  21. /* add an audio player to hear the sample questions */
  22. player = document.createElement("audio");
  23. player.src = 'http://www.j-cat.org/lib/soundChecker/soundtest.mp3';
  24. player.controls = true;
  25. /* add a fieldset container to wrap everything */
  26. field = document.createElement("fieldset");
  27. field.textContent = 'Click the play button to hear an audio sample.';
  28. if (!(target = document.getElementById(target)))
  29. chkEnv.soundNG();
  30. target.replaceWith(field);
  31. /* add the audio player to the fieldset */
  32. field.appendChild(player);
  33. /* add a confirmation button, too */
  34. button = document.createElement("button");
  35. button.textContent = 'Could you hear? Click here.';
  36. button.addEventListener('click', function()
  37. {
  38. /* call back the page when clicking and tell
  39. it that we were successful */
  40. chkEnv.soundOK("6999");
  41. });
  42. field.appendChild(button);
  43. }
  44. },
  45. writable: false
  46. });