Created
April 14, 2010 19:03
-
-
Save kei-s/366189 to your computer and use it in GitHub Desktop.
Nicovideo username in mylist
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 Nicovideo username in mylist | |
// @namespace http://libelabo.jp/ | |
// @include http://www.nicovideo.jp/openlist/* | |
// @require http://gist.github.com/3238.txt | |
// ==/UserScript== | |
(function(){ | |
function addUserName(node) { | |
var lists = $X('.//strong',node); | |
lists.forEach(function(list){ | |
var link = $X('.//a',list)[0]; | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: link.href, | |
onload: function(response){ | |
var name = response.responseText.match(/nickname: "([^"]*)"/)[1]; | |
var id = response.responseText.match(/user_id: (\w+),/)[1]; | |
var a = document.createElement('a'); | |
a.textContent = name; | |
a.setAttribute('href','http://www.nicovideo.jp/user/'+id); | |
a.setAttribute('style','padding-left: 5px;'); | |
list.appendChild(a); | |
} | |
}); | |
}); | |
} | |
document.body.addEventListener('AutoPagerize_DOMNodeInserted',function(evt){ | |
var node = evt.target; | |
var requestURL = evt.newValue; | |
var parentNode = evt.relatedNode; | |
addUserName(node); | |
},false); | |
addUserName($X('//table[@class="font12"]')[0]); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment