Created
August 2, 2011 07:45
-
-
Save adamtaylor/1119770 to your computer and use it in GitHub Desktop.
Chrome greasemonkey script: why you no execute?!
This file contains 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 MetaCPAN Everywhere | |
// @description Add to every link to CPAN a link to MetaCPAN on a Google results page. | |
// @namespace http://ajct.info | |
// @match http://*/* | |
// @version 0.1 | |
// ==/UserScript== | |
(function() { | |
var page_links = document.links; | |
for (var i=0; i<page_links.length; i++){ | |
if (page_links[i].href.match(/http:\/\/search\.cpan\.org\/perldoc\?(.*?)$/i)) { | |
var match = page_links[i].href.match(/http:\/\/search\.cpan\.org\/perldoc\?(.*?)$/i); | |
var span = document.createElement("span"); | |
span.innerHTML = " <a href=\"http://www.metacpan.org/module/"+match[1]+"\">MetaCPAN</a>"; | |
page_links[i].parentNode.insertBefore(span, page_links[i].nextSibling); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment