您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Make Coursera better! Enlarge reading material font size; enforce Space key & ArrowLeft key & ArrowRight key work properly when playing video.
// ==UserScript== // @name CourseraUXEnhancer // @namespace http://tampermonkey.net/ // @version 0.3 // @description Make Coursera better! Enlarge reading material font size; enforce Space key & ArrowLeft key & ArrowRight key work properly when playing video. // @author Winston Shu // @match *://*.coursera.org/learn/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript== (function () { "use strict"; const observer = new MutationObserver(() => { let previousUrl = ""; let root = document.querySelector("html"); if (location.href !== previousUrl) { previousUrl = location.href; if ( location.href.includes("/supplement/") || location.href.includes("/gradedLti") || location.href.includes("/ungradedLti") || location.href.includes("/discussionPrompt") ) { root.style.fontSize = "23px"; } else { injectSpaceKey(); root.style.fontSize = "16px"; } } }); const config = { subtree: true, childList: true }; observer.observe(document, config); function injectSpaceKey() { window.onload = () => { window.addEventListener("keydown", (key) => { let media = document.querySelector("video"); if (key.code == "Space") { media.paused || media.currentTime == 0 ? media.play() : media.pause(); } else if (key.code == "ArrowLeft") { media.currentTime >= 5 ? (media.currentTime -= 5) : (media.currentTime = 0); } else if (key.code == "ArrowRight") { media.currentTime <= media.duration - 5 ? (media.currentTime += 5) : (media.currentTime = media.currentTime); } }); }; } })();