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/*
  6. // @match *://www.j-cat.org/*/page/test_check
  7. // @match *://www.j-cat.org/*/page/test_start
  8. // @version 3
  9. // @grant none
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. window.flashVersion = 9;
  14.  
  15. Object.defineProperty(window, "swfobject",
  16. {
  17. value:
  18. {
  19. embedSWF: function(swf, target, width, height, min_flash_version, alt_swf, flashvars, params, attributes)
  20. {
  21. console.log(arguments);
  22. /* this is a check page */
  23. if (target === 'soundChk_swf')
  24. {
  25. /* add an audio player to hear the sample questions */
  26. player = document.createElement("audio");
  27. player.src = 'http://www.j-cat.org/lib/soundChecker/soundtest.mp3';
  28. player.controls = true;
  29.  
  30. /* add a fieldset container to wrap everything */
  31. field = document.createElement("fieldset");
  32. field.textContent = 'Click the play button to hear an audio sample.';
  33.  
  34. if (!(target = document.getElementById(target)))
  35. chkEnv.soundNG();
  36.  
  37. target.replaceWith(field);
  38.  
  39. /* add the audio player to the fieldset */
  40. field.appendChild(player);
  41.  
  42. /* add a confirmation button, too */
  43. button = document.createElement("button");
  44. button.textContent = 'Could you hear? Click here.';
  45. button.addEventListener('click', function()
  46. {
  47. /* call back the page when clicking and tell
  48. it that we were successful */
  49. chkEnv.soundOK("6999");
  50. });
  51.  
  52. field.appendChild(button);
  53. }
  54. /* this is an actual test page */
  55. else if (target == 'testFlashArea')
  56. {
  57. this.BASE_URL = flashvars["BASE_URL"];
  58. this.ITEMOUT_URL = this.BASE_URL + "itemout/";
  59. this.PREVIEW_URL = this.BASE_URL + "admin/";
  60. this.SAMPLE_URL = this.BASE_URL + "sample/";
  61. this.SAMPLE_ITEMOUT_URL = this.BASE_URL + "sample/itemout/";
  62. this.PREVIEW = flashvars["PREVIEW"];
  63. this.SAMPLE = flashvars["SAMPLE"];
  64. this.lang = flashvars["LANG"];
  65. console.log(target, this);
  66. }
  67. }
  68. },
  69. writable: false
  70. });