Changeset 26085

Show
Ignore:
Timestamp:
12/08/08 07:52:49 (4 years ago)
Author:
suVene
Message:

*libty.js bug fix.
*それに伴うmulti_requester.jsの修正
*subject_test.js rename to subject_hatelabo_bottle.js(途中)
*etc.

Location:
lang/javascript/vimperator-plugins
Files:
5 modified
1 moved

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/branches/1.2/multi_requester.js

    r26020 r26085  
    55 * @description-ja   リクエストの結果をバッファに出力する。 
    66 * @author           suVene suvene@zeromemory.info 
    7  * @version          0.4.2 
     7 * @version          0.4.3 
    88 * @minVersion       1.2 
    99 * @maxVersion       1.2 
    10  * Last Change:      07-Dec-2008. 
     10 * Last Change:      08-Dec-2008. 
    1111 * ==/VimperatorPlugin== 
    1212 * 
     
    361361        try { 
    362362 
    363             if (!res.isSuccess || res.responseText == '') throw 'response is fail or null'; 
     363            if (!res.isSuccess() || res.responseText == '') throw 'response is fail or null'; 
    364364 
    365365            url = res.req.url; 
     
    373373            } 
    374374 
    375             doc = res.getHTMLDocument(xpath); 
     375            doc = res.getHTMLDocument(xpath, null, res.req.options.siteinfo.ignoreTags); 
    376376            if (!doc) throw 'XPath result is undefined or null.: XPath -> ' + xpath; 
    377377 
  • lang/javascript/vimperator-plugins/trunk/libly.js

    r26036 r26085  
    55 * @description-ja  適当なライブラリっぽいものたち 
    66 * @author          suVene suvene@zeromemory.info 
    7  * @version         0.1.0 
     7 * @version         0.1.1 
    88 * @minVersion      1.2 
    99 * @maxVersion      2.0pre 
    10  * Last Change:     07-Dec-2008. 
     10 * Last Change:     08-Dec-2008. 
    1111 * ==/VimperatorPlugin== 
    1212 * 
     
    247247        this.req = req; 
    248248        this.transport = req.transport; 
    249         this.isSuccess = req.isSuccess(); 
     249        this.isSuccess = req.isSuccess; 
    250250        this.readyState = this.transport.readyState; 
    251251 
     
    267267        } catch (e) { return ''; } 
    268268    }, 
    269     getHTMLDocument: function(xpath, xmlns) { 
     269    getHTMLDocument: function(xpath, xmlns, ignoreTags) { 
    270270        if (!this.doc) { 
    271271            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                 ignoreTags.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); 
    277277            this.doc = this._createHTMLDocument(this.htmlStripScriptFragmentstr, xmlns); 
    278278        } 
  • lang/javascript/vimperator-plugins/trunk/multi_requester.js

    r26020 r26085  
    55 * @description-ja   リクエストの結果をバッファに出力する。 
    66 * @author           suVene suvene@zeromemory.info 
    7  * @version          0.4.2 
     7 * @version          0.4.3 
    88 * @minVersion       2.0pre 
    99 * @maxVersion       2.0pre 
    10  * Last Change:      07-Dec-2008. 
     10 * Last Change:      08-Dec-2008. 
    1111 * ==/VimperatorPlugin== 
    1212 * 
     
    366366        try { 
    367367 
    368             if (!res.isSuccess || res.responseText == '') throw 'response is fail or null'; 
     368            if (!res.isSuccess() || res.responseText == '') throw 'response is fail or null'; 
    369369 
    370370            url = res.req.url; 
     
    378378            } 
    379379 
    380             doc = res.getHTMLDocument(xpath); 
     380            doc = res.getHTMLDocument(xpath, null, res.req.options.siteinfo.ignoreTags); 
    381381            if (!doc) throw 'XPath result is undefined or null.: XPath -> ' + xpath; 
    382382 
  • lang/javascript/vimperator-plugins/trunk/notifier.js

    r26035 r26085  
    3030function bootstrap() { 
    3131 
    32     var lib = liberator.plugins.libly; 
    33     var $U = lib.$U; 
     32    var libly = liberator.plugins.libly; 
     33    var $U = libly.$U; 
    3434    var logger = $U.getLogger('notifier'); 
    3535 
     
    161161            ); 
    162162 
    163             liberator.plugins.notifier.lib = lib; 
     163            liberator.plugins.notifier.libly = libly; 
    164164            liberator.plugins.notifier.Message = Message; 
    165165 
     
    214214            }), 10); 
    215215 
    216             logger.log('start end'); 
    217216        },//}}} 
    218217        stop: function(finallycallback) {//{{{ 
  • lang/javascript/vimperator-plugins/trunk/notifier/observer_growl.js

    r26021 r26085  
    1818if (!notifier) return; 
    1919 
    20 var lib = notifier.lib; 
    21 var $U = lib.$U; 
     20var libly = notifier.libly; 
     21var $U = libly.$U; 
    2222var logger = $U.getLogger('observer_growl'); 
    2323 
  • lang/javascript/vimperator-plugins/trunk/notifier/subject_hatelabo_bottle.js

    r26017 r26085  
    11/** 
    22 * notifier.js plugin subject 
    3  * @name            subject_test.js 
    4  * @description     notify if ... 
    5  * @description-ja  ... の時ポップアップ通知。 
     3 * @name            subject_hatena_bottle.js 
     4 * @description     notify if hatena bottle changed. 
     5 * @description-ja  はてなボトルの変更通知。 
    66 * @author          suVene suvene@zeromemory.info 
    77 * @version         0.1.0 
    8  * Last Change:     07-Dec-2008. 
     8 * Last Change:     08-Dec-2008. 
    99 */ 
    1010(function() { 
     
    1313if (!notifier) return; 
    1414 
    15 var lib = notifier.lib; 
    16 var $U = lib.$U; 
    17 var logger = $U.getLogger('subject_test'); 
     15var libly = notifier.libly; 
     16var $U = libly.$U; 
     17var logger = $U.getLogger('subject_hatelabo_bottle'); 
     18 
     19var URL = 'http://bottle.hatelabo.jp'; 
    1820 
    1921notifier.subject.register({ 
    20     interval: 3, 
     22    interval: 30, 
    2123    initialize: function() { 
    22         logger.log('initialize'); 
    2324        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; 
    2452    }, 
    2553    check: function() { 
     54 
     55        if (!this.initialized) return; 
     56 
    2657        this.count++; 
    2758        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); 
    3560        req.addEventListener('onSuccess', $U.bind(this, function(res) { 
    3661            var text = res.responseText;