| 43 | | return o.bookmarks.map(function (b) { |
| 44 | | var id = b.user; |
| 45 | | var dt = new Date(b.timestamp); |
| 46 | | var com = (b.comment.length > 0) ? '' : 'out'; |
| 47 | | var tags = b.tags.map(function (tag) { |
| 48 | | tag = escapeHTML(tag); |
| 49 | | return [ |
| 50 | | '<span class="sbm_tag">', |
| 51 | | '<a href="http://b.hatena.ne.jp/', id, '/', tag, '/">', tag, '</a>', |
| 52 | | '</span>' |
| 53 | | ].join(''); |
| 54 | | }).join(','); |
| 55 | | return { |
| 56 | | sort_key : dt.getTime(), |
| 57 | | comment : [ |
| 58 | | '<div class="flat_menu sbm_comment hatebu with', com, '_comment">', |
| 59 | | '<a href="http://b.hatena.ne.jp/', id, '/">', |
| 60 | | '<img src="http://www.hatena.ne.jp/users/', id.substr(0, 2), '/', id, '/profile_s.gif" width="16" height="16">', id, '</a>', |
| 61 | | '<span class="date">', dt.toLocaleString(), '</span>', tags, b.comment, |
| 62 | | '</div>' |
| 63 | | ].join('') |
| 64 | | } |
| 65 | | }); |
| 66 | | }), |
| 67 | | 'livedoor' : xhttp.get('http://api.clip.livedoor.com/json/comments?all=1&link=' + url).next(function (req) { |
| 68 | | stat['L'] = true; |
| 69 | | updateStat(); |
| | 32 | return o.bookmarks.map(hatena.makeComment); |
| | 33 | }, |
| | 34 | makeTag : function (tags, id) { |
| | 35 | return tags.map(escapeHTML).map(function (tag) { |
| | 36 | return [ |
| | 37 | '<span class="sbm_tag">', |
| | 38 | '<a href="http://b.hatena.ne.jp/', id, '/', tag, '/">', tag, '</a>', |
| | 39 | '</span>' |
| | 40 | ].join(''); |
| | 41 | }).join(','); |
| | 42 | }, |
| | 43 | makeComment : function (o) { |
| | 44 | var id = o.user; |
| | 45 | var dt = new Date(o.timestamp); |
| | 46 | var com = (o.comment.length > 0) ? '' : 'out'; |
| | 47 | var tags = hatena.makeTag(o.tags, id); |
| | 48 | return { |
| | 49 | sort_key : dt.getTime(), |
| | 50 | comment : [ |
| | 51 | '<div class="flat_menu sbm_comment hatebu with', com, '_comment">', |
| | 52 | '<a href="http://b.hatena.ne.jp/', id, '/">', |
| | 53 | '<img src="http://www.hatena.ne.jp/users/', id.substr(0, 2), '/', id, '/profile_s.gif" width="16" height="16">', id, '</a>', |
| | 54 | '<span class="date">', dt.toLocaleString(), '</span>', tags, o.comment, |
| | 55 | '</div>' |
| | 56 | ].join('') |
| | 57 | }; |
| | 58 | } |
| | 59 | }; |
| | 60 | |
| | 61 | var livedoor = { |
| | 62 | api : 'http://api.clip.livedoor.com/json/comments?all=1&link=', |
| | 63 | parseResponse: function (req) { |
| 72 | | return o.Comments.map(function (c) { |
| 73 | | var id = c.livedoor_id; |
| 74 | | var dt = new Date(c.created_on * 1000); |
| 75 | | var com = (c.notes.length > 0) ? '' : 'out'; |
| 76 | | var tags = c.tags.map(function (tag) { |
| 77 | | tag = escapeHTML(tag); |
| 78 | | return [ |
| 79 | | '<span class="sbm_tag">', |
| 80 | | '<a href="http://clip.livedoor.com/clips/', id, '/tag/', tag, '">', tag, '</a>', |
| 81 | | '</span>' |
| 82 | | ].join(''); |
| 83 | | }).join(','); |
| 84 | | return { |
| 85 | | sort_key : dt.getTime(), |
| 86 | | comment : [ |
| 87 | | '<div class="flat_menu sbm_comment ldc with', com, '_comment">', |
| 88 | | '<a href="http://clip.livedoor.com/clips/', id, '">', |
| 89 | | '<img src="http://image.profile.livedoor.jp/icon/', id, '_16.gif" width="16" height="16">', id, '</a>', |
| 90 | | '<span class="date">', dt.toLocaleString(), '</span>', tags, escapeHTML(c.notes), |
| 91 | | '</div>' |
| 92 | | ].join('') |
| 93 | | } |
| 94 | | }); |
| 95 | | }) |
| | 66 | return o.Comments.map(livedoor.makeComment); |
| | 67 | }, |
| | 68 | makeTag : function (tags, id) { |
| | 69 | return tags.map(escapeHTML).map(function (tag) { |
| | 70 | return [ |
| | 71 | '<span class="sbm_tag">', |
| | 72 | '<a href="http://clip.livedoor.com/clips/', id, '/tag/', tag, '">', tag, '</a>', |
| | 73 | '</span>' |
| | 74 | ].join(''); |
| | 75 | }).join(','); |
| | 76 | }, |
| | 77 | makeComment : function (o) { |
| | 78 | var id = o.livedoor_id; |
| | 79 | var dt = new Date(o.created_on * 1000); |
| | 80 | var com = (o.notes.length > 0) ? '' : 'out'; |
| | 81 | var tags = livedoor.makeTag(o.tags, id); |
| | 82 | return { |
| | 83 | sort_key : dt.getTime(), |
| | 84 | comment : [ |
| | 85 | '<div class="flat_menu sbm_comment ldc with', com, '_comment">', |
| | 86 | '<a href="http://clip.livedoor.com/clips/', id, '">', |
| | 87 | '<img src="http://image.profile.livedoor.jp/icon/', id, '_16.gif" width="16" height="16">', id, '</a>', |
| | 88 | '<span class="date">', dt.toLocaleString(), '</span>', tags, escapeHTML(o.notes), |
| | 89 | '</div>' |
| | 90 | ].join('') |
| | 91 | }; |
| | 92 | } |