好看视频 取消自动播放

在播放结束后,停止播放

// ==UserScript==
// @name         好看视频 取消自动播放
// @namespace    haokan.baidu.com
// @version      0.1
// @description  在播放结束后,停止播放
// @author       e1399579
// @icon         https://hk.bdstatic.com/app/favicon.ico
// @match        *://haokan.baidu.com/v*
// @run-at       document-start
// @license      MIT
// ==/UserScript==

"use strict";
HTMLVideoElement.prototype.realAddEventListener = HTMLVideoElement.prototype.addEventListener;
HTMLVideoElement.prototype.addEventListener = function(type, listener, options) {
    if (type === "ended") {
        this.realAddEventListener(type, function() {
            this.pause();
            this.currentTime = 0;
        });
    } else {
        this.realAddEventListener(...arguments);
    }
};