J-CAT HTML5

Use the site without having to install Adobe Flash Player.

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