Greasy Fork 还支持 简体中文。

Change Google Classroom User

Swithces between /u/0 & /u/1 on google classroom automatically.

目前為 2020-04-05 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Change Google Classroom User
  3. // @namespace Change Google Classroom User by C4illin
  4. // @description Swithces between /u/0 & /u/1 on google classroom automatically.
  5. // @match https://classroom.google.com/*
  6. // @run-at document-idle
  7. // @grant none
  8. // @author C4illin <C@illin.cf>
  9. // @oujs:author C4illin
  10. // @version 1.1.5
  11. // @homepageURL https://github.com/C4illin/Userscripts/tree/master/Change-Google-Classroom-User
  12. // @license MIT; https://opensource.org/licenses/MIT
  13. // @copyright 2018-2019, C4illin (https://github.com/C4illin)
  14. // ==/UserScript==
  15.  
  16. ;(function() {
  17. let redirected = false
  18. setInterval(() => {
  19. if (!redirected) {
  20. if ((document.getElementsByClassName("Lqr2e").length != 0) && (window.location.pathname.length < 7)) {
  21. switchUser()
  22. }
  23. if ((document.getElementsByClassName("tCD5Mc").length != 0) && (window.location.pathname.length > 7)) {
  24. switchUser()
  25. }
  26. }
  27. }, 250)
  28. function switchUser() {
  29. redirected = true
  30. let user
  31. if (window.location.pathname.substring(3,4) == 0) {
  32. user = 1
  33. } else {
  34. user = 0
  35. }
  36. let newlink = "https://classroom.google.com/u/"+ user + window.location.pathname.substring(4) + window.location.search + window.location.hash
  37. window.location.replace(newlink)
  38. }
  39. })()