Last active
May 22, 2022 20:25
-
-
Save Armster15/0c8941b3b9af6e55874f4e082c5dc714 to your computer and use it in GitHub Desktop.
A userscript for hiding OneNote drawing annotations with ease
This file contains 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 Remove OneNote Annotations | |
// @version 1.0.0 | |
// @description Need to hide drawing annotations in OneNote? This userscript is for you! It adds toggle buttons where you can hide/show the drawing annotations. | |
// @author Armster15 | |
// @license The Unlicense | |
// @match https://usc-onenote.officeapps.live.com/* | |
// @icon https://i.imgur.com/84FaPib.png | |
// @grant none | |
// @namespace https://gist.github.com/Armster15/0c8941b3b9af6e55874f4e082c5dc714 | |
// @supportURL https://gist.github.com/Armster15/0c8941b3b9af6e55874f4e082c5dc714 | |
// ==/UserScript== | |
/* | |
Required attribution for UserScript's icon: | |
"""No Edit by Adrien Coquet from NounProject.com""" | |
UserScript formatted with Prettier.js (https://prettier.io) | |
*/ | |
(function () { | |
"use strict"; | |
var addCSS = (css) => | |
(document.head.appendChild(document.createElement("style")).innerHTML = | |
css); | |
addCSS(` | |
@media print{ | |
.no-print{ | |
display:none; | |
} | |
} | |
`); | |
var styleEl = document.createElement("style"); | |
var addAnnotations = document.createElement("button"); | |
addAnnotations.innerText = "Add annotations back"; | |
addAnnotations.classList.add("no-print"); | |
addAnnotations.setAttribute( | |
"style", | |
"position: fixed; bottom: 50px; right: 10px;" | |
); | |
addAnnotations.addEventListener("click", () => { | |
styleEl.innerHTML = ` | |
.Ink { | |
display: block !important; | |
} | |
`; | |
}); | |
var removeAnnotations = document.createElement("button"); | |
removeAnnotations.innerText = "Remove annotations"; | |
removeAnnotations.classList.add("no-print"); | |
removeAnnotations.setAttribute( | |
"style", | |
"position: fixed; bottom: 50px; right: 150px;" | |
); | |
removeAnnotations.addEventListener("click", () => { | |
styleEl.innerHTML = ` | |
.Ink { | |
display: none !important; | |
} | |
`; | |
}); | |
document.head.appendChild(styleEl); | |
document.body.appendChild(addAnnotations); | |
document.body.appendChild(removeAnnotations); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment