Changeset 14795 for lang/javascript/userscripts/ldr_show_sbm_comments
- Timestamp:
- 06/28/08 23:37:57 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/userscripts/ldr_show_sbm_comments/ldr_show_sbm_comments.user.js
r14791 r14795 14 14 window.addEventListener('load', function () { with (D()) { 15 15 var w = (typeof unsafeWindow == 'undefined') ? window : unsafeWindow; 16 var cache = new Cache(); 16 17 17 18 if (GM_getValue('hide', false)) addClass('right_body', 'nocomment'); … … 53 54 '<span class="date">', dt.ymd_jp(), ' ', dt.hms(), '</span>', 54 55 '<a href="http://b.hatena.ne.jp/', id, '/">', 55 '<img src="http://www.hatena.ne.jp/users/', id.substr(0, 2), '/', id, '/profile_s.gif" width="16" height="16">', id, '</a> ',56 '<img src="http://www.hatena.ne.jp/users/', id.substr(0, 2), '/', id, '/profile_s.gif" width="16" height="16">', id, '</a> ', 56 57 tags, o.comment, 57 58 '</div>' … … 88 89 '<span class="date">', dt.ymd_jp(), ' ', dt.hms(), '</span>', 89 90 '<a href="http://clip.livedoor.com/clips/', id, '">', 90 '<img src="http://image.profile.livedoor.jp/icon/', id, '_16.gif" width="16" height="16">', id, '</a> ',91 '<img src="http://image.profile.livedoor.jp/icon/', id, '_16.gif" width="16" height="16">', id, '</a> ', 91 92 tags, o.notes.escapeHTML(), 92 93 '</div>' … … 96 97 }; 97 98 98 w.LoadEffect.Start();99 99 100 parallel([ 101 xhttp.get(hatena.api + url).next(hatena.parseResponse), 102 xhttp.get(livedoor.api + url).next(livedoor.parseResponse) 103 ]).next(function (o) { 104 w.LoadEffect.Stop(); 100 if (elem) { 101 elem.parentNode.removeChild(elem); 102 } 103 else if (cache.has(item_id)) { 104 showComments(cache.get(item_id)); 105 } 106 else { 107 w.LoadEffect.Start(); 105 108 106 var comments = merge(o).sort(function (a, b) { 107 return b.sort_key - a.sort_key; 108 }).map(function (c) { return c.comment }).join('\n'); 109 parallel([ 110 xhttp.get(hatena.api + url).next(hatena.parseResponse), 111 xhttp.get(livedoor.api + url).next(livedoor.parseResponse) 112 ]).next(function (o) { 113 w.LoadEffect.Stop(); 109 114 115 var comments = merge(o).sort(function (a, b) { 116 return b.sort_key - a.sort_key; 117 }).map(function (c) { return c.comment }).join('\n'); 118 119 cache.set(item_id, comments); 120 121 showComments(comments); 122 }).error(function (e) { 123 alert(e); 124 }); 125 } 126 127 function showComments (comments) { 110 128 var d = $N('div', { 111 129 id : 'sbm_' + item_id, … … 116 134 // d.innerHTML = '<h2 class="flat_menu sbm_comment">SBM Comments</h2>' + comments; 117 135 118 try { $('item_' + item_id).appendChild(d); } catch (e) { alert(e) } 119 }).error(function (e) { 120 alert(e); 121 }); 136 try { $('item_' + item_id).appendChild(d); } catch (e) {} 137 } 122 138 }); 123 139
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)