Skip to content

Instantly share code, notes, and snippets.

@bigethan
Last active October 11, 2020 18:01
Show Gist options
  • Save bigethan/38389baeb79e3531af168db2ad88b46a to your computer and use it in GitHub Desktop.
Save bigethan/38389baeb79e3531af168db2ad88b46a to your computer and use it in GitHub Desktop.
Makes the Google docs share button red when only the author has access. To install click the `Raw` button and your userscript extension will take it from there.
// ==UserScript==
// @name Red Share button when only I can see the file
// @namespace http://bigethan.com/
// @version 0.1
// @description To prevent sharing unshared docs, this turns the share button on google docs red when it's only shared with me.
// @author Bigethan
// @match https://docs.google.com/document/*
// @grant none
// ==/UserScript==
(function(document) {
'use strict';
setInterval(function() {
let button = document.querySelector("#docs-titlebar-share-client-button > div");
if (button.getAttribute('aria-label') == 'Share. Private to only me. ') {
button.style.background = 'rgb(232, 74, 26)'
} else {
button.style.background = 'rgb(26, 115, 232)'
}
}, 5000);
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment