调整超星慕课的播放速度
As of
// ==UserScript==
// @name 慕课倍速播放
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 调整超星慕课的播放速度
// @author You
// @match https://mooc1-1.chaoxing.com/mycourse/studentstudy?*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var $ = window.$;
var speed = `
<div id="control-bar" style="position:fixed;top:10px;left:10px;font-size:14px;border:1px solid black;padding:2px;">
播放速度
<input type="number" id="speed-input" min="0.5" step="0.1" value="1">
</div>`;
$('html').append(speed);
$('#speed-input').on('change', function() {
let firstIframe = document.getElementById('iframe');
let firstIframeDoc = (firstIframe.contentDocument) ? firstIframe.contentDocument : firstIframe.contentWindow.document;
let secondIframe = firstIframeDoc.getElementsByClassName("ans-attach-online")[0];
let secondIframeDoc = (secondIframe.contentDocument) ? secondIframe.contentDocument : secondIframe.contentWindow.document;
let video = secondIframeDoc.getElementById('video_html5_api');
video.playbackRate = this.value;
video.play();
});
})();