Created
June 1, 2010 09:07
-
-
Save Soft/420744 to your computer and use it in GitHub Desktop.
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 Secure Wikipedia | |
// @include http://*/* | |
// @include https://*/* | |
// @description Changes links to Wikipedia articles to point to secure version | |
// ==/UserScript== | |
(function(){ | |
var links = document.getElementsByTagName("a"); | |
for (var i = 0; i < links.length; i++) { | |
var wiki_regexp = /http:\/\/(..)\.wikipedia\.org\/wiki\/(.+)/; | |
if (wiki_regexp.test(links[i].href)) { | |
var matches = wiki_regexp.exec(links[i].href); | |
links[i].href = "https://secure.wikimedia.org/wikipedia/" + matches[1] + "/wiki/" + matches[2]; | |
} | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment