Changeset 5323 for lang/javascript
- Timestamp:
- 01/23/08 03:27:08 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/userscripts/niconicodougaanalytics.user.js
r5187 r5323 5 5 // @description Analyzes comments for movie in NicoNicoDouga 6 6 // @license The MIT License 7 // @version 0.1. 27 // @version 0.1.3 8 8 // @released 2008-01-19 14:00:00 9 // @updated 2008-01-2 1 22:00:009 // @updated 2008-01-23 03:00:00 10 10 // @compatible Greasemonkey 11 11 // @include http://www.nicovideo.jp/watch/* … … 22 22 var waiting = new PE(function() { 23 23 var flvplayer = unsafeWindow.document.getElementById('flvplayer'); 24 var nico = flvplayer.GetVariable('o') || flvplayer.GetVariable('nico.o'); 24 var nico = flvplayer.GetVariable('o'); 25 if(nico == 'base') nico = flvplayer.GetVariable('nico.o'); 25 26 if(nico && ready.test(nico)) { 26 27 var memo = nico.split('&'); … … 77 78 this.comments = new Array(); 78 79 this.__jQuery = unsafeWindow.jQuery; 79 this.max = parseInt(size, 10);80 //this.max = parseInt(size, 10); 80 81 }, 81 82 size: function() { return this.comments.length; }, … … 133 134 get_waybackkey: function() { 134 135 var self = this; 135 GM_xmlhttpRequest({ 136 var endpoint = unsafeWindow.document.getElementById('flvplayer').GetVariable('B') || 137 unsafeWindow.document.getElementById('flvplayer').GetVariable('nico.B'); 138 GM_wrap(GM_xmlhttpRequest)({ 136 139 method: 'GET', 137 140 headers: { 138 141 'User-Agent': 'Mozilla/4.0 (compatible) Greasemonkey (NicoNicoDouga - Analytics)' 139 142 }, 140 url: unsafeWindow.document.getElementById('flvplayer').GetVariable('B') 141 + 'getwaybackkey?thread=' + this.thread_id, 143 url: endpoint + 'getwaybackkey?thread=' + this.thread_id, 142 144 onload: function(res) { 143 145 self.waybackkey = res.responseText.split('=')[1]; … … 157 159 post_data += '/>'; 158 160 var self = this; 159 GM_ xmlhttpRequest({161 GM_wrap(GM_xmlhttpRequest)({ 160 162 method: 'POST', 161 163 headers: { … … 177 179 } 178 180 comments.video_length = self.video_length; 181 if(!last) comments.max = thread.getAttribute('last_res'); 179 182 callback(comments, responseXML); 180 183 }, … … 190 193 var thread_url = video_info.ms; 191 194 var retriever = new Retriever(video_info); 192 var comments = new CommentSet( $j('#flvplayer')[0].GetVariable('last_resno'));195 var comments = new CommentSet(/*$j('#flvplayer')[0].GetVariable('last_resno')*/); 193 196 194 197 retriever.next(comments, plot); … … 530 533 } 531 534 #niconicodouga_analytics .gridLabel { font-size: 80%; } 532 .userscript_credit {535 #niconicodouga_analytics p.userscript_credit { 533 536 background-color: #333; 534 537 border-top: 2px dotted #ccc; … … 537 540 color: #ccc; 538 541 text-align: center; 539 } 540 .userscript_credit a { 542 margin: 0; 543 } 544 #niconicodouga_analytics p.userscript_credit a { 541 545 color: #fcc; 542 546 } … … 717 721 ]]></>); 718 722 723 // Greasemonkey 0.7.20080121.0 compatibility 724 // http://wiki.greasespot.net/0.7.20080121.0_compatibility 725 function GM_wrap(f) { 726 return function() { 727 setTimeout.apply(window, [f, 0].concat([].slice.call(arguments))); 728 }; 729 } 730 719 731 // Auto UserScript Updater 720 732 function UpdateChecker() {}; … … 722 734 script_name: 'NicoNicoDouga Analytics', 723 735 script_url: 'http://blog.fulltext-search.biz/files/niconicodougaanalytics.user.js', 724 current_version: '0.1. 2',736 current_version: '0.1.3', 725 737 more_info_url: 'http://blog.fulltext-search.biz/pages/niconicodouga-analytics', 726 738 … … 762 774 close_link.setAttribute('href', 'javascript:void(0);'); 763 775 close_link.addEventListener('click', function() { 764 GM_ setValue('last_check_day', self.beginning_of_day().toString());776 GM_wrap(GM_setValue)('last_check_day', self.beginning_of_day().toString()); 765 777 var update_alert = document.getElementById('gm_update_alert'); 766 778 update_alert.parentNode.removeChild(update_alert);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)