Greasy Fork 还支持 简体中文。

Blow up Stream in Google Classroom

Change out all the links that go to the Stream tab to the Classwork tab, except the Stream tab button

目前為 2025-02-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Blow up Stream in Google Classroom
// @description Change out all the links that go to the Stream tab to the Classwork tab, except the Stream tab button
// @match https://classroom.google.com/*
// @namespace   test
// @version     1.2
// @grant       none
// @license MIT
// ==/UserScript==

const target = document.body

const observer = new MutationObserver(function(mutations) {
  mutations.forEach(function(mutation) {
        const links = document.getElementsByTagName('a');
       	const regexFull = /\/u\/1\/c\/(.*)$/i;
    
        for (var i = 0; i < links.length; i++) {
          if (links[i].href.includes("details")) {
            continue
          }
          
          if (links[i].getAttribute("tabindex") == "-1" || links[i].getAttribute("data-focus-id")?.length > -1) {
            links[i].href = links[i].href.replace(regexFull, '/u/1/w/$1/t/all');
          }
        }
  });
});

const config = {
  childList: true,
    subtree: true,
};

observer.observe(target, config);