Last active
March 22, 2026 11:16
-
-
Save SummonHIM/710888556ad8368f831f26b53f4bf164 to your computer and use it in GitHub Desktop.
广工商网校强制开启自动连播
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name 广工商网校强制开启自动连播 | |
| // @namespace https://usc.gzgs.edu.cn/ | |
| // @version 2026-03-22 | |
| // @description 通过修改本地储存空间缓存的自动播放开关来实现强制开启自动连播。如果没有生效则尝试刷新网页。 | |
| // @author SummonHIM | |
| // @license MPL-2.0 | |
| // @match https://usc.gzgs.edu.cn/wx/study-mooc/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| "use strict"; | |
| function checkAndEnableAutoPlay() { | |
| let changed = false; | |
| for (let key in localStorage) { | |
| if (key.startsWith("vodStore")) { | |
| try { | |
| let data = JSON.parse(localStorage.getItem(key)); | |
| if (data && data.autoPlay !== 1) { | |
| data.autoPlay = 1; | |
| localStorage.setItem(key, JSON.stringify(data)); | |
| changed = true; | |
| console.log(`已为 ${key} 开启自动连播`); | |
| } | |
| } catch (e) { | |
| // 忽略非 JSON 的 localStorage | |
| } | |
| } | |
| } | |
| if (changed) { | |
| // 刷新页面 | |
| location.reload(); | |
| } | |
| } | |
| // 每 500ms 检查一次 localStorage | |
| setInterval(checkAndEnableAutoPlay, 500); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment