📄 n2corelibs-simplepopover-41238.js
字号:
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 {var innerObj = this.popObj;if (this.sBorderStyle == 'rounded') {innerObj = goN2U.getRawObject(this.myID + '_InnerX');}innerObj.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 {var innerObj = this.popObj;if (this.sBorderStyle == 'rounded') {innerObj = goN2U.getRawObject(this.myID + '_InnerX');}sHtml = innerObj.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._makePopoverStatic = function(bMakeStatic) {if (bMakeStatic == true){this.cursorCanLeavePopover = true;} else if (bMakeStatic == false) {this.cursorCanLeavePopover = false;if (this.isParent()) {var oActiveFeatureInstance = this._getActiveWrappedFeatureInstance(this.regFeatureID);var oActiveChildFeatureInstance = this._getActiveWrappedFeatureInstance(this.childPopFeatureID);if (oActiveFeatureInstance) {oActiveFeatureInstance.setMouseIn(true);}if (oActiveChildFeatureInstance) {oActiveChildFeatureInstance.setMouseIn(true);}}goN2Events.validateState();}}N2SimplePopover.prototype._getRelatedWrappedFeature = function (sFeatureID) {var oWrappedFeature = null;var oRegFeature = goN2Events.lookupRegFeature(sFeatureID);if (oRegFeature){var oFeature = oRegFeature.getFeature();oWrappedFeature = oFeature.getWrappedFeatureObj();}return oWrappedFeature;};N2SimplePopover.prototype._getActiveWrappedFeatureInstance = function (sFeatureID) {var oActiveFeatureInstance = null;var oRegFeature = goN2Events.lookupRegFeature(sFeatureID);var oFeature = oRegFeature.getFeature();oActiveFeatureInstance = oFeature.getActiveWrappedFInstance();return oActiveFeatureInstance;};N2SimplePopover.prototype.getChildPopover = function() { return this._getRelatedWrappedFeature(this.childPopFeatureID); }N2SimplePopover.prototype.getParentPopover = function() { return this._getRelatedWrappedFeature(this.parentPopFeatureID); }N2SimplePopover.prototype.isParent = function() { return (this.childPopFeatureID)? true : false; }N2SimplePopover.prototype.isChild = function() { return (this.parentPopFeatureID)? true : false; }N2SimplePopover.prototype.getRegFeatureID = function() { return (this.regFeatureID)? true : false; }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.locateAt = function (sLocateMethodID, nHAdjust, nVAdjust) {this._presetLocate(sLocateMethodID, nHAdjust, nVAdjust);}N2SimplePopover.prototype._presetLocate = function (sLocateMethodID, nHAdjust, nVAdjust) {this.nHAdjust = nHAdjust ? nHAdjust : 0;this.nVAdjust = nVAdjust ? nVAdjust : 0;if (goN2U.isUndefined(sLocateMethodID) || sLocateMethodID == 'auto') {this.locate = this._locateLinkAdjacent;} else if (sLocateMethodID == 'window_center' ) {this.locate = this._locateWindowCenter;} else if (sLocateMethodID == 'below_above' ) {this.locate = this._locateLinkBelowAbove;} else if (sLocateMethodID == 'topleft' ) {this.locate = this._locateLinkTopLeft;} else if (sLocateMethodID == 'left' ) {this.locate = this._locateLinkLeft;} else if (sLocateMethodID == 'right' ) {this.locate = this._locateLinkRight;} else if (sLocateMethodID == 'above' ) {this.locate = this._locateAboveLink;} else if (sLocateMethodID == '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 = goN2U.getScrollLeft() + 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;;if (window.goN2Debug){var ePop = goN2U.getElement(this.myID);;;;;}};N2SimplePopover.prototype._locateLinkTopLeft = function (oHotspot) {var popX = oHotspot.absleft;var popY = oHotspot.abstop;var nHAdj = this.nHAdjust;var nVAdj = this.nVAdjust;if (nVAdj == 'c') {nVAdj = parseInt(oHotspot.height/2);}if (nHAdj == 'c') {nHAdj = parseInt(oHotspot.width/2);}this._doLocate (popX + nHAdj, popY + nVAdj);};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;}var popLeft = popX + nHAdj;this._doLocate (popLeft, popY + nVAdj);if (this.bIsTabTitled && this.connID) {var connLeft = Math.min(oHotspot.absleft + oHotspot.width - 1, popLeft - 1);var eConn = goN2U.getElement(this.connID, true);eConn.style.left = connLeft;eConn.style.top = oHotspot.abstop;eConn.style.width = (popLeft - connLeft) + 7;eConn.style.height = oHotspot.height;}};N2SimplePopover.prototype._locateLinkLeft = function (oHotspot) {var popX = oHotspot.absleft - this.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, Math.max(popY + nVAdj, 4));};N2SimplePopover.prototype._locateBelowLink = function (oHotspot) {var popX = oHotspot.absleft;var popY = oHotspot.abstop + oHotspot.height;var nHAdj = this.nHAdjust;var nVAdj = this.nVAdjust;if (nHAdj == 'c') {nHAdj = parseInt(oHotspot.width/2 - this.width/2);} else if (nHAdj == 'r') {nHAdj = oHotspot.width-this.width;}var popTop = popY + nVAdj;this._doLocate (Math.max(popX + nHAdj, 4), popTop);if (this.bIsTabTitled && this.connID) {var connTop = Math.min(oHotspot.abstop + oHotspot.height - 1, popTop - 1);var eConn = goN2U.getElement(this.connID, true);eConn.style.left = oHotspot.absleft;eConn.style.width = oHotspot.width;eConn.style.top = connTop;eConn.style.height = (popTop - connTop) + 7;}};N2SimplePopover.prototype._locateAboveLink = function (oHotspot) {var popX = oHotspot.absleft;var popY = oHotspot.abstop - this.height;var nHAdj = this.nHAdjust;var nVAdj = this.nVAdjust;if (nHAdj == 'c') {nHAdj = parseInt(oHotspot.width/2 - this.width/2);} else if (nHAdj == 'r') {nHAdj = oHotspot.width-this.width;}this._doLocate (Math.max(popX + nHAdj, 4), popY + nVAdj);};N2SimplePopover.prototype._locateLinkBelowAbove = function (oHotspot) {var popX;var popY;var nXOffset = 100;var nXOffsetL = 20;var totalAvailFromLinkLeft = oHotspot.availRight + oHotspot.width;if (this.width < (totalAvailFromLinkLeft - nXOffset) ) {this.expandsH ='r';} else {this.expandsH ='l';}this.availDown = oHotspot.availUnder + oHotspot.height;this.availUp = oHotspot.availAbove;if (this.availUp < this.availDown - this.height ) {this.expandsV = 'd';} else {this.expandsV = 'u';}if (this.expandsH == 'l') {if (this.width + this.nHotPad < oHotspot.availLeft) {popX = oHotspot.absleft - this.width - this.nHotPad + nXOffsetL;} else {popX = this.nEdgePad;}} else {if (oHotspot.width >120) {popX = oHotspot.absleft + nXOffset;} else {popX = oHotspot.absleft + oHotspot.width - nXOffsetL;}}var totalAvailFromLinkTop = oHotspot.height + oHotspot.availUnder;if (this.height <= oHotspot.availUnder) {popY = oHotspot.abstop + oHotspot.height + this.nHotPad;} else {popY = oHotspot.abstop - (this.height-totalAvailFromLinkTop+this.nEdgePad);if (oHotspot.width < 120) {if (this.expandsH == 'r') {popX = oHotspot.absleft + oHotspot.width + this.nHotPad;} else {popX = oHotspot.absleft - this.width - this.nHotPad;}}}this._doLocate(popX, popY);};N2SimplePopover.prototype._locateWindowCenter = function (oHotspot) {var popX = Math.max(goN2U.getScrollLeft()+((goN2U.getInsideWindowWidth()-this.width)/2), this.nEdgePad);var popY = Math.max(goN2U.getScrollTop()+((goN2U.getInsideWindowHeight()-this.height)/2), this.nEdgePad);this._doLocate(popX, popY);};N2SimplePopover.prototype.createPopHTML = function (id, objectID, content) {var gp = '';var zOrder = 200;if (this.nPopLevel != null) {zOrder += (this.nPopLevel * 20) ;}if (this.sBorderStyle == 'rounded') {gp+='<span id="' + id + '" class="n2PopRounded" style="display:inline; z-index:' + zOrder + ' ; visibility:hidden; left:0px; top:0px;"';gp+='onMouseOver="' + objectID + '.mouseOver();" onMouseOut="' + objectID + '.mouseOut(event);"';gp+='onMouseMove="' + objectID + '.mouseMove(event);">';gp+='<table border="0" cellpadding="0" cellspacing="0"><tr>' +'<td><img src="' + this.oBorderImg['tl'] + '"></td>';gp+='<td background="' + this.oBorderImg['t'] + '"><img src="' + this.sTransImg + '"></td>';gp+='<td><img src="' + this.oBorderImg['tr'] + '"></td></tr>' +'<tr><td background="' + this.oBorderImg['l'] + '"><img src="' + this.sTransImg + '"></td>' +'<td><div id="' + id + '_InnerX" style="clear:both">';if (content) {gp+=content;} else {gp+='-- CONTENT GOES HERE (simple)--';}gp+='</div></td><td background="' + this.oBorderImg['r'] + '"><img src="' + this.sTransImg + '"></td></tr>' +'<tr><td><img src="' + this.oBorderImg['bl'] + '"></td>' +'<td background="' + this.oBorderImg['b'] + '"><img src="' + this.sTransImg + '"></td>' +'<td><img src="' + this.oBorderImg['br'] + '"></td></tr></table>';gp+='</span>';} else {gp+='<span id="' + id + '" class="';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -