Created
March 5, 2022 22:09
-
-
Save NeutralKaon/584c8b1a92d3f63850da745f6a54d3de to your computer and use it in GitHub Desktop.
Oxford TMS quality of life improvements.
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 TMS-Hax | |
// @namespace https://tms.ox.ac.uk tms.ox.ac.uk | |
// @description Quality of life hax | |
// @include https://tms.ox.ac.uk/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// ==/UserScript== | |
// This is a quality of life script for the rather unfortunately terrible site tms.ox.ac.uk | |
// Use with greasemonkey or tampermonkey | |
// I will try to improve things as time goes on. | |
let debug=0; | |
//Deal with disclaimer | |
if(window.location.href.match("https://tms.ox.ac.uk/AcademicReport/OrganisingUserAcademicReportExportToPdf")){ | |
waitForKeyElements(".results-list li",HideDisclaimer); | |
} | |
//Make spellcheck great again | |
if(window.location.href.match("https://tms.ox.ac.uk/AcademicFeedback") || | |
window.location.href.match("https://tms.ox.ac.uk/TeachingArrangement") ){ | |
debug && console.log("Firing!"); | |
waitForKeyElements(".cke_editable",EnableSpellcheck,false); | |
document.addEventListener( "DOMNodeInserted", EnableSpellcheck, false ); | |
} | |
//Reduce line-height to help increase information density. | |
waitForKeyElements(".tab-content",FixStylings,false); | |
function FixStylings() { | |
var userTypeNodes = $(".tab-content"); | |
userTypeNodes.css("line-height",1); | |
} | |
function EnableSpellcheck () { | |
debug && console.log('Enabling Spellcheck!'); | |
var query=document.querySelector("iframe").contentWindow.document.querySelector(".cke_editable"); | |
query.setAttribute("spellcheck","true"); | |
debug && console.log('Done!'); | |
} | |
function HideDisclaimer () { | |
debug && console.log('Firing!'); | |
var toHide = document.getElementsByClassName('important'); | |
for (var i = 0; i < toHide.length; i ++) { | |
toHide[i].style.display = 'none'; | |
debug && console.log('disclaimer hidden!') | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment