📄 keyboard.js
字号:
/*
* Copyright 2001-2007 Hippo (www.hippo.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var EVENT_KEYPRESS = 'keypress';
InputEventHandler = Class.create();
InputEventHandler.prototype = {
initialize: function(handlerWrapper){
this.globalListeners = new Array();
this.addGlobalKeyBoardEventListener(handlerWrapper);
this.propagateHandlers(window.top.frames);
},
addGlobalKeyBoardEventListener : function(handlerWrapper){
var newFunc = function(event){
handlerWrapper.handleInputEvent(event);
}
this.globalListeners.push(newFunc);
if (navigator.appName.match(/Microsoft/)){
this.attachEventTo(window.top.document.body,EVENT_KEYPRESS,newFunc);
} if (navigator.appName.match(/Netscape/)){
this.attachEventTo(window.top.document,EVENT_KEYPRESS,newFunc);
}
},
attachEventTo : function(object,eventType,handler){
Event.observe(object,eventType,handler,true);
},
addGlobalPropagationHandlers : function(){
this.propagateHandlers(window.top);
},
passGlobalEvent: function(event){
var i;
for (i=0; i<this.globalListeners.length; i++){
this.globalListeners[i](event);
}
},
propagateHandlers : function(framesArray){
var i;
var j;
var frames;
var doc;
var thisObj = this;
var func =
function(event){
thisObj.passGlobalEvent(event);
};
if (framesArray.length > 0 ){
var i;
for (i=0; i < framesArray.length; i++){
if (framesArray[i].relayHandler == null){
try{
if (navigator.appName.match(/Microsoft/)){
this.attachEventTo(framesArray[i].document.body,EVENT_KEYPRESS,func);
} if (navigator.appName.match(/Netscape/)){
this.attachEventTo(framesArray[i].document,EVENT_KEYPRESS,func);
}
} catch(e){
}
framesArray[i].relayHandler = func;
}
try{
if (navigator.appName.match(/Microsoft/)){
if (framesArray[i].contentWindow)
doc = framesArray[i].contentDocument;
else
if (framesArray[i].contentDocument) alert('sup');
} if (navigator.appName.match(/Netscape/)){
doc = framesArray[i].document;
}
// alert(doc);
frames = doc.getElementsByTagName('iframe');
frames=$A(frames);
if (frames && frames.length > 0){
this.propagateHandlers(frames);
}
} catch(e){}
}
}
}
}
function createHandler(){
window.top.document.globalInputEventHandler = new InputEventHandler();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -