Changeset 7257

Show
Ignore:
Timestamp:
02/28/08 22:56:41 (5 years ago)
Author:
mattn
Message:

lang/javascript/opera-userjs/minibufferbookmarkcommand.js:
ドメインでチェックする用修正。
TODO: いずれプラグインを作成する際に外からACCEPTABLE_DOMAIN_LISTを変更出来る様にする

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/opera-userjs/minibufferbookmarkcommand.js

    r7248 r7257  
    3131var TAG = '' 
    3232 
     33if (typeof ACCEPTABLE_DOMAIN_LIST === 'undefined') { 
     34        var ACCEPTABLE_DOMAIN_LIST = [ 
     35                'b.hatena.ne.jp', 
     36                'clip.livedoor.com', 
     37                'del.icio.us' 
     38        ]; 
     39} 
     40 
    3341const MINIBUFFER_BOOKMARKCOMMAND = 'MINIBUFFER_BOOKMARKCOMMAND'; 
    3442if (window.parent != window) { 
    3543        if (window.name && window.name == MINIBUFFER_BOOKMARKCOMMAND) { 
    36                 window.opera.addEventListener( 'BeforeScript', function (e) { e.preventDefault(); }, false ); 
    37                 window.opera.addEventListener( 'BeforeExternalScript', function (e) { e.preventDefault(); }, false ); 
    38                 document.addEventListener("DOMContentLoaded", function() { 
    39                         var html = (document.documentElement || document.body).outerHTML; 
    40                         window.parent.document.postMessage(html); 
    41                 }, false); 
     44                for(var n = 0; n < ACCEPTABLE_DOMAIN_LIST.length; n++) { 
     45                        if (location.host != ACCEPTABLE_DOMAIN_LIST[n]) continue; 
     46                        window.opera.addEventListener( 'BeforeScript', function (e) { e.preventDefault(); }, false ); 
     47                        window.opera.addEventListener( 'BeforeExternalScript', function (e) { e.preventDefault(); }, false ); 
     48                        document.addEventListener("DOMContentLoaded", function() { 
     49                                var html = (document.documentElement || document.body).outerHTML; 
     50                                window.parent.document.postMessage(html); 
     51                        }, false); 
     52                        break; 
     53                } 
    4254        } 
    4355} else { 
     
    163175                var hatenab = new function(){ 
    164176                        var self = this; 
     177 
    165178                        this.checkLogin = function(html){ 
    166179                                var input = $X('//input', html); 
     
    268281                var livedoorclip = new function(){ 
    269282                        var self = this; 
     283 
    270284                        this.checkLogin = function(html){ 
    271285                                var login = $X('//form[@name="loginForm"]', html); 
     
    366380                var delicious = new function(){ 
    367381                        var self = this; 
     382 
    368383                        this.checkLogin = function(html){ 
    369384                                return $X('id("header-auth-links")/a[@href="/logout"]', html).length;