Skip to content

Instantly share code, notes, and snippets.

@dginev
Created April 24, 2013 23:17
Show Gist options
  • Save dginev/5456394 to your computer and use it in GitHub Desktop.
Save dginev/5456394 to your computer and use it in GitHub Desktop.
NNexus Glasses - a handy Greasemonkey utility for seeing any web page through the eyes of NNexus
// ==UserScript==
// @name NNexus Glasses
// @namespace http://nnexus.mathweb.org
// @description Enables a NNexus auto-link pass over each page in the namespace
// @include http://dlmf.nist.gov/*
// ==/UserScript==
var body = document.getElementsByTagName("body")[0];
var markup = body.innerHTML;
var params = "body="+encodeURIComponent(markup);
// Localhost for now, expect support at http://nnexus.mathweb.org
var url = "http://127.0.0.1:3000/linkentry";
req = new XMLHttpRequest();
req.open("POST",url,true);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.setRequestHeader("Content-length", params.length);
req.onreadystatechange = function () {
if (req.readyState === 4) {
var response = JSON.parse(req.responseText);
body.innerHTML = response.payload;
}
};
req.send(params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment