?? overlib.js
字號:
function createDivContainer(id,frm,zValue) {
id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000);
var objRef, divContainer = layerReference(id);
if (divContainer == null) {
if (olNs4) {
divContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm);
objRef = divContainer;
} else {
var body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName("BODY")[0]);
if (olIe4&&!document.getElementById) {
body.insertAdjacentHTML("beforeEnd",'<div id="'+id+'"></div>');
divContainer=layerReference(id);
} else {
divContainer = frm.document.createElement("DIV");
divContainer.id = id;
body.appendChild(divContainer);
}
objRef = divContainer.style;
}
objRef.position = 'absolute';
objRef.visibility = 'hidden';
objRef.zIndex = zValue;
if (olIe4&&!olOp) objRef.left = objRef.top = '0px';
else objRef.left = objRef.top = -10000 + (!olNs4 ? 'px' : 0);
}
return divContainer;
}
// get reference to a layer with ID=id
function layerReference(id) {
return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id)));
}
////////
// UTILITY FUNCTIONS
////////
// Checks if something is a function.
function isFunction(fnRef) {
var rtn = true;
if (typeof fnRef == 'object') {
for (var i = 0; i < fnRef.length; i++) {
if (typeof fnRef[i]=='function') continue;
rtn = false;
break;
}
} else if (typeof fnRef != 'function') {
rtn = false;
}
return rtn;
}
// Converts an array into an argument string for use in eval.
function argToString(array, strtInd, argName) {
var jS = strtInd, aS = '', ar = array;
argName=(argName ? argName : 'ar');
if (ar.length > jS) {
for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
aS = aS.substring(0, aS.length-2);
}
return aS;
}
// Places a hook in the correct position in a hook point.
function reOrder(hookPt, fnRef, order) {
var newPt = new Array(), match, i, j;
if (!order || typeof order == 'undefined' || typeof order == 'number') return hookPt;
if (typeof order=='function') {
if (typeof fnRef=='object') {
newPt = newPt.concat(fnRef);
} else {
newPt[newPt.length++]=fnRef;
}
for (i = 0; i < hookPt.length; i++) {
match = false;
if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
continue;
} else {
for(j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
match = true;
break;
}
}
if (!match) newPt[newPt.length++] = hookPt[i];
}
newPt[newPt.length++] = order;
} else if (typeof order == 'object') {
if (typeof fnRef == 'object') {
newPt = newPt.concat(fnRef);
} else {
newPt[newPt.length++] = fnRef;
}
for (j = 0; j < hookPt.length; j++) {
match = false;
if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
continue;
} else {
for (i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
match = true;
break;
}
}
if (!match) newPt[newPt.length++]=hookPt[j];
}
for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
newPt.length = 0;
for (j = 0; j < hookPt.length; j++) {
match = false;
for (i = 0; i < order.length; i++) {
if (hookPt[j] == order[i]) {
match = true;
break;
}
}
if (!match) newPt[newPt.length++] = hookPt[j];
}
newPt = newPt.concat(order);
}
hookPt = newPt;
return hookPt;
}
////////
// PLUGIN ACTIVATION FUNCTIONS
////////
// Runs plugin functions to set runtime variables.
function setRunTimeVariables(){
if (typeof runTime != 'undefined' && runTime.length) {
for (var k = 0; k < runTime.length; k++) {
runTime[k]();
}
}
}
// Runs plugin functions to parse commands.
function parseCmdLine(pf, i, args) {
if (typeof cmdLine != 'undefined' && cmdLine.length) {
for (var k = 0; k < cmdLine.length; k++) {
var j = cmdLine[k](pf, i, args);
if (j >- 1) {
i = j;
break;
}
}
}
return i;
}
// Runs plugin functions to do things after parse.
function postParseChecks(pf,args){
if (typeof postParse != 'undefined' && postParse.length) {
for (var k = 0; k < postParse.length; k++) {
if (postParse[k](pf,args)) continue;
return false; // end now since have an error
}
}
return true;
}
////////
// PLUGIN REGISTRATION FUNCTIONS
////////
// Registers commands and creates constants.
function registerCommands(cmdStr) {
if (typeof cmdStr!='string') return;
var pM = cmdStr.split(',');
pms = pms.concat(pM);
for (var i = 0; i< pM.length; i++) {
eval(pM[i].toUpperCase()+'='+pmCount++);
}
}
// Registers no-parameter commands
function registerNoParameterCommands(cmdStr) {
if (!cmdStr && typeof cmdStr != 'string') return;
pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
}
// Register a function to hook at a certain point.
function registerHook(fnHookTo, fnRef, hookType, optPm) {
var hookPt, last = typeof optPm;
if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();
hookPt = hookPts[fnHookTo];
if (hookType != null) {
if (hookType == FREPLACE) {
hookPt.ovload = fnRef; // replace normal overlib routine
if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef;
} else if (hookType == FBEFORE || hookType == FAFTER) {
var hookPt=(hookType == 1 ? hookPt.before : hookPt.after);
if (typeof fnRef == 'object') {
hookPt = hookPt.concat(fnRef);
} else {
hookPt[hookPt.length++] = fnRef;
}
if (optPm) hookPt = reOrder(hookPt, fnRef, optPm);
} else if (hookType == FALTERNATE) {
if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef;
} else if (hookType == FCHAIN) {
hookPt = hookPt.chain;
if (typeof fnRef=='object') hookPt=hookPt.concat(fnRef); // add other functions
else hookPt[hookPt.length++]=fnRef;
}
return;
}
}
// Register a function that will set runtime variables.
function registerRunTimeFunction(fn) {
if (isFunction(fn)) {
if (typeof fn == 'object') {
runTime = runTime.concat(fn);
} else {
runTime[runTime.length++] = fn;
}
}
}
// Register a function that will handle command parsing.
function registerCmdLineFunction(fn){
if (isFunction(fn)) {
if (typeof fn == 'object') {
cmdLine = cmdLine.concat(fn);
} else {
cmdLine[cmdLine.length++] = fn;
}
}
}
// Register a function that does things after command parsing.
function registerPostParseFunction(fn){
if (isFunction(fn)) {
if (typeof fn == 'object') {
postParse = postParse.concat(fn);
} else {
postParse[postParse.length++] = fn;
}
}
}
////////
// PLUGIN REGISTRATION FUNCTIONS
////////
// Runs any hooks registered.
function runHook(fnHookTo, hookType) {
var l = hookPts[fnHookTo], k, rtnVal = null, optPm, arS, ar = runHook.arguments;
if (hookType == FREPLACE) {
arS = argToString(ar, 2);
if (typeof l == 'undefined' || !(l = l.ovload)) rtnVal = eval(fnHookTo+'('+arS+')');
else rtnVal = eval('l('+arS+')');
} else if (hookType == FBEFORE || hookType == FAFTER) {
if (typeof l != 'undefined') {
l=(hookType == 1 ? l.before : l.after);
if (l.length) {
arS = argToString(ar, 2);
for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');
}
}
} else if (hookType == FALTERNATE) {
optPm = ar[2];
arS = argToString(ar, 3);
if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
rtnVal = eval(fnHookTo+'('+arS+')');
} else {
rtnVal = eval('l('+arS+')');
}
} else if (hookType == FCHAIN) {
arS=argToString(ar,2);
l=l.chain;
for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) break;
}
return rtnVal;
}
////////
// OBJECT CONSTRUCTORS
////////
// Object for handling hooks.
function FunctionReference() {
this.ovload = null;
this.before = new Array();
this.after = new Array();
this.alt = new Array();
this.chain = new Array();
}
// Object for simple access to the overLIB version used.
// Examples: simpleversion:351 major:3 minor:5 revision:1
function Info(version, prerelease) {
this.version = version;
this.prerelease = prerelease;
this.simpleversion = Math.round(this.version*100);
this.major = parseInt(this.simpleversion / 100);
this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10;
this.meets = meets;
}
// checks for Core Version required
function meets(reqdVersion) {
return (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion));
}
////////
// STANDARD REGISTRATIONS
////////
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF);
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS);
registerPostParseFunction(checkPositionFlags);
registerHook("hideObject", nbspCleanup, FAFTER);
registerHook("horizontalPlacement", horizontalPlacement, FCHAIN);
registerHook("verticalPlacement", verticalPlacement, FCHAIN);
if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1;
registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');
///////
// ESTABLISH MOUSECAPTURING
///////
// Capture events, alt. diffuses the overlib function.
var olCheckMouseCapture=true;
if ((olNs4 || olNs6 || olIe4)) {
olMouseCapture();
} else {
overlib = no_overlib;
nd = no_overlib;
ver3fix = true;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -