Created
August 14, 2021 19:30
-
-
Save dimidd/45769dc156a92af9fce525ad7a6d89a6 to your computer and use it in GitHub Desktop.
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 cal_anchors | |
// @version 1 | |
// @grant none | |
// @include http://cal.huc.edu/* | |
// ==/UserScript== | |
const queryString = window.location.search; | |
const urlParams = new URLSearchParams(queryString); | |
url = window.location.href; | |
prefix = url.match(/file=(\d+)/)[1]; | |
table = document.getElementsByTagName('table')[1]; | |
trs = table.children[0].children; | |
for (let r of trs) { | |
bdo = r.getElementsByTagName('bdo')[0]; | |
naiveReverse = function(string) { | |
return string.split('').reverse().join(''); | |
}; | |
suffix = naiveReverse(bdo.innerText).replace(/[\s.:\(\)]/g, ''); | |
r.id = prefix + suffix; | |
} | |
row = urlParams.get('row'); | |
console.log(row); | |
document.getElementById(row).scrollIntoView(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment