📄 allcatepop_b.js
字号:
function n2SimplePopoverInitLibrary() { // Begin library code wrapper. Goes all the way to the bottom of the file
if (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 initialization
this.myMouseOutCallback=n2MouseOutFeature; // put here not in initialization
this.myOnCloseCallback=n2OverlayClosed; // put here not in initialization
this.myFeatureChangedCallback=n2OverlayChanged; // put here not in initialization
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.bLADSupported = true;
this.nLADTimeoutMs = 16000; // ms to wait
this.nLADRetryMs = 250; // ms delay between checks
this.sLADKey = null; // gaTD[key] exists
this.sLADField = null; // gaTD[<sID>].field or gaTD[key].field exists
this.sLADLoadingMessage = 'Loading...';
this.sLADTimeoutMessage = "Unable to obtain necessary information. Please try again later";
this.bMoveHEContent = true;
}
new N2SimplePopover();
N2SimplePopover.prototype.initialize = function (id, objectName, dataArrayName, populateMethod,
locateMethod, nHAdjust, nVAdjust) {
;
this.myID=id; // ID of HTML layer element
this.objectName=objectName; // JS Object name
if(dataArrayName) {
try {
this.aDataArray = eval(dataArrayName);
}
catch(e) {
;
}
}
this.sDataArrayName = dataArrayName; // JS Object name
;
this.popObj = this.createPopHTML(id, objectName, this.content);
this.popObj = goN2U.getRawObject(this.myID);
this.popObjStyle = goN2U.getObject(this.myID);
;
;
this._presetLocate(locateMethod, nHAdjust, nVAdjust);
};
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.getID = function() { return this.myID; };
N2SimplePopover.prototype.getObjectName = function() { return this.objectName; };
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.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) {
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;
window.focus();
goN2U.display(this.myID, 'inline');
this.bIsVisible = true;
this.hookEvents();
};
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) {
this.updateLocation(true);
this.locate(oHotspot);
if (this.nAnimateOpen) {
var eTitlebar = goN2U.getObject(this.myID + '_titleBar');
goN2U.hide(this.myID);
if (eTitlebar) { goN2U.hide(this.myID + '_titleBar'); } // 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;
goN2U.animateBox(oHotspot.absleft, oHotspot.abstop, oHotspot.width, oHotspot.height,
this.left, this.top, this.width, this.height,
this.nAnimateOpen,
eTitlebar ? new Function('','goN2U.show(\''+this.myID+'\'); goN2U.show(\'' + this.myID + '_titleBar\'); ' ) :
new Function('','goN2U.show(\''+this.myID+'\'); '),
this.sAnimateOpenStyle );
}
};
N2SimplePopover.prototype.hide = function () {
;
this.cursorCanLeavePopover = false;
goN2U.undisplay (this.myID);
if (this.staticTimer) {
clearTimeout(this.staticTimer);
this.staticTimer = null;
}
this.bIsVisible = false;
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 (this.nAnimateClose) {
goN2U.animateBox(this.left, this.top, this.width, this.height,
this.hotLeft, this.hotTop, this.hotWidth, 1,
this.nAnimateClose,
null, this.sAnimateCloseStyle );
}
};
N2SimplePopover.prototype.hideEx = function() {};
N2SimplePopover.prototype.setCurrentThingData = function (action, id, type, params, linkID, href, linkText) {
this.action = action;
this.thingID = id;
this.thingType = type;
this.thingParams = params;
this.linkID = linkID;
this.linkHref = href;
this.linkText = linkText;
this.sReftagHead='';
this.sReftagTail='';
if (href) {
;
var re = 'ref=([^_]*_[^_]*)(_[^\/]*)?';
var aResult = href.match(re);
if (aResult) {
;
this.sReftagHead = aResult[1];
this.sReftagTail = aResult[2];
}
}
};
N2SimplePopover.prototype.getReftagHead = function() { return this.sReftagHead; };
N2SimplePopover.prototype.getReftagTail = function() { return this.sReftagTail; };
N2SimplePopover.prototype.setContent = function (sHtml) {
sHtml = this.replacePlaceholders(sHtml);
this.popObj = goN2U.getRawObject(this.myID);
if (this.popObj === null) {
this.content = sHtml;
} else {
this.popObj.innerHTML = sHtml;
this.updateLocation(true);
}
};
N2SimplePopover.prototype.getContent = function () {
var sHtml;
this.popObj = goN2U.getRawObject(this.myID);
if (this.popObj === null) {
sHtml = this.content;
} else {
sHtml = this.popObj.innerHTML;
}
return sHtml;
};
N2SimplePopover.prototype.replacePlaceholders = function (sHtml) {
;
if (goN2U.isUndefOrNull(sHtml)) {
return '';
}
if ( sHtml.indexOf('{') == -1) { return sHtml; }
sHtml = sHtml.replace(/{REFTAG_HEAD}/g, this.getReftagHead());
sHtml = sHtml.replace(/{REFTAG_TAIL}/g, this.getReftagTail());
if (this.oUpdateManager) {
sHtml = sHtml.replace(/{SESSION_ID}/g, this.oUpdateManager.sessionID ? this.oUpdateManager.sessionID : '');
}
sHtml = sHtml.replace(/{POPOVER_ID}/g, this.myID);
return sHtml.replace(/{POPOVER_OBJECT}/g, this.objectName);
};
N2SimplePopover.prototype.getDataArray = function() { return this.aDataArray; };
N2SimplePopover.prototype.getPopoverElementID = function() { return this.myID; };
N2SimplePopover.prototype.isActive = function() { return this.bIsVisible; }; // we assume for now that if its visible, it IS active.
N2SimplePopover.prototype.isVisible = function() { return this.bIsVisible; };
N2SimplePopover.prototype.isStatic = function() { return this.cursorCanLeavePopover; };
N2SimplePopover.prototype._presetLocate = function (locateMethod, nHAdjust, nVAdjust) {
this.nHAdjust = nHAdjust ? nHAdjust : 0;
this.nVAdjust = nVAdjust ? nVAdjust : 0;
if (goN2U.isUndefined(locateMethod) || locateMethod == 'auto') {
this.locate = this._locateLinkAdjacent;
} else if (locateMethod == 'window_center' ) {
this.locate = this._locateWindowCenter;
} else if (locateMethod == 'below_above' ) {
this.locate = this._locateLinkBelowAbove;
} else if (locateMethod == 'left' ) {
this.locate = this._locateLinkLeft;
} else if (locateMethod == 'right' ) {
this.locate = this._locateLinkRight;
} else if (locateMethod == 'above' ) {
this.locate = this._locateAboveLink;
} else if (locateMethod == 'below' ) {
this.locate = this._locateBelowLink;
} else {
;
this.locate = this._locateLinkAdjacent;
}
return this.locate;
};
N2SimplePopover.prototype._locateLinkAdjacent = function (oHotspot) {
var popX;
var popY;
var bOverlapsHotspot = false;
if (oHotspot.availLeft < oHotspot.availRight ) {
this.expandsH ='r';
} else {
this.expandsH ='l';
}
if (this.expandsH == 'l') {
if (this.width + this.nHotPad < oHotspot.availLeft) {
popX = oHotspot.absleft - this.width - this.nHotPad;
} else {
popX = this.nEdgePad;
}
} else {
if (oHotspot.availRight > this.width) {
popX = oHotspot.absleft + oHotspot.width + this.nHotPad;
} else {
var nWindowWidth = goN2U.getInsideWindowWidth();
var nWindowRight = document.body.scrollLeft + nWindowWidth;
popX = nWindowRight - this.width - 6;
bOverlapsHotspot = true;
}
}
var totalAvailFromLinkTop = oHotspot.height + oHotspot.availUnder;
if (bOverlapsHotspot && this.height <= oHotspot.availUnder) {
popY = oHotspot.abstop + oHotspot.height + 2;
} else if (this.height <= totalAvailFromLinkTop) {
popY = oHotspot.availAbove > 0 ? oHotspot.abstop : oHotspot.abstop - oHotspot.availAbove;
} else {
popY = oHotspot.abstop - (this.height-totalAvailFromLinkTop+this.nEdgePad);
}
this._doLocate(popX, popY);
};
N2SimplePopover.prototype._doLocate = function (popX, popY) {
goN2U.shiftTo(this.myID, popX, popY);
this.updateLocation();
this.initialLeft = this.left;
this.initialTop = this.top;
;
};
N2SimplePopover.prototype._locateLinkRight = function (oHotspot) {
var popX = oHotspot.absleft + oHotspot.width;
var popY = oHotspot.abstop;
var nHAdj = this.nHAdjust;
var nVAdj = this.nVAdjust;
if (nVAdj == 'c') {
nVAdj = parseInt(oHotspot.height/2 - this.height/2);
} else if (nVAdj == 'b') {
nVAdj = oHotspot.height-this.height;
}
this._doLocate (popX + nHAdj, popY + nVAdj);
};
N2SimplePopover.prototype._locateLinkLeft = function (oHotspot) {
var popX = oHotspot.absleft - this.width;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -