Skip to content

Instantly share code, notes, and snippets.

@koichiro
Created October 2, 2008 13:37
Show Gist options
  • Save koichiro/14353 to your computer and use it in GitHub Desktop.
Save koichiro/14353 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Dan the Cleaner
// @namespace Not Found
// @description Makes alpha bloggers's blogs more easy to read.
// @include http://blog.livedoor.jp/dankogai/*
// ==/UserScript==
(function () {
var url = "http://www.google.co.jp/search?ie=euc-jp&oe=utf-8&q=";
var replacer = function (matchedString, dan, offset, originalString) {
return '<a href="' + url + encodeURIComponent(dan) + '" target="_blank">404 Dan the Not Found</a>';
};
var entry = document.getElementsByTagName('p');
for (var i = 0; i < entry.length; i++) {
if (entry[i].textContent.match(/dan the\s*(.*)/i)) {
var s = entry[i].innerHTML.replace(/dan the\s*(.*)/ig, replacer);
entry[i].innerHTML = s;
break;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment