Skip to content

Instantly share code, notes, and snippets.

@electrum
Created August 21, 2012 22:54
Show Gist options
  • Save electrum/3420125 to your computer and use it in GitHub Desktop.
Save electrum/3420125 to your computer and use it in GitHub Desktop.
Latest Javadoc Redirect
// ==UserScript==
// @name Latest Javadoc Redirect
// @match http://docs.oracle.com/javase/*/api/*
// ==/UserScript==
(function() {
var oldVersions = ['1.3', '1.4.2', '1.5.0', '1,5.0', '6'];
var newVersion = '7';
var url = window.location.toString();
for (var i = 0; i < oldVersions.length; i++) {
if (url.indexOf('/' + oldVersions[i] + '/') != -1) {
var newUrl = url.replace(oldVersions[i], newVersion);
window.location.replace(newUrl);
break;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment