⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 n2corelibs-utilities-54559.js

📁 模拟amazon.com的窗口弹出效果,当鼠标移到图片上时弹出模拟的窗口
💻 JS
📖 第 1 页 / 共 4 页
字号:
goN2Locale.getString = function(id, sFallback){var oCfg = goN2U.getConfigurationObject('JSFStringTable');var str;if (id && oCfg){str = oCfg.getValue(id);}if (!str){;//goN2Debug.error('Untranslated string '+id+' ("'+sFallback+'") used (or string table not available)');return sFallback;}return str;}goN2Locale.getStrings = function(idsAndFallbacks){var oCfg = goN2U.getConfigurationObject('JSFStringTable');var trans = {};if (oCfg){var str;for (id in idsAndFallbacks){str = oCfg.getValue(id);if (str){trans[id] = str;}else{;trans[id] = idsAndFallbacks[id];}}}else{;}return trans;}goN2Locale.getImageURL = function(id, sFallback){var oCfg = goN2U.getConfigurationObject('JSFImageURL');if (oCfg){if (oCfg.getValue(id)){return oCfg.getValue(id);}else if (goN2U.isDefined(sFallback)){var fullPathFallback = window.gsN2ImageHost + sFallback;;return fullPathFallback;}else{;str = '';}}else{;//goN2Debug.error("JSF image table not available)");}return str;}goN2Locale.getImageURLs = function(idsAndFallbacks){var oCfg = goN2U.getConfigurationObject('JSFImageURL');var trans = {};if (oCfg){var url;for (id in idsAndFallbacks){url = oCfg.getValue(id);if (url){trans[id] = url;}else{var fullPathFallback = window.gsN2ImageHost + idsAndFallbacks[id];;//goN2Debug.error("Couldn't find image tag \"" + id + '"; falling back to ' + fullPathFallback + ')');trans[id] = fullPathFallback;}}}else{;}return trans;}if (typeof(HTMLElement) != 'undefined'){HTMLElement.prototype.insertAdjacentHTML = function(sWhere, sHTML){goN2U.insertAdjacentHTML(this, sWhere, sHTML);}}window.N2TextSizer=function(spanID) {var spanEl = document.createElement("span");if (spanEl) {spanEl.setAttribute("id",spanID, 0);document.body.appendChild(spanEl);goN2U.hide(spanID);this.span=spanEl;   // expects goN2Utility class to have been initializedthis.sID = spanID;this.style=null;}this.getStringWidth = function (txt, len) {;if (len) this.span.innerText = txt.substring(0, len);else this.span.innerText = txt;return goN2U.getElementWidth(this.sID);}this.setStyle = function (style) {if (style != this.style) {goN2U.setClass (this.span, style);this.style = style;}}this.truncateToWidth = function (txt, width) {var len = txt.length;var txtwidth = this.getStringWidth(txt);if (txtwidth >width) {var reqlen = Math.floor(width/txtwidth*len) - 3;var temptxt = txt.substring(0, reqlen);temptxt += '...';return temptxt;} else {return txt;}}this.setContent = function (cont) {this.span.innerHTML=cont;return goN2U.getElementWidth(this.span);}this.getWidth = function () {return goN2U.getElementWidth(this.span);}this.getHeight = function () {return goN2U.getElementHeight(this.span);}}window.N2FifoQueue=function(n) {var current = 0;var next = 0;var size = n ? n : 20;var q = new Array(n);this.add = function (item) {q[next] = item;next++;if (next == size) next = 0;q[next] = null;  // to ensure we don't have current go past}this.current = function () {return q[current];}this.next = function () {var val = null;if (q[current]) current++;  // don't advance past stop fenceif (current == size) current = 0;val = q[current];return val;}this.nextExists = function () {var val = null;var temp = current;if (q[temp]) temp++;   // don't advance past stop fenceif (temp == size) temp = 0;return q[temp] != null;}this.toString = function () {var txt = "Current: " + current + "\n";txt += "Next: " + next + "\n";for (i=0;i<size;i++) {txt += "["+i+"] = " + q[i];if (i == current) txt += " <-Current ";if (i == next) txt += " <-Next";txt +="\n";}return txt}}window.N2BrowseStack=function(n) {var current = -1;var size = n ? n : 20;var q = new Array(n);this.add = function (item) {current++;q[current] = item;q[current+1] = null;   // once we add a new item any past it are toast}this.reset = function () {current = -1;q[0] = null;q[1] = null;}this.previous = function (item) {if (current >0) return q[current-1];return null;}this.current = function () {return q[current];}this.next = function () {return q[current+1];}this.goBack = function () { if (current >0) current--; }this.goForward = function () { if (q[current+1]) current++; }this.toString = function () {var txt = "Current: " + current + "\n";for (i=0;i<=current;i++) {txt += "["+i+"] = " + q[i].id;if (i == current) txt += " <-Current ";txt +="\n";}return txt}}window.N2LinkNameInfo=function(sLinkID, sNameOverride) {if (sLinkID) {var oLink = goN2U.getElement(sLinkID);var sName = "";if (oLink) {sName = oLink.name;;}if (sNameOverride) {sName = sNameOverride;;}if (sName) {var tmpArray = sName.split("|");if (tmpArray.length >1) {this.sLinkID = sLinkID;this.sName = sName;this.sFeature  = tmpArray[0];this.sType = tmpArray[1];this.sID = tmpArray[2];this.sParams = tmpArray[3];for (var i = 4; !goN2U.isUndefined(tmpArray[i]); i++) {this.sParams = this.sParams + "|" + tmpArray[i];}}}} else {;}this.getLinkID  = function () { return this.sLinkID; }this.getLinkName= function () { return this.sName; }this.getFeature = function () { return this.sFeature; }this.getType    = function () { return this.sType; }this.getID      = function () { return this.sID; }this.getParams  = function () { return this.sParams; }}var gaN2HandlerChains = new Array();var gaN2HandlerRunFns = new Array();window.N2ChainEventHandler=function(sHandlerName, fFn, sComment) {sHandlerName = sHandlerName.toLowerCase();sComment = sComment ? sComment : 'unknown';;;if ( (typeof fFn != 'function') || fFn == null) return false;var aChain;if (!gaN2HandlerChains[sHandlerName]) {aChain = gaN2HandlerChains[sHandlerName] = new Array();} else {aChain =  gaN2HandlerChains[sHandlerName];}var oE = window;if (sHandlerName != 'onload' && sHandlerName != 'onresize' && sHandlerName != 'onerror') {oE = document.getElementsByTagName("body")[0];if (oE == null) {;return;}}if  (oE[sHandlerName])  {if (oE[sHandlerName] != gaN2HandlerRunFns[sHandlerName]) {aChain[0] = oE[sHandlerName];var fn = new Function ("evt", "evt = evt ? evt : window.event; _N2RunHandlers(evt, '"+sHandlerName+"');");gaN2HandlerRunFns[sHandlerName] = fn;oE[sHandlerName] = fn;}var len = aChain.length;;aChain[len] = fFn;} else {;oE[sHandlerName] = fFn;}return true;}function _N2RunHandlers( evt, sHandlerName ) {var aH = gaN2HandlerChains[sHandlerName];var len = aH.length;for (var i=0;i<len;i++) {aH[i](evt);}}N2ChainEventHandler('onload',function(){n2RunEvent('onload');n2RunEvent(gbN2Loaded ? 'onloadsuccess' : 'onloaderror');},'run onload events' );window.goN2Drag = {obj : null,normalizeEvent : function (evt) {evt = (evt) ? evt : ((window.event) ? window.event : null);if (evt) {if(!evt.target) {evt.target = evt.srcElement;}} else {;}return evt;},mouseDown : function(evt) {evt = goN2Drag.normalizeEvent(evt);if (evt) {var oE = goN2Drag.obj = evt.target;if (oE._n2bDraggable) {oE._n2SavedMouseMove = document.onmousemove;oE._n2SavedMouseUp = document.onmouseup;document.onmousemove = goN2Drag.mouseMove;document.onmouseup = goN2Drag.mouseUp;if (document.body && document.body.setCapture) {document.body.setCapture();;}var mouseDownX = (evt.clientX)? evt.clientX : evt.pageX;var mouseDownY = (evt.clientY)? evt.clientY : evt.pageY;oE.dragOffsetX = mouseDownX - ((oE.offsetLeft) ? oE.offsetLeft : oE.left);oE.dragOffsetY = mouseDownY - ((oE.offsetTop) ? oE.offsetTop : oE.top);oE.buttonIsDown = true;if (oE._oN2 && oE._oN2.mouseDown) {oE._oN2.onMouseDown(evt)}}}},mouseMove : function(evt) {evt = goN2Drag.normalizeEvent(evt);if (evt) {var oE = goN2Drag.obj;if (oE.buttonIsDown) {var nX = (evt.clientX)? evt.clientX : evt.pageX;nX -= oE.dragOffsetX;var nY = (evt.clientY)? evt.clientY : evt.pageY;nY -= oE.dragOffsetY;nX = Math.max(oE._n2nMinLeft, nX);nX = Math.min(oE._n2nMaxLeft, nX);nY = Math.max(oE._n2nMinTop, nY);nY = Math.min(oE._n2nMaxTop, nY);var bDoShift = true;if (oE._oN2 && oE._oN2.onMoved) {bDoShift = oE._oN2.onMoved(nX, nY);}if (bDoShift) {goN2U.shiftTo(oE, nX, nY);}}}},mouseUp : function(evt) {;evt = goN2Drag.normalizeEvent(evt);if (evt) {var oE = goN2Drag.obj;if (oE.buttonIsDown) {if (document.body && document.body.releaseCapture) {document.body.releaseCapture();;}oE.buttonIsDown = false;if (oE._oN2 && oE._oN2.onMouseUp) {oE._oN2.onMouseUp();}}document.onmousemove = oE._n2SavedMouseMove;document.onmouseup   = oE._n2SavedMouseUp;}},makeDraggable : function (sID, nMinLeft, nMaxLeft, nMinTop, nMaxTop) {var oE = goN2U.getElement(sID);if (oE) {oE["onmousedown"] = goN2Drag.mouseDown;oE._n2bDraggable = true;oE._n2nMinLeft = goN2U.isDefined(nMinLeft) ? nMinLeft : 0;oE._n2nMaxLeft = goN2U.isDefined(nMaxLeft) ? nMaxLeft : 10000;oE._n2nMinTop = goN2U.isDefined(nMinTop) ? nMinTop : 0;oE._n2nMaxTop = goN2U.isDefined(nMaxTop) ? nMaxTop : 10000;;} else {;}return oE;}}var goN2U = new N2Utilities();goN2U.initialize();n2RunThisWhen('onload',function() {if (!document.body) {alert("Error: Must initialize Utilities library in the body. (body not found)");return;}var sID = goN2U.sAnimationDivID = 'goN2UAnimatedBox';var o = document.createElement("div");if (o) {document.body.appendChild(o);o.setAttribute("id",sID, 0);goN2U.setClass(sID, 'animatedBox');} else {;}}, 'animate box creation' );if (window.goN2LibMon) goN2LibMon.endLoad('utilities');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -