Created
March 11, 2021 20:10
-
-
Save salsalabs/547c4c0304faca8910138f5c10621089 to your computer and use it in GitHub Desktop.
Change newspaper URLs to links in the LTE paper selection grid. Makes it *much* easier to use.
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
<!-- BEGIN change newspaper URLs to links in the LTE paper selection grid. --> | |
<script type="text/javascript"> | |
document.addEventListener("DOMContentLoaded", () => { | |
var isLetter = RegExp("letter/.*letter_KEY=\\d+").test(window.location.href); | |
var hasPapers = document.querySelector("div.address") != null; | |
if (isLetter && hasPapers) { | |
Array.from(document.querySelectorAll("div.address")) | |
.forEach((e) => { | |
var t = e.innerHTML | |
var a = e.innerHTML.split("\t").join("").split("\n").join("").split("<br>") | |
a[2] = `<a href="${a[2]}" target="_blank">Link</a>` | |
e.innerHTML = a.join("<br>") | |
}) | |
} | |
}) | |
</script> | |
<!-- END change newspaper URLs to links in the LTE paper selection grid. --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment