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

📄 slide.js

📁 tarena电子月刊第一期,包括java开发、面试相关信息
💻 JS
📖 第 1 页 / 共 4 页
字号:
var imgMap=this.customImageMap;if(imgMap===undefined){imgMap=doc.createElement("map");var areas=[];areas.push(["getViewer().first()","17",getMessage("photoviewer.toolbar.first")]);areas.push(["getViewer().prev()","68",getMessage("photoviewer.toolbar.prev")]);areas.push(["getViewer().slideShow(true)","122",getMessage("photoviewer.toolbar.slideShow")]);areas.push(["getViewer().next()","175",getMessage("photoviewer.toolbar.next")]);areas.push(["getViewer().last()","227",getMessage("photoviewer.toolbar.last")]);if(this.enableEmailLink)areas.push(["getViewer().email()","300",getMessage("photoviewer.toolbar.email")]);if(this.enablePhotoLink)areas.push(["getViewer().permalink()","350",getMessage("photoviewer.toolbar.permalink")]);areas.push(["getViewer().close()","402",getMessage("photoviewer.toolbar.close")]);for(i=0;i<areas.length;i++){var area=doc.createElement("area");area.href="javascript:void(0)";area.alt=areas[i][2];area.title=area.alt;area.shape="circle";area.coords=areas[i][1]+", 21, 22";area.onclick=buildAreaMapClosure(areas[i][0]);imgMap.appendChild(area);}}imgMap.name=VIEWER_ID_TOOLBAR_MAP;imgMap.id=VIEWER_ID_TOOLBAR_MAP;var img=doc.createElement("img");img.id=VIEWER_ID_TOOLBAR_IMG;img.src=P_IMG_ROOT+"/"+TOOLBAR_IMG;img.width=TOOLBAR_IMG_W;img.height=TOOLBAR_IMG_H;img.style.border="none";img.style.background="none";if(STRICT_MODE){img.style.margin="4px 0px 0px 0px";}else{img.style.margin="4px";}img.useMap="#"+VIEWER_ID_TOOLBAR_MAP;photoToolbar.appendChild(imgMap);photoToolbar.appendChild(img);if(isHosted()){var ttLink=doc.createElement("a");ttLink.style.position="absolute";ttLink.style.bottom="0px";ttLink.style.right="0px";ttLink.style.width="25px";ttLink.style.height="25px";ttLink.style.background="none";ttLink.alt="TripTracker.net";ttLink.title=ttLink.alt;ttLink.cursor=ttLink.alt;ttLink.href=TOOLBAR_LINK;ttLink.target="_new";ttLink.alt="TripTracker Slideshow";ttLink.title=ttLink.alt;photoToolbar.appendChild(ttLink);}var loadingIcon=doc.createElement("img");loadingIcon.id=VIEWER_ID_LOADING;loadingIcon.width=16;loadingIcon.height=16;loadingIcon.style.display="none";loadingIcon.style.position="absolute";loadingIcon.style.left=(TOOLBAR_IMG_LOADING_LEFT-8)+"px";loadingIcon.style.top=(TOOLBAR_IMG_LOADING_TOP-8)+"px";loadingIcon.src=P_IMG_ROOT+"/"+TOOLBAR_IMG_LOADING;loadingIcon.style.border="none";loadingIcon.style.background="none";photoToolbar.appendChild(loadingIcon);photoToolbar.appendChild(doc.createElement("br"));var photoTime=doc.createElement("span");photoTime.id=VIEWER_ID_TIME;if(!this.overrideToolbarStyles){photoTime.position="relative";photoTime.style.color=TOOLBAR_FONT_COLOR;photoTime.style.fontFamily=TOOLBAR_FONT_STYLE;photoTime.style.fontSize=this.fontSize+"px";if(STRICT_MODE){photoTime.style.lineHeight=this.fontSize+"px";}if(this.font!=undefined){photoTime.style.font=this.font;}photoTime.style.cssFloat="none";photoTime.style.textAlign="right";photoTime.style.padding="0px 10px";}photoTime.appendChild(doc.createTextNode(" "));photoToolbar.appendChild(photoTime);var photoTitle=doc.createElement("span");photoTitle.id=VIEWER_ID_TITLE;if(!this.overrideToolbarStyles){photoTitle.position="relative";photoTitle.style.color=TOOLBAR_FONT_COLOR;photoTitle.style.fontFamily=TOOLBAR_FONT_STYLE;photoTitle.style.fontSize=this.fontSize+"px";if(STRICT_MODE){photoTitle.style.lineHeight=this.fontSize+"px";}if(this.font!=undefined){photoTitle.style.font=this.font;}photoTitle.style.cssFloat="none";photoTitle.style.textAlign="left";photoTitle.style.paddingRight="20px";}photoTitle.appendChild(doc.createTextNode(" "));photoToolbar.appendChild(photoTitle);doc.body.appendChild(photoToolbar);}function addByLine(zIndex){var doc=this.win.document;if(doc.getElementById(VIEWER_ID_BYLINE)!=undefined)return;var photoByline=doc.createElement("div");photoByline.appendChild(doc.createTextNode(""));photoByline.style.color=BYLINE_FONT_COLOR;photoByline.style.fontFamily=BYLINE_FONT_STYLE;photoByline.style.fontSize=this.fontSize+"px";if(this.font!=undefined){photoByline.style.font=this.font;}photoByline.id=VIEWER_ID_BYLINE;photoByline.style.position="absolute";photoByline.style.right=BYLINE_POSITION_RIGHT+"px";photoByline.style.bottom=BYLINE_POSITION_BOTTOM+"px";photoByline.style.zIndex=zIndex+1;photoByline.appendChild(doc.createTextNode(" "));doc.body.appendChild(photoByline);}function buildAreaMapClosure(func){return function(event){eval(func);blurElement(event);return false;};}function blurElement(event){var target=getEventTarget(getEvent(event));if(target!=undefined)target.blur();}function setToolbarImage(img){var doc=this.win.document;var elt=doc.getElementById(VIEWER_ID_TOOLBAR_IMG);if(elt!=undefined)elt.src=img;}function setShowToolbar(doShow){this.showToolbar=doShow;}function addCaptions(){var photo=this.photos[this.index];var doc=this.win.document;var photoTime=doc.getElementById(VIEWER_ID_TIME);var photoTitle=doc.getElementById(VIEWER_ID_TITLE);var time=(this.index+1)+"/"+this.photos.length;if(photo.time!=undefined){time+=" ["+photo.time+"]";}photoTime.firstChild.nodeValue=time;var title=(photo.title!=undefined?photo.title:"");photoTitle.title="";photoTitle.alt="";if(title.length>TITLE_MAX_LENGTH){photoTitle.title=title;photoTitle.alt=title;title=title.substring(0,TITLE_MAX_LENGTH)+" ...";}if(title.indexOf("\n")!==0){title=title.replace("\n","<br />");photoTitle.innerHTML=title;}else{photoTitle.nodeValue=title;}}function addBylineCaption(){var photo=this.photos[this.index];var doc=this.win.document;var photoByline=doc.getElementById(VIEWER_ID_BYLINE);if(photo.byline!=undefined&&photo.byline.length>0){photoByline.firstChild.nodeValue=photo.byline;}else{photoByline.firstChild.nodeValue="";}}function setCloseCallback(callback){this.closeCallback=callback;}function setShowCallback(callback){this.showCallback=callback;}function setEndCallback(callback){this.endCallback=callback;}function emailPhoto(){var photo=this.photos[this.index];var doc=this.win.document;var title=(photo.title!=undefined?photo.title:getMessage("photoviewer.email.subject.photo"));var mailtoLink="mailto:?subject="+title+"&body="+getPhotoURL(photo.src);doc.location.href=mailtoLink;}function getPhotoURL(url){var loc=document.location;if(/\w+:\/\/.+/.test(url)){return url;}else if(url.indexOf("/")===0){return loc.protocol+"//"+loc.host+url;}else{var path=loc.pathname;var pos=path.lastIndexOf("/");if(pos!=-1){path=path.substring(0,pos);}return loc.protocol+"//"+loc.host+path+"/"+url;}}function linkPhoto(){var photo=this.photos[this.index];window.open(photo.src);}function favoritePhoto(){var photo=this.photos[this.index];var doc=this.win.document;var restURL=REST_URL+"markfeatured?id"+photo.id;try{var res=getResponse(restURL,false,true);}catch(e){return;}}function hideOverlappingElements(node){if(node==undefined){node=this.win.document.body;this.hideOverlappingElements(node);return;}if(node.style!=undefined&&node.style.visibility!="hidden"){var nodeName=node.nodeName.toLowerCase();if((node.className!=undefined&&node.className.indexOf("SlideshowDoHide")!=-1)||((IE||FIREFOX)&&(nodeName=="select"||nodeName=="object"||nodeName=="embed"))){node.style.visibility="hidden";if(this.hiddenElements==undefined)this.hiddenElements=[];this.hiddenElements.push(node);}}if(node.childNodes!=undefined){var i;for(i=0;i<node.childNodes.length;i++){this.hideOverlappingElements(node.childNodes[i]);}}}function showOverlappingElements(){var i;if(this.hiddenElements!=undefined){for(i=0;i<this.hiddenElements.length;i++){this.hiddenElements[i].style.visibility="visible";}this.hiddenElements=[];}}function viewerHandleKey(event){if(typeof getViewer=='undefined'||!getViewer)return true;var viewer=getViewer();if(viewer==undefined||!viewer.shown)return true;event=getEvent(event);if(event.ctrlKey||event.altKey)return true;var keyCode=event.keyCode;switch(keyCode){case 37:case 38:viewer.prev();break;case 39:case 40:viewer.next();break;case 33:viewer.prev(10);break;case 34:viewer.next(10);break;case 36:viewer.first();break;case 35:viewer.last();break;case 32:case 13:viewer.slideShow(true);break;case 27:viewer.close();break;default:return true;}preventDefault(event);return false;}function flickrHack(viewer,index){if(viewer.photos[index]!=undefined){var preloadPhoto=viewer.photos[index].preloadImage;if(preloadPhoto!=undefined&&preloadPhoto.width==500&&preloadPhoto.height==375){var flickrRE=/.+static\.flickr\.com.+_b\.jpg/;if(flickrRE.test(preloadPhoto.src)){viewer.photos[index].src=viewer.photos[index].src.replace(/_b\.jpg/,"_o.jpg");return true;}}}return false;}function findPhotosTT(viewer,node){var i;if(node.nodeName.toLowerCase()=="a"){var onclick=node.getAttribute("onclick");if(onclick==undefined){onclick=node.onclick;}if(onclick!=undefined&&new String(onclick).indexOf("popupImg")!=-1){var popupRE=/.*popupImg\((.+?),(.+?),(.+?)\).*/;if(popupRE.test(onclick)){var url,w,h;if(node.photoUrl!=undefined){url=node.photoUrl;w=node.photoW;h=node.photoH;}else{url=RegExp.$1;if(url.charAt(0)=="'"&&url.charAt(url.length-1)=="'")url=url.substring(1,url.length-1);w=parseInt(RegExp.$2);h=parseInt(RegExp.$3);}var photo=new PhotoImg(undefined,url,w,h);var found=false;for(i=0;i<viewer.photos.length;i++){if(viewer.photos[i].src==photo.src){found=true;break;}}if(!found)viewer.add(photo);}}}if(node.childNodes!=undefined){for(i=0;i<node.childNodes.length;i++){findPhotosTT(viewer,node.childNodes[i]);}}}var defaultViewer=undefined;function popupImg(url,w,h,backColor,showToolbar){var i;if(defaultViewer==undefined)defaultViewer=new PhotoViewer();else{defaultViewer.photos=[];defaultViewer.index=0;}if(backColor!=undefined)defaultViewer.setBackground(backColor,backColor,false);if(showToolbar==undefined||showToolbar){findPhotosTT(defaultViewer,window.document.body);for(i=0;i<defaultViewer.photos.length;i++){if(defaultViewer.photos[i].src==url){defaultViewer.show(i);}}}if(defaultViewer.photos===undefined||defaultViewer.photos.length===0){defaultViewer.setShowToolbar(false);defaultViewer.add(new PhotoImg(undefined,url,w,h));defaultViewer.show();}return false;}function onClickEvent(){var v=getViewer();if(v.contextMenu!=undefined&&v.contextMenu.visible){v.contextMenu.hide();return;}if(v.toolbarAnimator!=undefined)v.toolbarAnimator.reset();if(v.customOnClickEvent!=undefined)v.customOnClickEvent();elsecloseViewer();}function onContextMenuEvent(e){var v=getViewer();var event=getEvent(e);if(v.contextMenu==undefined&&v.customOnRightclickEvent==undefined){return true;}event.cancelBubble=true;if(v.customOnRightclickEvent!=undefined)v.customOnRightclickEvent(e);if(v.contextMenu!=undefined&&(!v.slideShowRunning||v.slideShowPaused))v.contextMenu.show(getMousePosition(e));return false;}function setupFragmentIdentifierModePhotoViewer(iframeLocation,iframename,viewerJSONArray){var viewer=new PhotoViewer();viewer.origRootLocation=document.location.href;viewer.origIFrameLocation=iframeLocation;viewer.iframename=iframename;viewer.setCloseCallback(viewer.setStopFragmentIdentifier);for(var i=0;i<viewerJSONArray.length;i++){viewer.add(viewerJSONArray[i].url,viewerJSONArray[i].title,viewerJSONArray[i].date,viewerJSONArray[i].byline);}window.frames[viewer.iframename].location=viewer.origIFrameLocation+"#"+viewer.origRootLocation;viewer.checkStartFragmentIdentifier();}function checkStartFragmentIdentifier(){var href=document.location.href;if(href.indexOf("#startphoto=")==-1){window.setTimeout(checkStartFragmentIdentifier,500);}else{var startPhoto=parseInt(href.substring(href.lastIndexOf("=")+1));var viewer=getViewer();if(viewer.origRootLocation.indexOf("#")==-1)viewer.origRootLocation+="#";if(FIREFOX){window.history.back();}else{document.location.href=viewer.origRootLocation;}viewer.show(startPhoto);}}function setStopFragmentIdentifier(index){window.frames[getViewer().iframename].location=this.origIFrameLocation+"#stopphoto="+index;checkStartFragmentIdentifier();}function setStartFragmentIdentifier(index){var rootWin=getRootWindow();if(this.origIFrameLocation==undefined)this.origIFrameLocation=rootWin.location.href.substring(0,rootWin.location.href.indexOf("#"));if(this.origRootLocation==undefined)this.origRootLocation=rootWin.location.href.substring(rootWin.location.href.indexOf("#")+1);this.checkStopFragmentIdentifier();var frIdentifier="#startphoto="+index;rootWin.parent.location=this.origRootLocation+frIdentifier;}function checkStopFragmentIdentifier(){var href=getRootWindow().location.href;if(href.indexOf("#stopphoto")==-1){window.setTimeout(checkStopFragmentIdentifier,500);}else{var viewer=getViewer();var index=href.substring(href.lastIndexOf("=")+1);if(viewer.origIFrameLocation.indexOf("#")==-1)viewer.origIFrameLocation+="#";if(FIREFOX){window.history.back();}else{getRootWindow().location.href=viewer.origIFrameLocation;}viewerCloseCallback(index);}}function ToolbarAnimator(viewer){this.viewer=viewer;}ToolbarAnimator.prototype.initialize=function(){var _this=this;var backDiv=findDOMElement(VIEWER_ID_BACK);var frontDiv=findDOMElement(VIEWER_ID_PHOTO);var toolbar=findDOMElement(VIEWER_ID_TOOLBAR);if(backDiv!=undefined&&frontDiv!=undefined&&toolbar!=undefined){var func=function(){_this.mouseAction();};backDiv.onmousemove=func;frontDiv.onmousemove=func;toolbar.onmousemove=func;toolbar.onclick=func;this.initialized=true;}};ToolbarAnimator.prototype.reset=function(){this.stop();var backDiv=findDOMElement(VIEWER_ID_BACK);var frontDiv=findDOMElement(VIEWER_ID_PHOTO);var toolbar=findDOMElement(VIEWER_ID_TOOLBAR);if(backDiv!=undefined&&frontDiv!=undefined&&toolbar!=undefined){backDiv.onmousemove=null;frontDiv.onmousemove=null;toolbar.onmousemove=null;toolbar.onclick=null;}this.initialized=false;};ToolbarAnimator.prototype.stop=function(){var _this=this;if(this.hiderID!=undefined){window.clearTimeout(this.hiderID);this.hiderID=undefined;}if(this.hidden){this.showToolbar();}};ToolbarAnimator.prototype.mouseAction=function(){this.stop();};ToolbarAnimator.prototype.slideshowAction=function(){var _this=this;if(this.viewer.slideShowRunning&&!this.viewer.slideShowPaused&&this.hiderID==undefined){if(!this.initialized){this.initialize();}this.hiderID=window.setTimeout(function(){_this.hideToolbar();},5000);}else if(this.viewer.slideShowPaused){this.reset();}};ToolbarAnimator.prototype.hideToolbar=function(){var _this=this;var toolbar=findDOMElement(VIEWER_ID_TOOLBAR);if(toolbar==undefined){return;}var opacity=toolbar.style.KhtmlOpacity;if(opacity==undefined){opacity=toolbar.style.opacity;}if(opacity===0){toolbar.style.display="none";return;}opacity=opacity-0.05;setOpacity(toolbar,opacity>0?opacity:0);this.hidden=true;this.hiderID=window.setTimeout(function(){_this.hideToolbar();},100);};ToolbarAnimator.prototype.showToolbar=function(){var toolbar=findDOMElement(VIEWER_ID_TOOLBAR);if(toolbar!=undefined){toolbar.style.display="block";setOpacity(toolbar,TOOLBAR_OPACITY);}this.hidden=false;};function addContextMenu(contextMenu){if(isHosted()||getViewer().contextMenu!=undefined){return;}this.contextMenu=contextMenu;this.contextMenu.initialize();}function PhotoViewerCtxMenuItem(text,callback){this.text=text;this.callback=callback;}function PhotoViewerCtxMenu(cssClass){this.cssClass=cssClass;this.items=[];this.ctxSubMenus=[];}PhotoViewerCtxMenu.prototype.mouseover=function(e){var viewer=getViewer();var ctxMenu=viewer.contextMenu;if(!ctxMenu.visible){return;}for(var i=0;i<ctxMenu.ctxSubMenus.length;i++){ctxMenu.ctxSubMenus[i].style.visibility="hidden";}var subMenuId=this.id+"_sub";var subMenu=document.getElementById(subMenuId);var menuDiv=this.parentNode.parentNode;var mouseLoc=getMousePosition(e);var itemLoc=getDOMLocation(this);var menuLoc=getDOMLocation(menuDiv);if(subMenu&&menuDiv){subMenu.style.left=(menuLoc.x+menuDiv.clientWidth)+"px";subMenu.style.top=itemLoc.y+"px";subMenu.style.visibility="visible";}};PhotoViewerCtxMenu.prototype.mouseclick=function(e){var viewer=getViewer();var menu=viewer.contextMenu;var menuItem=undefined;for(var i=0;i<menu.items.length;i++){if(menu.items[i].DOMElement==this){menuItem=menu.items[i];break;}var itemFound=false;if(menu.items[i].subitems==undefined){continue;}for(var j=0;j<menu.items[i].subitems.length;j++){if(menu.items[i].subitems[j].DOMElement.id===this.id){menuItem=menu.items[i].subitems[j];itemFound=true;break;}}if(itemFound){break;}}if(menuItem!=undefined&&menuItem.callback!=undefined){viewer.contextMenu.hide();menuItem.callback(viewer.photos[viewer.index].src,e);}};PhotoViewerCtxMenu.prototype.add=function(item,subitems){item.subitems=subitems;this.items.push(item);};PhotoViewerCtxMenu.prototype.initialize=function(){var viewer=getViewer();var doc=viewer.win.document;this.createMenu(doc,viewer);this.initialized=true;};PhotoViewerCtxMenu.prototype.createMenu=function(doc,viewer){var ctxMenuDiv=doc.createElement("div");ctxMenuDiv.id=VIEWER_ID_CTXMENU;ctxMenuDiv.style.visibility="hidden";ctxMenuDiv.style.position="absolute";ctxMenuDiv.style.zIndex=999999;var ctxMenu=doc.createElement("ul");for(var i=0;i<this.items.length;i++){var ctxMenuItem=doc.createElement("li");ctxMenuItem.appendChild(doc.createTextNode(this.items[i].text));ctxMenuItem.onclick=this.mouseclick;ctxMenuItem.id=VIEWER_ID_CTXMENU+"_"+i;ctxMenuItem.onmouseover=this.mouseover;this.items[i].DOMElement=ctxMenuItem;ctxMenu.appendChild(ctxMenuItem);if(this.items[i].subitems!=undefined){ctxMenuItem.className="ctxmenu_expanded";var submenuid=ctxMenuItem.id+"_sub";this.createSubMenu(doc,viewer,this.items[i].subitems,submenuid);}}ctxMenuDiv.appendChild(ctxMenu);ctxMenuDiv.className=this.cssClass;doc.body.appendChild(ctxMenuDiv);this.ctxMenuDOM=ctxMenuDiv;};PhotoViewerCtxMenu.prototype.createSubMenu=function(doc,viewer,subitems,id){var ctxSubMenuDiv=doc.createElement("div");ctxSubMenuDiv.id=id;ctxSubMenuDiv.style.visibility="hidden";ctxSubMenuDiv.style.position="absolute";ctxSubMenuDiv.style.zIndex=999999;var ctxSubMenu=doc.createElement("ul");for(var i=0;i<subitems.length;i++){var ctxSubMenuItem=doc.createElement("li");ctxSubMenuItem.id=id+"_"+i;ctxSubMenuItem.appendChild(doc.createTextNode(subitems[i].text));ctxSubMenuItem.onclick=this.mouseclick;subitems[i].DOMElement=ctxSubMenuItem;ctxSubMenu.appendChild(ctxSubMenuItem);}ctxSubMenuDiv.appendChild(ctxSubMenu);ctxSubMenuDiv.className=this.cssClass;doc.body.appendChild(ctxSubMenuDiv);this.ctxSubMenus.push(ctxSubMenuDiv);};PhotoViewerCtxMenu.prototype.show=function(loc){if(!this.initialized){this.initialize();}for(var i=0;i<this.ctxSubMenus.length;i++){this.ctxSubMenus[i].style.visibility="hidden";}this.ctxMenuDOM.style.left=loc.x+"px";this.ctxMenuDOM.style.top=loc.y+"px";this.ctxMenuDOM.style.visibility="visible";this.visible=true;};PhotoViewerCtxMenu.prototype.hide=function(){this.ctxMenuDOM.style.visibility="hidden";for(var i=0;i<this.ctxSubMenus.length;i++){this.ctxSubMenus[i].style.visibility="hidden";}this.visible=false;};

⌨️ 快捷键说明

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