Created
December 6, 2008 09:31
-
-
Save snaka/32847 to your computer and use it in GitHub Desktop.
はてなカウンターのURLの表示をタイトルに置き換えるGreaseMonkey
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 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