📄 allcatepop_a.js
字号:
if (window.goN2LibMon) goN2LibMon.beginLoad('utilities', 'n2CoreLibs');
function N2Utilities() {
this.className = 'N2Utilities';
this.version = '1.0.0';
this.revision= '$Revision: #38 $';
this.initialized = false;
this.bIsCSS;
this.bIsW3C;
this.bIsIE4;
this.bIsNN4;
this.bIsIE6CSS;
this.bIsIE;
this.browser_version;
//! * **********************************************************************
//! The following section of this file code was mainly adapted from:
//! "Dynamic HTML:The Definitive Reference"
//! 2nd Edition
//! by Danny Goodman
//! Published by O'Reilly & Associates ISBN 1-56592-494-0
//! http://www.oreilly.com
//! http://www.amazon.com/exec/obidos/tg/detail/-/0596003161/qid=1049505315
//! Copyright 2002 Danny Goodman. All Rights Reserved.
//! Some minor changes and additions have been made to suit the
//! current application requirements and to enhance functionality.
//! ************************************************************************
this.initDHTMLAPI = function () {
if (document.images) {
this.bIsCSS = (document.body && document.body.style) ? true : false;
this.bIsW3C = (this.bIsCSS && document.getElementById) ? true : false;
this.bIsIE4 = (this.bIsCSS && document.all) ? true : false;
this.bIsNN4 = (document.layers) ? true : false;
this.bIsIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
}
}
this.seekLayer = function (oDoc, sName) {
var elem;
for (var i = 0; i < oDoc.layers.length; i++) {
if (oDoc.layers[i].name == sName) {
elem = oDoc.layers[i];
break;
}
if (oDoc.layers[i].document.layers.length > 0) {
elem = this.seekLayer(document.layers[i].document, sName);
}
}
return elem;
}
this.getRawObject = function (obj) {
;
}
this._getRawObject = function (obj) {
var elem;
;
if (!obj) {
return null;
}
if (typeof obj == "string") {
if (this.bIsW3C) {
elem = document.getElementById(obj);
} else if (this.bIsIE4) {
elem = document.all(obj);
} else if (this.bIsNN4) {
elem = this.seekLayer(document, obj);
}
if ( this.isUndefOrNull(elem) ) {
;
}
} else {
elem = obj;
}
return elem;
}
this.getObject = function (obj) {
var elem = this.getRawObject(obj);
if (elem && this.bIsCSS) {
elem = elem.style;
}
return elem;
}
this.shiftTo = function (obj, x, y) {
var elem = this.getObject(obj);
if (elem) {
if (this.bIsCSS) {
var units = (typeof elem.left == "string") ? "px" : 0;
elem.left = x + units;
elem.top = y + units;
} else if (this.bIsNN4) {
elem.moveTo(x,y)
}
}
}
this.shiftBy = function (obj, deltaX, deltaY) {
var elem = this.getObject(obj);
if (elem) {
if (this.bIsCSS) {
var units = (typeof elem.left == "string") ? "px" : 0;
elem.left = this.getObjectLeft(obj) + deltaX + units;
elem.top = this.getObjectTop(obj) + deltaY + units;
} else if (this.bIsNN4) {
elem.moveBy(deltaX, deltaY);
}
}
}
this.setZIndex = function (obj, zOrder) {
var elem = this.getObject(obj);
if (elem) { elem.zIndex = zOrder; }
}
this.setBGColor = function (obj, color) {
var elem = this.getObject(obj);
if (elem) {
if (this.bIsNN4) {
elem.bgColor = color;
} else if (this.bIsCSS) {
elem.backgroundColor = color;
}
}
}
this.show = function (obj) {
var elem = this.getObject(obj);
if (elem) { elem.visibility = "visible"; }
}
this.hide = function (obj) {
var elem = this.getObject(obj);
if (elem) { elem.visibility = "hidden"; }
}
this.MOZALPHAMAX = 255./256.;
this.getAlphaLevel = function (rawObj) {
var elem = this.getRawObject(rawObj);
var ret;
if (elem) {
if (elem.filters && elem.filters.alpha) {
ret = elem.filters.alpha.opacity;
} else {
var style = elem.style;
if (elem.style && !this.isUndefined(elem.style.MozOpacity)) {
var strOpacity = elem.style.MozOpacity;
if (strOpacity.length > 0) {
ret = parseFloat(elem.style.MozOpacity);
if (ret >= this.MOZALPHAMAX && !this.isUndefined(elem.style.azdMozOpacity)) {
var saved = parseFloat(elem.style.azdMozOpacity);
if (elem.style.azdMozOpacity >= this.MOZALPHAMAX) {
ret = saved;
}
}
ret = ret * 100;
} else {
ret = 100; // presume that no set opacity means opaque
}
}
}
}
if (this.isUndefined(ret)) {
;
}
return ret;
}
this.setAlphaLevel = function (rawObj, level) {
level = (level <= 0 ? 0 : (level >= 100 ? 100 : level));
var elem = this.getRawObject(rawObj);
;
if (elem) {
if (elem.filters && elem.filters.alpha) {
elem.filters.alpha.opacity = level;
} else if (elem.style && !this.isUndefined(elem.style.MozOpacity)) {
var reqLevel = level * 0.01;
var mozLevel = (reqLevel > this.MOZALPHAMAX ? this.MOZALPHAMAX : reqLevel);
if (mozLevel != reqLevel) {
;
}
elem.style.MozOpacity = mozLevel;
elem.style.azdMozOpacity = "" + reqLevel; // store as string (just as MozOpacity is) to get same rounding
} else {
;
}
}
}
this.getObjectLeft = function (obj) {
var elem = this.getRawObject(obj);
var result = 0;
if (elem) {
if (document.defaultView) {
var style = document.defaultView;
var cssDecl = style.getComputedStyle(elem, "");
result = cssDecl.getPropertyValue("left");
} else if (elem.currentStyle) {
result = elem.currentStyle.left;
} else if (elem.style) {
result = elem.style.left;
} else if (this.bIsNN4) {
result = elem.left;
}
if (isNaN(result)) {
result = this.getPageElementLeft(elem);
}
}
return parseInt(result);
}
this.getObjectTop = function (obj) {
var elem = this.getRawObject(obj);
var result = 0;
if (elem) {
if (document.defaultView) {
var style = document.defaultView;
var cssDecl = style.getComputedStyle(elem, "");
result = cssDecl.getPropertyValue("top");
} else if (elem.currentStyle) {
result = elem.currentStyle.top;
} else if (elem.style) {
result = elem.style.top;
} else if (this.bIsNN4) {
result = elem.top;
}
}
if (isNaN(result)) {
result = this.getPageElementTop(elem);
}
return parseInt(result);
}
this.getObjectWidth = function (obj) {
var elem = this.getRawObject(obj);
var result = 0;
if (elem) {
if (elem.width && this.isMozilla5()) {
result = elem.width;
} else if (elem.offsetWidth) {
result = elem.offsetWidth;
} else if (elem.clip && elem.clip.width) {
result = elem.clip.width;
} else if (elem.style && elem.style.pixelWidth) {
result = elem.style.pixelWidth;
}
}
return parseInt(result);
}
this.getObjectHeight = function (obj) {
var elem = this.getRawObject(obj);
var result = 0;
if (elem) {
if (elem.height && this.isMozilla5()) {
result = elem.height;
} else if (elem.offsetHeight) {
result = elem.offsetHeight;
} else if (elem.clip && elem.clip.height) {
result = elem.clip.height;
} else if (elem.style && elem.style.pixelHeight) {
result = elem.style.pixelHeight;
}
}
return parseInt(result);
}
this.getInsideWindowWidth = function () {
if (window.innerWidth) {
return window.innerWidth;
} else if (this.bIsIE6CSS) {
return document.body.parentElement.clientWidth
} else if (document.body && document.body.clientWidth) {
return document.body.clientWidth;
}
return 0;
}
this.getInsideWindowHeight = function () {
if (window.innerHeight) {
return window.innerHeight;
} else if (this.bIsIE6CSS) {
return document.body.parentElement.clientHeight
} else if (document.body && document.body.clientHeight) {
return document.body.clientHeight;
}
return 0;
}
//! ************************************************************
//! END CODE derived from "Dynamic HTML:The Definitive Reference"
//! 2nd Edition
//! by Danny Goodman
//! Published by O'Reilly & Associates ISBN 1-56592-494-0
//! http://www.oreilly.com
//! Copyright 2002 Danny Goodman. All Rights Reserved.
//! ################################################################
//! All the code that follows is Copyright 2003 Amazon.com.
//! All Rights Reserved.
//! ************************************************************
//! Copyright (c) Amazon.com 2003, 2004. All Rights Reserved.
//! Not to be reused without permission
//! ################################################################
this.initialize = function () {
this.initDHTMLAPI();
var agid = navigator.userAgent.toLowerCase();
this.bIsIE = (agid.indexOf("msie") != -1);
this.bIsGecko = (agid.indexOf("gecko") != -1);
this.bIsFirefox = (agid.indexOf("firefox") != -1);
this.browser_version = parseInt(navigator.appVersion);
this.getRawObject = this._getRawObject; // rest to use the correct fn.
this.sAnimationDivID = 'goN2UAnimatedBox';
this.bAnimateBoxRunning = false;
this.initialized = true;
;
}
this.isIE = function () { return this.bIsIE; }
this.isW3C = function () { return this.bIsW3C; }
this.isMozilla5 = function () { return this.bIsGecko && this.browser_version>=5; }
this.isFirefox = function () { return this.bIsFirefox && this.browser_version>=5; }
this.exists = function(obj) {
return ( !this.isUndefOrNull(this.getRawObject(obj)) );
}
this.display = function (obj, type) {
var elem = this.getObject(obj);
if (elem) {
if (this.bIsIE || this.isMozilla5())
elem.display = type ? type : "block";
else {
elem.display = "block";
}
}
}
this.undisplay = function (obj) {
var elem = this.getObject(obj);
if (elem) {
elem.display = 'none';
}
}
this.toggleDisplay = function (obj, type) {
var elem = this.getObject(obj);
if (elem) {
if (elem.display == 'none')
this.display (obj, type);
else
this.undisplay(obj);
}
}
this.toggleDualDisplay = function (obj1, obj2) {
this.toggleDisplay(obj1);
this.toggleDisplay(obj2);
}
this.adjustBy = function (obj, deltaX, deltaY, deltaW, deltaH) {
var elem = this.getObject(obj);
if (elem) {
if (this.bIsCSS) {
var units = (typeof elem.left == "string") ? "px" : 0;
elem.left = this.getObjectLeft(obj) + deltaX + units;
elem.top = this.getObjectTop(obj) + deltaY + units;
elem.width = this.getObjectWidth(obj) + deltaW; // + units;
elem.height = this.getObjectHeight(obj) + deltaH; // + units;
} else if (this.bIsNN4) {
elem.moveBy(deltaX, deltaY);
}
}
}
this.clip = function (obj, nTop, nRight, nBottom, nLeft) {
var elem = this.getObject(obj);
elem.clip = "rect("+nTop+"px, " + nRight + "px, "+nBottom+"px, "+nLeft+"px)";
}
this.setContent = function (sID, sHtml, sClass) {
var relem = this.getRawObject(sID);
if (relem) relem.innerHTML = sHtml;
if (sClass) this.setClass(sID, sClass);
}
this.setWidth = function (obj, w) {
var elem = this.getObject(obj);
if (elem) elem.width = w;
}
this.setHeight = function (obj, h) {
var elem = this.getObject(obj);
if (elem) elem.height = h;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -