Created
September 23, 2020 12:16
-
-
Save easrng/c85db478dc4269a094eda35cd8770618 to your computer and use it in GitHub Desktop.
Fix the classroom turn in button on docs. Makes it function correctly when used with multiple accounts, and look more modern.
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 Turn in button fixer | |
// @namespace https://easrng.github.io/ | |
// @match https://docs.google.com/* | |
// @grant none | |
// @version 1.0 | |
// @author easrng | |
// @description Fix the classroom turn in button on docs. Makes it function correctly when used with multiple accounts, and look more modern. | |
// ==/UserScript== | |
const realopen=window.open; | |
window.open=(...e)=>{ | |
let u=new URL(e[0]) | |
if(u.pathname=="/url"&&u.hostname.includes("google.")) u=new URL(u.searchParams.get("q")) | |
if(u.hostname.includes("google")) u.searchParams.set("authuser",new URL(document.querySelector('#gb a[href^="https://myaccount.google.com/?"]').href).searchParams.get("authuser")||"0") | |
e[0]=u.href | |
return realopen(...e) | |
} | |
let s=document.createElement("style"); | |
s.textContent=`.docs-material #docs-script-button-bar .jfk-button:not(:root) { | |
--matter-helper-theme: var(--matter-theme-rgb, var(--matter-primary-rgb, 33, 150, 243)); | |
position: relative; | |
display: inline-block; | |
box-sizing: border-box; | |
border: solid 1px; /* Safari */ | |
border-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.24) !important; | |
border-radius: 4px; | |
padding: 0 16px; | |
min-width: 64px; | |
height: 36px; | |
vertical-align: middle; | |
text-align: center; | |
text-overflow: ellipsis; | |
color: rgb(var(--matter-helper-theme)) !important; | |
background-color: transparent; | |
font-family: "Google Sans", Roboto, RobotoDraft, Helvetica, Arial, sans-serif; | |
font-weight: 500; | |
font-size: 14px; | |
line-height: 34px; | |
outline: none; | |
cursor: pointer; | |
box-shadow: none !important; | |
text-transform: none; | |
} | |
.docs-material #docs-script-button-bar .jfk-button::-moz-focus-inner { | |
border: none; | |
} | |
/* Highlight, Ripple */ | |
.docs-material #docs-script-button-bar .jfk-button::before, | |
.docs-material #docs-script-button-bar .jfk-button::after { | |
content: ""; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
border-radius: 3px; | |
opacity: 0; | |
} | |
.docs-material #docs-script-button-bar .jfk-button::before { | |
background-color: rgb(var(--matter-helper-theme)); | |
transition: opacity 0.2s; | |
} | |
.docs-material #docs-script-button-bar .jfk-button::after { | |
background: radial-gradient(circle at center, currentColor 1%, transparent 1%) center/10000% 10000% no-repeat; | |
transition: opacity 1s, background-size 0.5s; | |
} | |
/* Hover, Focus */ | |
.docs-material #docs-script-button-bar .jfk-button:hover::before { | |
opacity: 0.04; | |
} | |
.docs-material #docs-script-button-bar .jfk-button:focus::before { | |
opacity: 0.12; | |
} | |
.docs-material #docs-script-button-bar .jfk-button:hover:focus::before { | |
opacity: 0.16; | |
} | |
/* Active */ | |
.docs-material #docs-script-button-bar .jfk-button:active::after { | |
opacity: 0.16; | |
background-size: 100% 100%; | |
transition: background-size 0s; | |
} | |
/* Disabled */ | |
.docs-material #docs-script-button-bar .jfk-button:disabled { | |
color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38); | |
background-color: transparent; | |
cursor: initial; | |
} | |
.docs-material #docs-script-button-bar .jfk-button:disabled::before, | |
.docs-material #docs-script-button-bar .jfk-button:disabled::after { | |
opacity: 0; | |
}` | |
document.head.appendChild(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment