NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Textbook Citation Footnote-ifier // @namespace http://your.homepage/ // @version 0.3 // @description Script to convert in-text citations into footnotes, making it more readable // @author h2 // @match https://gpc.view.usg.edu/content/enforced/730176* // @grant none // ==/UserScript== var footnotes = document.getElementsByClassName('footnote'); // make an array of all footnotes in document for (var i=footnotes.length; --i>=0;) { // run a loop iterating over each instance of a footnote appearing var note = footnotes[i].innerHTML; //make a text copy of the current footnote html, will use it to be mouseover text later note.replace(); //figure out some magic regexp and put it here later, to parse string for stupid html tags and purge them var icon = new Image(16, 16); //make a footnote icon to replace the in-text citations with later icon.src = 'http://web.mit.edu/ghudson/dev/nokrb/third/gnome-icon-theme/16x16/stock/text/stock_insert_footnote.png'; var enhancedNote = document.createElement('span'); //make supernote, start bringing it all together enhancedNote.setAttribute ('title', note); enhancedNote.appendChild (icon); footnotes[i].parentNode.replaceChild(enhancedNote, footnotes[i]); // replace ugly in-text citation with enhanced footnote icon that uses old footnote as it's mouseover text }