Changeset 26085
- Timestamp:
- 12/08/08 07:52:49 (4 years ago)
- Location:
- lang/javascript/vimperator-plugins
- Files:
-
- 5 modified
- 1 moved
-
branches/1.2/multi_requester.js (modified) (3 diffs)
-
trunk/libly.js (modified) (3 diffs)
-
trunk/multi_requester.js (modified) (3 diffs)
-
trunk/notifier.js (modified) (3 diffs)
-
trunk/notifier/observer_growl.js (modified) (1 diff)
-
trunk/notifier/subject_hatelabo_bottle.js (moved) (moved from lang/javascript/vimperator-plugins/trunk/notifier/subject_test.js) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/branches/1.2/multi_requester.js
r26020 r26085 5 5 * @description-ja リクエストの結果をバッファに出力する。 6 6 * @author suVene suvene@zeromemory.info 7 * @version 0.4. 27 * @version 0.4.3 8 8 * @minVersion 1.2 9 9 * @maxVersion 1.2 10 * Last Change: 0 7-Dec-2008.10 * Last Change: 08-Dec-2008. 11 11 * ==/VimperatorPlugin== 12 12 * … … 361 361 try { 362 362 363 if (!res.isSuccess || res.responseText == '') throw 'response is fail or null';363 if (!res.isSuccess() || res.responseText == '') throw 'response is fail or null'; 364 364 365 365 url = res.req.url; … … 373 373 } 374 374 375 doc = res.getHTMLDocument(xpath );375 doc = res.getHTMLDocument(xpath, null, res.req.options.siteinfo.ignoreTags); 376 376 if (!doc) throw 'XPath result is undefined or null.: XPath -> ' + xpath; 377 377 -
lang/javascript/vimperator-plugins/trunk/libly.js
r26036 r26085 5 5 * @description-ja 適当なライブラリっぽいものたち 6 6 * @author suVene suvene@zeromemory.info 7 * @version 0.1. 07 * @version 0.1.1 8 8 * @minVersion 1.2 9 9 * @maxVersion 2.0pre 10 * Last Change: 0 7-Dec-2008.10 * Last Change: 08-Dec-2008. 11 11 * ==/VimperatorPlugin== 12 12 * … … 247 247 this.req = req; 248 248 this.transport = req.transport; 249 this.isSuccess = req.isSuccess ();249 this.isSuccess = req.isSuccess; 250 250 this.readyState = this.transport.readyState; 251 251 … … 267 267 } catch (e) { return ''; } 268 268 }, 269 getHTMLDocument: function(xpath, xmlns ) {269 getHTMLDocument: function(xpath, xmlns, ignoreTags) { 270 270 if (!this.doc) { 271 271 this.htmlFragmentstr = this.responseText.replace(/^[\s\S]*?<html(?:[ \t\n\r][^>]*)?>|<\/html[ \t\r\n]*>[\S\s]*$/ig, '').replace(/[\r\n]+/g, ' '); 272 let ignoreTags = ['script'];273 if ( this.req.options.siteinfo.ignoreTags) {274 i gnoreTags.concat(this.req.options.siteinfo.ignoreTags.split(','));275 } 276 this.htmlStripScriptFragmentstr = lib.$U.stripTags(this.htmlFragmentstr, 'script');272 var iTags = ['script']; 273 if (ignoreTags) { 274 iTags.concat(ignoreTags.split(',')); 275 } 276 this.htmlStripScriptFragmentstr = lib.$U.stripTags(this.htmlFragmentstr, iTags); 277 277 this.doc = this._createHTMLDocument(this.htmlStripScriptFragmentstr, xmlns); 278 278 } -
lang/javascript/vimperator-plugins/trunk/multi_requester.js
r26020 r26085 5 5 * @description-ja リクエストの結果をバッファに出力する。 6 6 * @author suVene suvene@zeromemory.info 7 * @version 0.4. 27 * @version 0.4.3 8 8 * @minVersion 2.0pre 9 9 * @maxVersion 2.0pre 10 * Last Change: 0 7-Dec-2008.10 * Last Change: 08-Dec-2008. 11 11 * ==/VimperatorPlugin== 12 12 * … … 366 366 try { 367 367 368 if (!res.isSuccess || res.responseText == '') throw 'response is fail or null';368 if (!res.isSuccess() || res.responseText == '') throw 'response is fail or null'; 369 369 370 370 url = res.req.url; … … 378 378 } 379 379 380 doc = res.getHTMLDocument(xpath );380 doc = res.getHTMLDocument(xpath, null, res.req.options.siteinfo.ignoreTags); 381 381 if (!doc) throw 'XPath result is undefined or null.: XPath -> ' + xpath; 382 382 -
lang/javascript/vimperator-plugins/trunk/notifier.js
r26035 r26085 30 30 function bootstrap() { 31 31 32 var lib = liberator.plugins.libly;33 var $U = lib .$U;32 var libly = liberator.plugins.libly; 33 var $U = libly.$U; 34 34 var logger = $U.getLogger('notifier'); 35 35 … … 161 161 ); 162 162 163 liberator.plugins.notifier.lib = lib;163 liberator.plugins.notifier.libly = libly; 164 164 liberator.plugins.notifier.Message = Message; 165 165 … … 214 214 }), 10); 215 215 216 logger.log('start end');217 216 },//}}} 218 217 stop: function(finallycallback) {//{{{ -
lang/javascript/vimperator-plugins/trunk/notifier/observer_growl.js
r26021 r26085 18 18 if (!notifier) return; 19 19 20 var lib = notifier.lib;21 var $U = lib .$U;20 var libly = notifier.libly; 21 var $U = libly.$U; 22 22 var logger = $U.getLogger('observer_growl'); 23 23 -
lang/javascript/vimperator-plugins/trunk/notifier/subject_hatelabo_bottle.js
r26017 r26085 1 1 /** 2 2 * notifier.js plugin subject 3 * @name subject_ test.js4 * @description notify if ...5 * @description-ja ... の時ポップアップ通知。3 * @name subject_hatena_bottle.js 4 * @description notify if hatena bottle changed. 5 * @description-ja はてなボトルの変更通知。 6 6 * @author suVene suvene@zeromemory.info 7 7 * @version 0.1.0 8 * Last Change: 0 7-Dec-2008.8 * Last Change: 08-Dec-2008. 9 9 */ 10 10 (function() { … … 13 13 if (!notifier) return; 14 14 15 var lib = notifier.lib; 16 var $U = lib.$U; 17 var logger = $U.getLogger('subject_test'); 15 var libly = notifier.libly; 16 var $U = libly.$U; 17 var logger = $U.getLogger('subject_hatelabo_bottle'); 18 19 var URL = 'http://bottle.hatelabo.jp'; 18 20 19 21 notifier.subject.register({ 20 interval: 3 ,22 interval: 30, 21 23 initialize: function() { 22 logger.log('initialize');23 24 this.count = 0; 25 this.initialized = false; 26 this.cache; 27 28 var req = new libly.Request(URL); 29 req.addEventListener('onSuccess', $U.bind(this, function(res) { 30 logger.log('initialized'); 31 this.cache = this.parse(res); 32 if (this.cache) 33 this.initialized = true; 34 })); 35 req.get(); 36 }, 37 parse: function(res) { 38 39 var ret, dom; 40 41 if (!res.isSuccess() || res.responseText == '') return ret; 42 43 dom = res.getHTMLDocument('id("body")//div[contains(concat(" ", @class, " "), " entry ")]'); 44 if (!dom) return ret; 45 46 ret = []; 47 for (let i = 0, len < dom.childNodes.length; i < len; i++) { 48 ret.push(dom.childNodes[i]); 49 } 50 51 return ret; 24 52 }, 25 53 check: function() { 54 55 if (!this.initialized) return; 56 26 57 this.count++; 27 58 logger.log('check'); 28 var req = new lib.Request( 29 'http://localhost:8080/index.html', 30 null, // headers {} 31 { 32 encode: 'shift_jis' 33 } 34 ); 59 var req = new libly.Request(URL); 35 60 req.addEventListener('onSuccess', $U.bind(this, function(res) { 36 61 var text = res.responseText;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)