Fuck Erya

解除尔雅通识课在自动暂停播放的限制并添加自动播放下一集的功能

  1. // ==UserScript==
  2. // @name Fuck Erya
  3. // @name:zh-CN Fuck Erya
  4. // @namespace xuyiming.open@outlook.com
  5. // @description 解除尔雅通识课在自动暂停播放的限制并添加自动播放下一集的功能
  6. // @description:zh-CN 解除尔雅通识课在自动暂停播放的限制并添加自动播放下一集的功能
  7. // @author 依然独特
  8. // @version 1.0.7
  9. // @grant none
  10. // @run-at document-start
  11. // @require https://greasyfork.org/scripts/18715-hooks/code/Hooks.js?version=126794
  12. // @include *://tsk.erya100.com/courseAction!toCourseVideo*
  13. // @include *://*tsk.erya100.com/courseAction!toCourseVideo*
  14. // @include *://tsk*.erya100.com/courseAction!toCourseVideo*
  15. // @include *://*tsk*.erya100.com/courseAction!toCourseVideo*
  16. // @match *://tsk.erya100.com/courseAction!toCourseVideo*
  17. // @match *://*tsk.erya100.com/courseAction!toCourseVideo*
  18. // @match *://tsk*.erya100.com/courseAction!toCourseVideo*
  19. // @include *://*tsk*.erya100.com/courseAction!toCourseVideo*
  20. // @license BSD 2-Clause
  21. // @homepageURL https://gist.github.com/xymopen/79e80a9322d7a1f35f16
  22. // ==/UserScript==
  23.  
  24. ( function() {
  25. "use strict";
  26.  
  27. function hookJQuery( onPlayerInit, contextWindow ) {
  28. contextWindow = contextWindow || window;
  29.  
  30. // CXPlayer extends jQuery for its own APIs
  31. // so hook jQuery to modify these APIs.
  32. Hooks.set( contextWindow, "jQuery", function( target, propertyName, ignored, jQuery ) {
  33. Hooks.set( jQuery.fn, "cxplayer", function( target, propertyName, oldValue, newValue ) {
  34. return Hooks.apply( newValue, function( target, thisArg, argv ) {
  35. var config = argv[ 0 ], $player;
  36.  
  37. config.datas.isAutoPlayNext = true;
  38. config.datas.isDefaultPlay = true;
  39.  
  40. $player = Hooks.Reply.apply( arguments );
  41.  
  42. if ( config.events &&
  43. config.events.onAnswerRight &&
  44. !config.events.onAnswerRight.toString()
  45. .replace( /(function .*?\(.*?\))/g, "" ).trim() // remove function signifigure
  46. .replace( /^\{|\}$/g, "" )
  47. .replace( /\/\/.*(\r|\n|(\r\n))/g,"" ) // remove single line comment
  48. .replace( /\/\*.*\*\//mg,"" ) // remove multiple line comment
  49. .match( /^\s*$/ )
  50. ) {
  51. contextWindow.alert( "onAnswerRight() is not empty. It's unsafe to block the resource URL." );
  52. }
  53.  
  54. $player.bind( "onPause", function() {
  55. $player.playMovie();
  56. } );
  57.  
  58. onPlayerInit( $player, config );
  59.  
  60. return $player;
  61. } );
  62. } );
  63.  
  64. Hooks.set( jQuery.fn, "pauseMovie", function( target, methodName, oldValue, newValue ) {
  65. return Hooks.apply( newValue, function ( target, thisArg, argv ) {
  66. /* empty */
  67. } );
  68. } );
  69.  
  70. return Hooks.Reply.set( arguments );
  71. } );
  72. };
  73.  
  74. hookJQuery( function( $player, config ) {
  75. // Automatically play the next episode
  76. $player.bind( "onEnd", function( event, index, config ) {
  77. // Wait for the player to synchronize your playback progress
  78. $player.bind( "onSendProgressSuccess", function go() {
  79. $player.unbind( "onSendProgressSuccess", go );
  80. $player.goPlay( index + 1 );
  81. } );
  82. } );
  83. } );
  84. } )();