📄 n2corelibs-simplepopover-41238.js
字号:
//! ################################################################//! Copyright (c) 2004-2007 Amazon.com, Inc., and its Affiliates.//! All rights reserved.//! Not to be reused without permission//! $DateTime: 2007/07/19 15:13:24 $//! ################################################################function n2SimplePopoverInitLibrary() { // Begin library code wrapper. Goes all the way to the bottom of the fileif (window.goN2LibMon) { goN2LibMon.beginLoad('simplePopover', 'n2CoreLibs'); }window.N2SimplePopover=function() {var oCfg = goN2U.getConfigurationObject('N2SimplePopover');this.nEdgePad = oCfg.getValue('this.nEdgePad', 6); // padding from screen edge to popup (when applicable)this.nHotPad = oCfg.getValue('this.nHotPad', 2);this.className = 'N2SimplePopover';this.version = '1.0.2';this.myMouseOverCallback=n2MouseOverFeature; // put here not in initializationthis.myMouseOutCallback=n2MouseOutFeature; // put here not in initializationthis.myOnCloseCallback=n2OverlayClosed; // put here not in initializationthis.myFeatureChangedCallback=n2OverlayChanged; // put here not in initializationthis.myCustomCallbacks = [];this.myID=null;this.popObj=null;this.bIsVisible = false;this.cursorCanLeavePopover = false;this.staticTimer = null;this.content = null;this.nHAdjust=0;this.nVAdjust=0;this.nAnimateOpen=5;this.nAnimateClose=4;this.sAnimateOpenStyle = 'animatedBox';this.sAnimateCloseStyle = 'animatedBoxHollow';this.sBorderStyle = null;this.bIsTabTitled = false;this.oBorderImg = {t: goN2Locale.getImageURL('JSF-popover-border-t','gno/popover-border-t.gif'),b: goN2Locale.getImageURL('JSF-popover-border-b','gno/popover-border-b.gif'),l: goN2Locale.getImageURL('JSF-popover-border-l','gno/popover-border-l.gif'),r: goN2Locale.getImageURL('JSF-popover-border-r','gno/popover-border-r.gif'),tl: goN2Locale.getImageURL('JSF-popover-border-tl','gno/popover-border-tl.gif'),tr: goN2Locale.getImageURL('JSF-popover-border-tr','gno/popover-border-tr.gif'),bl: goN2Locale.getImageURL('JSF-popover-border-bl','gno/popover-border-bl.gif'),br: goN2Locale.getImageURL('JSF-popover-border-br','gno/popover-border-br.gif'),ct: goN2Locale.getImageURL('JSF-popover-border-t','gno/popover-border-t.gif'),cb: goN2Locale.getImageURL('JSF-popover-border-b','gno/popover-border-b.gif'),cl: goN2Locale.getImageURL('JSF-popover-border-l','gno/popover-border-l.gif'),cr: goN2Locale.getImageURL('JSF-popover-border-r','gno/popover-border-r.gif'),ctl:goN2Locale.getImageURL('JSF-popover-border-ctl','gno/popover-border-ctl.gif'),ctr:goN2Locale.getImageURL('JSF-popover-border-ctr','gno/popover-border-ctr.gif'),cbl:goN2Locale.getImageURL('JSF-popover-border-cbl','gno/popover-border-cbl.gif'),cbr:goN2Locale.getImageURL('JSF-popover-border-cbr','gno/popover-border-cbr.gif')};this.sTransImg = goN2Locale.getImageURL('JSF-popover-trans', 'gno/popover-trans.gif');this.oCurHotspot = null;this.oCurTabTitle = null;this.nPopLevel = null;this.childPopFeatureID = null;this.parentPopFeatureID = null;this.regFeatureID;this.bLADSupported = true;this.nLADTimeoutMs = 16000; // ms to waitthis.nLADRetryMs = 250; // ms delay between checksthis.sLADKey = null; // gaTD[key] existsthis.sLADField = null; // gaTD[<sID>].field or gaTD[key].field existsvar imagePath = goN2Locale.getImageURL('JSF-loading-bar', 'nav2/images/loading-bar.gif');this.sLADLoadingMessage = goN2Locale.getString('loading_13548', 'Loading...') + '<im'+'g s'+'rc="' + imagePath + '" height="9" align="absmiddle">';this.sLADTimeoutMessage = goN2Locale.getString('unable_to_get_info_36020', "Unable to obtain necessary information. Please try again later");this.bMoveHEContent = true;}new N2SimplePopover();N2SimplePopover.sClickGrabberID = 'n2SPopClickGrab'; //WARNING: events.js uses N2SimplePopover.sClickGrabberIDN2SimplePopover.prototype.initialize = function (id, objectName, dataArrayName, populateMethod, sLocateMethodID, nHAdjust, nVAdjust, sBorderStyle) {;this.myID=id; // ID of HTML layer elementthis.objectName=objectName; // JS Object nameif(dataArrayName) {try {this.aDataArray = eval(dataArrayName);}catch(e) {;}}this.sDataArrayName = dataArrayName; // JS Object name;this.sBorderStyle = sBorderStyle;this.createPopHTML(id, objectName, this.content);this._createHotspotClickGrabber();this.popObj = goN2U.getRawObject(this.myID);this.popObjStyle = goN2U.getObject(this.myID);;;this._presetLocate(sLocateMethodID, nHAdjust, nVAdjust);};N2SimplePopover.prototype.destructor = function() {this.popObj = null;this.popObjStyle = null;}N2SimplePopover.prototype.getObject = function () { return this.popObj; };N2SimplePopover.prototype.simplePopoverInitialize = N2SimplePopover.prototype.initialize;N2SimplePopover.prototype.setMouseOverCallback = function (fn) { this.myMouseOverCallback = fn; };N2SimplePopover.prototype.setMouseOutCallback = function (fn) { this.myMouseOutCallback = fn; };N2SimplePopover.prototype.setPopoverChangedCallback = function (fn) { this.myFeatureChangedCallback = fn; };N2SimplePopover.prototype.setOnCloseCallback = function (fn) { this.myOnCloseCallback = fn; };N2SimplePopover.prototype.setCallback = function (sID, fFn) { this.myCustomCallbacks[sID] = fFn; }N2SimplePopover.prototype.getID = function() { return this.myID; };N2SimplePopover.prototype.getObjectName = function() { return this.objectName; };N2SimplePopover.prototype.getHotspotID = function() { return this.linkID; };N2SimplePopover.prototype.setPopulate = function (fn) { this.populate = fn; };N2SimplePopover.prototype.configureAnimation = function(nOpen, nClose, sOpenStyle, sCloseStyle) {this.nAnimateOpen=nOpen;this.nAnimateClose=nClose;this.sAnimateOpenStyle = sOpenStyle;this.sAnimateCloseStyle = sCloseStyle;};N2SimplePopover.prototype.configureTabTitle = function(bNoConnector) {this.bIsTabTitled = true;if (!bNoConnector) {this.connID = this.myID + "_conn";this.createConnectorHTML();}}N2SimplePopover.prototype.preConfigureNTier = function(nPopLevel, regFeatureID, parentFeatureID, childFeatureID) {this.regFeatureID = regFeatureID;this.parentPopFeatureID = parentFeatureID;this.childPopFeatureID = childFeatureID;this.nPopLevel = nPopLevel;}N2SimplePopover.prototype.setBorderImage = function(sImg, sURL) {this.oBorderImg[sImg] = sURL;}N2SimplePopover.prototype.configureLADSupport = function(b, sKey, sField, nTimeoutMs, nRetryMs,sLoadingMsg, sTimeoutMsg) {this.bLADSupported = b;if (sKey) {this.sLADKey = sKey;}if (sField) {this.sLADField = sField;}if (nTimeoutMs) {this.nLADTimeoutMs = nTimeoutMs;}if (nRetryMs) {this.nLADRetryMs = nRetryMs;}if (sLoadingMsg) {this.sLADLoadingMessage = sLoadingMsg;}if (sTimeoutMsg) {this.sLADTimeoutMessage = sTimeoutMsg;}};N2SimplePopover.prototype.show = function (oHotspot) {if (goN2U.isDefined(this.myCustomCallbacks['beforeShow'])) {;this.myCustomCallbacks['beforeShow'](this);}if (this.bIsTabTitled) {this.oCurHotspot = oHotspot.oLink;this.oCurTabTitle = this.oCurHotspot;if (this.oCurHotspot.id) {var eTab = goN2U.getElement(this.oCurHotspot.id + '_tab', true);if (eTab) {this.oCurTabTitle = eTab;}}}this._showPrepare(oHotspot);var sLinkID = oHotspot.sLinkID;var oLNI = new N2LinkNameInfo(sLinkID);var sID = oLNI.getID();var sType = oLNI.getType();var sParams = oLNI.getParams();var sHref = oHotspot.href;var sLinkText = oHotspot.linkText;var re = /([^\\])'/gi;sLinkText=sLinkText.replace(re, "$1\\'") ;;;this._hideTooltip(oHotspot.oLink);this.setCurrentThingData (null, sID, sType, sParams, sLinkID, sHref, sLinkText);this._showPopulate(null, sID, sType, sParams, sLinkID, sHref, sLinkText);this._showLocate(oHotspot);this.saveCurrentElementData();};N2SimplePopover.prototype._showPrepare = function (oHotspot) {this.initialMouseOver=true;this.initialUpdate=true;this.cursorCanLeavePopover = (oHotspot.staticFlag & 2);if (this.makeStatic) { this.makeStatic(oHotspot.staticFlag); }this.nLADRetries = this.nLADTimeoutMs/this.nLADRetryMs;this.bLADLoading = false;this.bWasLADDelayed = false;this._blurFormElements();if (goN2U.bIsSafari) {goN2U.show(this.myID);} else {goN2U.display(this.myID, 'inline');}this.bIsVisible = true;this.hookEvents();};N2SimplePopover.prototype._blurFormElements = function(){var aForms = document.getElementsByTagName('form');for (var i=0; i<aForms.length; i++){var oForm = aForms[i];for (var j=0; j<oForm.elements.length; j++){var oElem = oForm.elements[j];if ((oElem.id && oElem.id.substring(0,4) == '_po_' ) ||(oElem.name && oElem.name.substring(0,4) == '_po_') ){continue;}if (oElem.blur){oElem.blur();}}}}N2SimplePopover.prototype._showPopulate = function (sAction, sID, sType, sParams, sLinkID, sHref, sLinkText) {this.populate(sAction, sID, sType, sParams, sLinkID, sHref, sLinkText);};N2SimplePopover.prototype._showLocate = function (oHotspot) {if (goN2U.isDefined(this.displayPopoverDiv)) {this.displayPopoverDiv(true);}this.updateLocation(true);var oLocateHotspot = oHotspot;if (this.bIsTabTitled) {oLocateHotspot = new Object();oLocateHotspot.absleft = goN2U.getScrolledElementLeft(this.oCurTabTitle);oLocateHotspot.abstop = goN2U.getScrolledElementTop(this.oCurTabTitle);oLocateHotspot.width = goN2U.getElementWidth(this.oCurTabTitle);oLocateHotspot.height = goN2U.getElementHeight(this.oCurTabTitle);}this.locate(oLocateHotspot);goN2U.hide(this.myID);var eTitlebar = goN2U.getElement(this.myID + '_titleBar', true);if (eTitlebar) {goN2U.hide(eTitlebar); // kludge, since we don't HAVE a titlebar yet}this.hotLeft = oHotspot.absleft;this.hotTop = oHotspot.abstop;this.hotWidth = oHotspot.width;this.hotHeight = oHotspot.height;if (this.nAnimateOpen) {this._displayHotspotClickGrabber(oHotspot);var thisForClosure = this;fnDone = function() { thisForClosure._animateOpenDone(); }goN2U.animateBox(oHotspot.absleft, oHotspot.abstop, oHotspot.width, oHotspot.height,this.left, this.top, this.width, this.height,this.nAnimateOpen,fnDone,this.sAnimateOpenStyle );} else {this._animateOpenDone();}};N2SimplePopover.prototype._createHotspotClickGrabber = function() {var eGrabber = goN2U.getElement(N2SimplePopover.sClickGrabberID, true);if (!eGrabber) {eGrabber = document.createElement("a");if (eGrabber) {eGrabber.setAttribute("id", N2SimplePopover.sClickGrabberID);goN2U.setZIndex(eGrabber, 225); //FIXME: Hack -- animateBox style uses 220goN2U.display(eGrabber, "none");eGrabber.style.position = "absolute";goN2U.setBGColor(eGrabber, "transparent");document.body.insertBefore(eGrabber,document.body.firstChild);}}};N2SimplePopover.prototype._displayHotspotClickGrabber = function(oHotspot) {if (oHotspot.oLink && oHotspot.oLink.href) {var eGrabber = goN2U.getElement(N2SimplePopover.sClickGrabberID, true);if (eGrabber) {eGrabber.setAttribute("href", oHotspot.oLink.href);goN2U.setWidth(eGrabber, this.hotWidth);goN2U.setHeight(eGrabber, this.hotHeight);goN2U.shiftTo(eGrabber, this.hotLeft, this.hotTop);goN2U.display(eGrabber, "block");} else {;}}};N2SimplePopover.prototype._animateOpenDone = function() {goN2U.show(this.myID);var eTitlebar = goN2U.getElement(this.myID + '_titleBar', true);if (eTitlebar) {goN2U.show(eTitlebar);}var eConnector = goN2U.getElement(this.connID, true);if (eConnector) {goN2U.show(eConnector);}if (goN2U.isDefined(this.myCustomCallbacks['afterShow'])) {;this.myCustomCallbacks['afterShow'](this);}var eGrabber = goN2U.getElement(N2SimplePopover.sClickGrabberID, true);if (eGrabber) {goN2U.undisplay(eGrabber);}};N2SimplePopover.prototype.hide = function () {;if (goN2U.isDefined(this.myCustomCallbacks['beforeHide'])) {;if (!this.myCustomCallbacks['beforeHide'](this)) {;return;}}this.cursorCanLeavePopover = false;if (goN2U.bIsSafari) {goN2U.hide(this.myID);} else {goN2U.undisplay(this.myID);}if (this.staticTimer) {clearTimeout(this.staticTimer);this.staticTimer = null;}this.bIsVisible = false;goN2U.hide(this.connID);if (this.currentRequest && this.oUpdateManager) {this.oUpdateManager.cancelRequest(this.currentRequest);}if (this.myOnCloseCallback) {this.myOnCloseCallback(this);}this.unhookEvents();this.hideEx();if (this.bMoveHEContent && this.sCurrentContent && this.sCurrentHeID) {var eElem = goN2U.getRawObject(this.sCurrentHeID);if (eElem) {eElem.innerHTML = this.sCurrentContent;} else {;}this.sCurrentContent = '';}if (goN2U.isDefined(this.myCustomCallbacks['afterHide'])) {;this.myCustomCallbacks['afterHide'](this);}if (this.nAnimateClose) {goN2U.animateBox(this.left, this.top, this.width, this.height,this.hotLeft, this.hotTop, this.hotWidth, 1,this.nAnimateClose,null, this.sAnimateCloseStyle );}};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -