diff options
author | janus_wel | 2008-10-14 23:42:37 +0000 |
---|---|---|
committer | janus_wel | 2008-10-14 23:42:37 +0000 |
commit | 0971c0b28cd44a5f478f32784c6663c48f69b00a (patch) | |
tree | cbc40a3b526b942e14cd36f258fddd6a09dc1384 | |
parent | 50056e8a10a088122af2f408f254e071f8736e0b (diff) | |
download | vimperator-plugins-0971c0b28cd44a5f478f32784c6663c48f69b00a.tar.bz2 |
fix up thumbnail's URL
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@21342 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | nnp_cooperation.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nnp_cooperation.js b/nnp_cooperation.js index f4db214..8a5ea0a 100644 --- a/nnp_cooperation.js +++ b/nnp_cooperation.js @@ -95,7 +95,7 @@ EOM (function(){
// thumbnail URL
-const thumbnailURL = 'http://tn-skr1.smilevideo.jp/smile?i=';
+const thumbnailURL = 'http://tn-skr$HOSTNUMBER.smilevideo.jp/smile?i=$VIDEO_ID';
// style
const styles = [
@@ -135,7 +135,7 @@ const thead = [ const itemHTML = [
'<tr>',
'<td class="index">$INDEX:</td>',
- '<td class="thumbnail"><img src="$THUMBNAILURL$ID" width="33" height="25" /></td>',
+ '<td class="thumbnail"><img src="$THUMBNAILURL" width="33" height="25" /></td>',
'<td>$TITLE</td>',
'<td>$URL</td>',
'</tr>',
@@ -179,11 +179,14 @@ liberator.commands.addUserCommand(['nnpgetlist'], 'get NicoNicoPlaylist', for(var i=0 ; i<nodesLength && i<numofList ; ++i ) {
// get video id
var id = nodes[i].href.match(/\d+$/);
+ // build thumnail's URL
+ // refer: http://d.hatena.ne.jp/ZIGOROu/20081014/1223991205
+ var thumbnail = thumbnailURL.replace(/\$HOSTNUMBER/g, id % 2 + 1)
+ .replace(/\$VIDEO_ID/g, id);
// evaluate variables and push to list
items.push(
itemHTML.replace(/\$INDEX/g, i + 1)
- .replace(/\$THUMBNAILURL/g, thumbnailURL)
- .replace(/\$ID/g, id)
+ .replace(/\$THUMBNAILURL/g, thumbnail)
.replace(/\$TITLE/g, nodes[i].textContent)
.replace(/\$URL/g, nodes[i].href)
);
|