blob: 400740bad66a5b710c53d45dbf9eef33d5248f45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/**
* Auto switch vimperator key navigation
*
* @author teramako teramako@gmail.com
* @author halt feits <halt.feit at gmail.com>
* @version 0.6.0
*/
(function(){
/*
* String or RegExp
* e.g)
* * /^https?:\/\/mail\.google\.com\//
* * 'http://reader.livedoor.com/reader/'
*/
var ignorePageList = [
/^https?:\/\/mail\.google\.com\//,
'http://reader.livedoor.com/reader/'
];
document.getElementById('appcontent').addEventListener('DOMContentLoaded',function(event){
if ( isMatch(event.target.documentURI) ){
liberator.modes.passAllKeys = true;
} else {
liberator.modes.passAllKeys = false;
}
//liberator.log('load page: ' + gBrowser.selectedBrowser.contentDocument.URL);
},false);
getBrowser().mTabBox.addEventListener('TabSelect',function(event){
var uri = this.parentNode.currentURI.spec;
if ( isMatch(uri) ){
liberator.modes.passAllKeys = true;
} else {
liberator.modes.passAllKeys = false;
}
//liberator.log('select page: ' + gBrowser.selectedBrowser.contentDocument.URL);
},false);
function isMatch(uri){
return ignorePageList.some(function(e,i,a){
if (typeof e == 'string'){
return uri.indexOf(e) != -1;
} else if (e instanceof RegExp){
return e.test(uri);
}
});
}
})();
|