Skip to content

Instantly share code, notes, and snippets.

@osvein
Created October 1, 2017 12:53
Show Gist options
  • Select an option

  • Save osvein/bd8701a1928743b8a8e0f376d5cf6c4e to your computer and use it in GitHub Desktop.

Select an option

Save osvein/bd8701a1928743b8a8e0f376d5cf6c4e to your computer and use it in GitHub Desktop.
GreaseMonkey userscript to add some missing links from XBD header pages to XSU function pages in the online POSIX standard viewer
// ==UserScript==
// @name posix-linker
// @namespace https://github.com/osvein
// @description adds some missing links from XBD header pages to XSU function pages in the online POSIX standard viewer
// @include http://pubs.opengroup.org/onlinepubs/9699919799/
// @version 1
// @grant none
// ==/UserScript==
var frame = document.getElementById('main');
frame.addEventListener('load', function () {
var re = /^https?:[/][/]pubs.opengroup.org[/]onlinepubs[/]9699919799[/]basedefs[/]\w+[.]h[.]html(#\w*)?$/;
if (re.test(frame.contentWindow.location.href)) process(frame.contentDocument);
});
function process(doc) {
doc.querySelectorAll('pre > tt').forEach(function (node, index, list) {
node.innerHTML = node.innerHTML.replace(/ ([*]?)(\w+)[(]/gm, ' $1<a href="../functions/$2.html">$2</a>(');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment