Last active
June 8, 2023 02:04
-
-
Save adntaha/8221076f7f1acf922a9063fbd64436f4 to your computer and use it in GitHub Desktop.
because you don't want to accidentally edit a reference document a teacher forgot to mark as view-only and have your name appear on the Modified-By List of Shame™ - Userscript
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 Don't Edit Documents from Teams | |
// @version 1 | |
// @include https://*.sharepoint.com/* | |
// @grant none | |
// ==/UserScript== | |
const searchParams = new URLSearchParams(location.search) | |
if (searchParams.get("wdOrigin") === "TEAMS-ELECTRON.teamsSdk.openFilePreview" && searchParams.get("action") === "edit") { | |
searchParams.set("action", "view") | |
location.search = searchParams.toString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment