Created
February 12, 2016 15:53
-
-
Save oal/8953fa2a9aff5129570c to your computer and use it in GitHub Desktop.
Quick and dirty userscript that inlines footnotes so I don't have to scroll to the bottom and up again.
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 Safari Books Online | |
// @namespace https://www.safaribooksonline.com/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.safaribooksonline.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
setTimeout(function() { | |
var pointers = document.querySelectorAll('.totri-footnote'); | |
console.log(pointers); | |
for(var i = 0; i < pointers.length; i++) { | |
var pointer = pointers[i]; | |
var fnId = pointer.href.split('#')[1]; | |
console.log(fnId); | |
var fnText = document.querySelector('#'+fnId).innerHTML; | |
console.log(fnText); | |
var el = document.createElement('em'); | |
el.innerHTML = fnText; | |
pointer.parentElement.parentElement.appendChild(el); | |
} | |
}, 1500); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment