Skip to content

Instantly share code, notes, and snippets.

@snaka
Created December 6, 2008 09:31
Show Gist options
  • Save snaka/32847 to your computer and use it in GitHub Desktop.
Save snaka/32847 to your computer and use it in GitHub Desktop.
はてなカウンターのURLの表示をタイトルに置き換えるGreaseMonkey
// ==UserScript==
// @name hatena_c_uri_to_title.user.js
// @namespace http://d.hatena.ne.jp/snaka72/
// @include http://counter.hatena.ne.jp/*target=url*
// @require https://gist.github.com/raw/3238/0b1c093e30415be1109f9a36664ebd56e0e7300b/dollarX.js
// ==/UserScript==
(function() {
var links = $X('//td[@class="maincell"]/a');
(function getTitle(links) {
var link = links.pop();
if (!link) return;
GM_xmlhttpRequest({
method: 'GET',
url: link.href,
onload: function(data) {
var html = data.responseText;
var m = html.match(/<title>(.*)<\/title>/);
link.innerHTML = m[1];
getTitle(links); // recurcive call
}
});
})(links);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment