| 77 | | // TODO |
| | 60 | content.appendChild( |
| | 61 | $N('div', { class: 'thumb-metadata' }, [ |
| | 62 | $N('a', { |
| | 63 | href: at(data, 'watch_url').textContent, |
| | 64 | title: at(data, 'title').textContent |
| | 65 | }, [ |
| | 66 | $N('img', { |
| | 67 | src: at(data, 'thumbnail_url').textContent, |
| | 68 | alt: at(data, 'title').textContent |
| | 69 | }) |
| | 70 | ]), |
| | 71 | $N('p', { class: 'metadata' }, [ |
| | 72 | at(data, 'length').textContent, |
| | 73 | $N('br',{}), |
| | 74 | '再生: ', |
| | 75 | at(data, 'view_counter').textContent, |
| | 76 | $N('br',{}), |
| | 77 | 'コメント: ', |
| | 78 | at(data, 'comment_num').textContent, |
| | 79 | $N('br',{}), |
| | 80 | 'マイリスト: ', |
| | 81 | at(data, 'mylist_counter').textContent, |
| | 82 | ]) |
| | 83 | ]) |
| | 84 | ); |
| | 85 | content.appendChild( |
| | 86 | $N('div', { class: 'thumb-body' }, [ |
| | 87 | $N('h4', {}, [ |
| | 88 | $N('span', {}, [ |
| | 89 | (new Date.W3CDTF(at(data, 'first_retrieve').textContent)).strftime('yyyy年MM月dd日HH:mm:ss'), |
| | 90 | ' 投稿' |
| | 91 | ]), |
| | 92 | $N('br',{}), |
| | 93 | $N('a', { |
| | 94 | href: at(data, 'watch_url').textContent, |
| | 95 | title: at(data, 'title').textContent |
| | 96 | }, at(data, 'title').textContent) |
| | 97 | ]), |
| | 98 | $N('p', { class: 'description' }, truncate(at(data, 'description').textContent, 60)), |
| | 99 | $N('p', { class: 'last-res-body' }, at(data, 'last_res_body').textContent), |
| | 100 | $N('ul', { class: 'tags' }, map(search(data, 'tag'), function(tag, i) { |
| | 101 | return $N('li', {}, [ |
| | 102 | $N('a', { |
| | 103 | href: 'http://www.nicovideo.jp/tag/' + encodeURIComponent(tag.textContent) |
| | 104 | }, tag.textContent) |
| | 105 | ]) |
| | 106 | })) |
| | 107 | ]) |
| | 108 | ); |
| | 137 | GM_addStyle(<><![CDATA[ |
| | 138 | #content .matasamune p { text-indent: 0; } |
| | 139 | .matasamune { |
| | 140 | color: #333; |
| | 141 | margin: 4px 0; |
| | 142 | padding: 4px; |
| | 143 | border: 1px solid #ccc; |
| | 144 | background: #f7f7f7 none repeat scroll 0%; |
| | 145 | } |
| | 146 | .matasamune .thumb-body h4 a:link { |
| | 147 | color: #333; |
| | 148 | border-bottom: 1px solid #333; |
| | 149 | text-decoration: none; |
| | 150 | } |
| | 151 | .matasamune .thumb-body h4 a:visited { |
| | 152 | color: #555; |
| | 153 | border-bottom: 1px solid #333; |
| | 154 | } |
| | 155 | .matasamune .thumb-body h4 a:active, |
| | 156 | .matasamune .thumb-body h4 a:hover { |
| | 157 | color: #f7f7f7; |
| | 158 | background-color: #333; |
| | 159 | } |
| | 160 | .matasamune div.thumb-metadata { |
| | 161 | float: left; |
| | 162 | width: 130px; |
| | 163 | } |
| | 164 | .matasamune p, |
| | 165 | .matasamune div.thumb-body h4 span { |
| | 166 | font-size: 80%; |
| | 167 | font-weight: normal; |
| | 168 | } |
| | 169 | .matasamune div.thumb-body { |
| | 170 | margin-left: 135px; |
| | 171 | } |
| | 172 | #content .matasamune div.thumb-body p.last-res-body { |
| | 173 | background-color: #fff; |
| | 174 | border: 2px solid #ccc; |
| | 175 | margin: 4px 0 1px; |
| | 176 | padding: 6px; |
| | 177 | font-weight: bold; |
| | 178 | font-size: 90%; |
| | 179 | } |
| | 180 | #content .matasamune ul.tags { |
| | 181 | margin: 0; |
| | 182 | padding: 0; |
| | 183 | } |
| | 184 | .matasamune ul.tags li { |
| | 185 | display: inline; |
| | 186 | line-height: 1.6; |
| | 187 | margin: 1px; |
| | 188 | } |
| | 189 | .matasamune ul.tags li a { |
| | 190 | background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHcSURBVDjLhZPbahpRFIbnJXLb4lsIQx+sF6G0kMsmpZQ8hEeUGWcUTbQqnlDUUTwgIkaj4kUI0j3ozObvXjs4jXjoxbpZe//f/689a5Rut4tOp4N2u41Wq4Vms4lGo4F6vY5arXYFQLlUimVZ4Jwf1Ww2k5ByuXwRopAzCabTqXSeTCYehHoiBQqFwlmIQpHpMrlRo1qt1jebDRzHkX0ClkolZLPZkxCFXPcXhXgrIk9t24bz8gyna8qz8XiMfD6PTCZzBFHIeR/ZdV2QmL+u4Bpf4cY/C4ghz0ajEaVAMpk8gChiRrZer+Wl3W4nnd3EF/CH7+C5n+ACtIcMh0NKAV3XPYhSqVQ+iRnZarV6gzw1pTN/vAPP3x9BBoMBpUAsFpMQSSkWi6qYkS2XyzfI3IKjixSPP/5BRCrH0uR5r9ejFIhEIlfeLLlcThUzssVicQz5/Qs8eYM/+g2468gUhmEgFAp9PHhRMZ+aTqfZfD73IDvtGtz8Bjtzhy3bvBf7vBHeVyqVUk3TZLSJEjJrw3m4Bd/anjgYDPq8Rzy1HIlEQtU0jdEm7j8xiUX/QHwWQBWPx/3ipRktWL/fPym+CKCKRqP+cDjMSBwIBHwnV/l/v6tw9Qvxh3PnfwF+wjbwD++YrQAAAABJRU5ErkJggg==) 3px 50% no-repeat; |
| | 191 | padding: 1px 3px 1px 22px; |
| | 192 | color: #333; |
| | 193 | border: 1px solid #aaa; |
| | 194 | text-decoration: none; |
| | 195 | font-size: 80%; |
| | 196 | } |
| | 197 | .matasamune ul.tags li a:visited { |
| | 198 | border: 1px solid #ccc; |
| | 199 | color: #555; |
| | 200 | } |
| | 201 | .matasamune ul.tags li a:active, |
| | 202 | .matasamune ul.tags li a:hover { |
| | 203 | border: 1px solid #fa0; |
| | 204 | color: #202020; |
| | 205 | } |
| | 206 | ]]></>); |
| | 207 | |
| | 218 | function toArray(iterable) { |
| | 219 | if (!iterable) return []; |
| | 220 | var length = iterable.length || 0, results = new Array(length); |
| | 221 | while (length--) results[length] = iterable[length]; |
| | 222 | return results; |
| | 223 | } |
| | 224 | function map(elems, callback) { |
| | 225 | var ret = []; |
| | 226 | for(var i=0,l=elems.length; i<l; i++) { |
| | 227 | var value = callback(elems[i], i); |
| | 228 | if(value !== null && value != undefined) { |
| | 229 | if(value.constructor != Array) value = [value]; |
| | 230 | ret = ret.concat(value); |
| | 231 | } |
| | 232 | } |
| | 233 | return ret; |
| | 234 | } |
| | 235 | function truncate(str, length, truncation) { |
| | 236 | length = length || 30; |
| | 237 | truncation = truncation === undefined ? '...' : truncation; |
| | 238 | return str.length > length ? str.slice(0, length - truncation.length) + truncation : String(str); |
| | 239 | } |
| | 272 | |
| | 273 | // based on the W3CDTF2Date |
| | 274 | // http://www.kawa.net/works/js/date/w3cdtf.html |
| | 275 | // Date/W3CDTF.js -- W3C Date and Time Formats |
| | 276 | /* COPYRIGHT AND LICENSE |
| | 277 | |
| | 278 | Copyright (c) 2005-2006 Yusuke Kawasaki. All rights reserved. |
| | 279 | This program is free software; you can redistribute it and/or |
| | 280 | modify it under the Artistic license. Or whatever license I choose, |
| | 281 | which I will do instead of keeping this documentation like it is. |
| | 282 | */ |
| | 283 | |
| | 284 | Date.W3CDTF = function ( dtf ) { |
| | 285 | var dd = new Date(); |
| | 286 | dd.setW3CDTF = Date.W3CDTF.prototype.setW3CDTF; |
| | 287 | if ( dtf ) dd.setW3CDTF( dtf ); |
| | 288 | return dd; |
| | 289 | }; |
| | 290 | Date.W3CDTF.VERSION = "0.04"; |
| | 291 | Date.W3CDTF.prototype.setW3CDTF = function( dtf ) { |
| | 292 | var sp = dtf.split( /[^0-9]/ ); |
| | 293 | // invalid format |
| | 294 | if ( sp.length < 6 || sp.length > 8 ) return; |
| | 295 | // invalid time zone |
| | 296 | if ( sp.length == 7 ) { |
| | 297 | if ( dtf.charAt( dtf.length-1 ) != "Z" ) return; |
| | 298 | } |
| | 299 | // to numeric |
| | 300 | for( var i=0; i<sp.length; i++ ) sp[i] = sp[i]-0; |
| | 301 | // invalid range |
| | 302 | if ( sp[0] < 1970 || // year |
| | 303 | sp[1] < 1 || sp[1] > 12 || // month |
| | 304 | sp[2] < 1 || sp[2] > 31 || // day |
| | 305 | sp[3] < 0 || sp[3] > 23 || // hour |
| | 306 | sp[4] < 0 || sp[4] > 59 || // min |
| | 307 | sp[5] < 0 || sp[5] > 60 ) { // sec |
| | 308 | return; // invalid date |
| | 309 | } |
| | 310 | // get UTC milli-second |
| | 311 | var msec = Date.UTC( sp[0], sp[1]-1, sp[2], sp[3], sp[4], sp[5] ); |
| | 312 | // time zene offset |
| | 313 | if ( sp.length == 8 ) { |
| | 314 | if ( dtf.indexOf("+") < 0 ) sp[6] *= -1; |
| | 315 | if ( sp[6] < -12 || sp[6] > 13 ) return; // time zone offset hour |
| | 316 | if ( sp[7] < 0 || sp[7] > 59 ) return; // time zone offset min |
| | 317 | msec -= (sp[6]*60+sp[7]) * 60000; |
| | 318 | } |
| | 319 | // set by milli-second; |
| | 320 | return this.setTime( msec ); |
| | 321 | }; |
| | 322 | |
| | 323 | /** |
| | 324 | * Date.strftime |
| | 325 | * |
| | 326 | * Inspired by |
| | 327 | * http://www.mattkruse.com/javascript/date/date.js |
| | 328 | * Author: Matt Kruse <matt@mattkruse.com> |
| | 329 | * |
| | 330 | * Localization of Japan |
| | 331 | * Author: noriaki <uchiyama.noriaki@gmail.com> |
| | 332 | */ |
| | 333 | Date.MONTH_NAMES = 'January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' '); |
| | 334 | Date.DAY_NAMES = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat'.split(' '); |
| | 335 | Date.DAY_NAMES_J = '日曜日 月曜日 火曜日 水曜日 木曜日 金曜日 土曜日 日 月 火 水 木 金 土'.split(' '); |
| | 336 | Date.prototype.strftime = function(format) { |
| | 337 | function LZ(x) {return(x<0||x>9?"":"0")+x} |
| | 338 | format=format+""; |
| | 339 | var result="", i_format=0, c="", token=""; |
| | 340 | var y=this.getYear()+"", M=this.getMonth()+1, d=this.getDate(), E=this.getDay(); |
| | 341 | var H=this.getHours(), m=this.getMinutes(), s=this.getSeconds(); |
| | 342 | var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; |
| | 343 | // Convert real date parts into formatted versions |
| | 344 | var value=new Object(); |
| | 345 | if (y.length < 4) {y=""+(y-0+1900);} |
| | 346 | value["y"]=""+y; value["yyyy"]=y; value["yy"]=y.substring(2,4); value["M"]=M; |
| | 347 | value["MM"]=LZ(M); value["MMM"]=Date.MONTH_NAMES[M-1]; value["NNN"]=Date.MONTH_NAMES[M+11]; |
| | 348 | value["d"]=d; value["dd"]=LZ(d); value["E"]=Date.DAY_NAMES[E+7]; value["EE"]=Date.DAY_NAMES[E]; |
| | 349 | value["J"]=Date.DAY_NAMES_J[E+7]; value["JJ"]=Date.DAY_NAMES_J[E]; value["H"]=H; value["HH"]=LZ(H); |
| | 350 | if (H==0){value["h"]=12;} |
| | 351 | else if (H>12){value["h"]=H-12;} |
| | 352 | else {value["h"]=H;} |
| | 353 | value["hh"]=LZ(value["h"]); |
| | 354 | if (H>11){value["K"]=H-12;} else {value["K"]=H;} |
| | 355 | value["k"]=H+1; value["KK"]=LZ(value["K"]); value["kk"]=LZ(value["k"]); |
| | 356 | if (H > 11) { value["a"]="PM"; } |
| | 357 | else { value["a"]="AM"; } |
| | 358 | value["m"]=m; value["mm"]=LZ(m); value["s"]=s; value["ss"]=LZ(s); |
| | 359 | while (i_format < format.length) { |
| | 360 | c=format.charAt(i_format); token=""; |
| | 361 | while ((format.charAt(i_format)==c) && (i_format < format.length)) |
| | 362 | token += format.charAt(i_format++); |
| | 363 | if (value[token] != null) { result=result + value[token]; } |
| | 364 | else { result=result + token; } |
| | 365 | } |
| | 366 | return result; |
| | 367 | } |