📄 n2corelibs-events-15996.js
字号:
//! ################################################################//! Copyright (c) 2004-2007 Amazon.com, Inc., and its Affiliates.//! All rights reserved.//! Not to be reused without permission//! $DateTime: 2007/07/11 15:11:53 $//! ################################################################function n2EventsInitLibrary() { // Begin library code wrapper. Goes all the way to the bottom of the fileif (window.goN2LibMon) goN2LibMon.beginLoad('events', 'n2CoreLibs');window.N2Instance = function(oFeature) {this.className = 'N2Instance';this.version = '1.1.0';this.oFeature = oFeature;this._timers = new Object(); // HASH of timerids for this object, indexed by timer name.this.nSTATEDORMANT = 0;this.nSTATEPREOPEN = 1;this.nSTATEOPENING = 2;this.nSTATEVISIBLE = 3;this.nSTATECLOSING = 4;this.activeState = this.nSTATEDORMANT;this.instanceName = null;this.oRegFeatureOpened = null;}new N2Instance();window.N2Instance.prototype.getFeature = function() {return this.oFeature;}window.N2Instance.prototype.getFeatureID = function() {return (this.oRegFeatureOpened ? this.oRegFeatureOpened.getFeatureID() : "");}window.N2Instance.prototype.setRegFeatureOpened = function(oRegFeatureOpened) {this.oRegFeatureOpened = oRegFeatureOpened;}window.N2Instance.prototype.getRegFeatureOpened = function() {return this.oRegFeatureOpened;}window.N2Instance.prototype.getInstanceName = function() {return this.instanceName;}window.N2Instance.prototype.getInstanceNameFromLinkInfo = function(oLNI) {;return null;}window.N2Instance.prototype._setInstanceName = function(oLNI) {;var instanceName = this.getInstanceNameFromLinkInfo(oLNI);if (instanceName != this.instanceName) {this.clearAllTimers();this.instanceName = instanceName;}}window.N2Instance.prototype.isDormant = function() {return (this.activeState <= this.nSTATEDORMANT);}window.N2Instance.prototype.isPreOpen = function() {return (this.nSTATEDORMANT < this.activeState && this.activeState <= this.nSTATEPREOPEN);}window.N2Instance.prototype.isOpening = function() {return (this.nSTATEPREOPEN < this.activeState && this.activeState <= this.nSTATEOPENING);}window.N2Instance.prototype.isVisible = function() {return (this.nSTATEOPENING < this.activeState && this.activeState <= this.nSTATEVISIBLE);}window.N2Instance.prototype.isClosing = function() {return (this.nSTATEVISIBLE < this.activeState);}window.N2Instance.prototype.isActive = function() {return this.isVisible();};window.N2Instance.prototype.setTimer = function(timerName, nMSDelay, eventData) {this.clearTimer(timerName);var timerObject = new Object();this._timers[timerName] = timerObject;;//goN2Debug.info("N2Instance setting timer feature " + this.getFeatureID() + ", instance " + this.getInstanceName() + ", timer " + timerName + ", eventData " + eventData);timerObject.eventData = eventData;timerObject.timerid = setTimeout("N2Instance._timerFired('" +this.getFeatureID() + "', '" +this.getInstanceName() + "', '" +timerName+"')",nMSDelay);}window.N2Instance.prototype.clearTimer = function(timerName) {var timerObject = this._timers[timerName];if (timerObject) {;clearTimeout(timerObject.timerid);this._timers[timerName] = 0;}}window.N2Instance.prototype.clearAllTimers = function() {;for (var timerName in this._timers) {this.clearTimer(timerName);}}window.N2Instance._timerFired = function(featureID, instanceName, timerName) {;var oFeature = goN2Events.lookupFeature(featureID);;if (!oFeature) {return;}var oInstance = oFeature.getInstance(featureID, instanceName);;if (!oInstance) {return;}var timerObject = oInstance._timers[timerName];oInstance._timers[timerName] = 0;;oInstance[timerName](timerObject.eventData);}window.N2FInstance = function(oFeature) {N2FInstance.parentClass.call(this, oFeature);this.className = 'N2FInstance';this.version = '1.1.0';this.bPreOpenDuringClose = false;this.bMouseIsIn = false;}window.N2FInstance.prototype = new N2Instance();window.N2FInstance.parentClass = N2Instance;window.N2FInstance.prototype.getRawObject = function() {;return null;}window.N2FInstance.prototype.getInstanceNameFromLinkInfo = function(oLNI) {var name = N2FInstance.getInstanceNameFromLinkInfo(oLNI);return name;}window.N2FInstance.getInstanceNameFromLinkInfo = function(oLNI) {;var name = (oLNI.getID() ? N2Feature.prefixFInstanceNames + oLNI.getID() : null);return name;}window.N2FInstance.prototype.isStatic = function() {return false;}window.N2FInstance.prototype.assignInstance = function(oLNI) {if (!this.isDormant()) {;return false;}this._setInstanceName(oLNI);return true;}window.N2FInstance.prototype.overlayClosed = function() {return;}window.N2FInstance.prototype.notifyFInstanceHasMouse = function(bMouseIsInInstance) {var bMouseWasIn = this.bMouseIsIn;this.bMouseIsIn = bMouseIsInInstance;if (this.oFeature.isDisabled()) {return;}if (this.isStatic()) {return;}if (bMouseWasIn && !bMouseIsInInstance) {;this._scheduleClose(this.getRegFeatureOpened().getDelayCloseAfter());} else if (!bMouseWasIn && bMouseIsInInstance) {;this._cancelClose();}}window.N2FInstance.prototype.setMouseIn = function(bMouseIsInInstance) {this.bMouseIsIn = bMouseIsInInstance;}window.N2FInstance.prototype.mouseOverHotspotTrack = function(oLNI) {;//goN2Debug.info("feature instance mouseOverHotspotTrack; feature " + oLNI.getFeature() + ", feature instance '" + this.getInstanceName() + "'");var oRegFeature = goN2Events.lookupRegFeature(oLNI.getFeature());;if (this.oFeature.isDisabled()) {return;}this._cancelClose();}window.N2FInstance.prototype.mouseOverHotspotOpen = function(oLNI, nFeatureFlags) {;//goN2Debug.info("feature instance mouseOverHotspotOpen; feature " + oLNI.getFeature() + ", feature instance '" + this.getInstanceName() + "'");var oRegFeature = goN2Events.lookupRegFeature(oLNI.getFeature());;if (this.oFeature.isDisabled()) {return;}if (this.activeState<=this.nSTATEPREOPEN || this.isClosing()) {this._scheduleOpen(oLNI, nFeatureFlags, oRegFeature.getDelayShowAfter());} else {;this._cancelClose();}}window.N2FInstance.prototype.mouseOutHotspotClose = function(oLNI) {;//goN2Debug.info("feature instance mouseOutHotspotClose; feature " + this.getFeatureID() + ", feature instance '" + this.getInstanceName() + "'");var oRegFeature = goN2Events.lookupRegFeature(oLNI.getFeature());;if (this.activeState <= this.nSTATEDORMANT) {} else if (this.activeState <= this.nSTATEPREOPEN) {this._cancelOpen();} else if (this.activeState <= this.nSTATEVISIBLE) {this._scheduleClose(oRegFeature.getDelayReachWithin());} else {}}window.N2FInstance.prototype.clickHotspotOpen = function(oLNI, nFeatureFlags) {;//goN2Debug.info("feature instance clickHotspotOpen; feature " + this.getFeatureID() + ", feature instance '" + this.getInstanceName() + "'");var oRegFeature = goN2Events.lookupRegFeature(oLNI.getFeature());;this.openNow(oLNI, nFeatureFlags);}window.N2FInstance.prototype.mouseOver = function() {;//goN2Debug.info("feature instance mouseOver; feature " + this.getFeatureID() + ", feature instance '" + this.getInstanceName() + "'");this.notifyFInstanceHasMouse(true);}window.N2FInstance.prototype.mouseOut = function() {;//goN2Debug.info("feature instance mouseOut; feature " + this.getFeatureID() + ", feature instance '" + this.getInstanceName() + "'");this.notifyFInstanceHasMouse(false);}window.N2FInstance.prototype._scheduleOpen = function(oLNI, nFeatureFlags, nMSDelay) {this.setRegFeatureOpened(goN2Events.lookupRegFeature(oLNI.getFeature()));;var eventData = new Object();eventData.oLNI = oLNI;eventData.nFeatureFlags = nFeatureFlags;this.setTimer("_timedOpen", nMSDelay, eventData);if (this.isClosing()) {this.bPreOpenDuringClose = true;} else {this.activeState = this.nSTATEPREOPEN;}}window.N2FInstance.prototype._timedOpen = function(eventData) {if (this.oFeature.isDisabled()) {return;}this.openNow(eventData.oLNI, eventData.nFeatureFlags);}window.N2FInstance.prototype._cancelOpen = function() {;this.clearTimer("_timedOpen");}window.N2FInstance.prototype._scheduleClose = function(nMSDelay) {;if (this.isStatic()) {return;}this.setTimer("_timedClose", nMSDelay, null);}window.N2FInstance.prototype._timedClose = function(eventData) {this.closeNow();}window.N2FInstance.prototype._cancelClose = function() {;this.clearTimer("_timedClose");}window.N2FInstance.prototype.openNow = function(oLNI, nFeatureFlags) {;}window.N2FInstance.prototype.closeNow = function(bImmediate) {;}window.N2FInstanceWrapper = function(oWrapperFeature) {N2FInstanceWrapper.parentClass.call(this, oWrapperFeature); // Call the base class constructor function.this.className = 'N2FInstanceWrapper';this.version = '1.1.0';this.oWrappedFeature = null; // must be null except when Active.}window.N2FInstanceWrapper.prototype = new N2FInstance();window.N2FInstanceWrapper.parentClass = N2FInstance;window.N2FInstanceWrapper.prototype.isStatic = function() {return ((this.oWrappedFeature && this.oWrappedFeature.isStatic) ? this.oWrappedFeature.isStatic() : false);}window.N2FInstanceWrapper.prototype.getRawObject = function() {;return this.oWrappedFeature.getObject();}window.N2FInstanceWrapper.prototype.openNow = function(oLNI, nFeatureFlags) {;//goN2Debug.info("feature instance wrapper openNow; feature " + oLNI.getFeature() + ", feature instance '" + this.getInstanceNameFromLinkInfo(oLNI) + "'");;if (this.oFeature.isDisabled()) {return;}var oFInstanceActive = this.oFeature.getActiveWrappedFInstance();if (oFInstanceActive) {oFInstanceActive.closeNow(true);}this.oWrappedFeature = this.oFeature.getWrappedFeatureObj();this.oFeature.setActiveWrappedFInstance(this);if (!this.oWrappedFeature.isVisible()){;this._cancelOpen();this.setRegFeatureOpened(goN2Events.lookupRegFeature(oLNI.getFeature()));var oHotspot = this._createHotspotObj(oLNI, nFeatureFlags);this.oWrappedFeature.show(oHotspot);if (this.oWrappedFeature.isVisible()) {goN2Events.toggleObjects("hide", this.oFeature.getWrappedFeatureActiveElement().id);this._setStateFromWrappedFeature(this.nSTATEVISIBLE);} else {this.oWrappedFeature = null;this.oFeature.setActiveWrappedFInstance(null);this._setStateFromWrappedFeature(this.nSTATEDORMANT);}} else {;this._setStateFromWrappedFeature(this.nSTATEVISIBLE);}}window.N2FInstance.prototype.overlayClosed = function() {if (this.oWrappedFeature) {this.oWrappedFeature = null;this.oFeature.setActiveWrappedFInstance(null);}this._setStateFromWrappedFeature(this.nSTATEDORMANT);}window.N2FInstanceWrapper.prototype._setStateFromWrappedFeature = function(activeStateExpected) {if (this.oWrappedFeature && this.oWrappedFeature.isVisible()) {this.activeState = this.nSTATEVISIBLE;} else {this.activeState = this.nSTATEDORMANT;};if (this.activeState != activeStateExpected) {;}}window.N2FInstanceWrapper.prototype.closeNow = function(bImmediate) {;//goN2Debug.info("feature instance wrapper closeNow; feature " + this.getFeatureID() + ", feature instance '" + this.getInstanceName() + "'");if (this.isStatic()) {return;}var oWrappedFeature = this.oWrappedFeature;if (oWrappedFeature && oWrappedFeature.isVisible()) {this._cancelClose();var nAnimateCloseSaved;if (bImmediate) {nAnimateCloseSaved = this._smashNAnimateClose(oWrappedFeature, 0);}try {;oWrappedFeature.hide();} catch (e) {if (bImmediate) {this._smashNAnimateClose(oWrappedFeature, nAnimateCloseSaved);}throw(e);}if (bImmediate) {this._smashNAnimateClose(oWrappedFeature, nAnimateCloseSaved);};if (this.oWrappedFeature) {this.oWrappedFeature = null;this.oFeature.setActiveWrappedFInstance(null);}goN2Events.toggleObjects("show");} else {;}this._setStateFromWrappedFeature(this.nSTATEDORMANT);this.setRegFeatureOpened(null);}window.N2FInstanceWrapper.prototype._smashNAnimateClose = function(oWrappedFeature, newValue) {var oldValue = oWrappedFeature.nAnimateClose;oWrappedFeature.nAnimateClose = newValue;return oldValue;}window.N2FInstanceWrapper.prototype._createHotspotObj = function(oLNI, nFeatureFlags) {if (goN2U.isUndefOrNull(nFeatureFlags)) {nFeatureFlags = 0;}var oHotspot = new Object();oHotspot.id = "";oHotspot.objectname = "";oHotspot.abstop = ""; // abs y within the documentoHotspot.absleft = ""; // abs x within the documentoHotspot.top = ""; // abs y within the window [relative to the document]oHotspot.left = ""; // abs x within the window [relative to the document]oHotspot.bottom = "";oHotspot.right = "";oHotspot.availAbove = 0;oHotspot.availUnder = 0;oHotspot.availLeft = 0;oHotspot.availRight = 0;oHotspot.scrollLeft = 0;oHotspot.scrollTop = 0;oHotspot.clientHeight = 0;oHotspot.clientWidth = 0;oHotspot.staticFlag = 0;var sFeatureID = oLNI.getFeature();;var sLinkID = oLNI.getLinkID();var oLink = goN2U.getRawObject(sLinkID);oHotspot.oLink = oLink;var sName = oLNI.getLinkName();if (sName != oLink.id) {oHotspot.sNameOverride = sName;};oHotspot.featureID = sFeatureID;;oHotspot.relatedFeatureObj = this.oWrappedFeature;oHotspot.staticFlag = nFeatureFlags;oHotspot.scrollLeft = goN2U.getScrollLeft();oHotspot.scrollTop = goN2U.getScrollTop();oHotspot.clientHeight = goN2U.getInsideWindowHeight();oHotspot.clientWidth = goN2U.getInsideWindowWidth();;;oHotspot.href = oLink.href;var sTmp;var re = /([\r\n])/gi;sTmp = oLink.innerHTML;oHotspot.linkHTML = sTmp.replace(re, " ");sTmp = goN2U.isUndefOrNull(oLink.innerText) ? oLink.innerHTML : oLink.innerText;oHotspot.linkText = sTmp.replace(re, " ");;;;;oHotspot.absleft = goN2U.getScrolledElementLeft(oLink);oHotspot.abstop = goN2U.getScrolledElementTop(oLink);oHotspot.left = goN2U.getObjectLeft(oLink) - oHotspot.scrollLeft;oHotspot.top = goN2U.getObjectTop(oLink) - oHotspot.scrollTop;oHotspot.width = goN2U.getObjectWidth(oLink);oHotspot.height = goN2U.getObjectHeight(oLink);var elChild = oLink.firstChild;if ( (oHotspot.width == 0) && elChild ){oHotspot.width = goN2U.getObjectWidth(elChild);oHotspot.height = goN2U.getObjectHeight(elChild);} else if ( goN2U.isMozilla5() ) {var aChildren = oLink.childNodesvar nChildren = aChildren.length;for (var i=0;i<nChildren;i++) {elChild = aChildren[i];if ((elChild.nodeType == 1) && (elChild.tagName == 'IMG')) {oHotspot.bottom = oHotspot.top + goN2U.getObjectHeight(oLink);oHotspot.height = goN2U.getObjectHeight(elChild);var oldTop = oHotspot.top;oHotspot.top = oHotspot.bottom - oHotspot.height;oHotspot.abstop = oHotspot.abstop + (oHotspot.top-oldTop);break;}}}oHotspot.right = oHotspot.left + oHotspot.width;oHotspot.bottom = oHotspot.top + oHotspot.height;oHotspot.sLinkID = sLinkID;; //oLink set earlieroHotspot.availAbove = oHotspot.abstop - oHotspot.scrollTop - 1;oHotspot.availUnder = oHotspot.clientHeight - (oHotspot.abstop + oHotspot.height - oHotspot.scrollTop);oHotspot.availLeft = oHotspot.absleft - oHotspot.scrollLeft - 1;oHotspot.availRight = oHotspot.clientWidth - (oHotspot.absleft + oHotspot.width - oHotspot.scrollLeft);return oHotspot;}window.N2HInstance = function(oFeature) {N2HInstance.parentClass.call(this, oFeature); // Call the base class constructor function.this.className = 'N2HInstance';this.version = '1.1.0';}window.N2HInstance.prototype = new N2Instance();window.N2HInstance.parentClass = N2Instance;window.N2HInstance.prototype.getInstanceNameFromLinkInfo = function(oLNI) {return N2HInstance.getInstanceNameFromLinkInfo(oLNI);}window.N2HInstance.getInstanceNameFromLinkInfo = function(oLNI) {;;return N2Feature.prefixHInstanceNames + oLNI.getLinkID();}window.N2HInstance.prototype.getLinkInfoFromInstanceName = function(sInstanceName) {return N2HInstance.getInstanceNameFromLinkInfo(sInstanceName);}window.N2HInstance.getLinkInfoFromInstanceName = function(sInstanceName) {;var prefixLength = N2Feature.prefixHInstanceNames.length;;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -