Init commit. Added under construction banner for all pages.

This commit is contained in:
2020-02-23 12:36:42 +01:00
parent 0f9cd0c2bc
commit 234bb6f255
425 changed files with 15994 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
div.com-apple-iweb-widget-detailview img.canvas {
border: none;
vertical-align: middle;
position: relative;
top: -3px;
width: 19px;
height: 25px;
}
div.com-apple-iweb-widget-detailview div.thumbnail_view {
position: relative;
width: 100%;
height: 0px;
overflow: hidden;
}
div.com-apple-iweb-widget-detailview div.thumbnails_wrapper {
position: relative;
width: 100%;
height: 56px;
overflow: hidden;
}
div.com-apple-iweb-widget-detailview div.thumbnails {
position: absolute;
left: 0px;
width: 999999px;
height: inherit;
}
div.com-apple-iweb-widget-detailview div.thumbnail {
float: left;
width: 56px;
height: 56px;
margin-right: 3px;
overflow: hidden;
}
div.com-apple-iweb-widget-detailview div.selected {
float: left;
width: 52px;
height: 52px;
margin-right: 3px;
border: solid rgb(30,124,253) 2px;
overflow: hidden;
}
div.com-apple-iweb-widget-detailview div.selected img {
margin-left: -2px;
margin-top: -2px;
}
div.com-apple-iweb-widget-detailview div.thumbnail_arrows {
position: absolute;
top: 27px;
width: 19px;
height: 56px;
z-index: 10;
visibility: hidden;
}
div.com-apple-iweb-widget-detailview div.thumbnail_arrows img {
position: relative;
top: 13px;
}
div.com-apple-iweb-widget-detailview div.thumbnails_back {
left: 0px;
}
div.com-apple-iweb-widget-detailview div.thumbnails_forward {
right: 0px;
}
div.com-apple-iweb-widget-detailview div.middle {
position: relative;
margin-left: 18px;
margin-right: 18px;
}
div.com-apple-iweb-widget-detailview div.header_controls {
margin-top: 2px;
top: 2px;
height: 25px;
}
div.com-apple-iweb-widget-detailview div.positioned {
position: relative;
width: 100%;
}
div.com-apple-iweb-widget-detailview div.left {
position: absolute;
left: 0px;
}
div.com-apple-iweb-widget-detailview div.right {
position: absolute;
right: 0px;
}
div.com-apple-iweb-widget-detailview div.footer_controls {
position: relative;
top: 10px;
width: 100%;
height: 100px;
}
div.com-apple-iweb-widget-detailview a.slideshow_anchor {
outline: 0;
z-index: 2;
position: absolute;
width: 100%;
}

View File

@@ -0,0 +1,255 @@
//
// iWeb - DetailView.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var DetailViewToggleNotification="DetailViewToggleNotification";var DetailView=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-detailview",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID!=null)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);this.mIsActive=false;this.mShowingThumbnails=false;this.needsHeightSet=true;this.p_setHeight();this.updateFromPreferences();if(this.runningInApp)
{this.postToggleNotification(true);}}},onload:function()
{this.p_updateSlideshow();this.p_updateDownloadVisibility();this.p_addEvent(document,'onkeydown',this.p_keyDown.bind(this),true);this.p_addEvent(document,'onkeyup',this.p_keyUp.bind(this),true);this.div().select(".noselect").each(function(element)
{if(windowsInternetExplorer)
{element.onselectstart=function(){return false;};}
else
{element.onmousedown=function(){return false;};}});},onunload:function()
{},loadFromStream:function(mediaStream)
{if(mediaStream)
{mediaStream.load(this.p_baseURL(),this.onStreamLoad.bind(this));}},onStreamLoad:function(imageStream)
{this.mCurrentMediaStream=imageStream;this.mThumbnailsInvalid=true;var slideshowDiv=this.getElementById("slideshow_placeholder");var slideshowAnchor=this.getElementById("slideshow_anchor");if(this.mSlideshow!=null)
{this.mSlideshow.pause();slideshowDiv.innerHTML="";}
var photos=[];for(var i=0;i<imageStream.length;++i)
{photos.push(imageStream[i].slideshowValue("image"));}
var options={backgroundColor:this.p_backgroundColor(),scaleMode:this.p_scaleMode(),advanceAnchor:slideshowAnchor};this.mSlideshow=new Slideshow(slideshowDiv,photos,this.p_onPhotoChange.bind(this),options);this.mSlideshow.setTransitionIndex(1);this.mSlideshow.pause();if(this.preferences)
{var movieOverlayURL=this.preferenceForKey("movie overlay");if(movieOverlayURL&&IWImageNamed("movie overlay")===null)
{IWRegisterNamedImage("movie overlay",movieOverlayURL);}}
if(this.runningInApp)
{this.p_updateCanvasControls();this.p_setupThumbnails();var index=this.p_startIndex();this.p_updateThumbScrollers(index);this.mSlideshow.showPhotoNumber(index);var captionDiv=this.div().selectFirst(".Caption");captionDiv.innerHTML="&#160;";captionDiv.id="caption";}},downloadPhoto:function()
{var currentIndex=this.mSlideshow.currentPhotoNumber;var currentEntry=this.mCurrentMediaStream[currentIndex];var targetURL=currentEntry.targetURL();targetURL+=(targetURL.indexOf('?')==-1)?'?':'&';targetURL+='disposition=download';window.location.href=targetURL;},toggleThumbnails:function()
{var show=this.mShowingThumbnails==false;this.p_toggleThumbnails(show,true);this.setPreferenceForKey(show,"showThumbnails");},willShow:function(index)
{if(!this.mCanvasControlsSetUp)
{this.mCanvasControlsSetUp=true;this.p_updateCanvasControls();}
this.p_setupThumbnails();if(this.needsHeightSet)
{this.p_setHeight();}
else if(this.mSlideshow)
{this.mSlideshow.updateSize();}
this.p_updateThumbScrollers(index);},showPhotoNumber:function(index,callback)
{this.mIsActive=true;this.p_updateThumbScrollers(index);this.photoChangeCallback=callback;this.mSlideshow.showPhotoNumber(index);},height:function()
{return this.getElementById("middle").offsetHeight;},postToggleNotification:function(isVisible)
{this.mIsActive=isVisible;var userInfo={showDetailView:isVisible};if(this.mSlideshow)
{userInfo["index"]=this.mSlideshow.currentPhotoNumber;}
if(this.runningInApp)
{this.preferences.postCrossWidgetNotification("IWCommentTargetChanged",{});this.setPreferenceForKey(isVisible,"inDetailView");}
else
{NotificationCenter.postNotification(new IWNotification("IWCommentTargetChanged",null,{}));var gridID=this.preferenceForKey("gridID");NotificationCenter.postNotification(new IWNotification(DetailViewToggleNotification,gridID,userInfo));}},exitDetailView:function()
{this.mIsActive=false;if(this.mSlideshow)
{this.mSlideshow.inactivate();}
this.postToggleNotification(false);},playSlideshow:function()
{if(this.mPlaySlideshowFunction)
{this.mPlaySlideshowFunction();}},setPlaySlideshowFunction:function(playSlideshow)
{this.mPlaySlideshowFunction=playSlideshow;},p_setHeight:function()
{if(this.needsHeightSet)
{var slideshowDiv=this.getElementById("slideshow_placeholder");var width=slideshowDiv.offsetWidth;if(width>0)
{var height=px(width*3/4);if(height!=parseFloat(slideshowDiv.style.height))
{slideshowDiv.parentNode.style.height=height;slideshowDiv.style.height=height;if(this.mSlideshow)
{this.mSlideshow.updateSize();}
this.needsHeightSet=false;if(this.runningInApp&&!window.onresize)
{window.onresize=function()
{this.needsHeightSet=true;this.p_setHeight();}.bind(this);}}}
this.div().style.height='';var detailFooterDiv=this.getElementById("footer_controls");var gridID=this.preferenceForKey("gridID");var divTop=Position.cumulativeOffset(detailFooterDiv)[1]+detailFooterDiv.offsetHeight;if(divTop)
{NotificationCenter.postNotificationWithInfo("DetailViewHeightNotification",gridID,{"top":divTop});}}},p_setupThumbnails:function()
{if(this.p_showThumbnails())
{if(!this.mShowingThumbnails)
{this.p_toggleThumbnails(true,false);}}
else
{this.p_buildThumbnailView();}},p_toggleThumbnails:function(show,animate)
{if(this.mShowingThumbnails!=show)
{var thumbnailView=this.getElementById("thumbnail_view");var back=this.getElementById("thumbnails_back");var forward=this.getElementById("thumbnails_forward");var viewSpan=this.getElementById("view");var thumbsOnOnly=viewSpan.select(".thumbs_on_only");var thumbsOffOnly=viewSpan.select(".thumbs_off_only");var thumbnailViewFullHeight=59;if(show)
{this.mShowingThumbnails=true;if(animate)
{var animation=new SimpleAnimation(function(){});animation.duration=300;animation.pre=function()
{back.style.opacity=forward.style.opacity=0.0;back.style.visibility=forward.style.visibility="visible";thumbnailView.show();}
animation.post=function()
{thumbnailView.style.height=px(thumbnailViewFullHeight);back.style.opacity=forward.style.opacity=1.0;}
animation.update=function(now)
{thumbnailView.style.height=px(thumbnailViewFullHeight*now);back.style.opacity=forward.style.opacity=now;}
animation.start();}
else
{back.style.visibility=forward.style.visibility="visible";back.style.opacity=forward.style.opacity=1.0;thumbnailView.style.height=px(thumbnailViewFullHeight);thumbnailView.show();}
var thumbnailsDiv=this.getElementById("thumbnails");var thumbnailsArray=thumbnailsDiv.select(".thumbnail");if(thumbnailsArray.length>this.mSlideshow.currentPhotoNumber)
{var selected=thumbnailsArray[this.mSlideshow.currentPhotoNumber];if(selected)
{this.p_ensureThumbnailIsVisible(selected,true);}}
for(var i=0;i<thumbsOnOnly.length;++i)
{thumbsOnOnly[i].style.display="inline";}
for(i=0;i<thumbsOffOnly.length;++i)
{thumbsOffOnly[i].style.display="none";}
this.p_buildThumbnailView();}
else
{this.mShowingThumbnails=false;for(var i=0;i<thumbsOnOnly.length;++i)
{thumbsOnOnly[i].style.display="none";}
for(i=0;i<thumbsOffOnly.length;++i)
{thumbsOffOnly[i].style.display="inline";}
if(animate)
{var animation=new SimpleAnimation(function(){});animation.duration=300;animation.pre=function()
{}
animation.post=function()
{thumbnailView.style.height=px(1);back.style.visibility=forward.style.visibility="hidden";thumbnailView.hide();}
animation.update=function(now)
{thumbnailView.style.height=px(Math.max(1,thumbnailViewFullHeight*(1.0-now)));back.style.opacity=forward.style.opacity=1.0-now;}
animation.start();}
else
{thumbnailView.style.height=px(1);back.style.visibility=forward.style.visibility="hidden";thumbnailView.hide();}}}},p_setThumbnail:function(img,thumbnail)
{var thumbnailSize=56;thumbnail.load(function(img,thumbnail){img.src=thumbnail.sourceURL();var size=thumbnail.naturalSize();var shorterDimension=Math.min(size.width,size.height);var scale=thumbnailSize/shorterDimension;var width=scale*size.width;var height=scale*size.height;$(img).setStyle({position:"absolute",left:px(Math.round((thumbnailSize-width)/2)),top:px(Math.round((thumbnailSize-height)/2)),width:px(Math.round(width)),height:px(Math.round(height))});thumbnail.unload();}.bind(null,img,thumbnail));},p_buildThumbnailView:function()
{if(this.mThumbnailsInvalid)
{var thumbnailView=this.getElementById("thumbnail_view");var back=this.getElementById("thumbnails_back");var forward=this.getElementById("thumbnails_forward");this.mThumbnailsInvalid=false;var thumbnailsDiv=this.getElementById("thumbnails");var thumbnailSize=56;var thumbnailPadding=3;var currentIndex=this.preferenceForKey("currentPhoto")||0;for(var i=0;i<this.mCurrentMediaStream.length;++i)
{var anchor=$(document.createElement("a"));var container=$(document.createElement("div"));container.className="thumbnail";container.setStyle({position:"absolute",top:0,left:px(i*(thumbnailSize+thumbnailPadding))});if(windowsInternetExplorer&&(effectiveBrowserVersion<7))
{container.setStyle({width:px(thumbnailSize),height:px(thumbnailSize)});}
if(i==currentIndex)
{$(container).addClassName("selected");}
var entry=this.mCurrentMediaStream[i];var badgeMarkup=IWStreamEntryBadgeMarkup(new IWRect(0,0,thumbnailSize,thumbnailSize),entry.isMovie(),false,null);if(badgeMarkup&&badgeMarkup.length>0)
{container.innerHTML=badgeMarkup;}
var img=document.createElement("img");anchor.href="#"+i;anchor.onclick=function(i,slideshow){setTimeout(slideshow.showPhotoNumber.bind(slideshow,i,true),0);}.bind(null,i,this.mSlideshow);anchor.appendChild(img);container.insertBefore(anchor,container.firstChild);thumbnailsDiv.appendChild(container);}
this.p_updateThumbScrollers(currentIndex);back.onclick=function()
{var thumbnailsDiv=this.getElementById("thumbnails");var left=0;if(thumbnailsDiv.style.left)
{left=-parseFloat(thumbnailsDiv.style.left);}
if(left>0)
{var tileWidth=(thumbnailSize+thumbnailPadding);var nThumbs=Math.floor(thumbnailsDiv.parentNode.offsetWidth/tileWidth);this.p_setThumbnailLeft(Math.max(left-nThumbs*tileWidth,0),true);}}.bind(this);forward.onclick=function()
{var thumbnailsDiv=this.getElementById("thumbnails");var left=0;if(thumbnailsDiv.style.left)
{left=-parseFloat(thumbnailsDiv.style.left);}
if(this.p_enableForward(thumbnailsDiv))
{var tileWidth=thumbnailSize+thumbnailPadding;var parentWidth=thumbnailsDiv.parentNode.offsetWidth;var nThumbs=Math.floor(parentWidth/tileWidth);this.p_setThumbnailLeft(Math.min(left+nThumbs*tileWidth,this.p_lastThumnbailRight()-parentWidth),true);}}.bind(this);}},p_updateThumbScrollers:function(index)
{var thumbnailsDiv=this.getElementById("thumbnails");var back=this.getElementById("thumbnails_back");var forward=this.getElementById("thumbnails_forward");if(index!==undefined)
{var selected=thumbnailsDiv.select(".thumbnail")[index];if(selected)
{this.p_ensureThumbnailIsVisible(selected,false);}}
var left=parseFloat(thumbnailsDiv.style.left);var imgs=back.select('img');if(left<0)
{imgs[0].style.display="none";imgs[1].style.display="inline";}
else
{imgs[0].style.display="inline";imgs[1].style.display="none";}
var imgs=forward.select('img');if(this.p_enableForward(thumbnailsDiv))
{imgs[0].style.display="none";imgs[1].style.display="inline";}
else
{imgs[0].style.display="inline";imgs[1].style.display="none";}},p_enableForward:function(thumbnailsDiv)
{var enableForward=false;var thumbnails=thumbnailsDiv.select(".thumbnail");if(thumbnails&&thumbnails.length>0)
{var lastThumbnail=thumbnails[thumbnails.length-1];var left=0;if(thumbnailsDiv.style.left)
{left=parseFloat(thumbnailsDiv.style.left);}
var panWidth=thumbnailsDiv.parentNode.offsetWidth;var right=panWidth-left;if(lastThumbnail.offsetLeft+lastThumbnail.offsetWidth>right)
{enableForward=true;}}
return enableForward;},p_showSlideshow:function()
{var show=this.preferenceForKey("showSlideshow");(function(){return show!==undefined}).assert();return show;},p_updateSlideshow:function()
{this.div().select(".play_slideshow").invoke(this.p_showSlideshow()?'show':'hide');},p_showDownload:function()
{var kDoNotDownloadImageSize=4;var photoSize=this.preferenceForKey("photoSize");var show=(photoSize==null||photoSize!=kDoNotDownloadImageSize);return show;},p_updateDownloadVisibility:function()
{this.getElementById("download").style.visibility=(this.p_showDownload()?'visible':'hidden');},changedPreferenceForKey:function(key)
{if(key=="mediaStream"||key=="mediaStreamObject")
{var mediaStream=this.p_mediaStream();if(mediaStream!==null)
{this.loadFromStream(mediaStream);}}
else if(key=="captionHeight")
{var captionDiv=this.div().selectFirst(".Caption");captionDiv.style.height=px(this.preferenceForKey("captionHeight"));}
else if(key=="movieTime")
{this.mSlideshow.setMovieTime(this.preferenceForKey(key));}
else if(key=="movieParams")
{var params=this.preferenceForKey(key);this.mCurrentMediaStream[this.mSlideshow.currentPhotoNumber].setMovieParams(params);this.mSlideshow.setMovieParams(params);}
else if(key=="canvas controls")
{this.p_updateCanvasControls();}
else if(key=="currentImageURL")
{var entry=this.mCurrentMediaStream[this.mSlideshow.currentPhotoNumber];entry.setImageURL(this.preferenceForKey(key));this.mSlideshow.setImage(entry.image());}
else if(key=="currentThumbnailURL")
{var entry=this.mCurrentMediaStream[this.mSlideshow.currentPhotoNumber];var currentThumbnailURL=this.preferenceForKey(key);entry.setThumbnailURL(currentThumbnailURL);if(this.mThumbnailsInvalid==false)
{var thumbnailsDiv=this.getElementById("thumbnails");var selectedThumbContainer=thumbnailsDiv.selectFirst(".selected");var img=$(selectedThumbContainer).selectFirst('img');this.p_setThumbnail(img,entry.thumbnail());}}
else if(key=="showSlideshow")
{this.p_updateSlideshow();}
else if(key=="photoSize")
{this.p_updateDownloadVisibility();}},updateFromPreferences:function()
{var mediaStream=this.p_mediaStream();this.loadFromStream(mediaStream);},p_updateCanvasControls:function()
{var canvasControlURLs=this.preferenceForKey("canvas controls");this.div().select('.canvas').each(function(img)
{var canvasControlName="canvas_"+img.classNames().toArray()[1];setImgSrc(img,canvasControlURLs[canvasControlName]);});},p_onPhotoChange:function(index)
{var currentEntry=this.mCurrentMediaStream[index];var commentURL=currentEntry.commentAssetURL();if(this.runningInApp)
{commentURL="iweb-widget:Comments/"+currentEntry.guid();this.preferences.postCrossWidgetNotification("IWCommentTargetChanged",{IWResourceURL:commentURL});}
else
{if(this.mIsActive)
{NotificationCenter.postNotification(new IWNotification("IWCommentTargetChanged",null,{IWResourceURL:commentURL}));}
var captionDiv=this.div().selectFirst(".Caption");if(captionDiv)
{captionDiv.update(currentEntry.title());}}
var thumbnailsDiv=this.getElementById("thumbnails");var oldSelected=thumbnailsDiv.selectFirst(".selected");if(oldSelected)
{oldSelected.removeClassName("selected");}
var newSelected=thumbnailsDiv.select(".thumbnail")[index];if(newSelected)
{newSelected.addClassName("selected");this.p_ensureThumbnailIsVisible(newSelected,true);}
this.p_updatePreviousNextControls(index);this.setPreferenceForKey(index,"currentPhoto");if(this.photoChangeCallback)
{this.photoChangeCallback();this.photoChangeCallback=null;}},p_lastThumnbailRight:function()
{var thumbnailsDiv=this.getElementById("thumbnails");var thumbnails=thumbnailsDiv.select(".thumbnail");var lastThumbnail=thumbnails[thumbnails.length-1];var lastThumbnailRight=lastThumbnail.offsetLeft+lastThumbnail.offsetWidth;return lastThumbnailRight;},p_ensureThumbnailIsVisible:function(thumbnail,animate)
{if(this.mShowingThumbnails)
{var thumbnailsDiv=this.getElementById("thumbnails");var startLeft=0;if(thumbnailsDiv.style.left)
{startLeft=parseFloat(thumbnailsDiv.style.left);}
var visibleArea=new IWRange(-startLeft,thumbnailsDiv.parentNode.offsetWidth);var thumbnailLeft=thumbnail.offsetLeft;var thumbnailRight=thumbnailLeft+thumbnail.offsetWidth;var targetLeft=visibleArea.location();if(thumbnailRight>visibleArea.max())
{var targetLeft=thumbnailLeft;targetLeft=Math.min(targetLeft,this.p_lastThumnbailRight()-visibleArea.length());}
else if(thumbnailLeft<visibleArea.location())
{var targetLeft=thumbnailRight-visibleArea.length();targetLeft=Math.max(targetLeft,0);}
this.p_setThumbnailLeft(targetLeft,animate);}},p_setThumbnailLeft:function(targetLeft,animate)
{var thumbnailsDiv=this.getElementById("thumbnails");var startLeft=0;if(thumbnailsDiv.style.left)
{startLeft=parseFloat(thumbnailsDiv.style.left);}
var thumbnailSize=56;var thumbnailPadding=3;var tileWidth=(thumbnailSize+thumbnailPadding);var nThumbs=Math.ceil(thumbnailsDiv.parentNode.offsetWidth/tileWidth);var visibleRange=new IWRange(Math.floor(targetLeft/tileWidth),nThumbs);var thumbImgs=thumbnailsDiv.select('.thumbnail > a > img');for(var index=visibleRange.location(),end=Math.min(visibleRange.max(),thumbImgs.length);index<end;++index)
{var img=thumbImgs[index];if(img.src===undefined||img.src=='')
{var entry=this.mCurrentMediaStream[index];this.p_setThumbnail(img,entry.micro());}}
var deltaLeft=-startLeft-targetLeft;if(deltaLeft!=0)
{if(animate)
{var animation=new SimpleAnimation(function(){});animation.pre=function()
{}
animation.post=function()
{thumbnailsDiv.style.left=px(startLeft+deltaLeft);this.p_updateThumbScrollers();}.bind(this);animation.update=function(now)
{thumbnailsDiv.style.left=px(startLeft+deltaLeft*now);}
animation.start();}
else
{thumbnailsDiv.style.left=px(startLeft+deltaLeft);this.p_updateThumbScrollers();}}},p_updatePreviousNextControls:function(index)
{var previousSpans=this.getElementById("previous").select("span");var nextSpans=this.getElementById("next").select("span");var atFirstImage=index==0;var atLastImage=index>=this.mCurrentMediaStream.length-1;var navigationClickHandler=function(i,slideshow)
{setTimeout(slideshow.showPhotoNumber.bind(slideshow,i,true),0);}
if(atFirstImage)
{previousSpans[0].show();previousSpans[1].hide();}
else
{var previousIndex=index-1;previousSpans[0].hide();previousSpans[1].show();$(previousSpans[1]).select('a').each(function(anchor){anchor.href='#'+previousIndex;anchor.onclick=navigationClickHandler.bind(null,previousIndex,this.mSlideshow);}.bind(this));}
if(atLastImage)
{nextSpans[0].show();nextSpans[1].hide();}
else
{var nextIndex=index+1;nextSpans[0].hide();nextSpans[1].show();$(nextSpans[1]).select('a').each(function(anchor){anchor.href='#'+nextIndex;anchor.onclick=navigationClickHandler.bind(null,nextIndex,this.mSlideshow);}.bind(this));}},p_mediaStream:function()
{var mediaStream=null;if(this.preferences)
{mediaStream=this.preferenceForKey("mediaStreamObject");if(mediaStream==null||mediaStream==undefined)
{var mediaStreamCode=this.preferenceForKey("mediaStream");if(mediaStreamCode!=null&&mediaStreamCode.length>0)
{mediaStream=eval(mediaStreamCode);}}}
return mediaStream;},p_backgroundColor:function()
{var backgroundColor=null;if(this.preferences)
{backgroundColor=this.preferenceForKey("color");}
if(backgroundColor===undefined)
{backgroundColor="transparent";}
return backgroundColor;},p_baseURL:function()
{return this.preferenceForKey("baseURL");},p_startIndex:function()
{var startIndex=null;if(this.preferences)
{startIndex=this.preferenceForKey("startIndex");}
if(startIndex===undefined)
{startIndex=0;}
return startIndex;},p_showThumbnails:function()
{var showThumbnails=null;if(this.preferences)
{showThumbnails=this.preferenceForKey("showThumbnails");}
if(showThumbnails===undefined)
{showThumbnails=false;}
return showThumbnails;},p_scaleMode:function()
{var scaleMode=null;if(this.preferences)
{scaleMode=this.preferenceForKey("scaleMode");}
if(scaleMode===undefined)
{scaleMode="fit";}
return scaleMode;},p_addEvent:function(object,event,functionName,capture)
{if(object.addEventListener)
{event=event.length>2?event.substring(2):event;capture=capture?capture:false;object.addEventListener(event,functionName,capture);}
else if(object.attachEvent)
{object.attachEvent(event,functionName);}
else
{try
{object.setAttribute(event,functionName);}
catch(e)
{}}},p_keyDown:function(event)
{},p_keyUp:function(event)
{event=event?event:(window.event?window.event:"");var keyCode=event.which?event.which:event.keyCode;switch(keyCode)
{case 37:event.cancelBubble=true;if(event.stopPropagation)
{event.stopPropagation();}
if(!(window.isWebKit&&window.isEarlyWebKitVersion))
{location.hash=this.mSlideshow.prevPhotoNumber();}
this.mSlideshow.goBack();break;case 39:event.cancelBubble=true;if(event.stopPropagation)
{event.stopPropagation();}
if(!(window.isWebKit&&window.isEarlyWebKitVersion))
{location.hash=this.mSlideshow.nextPhotoNumber();}
this.mSlideshow.advance();break;}}});

View File

@@ -0,0 +1,2 @@
(function(){var strings={};strings['Back to Album']='Back to Album';strings['Download']='Download';strings['Previous']='Previous';strings['Next']='Next';strings['Play Slideshow']='Play Slideshow';RegisterWidgetStrings("com-apple-iweb-widget-detailview",strings);})();

View File

@@ -0,0 +1,29 @@
div.com-apple-iweb-widget-footercontrols img {
border: none;
}
div.com-apple-iweb-widget-footercontrols div.footer_middle {
position: relative;
text-align: center;
margin-left: 18px;
margin-right: 18px;
}
div.com-apple-iweb-widget-footercontrols div.positioned {
position: relative;
width: 100%;
}
div.com-apple-iweb-widget-footercontrols div.right {
position: absolute;
right: 0px;
}
div.com-apple-iweb-widget-footercontrols div.footer_middle img {
border: none;
vertical-align: middle;
position: relative;
top: -3px;
width: 19px;
height: 25px;
}

View File

@@ -0,0 +1,39 @@
//
// iWeb - FooterControls.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var FooterControls=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-footercontrols",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID!=null)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);NotificationCenter.addObserver(this,FooterControls.prototype.p_handlePaginationContentsNotification,"paginationSpanContents",this.p_mediaGridID());this.updateFromPreferences();}},onload:function()
{if(this.preferences&&this.preferences.postNotification)
{this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);}},onunload:function()
{},updateFromPreferences:function()
{this.setPage(0);},changedPreferenceForKey:function(key)
{if(this.runningInApp)
{if(key=="x-paginationSpanContents")
{this.p_setPaginationControls(this.p_paginationSpanContents());}}},prevPage:function()
{if(this.runningInApp)
{this.setPreferenceForKey(null,"x-previousPage");}
else
{NotificationCenter.postNotification(new IWNotification("PreviousPage",this.p_mediaGridID(),null));}},nextPage:function()
{if(this.runningInApp)
{this.setPreferenceForKey(null,"x-nextPage");}
else
{NotificationCenter.postNotification(new IWNotification("NextPage",this.p_mediaGridID(),null));}},setPage:function(pageIndex)
{if(this.runningInApp)
{this.setPreferenceForKey(pageIndex,"x-setPage");}
else
{NotificationCenter.postNotification(new IWNotification("SetPage",this.p_mediaGridID(),{pageIndex:pageIndex}));}},p_mediaGridID:function()
{var mediaGridID=null;if(this.preferences)
{mediaGridID=this.preferenceForKey("gridID");}
if(mediaGridID===undefined)
{mediaGridID=null;}
return mediaGridID;},p_paginationSpanContents:function()
{var paginationSpanContents=null;if(this.preferences)
{paginationSpanContents=this.preferenceForKey("x-paginationSpanContents");}
if(paginationSpanContents===undefined)
{paginationSpanContents=null;}
return paginationSpanContents;},p_handlePaginationContentsNotification:function(notification)
{var userInfo=notification.userInfo();var controls=userInfo.controls||"";this.p_setPaginationControls(controls);},p_setPaginationControls:function(controls)
{var template=new Template(controls);var myControls=template.evaluate({WIDGET_ID:this.instanceID});this.getElementById("pagination_controls").update(myControls);}});

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,53 @@
/* The main widget <div> element.
*/
div.com-apple-iweb-widget-HTMLRegion {
}
/* Root <div> for all widget views.
*/
div.com-apple-iweb-widget-HTMLRegion .html_region_widget {
position: relative;
width: 100%;
height: 100%;
}
/* HTML Snippet View.
*/
div.com-apple-iweb-widget-HTMLRegion div.HTMLRegionSnippetView {
position: absolute;
height: 100%;
width: 100%;
}
/* The Status View.
*/
div.com-apple-iweb-widget-HTMLRegion .HTMLRegionStatusView {
background: rgb(206,206,206);
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
/* Status View table.
*/
div.com-apple-iweb-widget-HTMLRegion .StatusMessageTable {
position: absolute;
border-collapse: collapse;
border: 0;
width: 100%;
height: 100%;
}
div.com-apple-iweb-widget-HTMLRegion .StatusMessageTable td {
vertical-align: middle;
text-align: center;
}

View File

@@ -0,0 +1,25 @@
//
// iWeb - Paste.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var Paste=Class.create(PrefMarkupWidget,{widgetIdentifier:"com-apple-iweb-widget-HTMLRegion",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);}
if(runningInApp)
{window.onresize=this.resize.bind(this);}
var parentDiv=this.div('htmlRegion');this.m_views={};this.m_views["html-snippet"]=new HTMLRegionSnippetView(this,parentDiv);this.m_views["default-image-status"]=new HTMLRegionDefaultImageStatus(this,parentDiv);var iframe_src=eval(instanceID+'_htmlMarkupURL');this.m_iframe='<iframe id="'+instanceID+'-frame" '+'src="'+iframe_src+'" '+'frameborder="0" style="width: 100%; height: 100%;" '+'scrolling="no" marginheight="0" marginwidth="0" allowTransparency="true"></frame>';this.updateFromPreferences();},updateFromPreferences:function()
{if(this.preferenceForKey('emptyLook')===true)
{this.showView("default-image-status");}
else
{this.showView("html-snippet");}},changedPreferenceForKey:function(key)
{if(key=="emptyLook")
{if(this.preferenceForKey(key)===false)
{if(this.m_currentView==this.m_views["html-snippet"])
{this.m_views["html-snippet"].render();}
this.showView("html-snippet");this.preferences.postNotification("BLWidgetShouldStartAutoSizingNotification",1);}
else
{this.showView("default-image-status");}}},resize:function()
{$H(this.m_views).each(function(pair){pair.value.resize();});}});var HTMLRegionSnippetView=Class.create(View,{m_divId:"html-snippet",m_divClass:"HTMLRegionSnippetView",render:function()
{this.ensureDiv().update(this.m_widget.m_iframe);if(this.m_widget.runningInApp)
{this.m_widget.preferences.postNotification("BLWidgetIsSafeToDrawNotification",0);}}});var HTMLRegionDefaultImageStatus=Class.create(StatusView,{m_divId:"default-image-status",m_divClass:"HTMLRegionStatusView",badgeImage:"HTMLRegionWorldMap.png",badgeImageWidth:198,badgeImageHeight:94});

View File

@@ -0,0 +1,48 @@
div.com-apple-iweb-widget-headercontrols img {
border: none;
vertical-align: middle;
position: relative;
top: -3px;
width: 19px;
height: 25px;
}
div.com-apple-iweb-widget-headercontrols div.middle {
position: relative;
text-align: center;
margin-left: 18px;
margin-right: 18px;
}
div.com-apple-iweb-widget-headercontrols div.header_controls {
margin-top: 2px;
top: 2px;
}
div.com-apple-iweb-widget-headercontrols div.positioned {
position: relative;
width: 100%;
}
div.com-apple-iweb-widget-headercontrols div.header_controls span.subscribe{
position: relative;
margin-left: 4px;
margin-right: 4px;
}
div.com-apple-iweb-widget-headercontrols div.header_controls span.play_slideshow{
position: relative;
margin-left: 4px;
margin-right: 4px;
}
div.com-apple-iweb-widget-headercontrols div.left {
position: absolute;
left: 0px;
}
div.com-apple-iweb-widget-headercontrols div.right {
position: absolute;
right: 0px;
}

View File

@@ -0,0 +1,122 @@
//
// iWeb - HeaderControls.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var HeaderControls=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-headercontrols",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID!=null)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);NotificationCenter.addObserver(this,HeaderControls.prototype.p_prevPage,"PreviousPage",this.p_mediaGridID());NotificationCenter.addObserver(this,HeaderControls.prototype.p_nextPage,"NextPage",this.p_mediaGridID());NotificationCenter.addObserver(this,HeaderControls.prototype.p_setPage,"SetPage",this.p_mediaGridID());this.mRange=new IWPageRange(0,5);this.p_updateRange();}},onload:function()
{var defaults={showBackToIndex:true,showSubscribe:true,showSlideshow:true,mediaIndex:false,entriesPerPage:99,entryCount:0};this.initializeDefaultPreferences(defaults);this.setPage(0);this.updateFromPreferences();if(this.preferences&&this.preferences.postNotification)
{this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);}},onunload:function()
{},startup:function()
{this.p_updateCanvasControls();this.p_updateBackToIndex();this.p_updatePaginationControls();this.p_updateSubscribe();this.p_updateSlideshow();if(this.p_mediaIndex())
{this.getElementById("media_index_only").show();}
else
{this.getElementById("album_only").show();}},changedPreferenceForKey:function(key)
{if(key=="entriesPerPage"||key=="entryCount"||key=="x-currentPage")
{this.p_updateRange();this.p_updatePaginationControls();}
else if(key=="showBackToIndex")
{this.p_updateBackToIndex();}
else if(key=="showSubscribe")
{this.p_updateSubscribe();}
else if(key=="showSlideshow")
{this.p_updateSlideshow();}
else if(key=="canvas controls")
{this.p_updateCanvasControls();}
else if(this.runningInApp)
{if(key=="x-nextPage")
{this.nextPage();}
else if(key=="x-previousPage")
{this.prevPage();}
else if(key=="x-setPage")
{this.setPage(this.p_setPagePreference());}}},updateFromPreferences:function()
{this.startup();},prevPage:function()
{NotificationCenter.postNotification(new IWNotification("PreviousPage",this.p_mediaGridID(),null));},nextPage:function()
{NotificationCenter.postNotification(new IWNotification("NextPage",this.p_mediaGridID(),null));},setPage:function(pageIndex)
{NotificationCenter.postNotification(new IWNotification("SetPage",this.p_mediaGridID(),{pageIndex:pageIndex}));},playSlideshow:function()
{if(this.mPlaySlideshowFunction)
{this.mPlaySlideshowFunction();}},setPlaySlideshowFunction:function(playSlideshow)
{this.mPlaySlideshowFunction=playSlideshow;},p_canNavigateToPrev:function()
{return(this.p_currentPage()>0);},p_prevPage:function(notification)
{if(this.p_canNavigateToPrev())
{this.setPage(this.p_currentPage()-1);}},p_canNavigateToNext:function()
{return(this.p_currentPage()<this.p_pageCount()-1);},p_nextPage:function(notification)
{if(this.p_canNavigateToNext())
{this.setPage(this.p_currentPage()+1);}},p_setPage:function(notification)
{var pageIndex=notification.userInfo().pageIndex;this.setPreferenceForKey(pageIndex,"x-currentPage");if(!this.runningInApp)
{var entriesPerPage=this.p_entriesPerPage();var location=pageIndex*entriesPerPage;var length=Math.min(this.p_entryCount()-location,entriesPerPage);var userInfo={"range":new IWRange(location,length)};NotificationCenter.postNotification(new IWNotification("RangeChanged",this.p_mediaGridID(),userInfo));}},p_showBackToIndex:function()
{var show=this.preferenceForKey("showBackToIndex");(function(){return show!==undefined}).assert();return show;},p_showSubscribe:function()
{var show=this.preferenceForKey("showSubscribe");(function(){return show!==undefined}).assert();return show;},p_showSlideshow:function()
{var show=this.preferenceForKey("showSlideshow");(function(){return show!==undefined}).assert();return show;},p_mediaGridID:function()
{var mediaGridID=null;if(this.preferences)
{mediaGridID=this.preferenceForKey("gridID");}
if(mediaGridID===undefined)
{mediaGridID=null;}
return mediaGridID;},p_setPagePreference:function()
{var setPagePreference=null;if(this.preferences)
{setPagePreference=this.preferenceForKey("x-setPage");}
if(setPagePreference===undefined)
{setPagePreference=null;}
return setPagePreference;},p_updatePaginationControls:function()
{var widgetDiv=this.div();var currentPage=this.p_currentPage();var controls="";if(this.p_isPaginated())
{var canvasControlURLs=this.preferenceForKey("canvas controls");if(this.p_canNavigateToPrev())
{var leftArrowSrc=canvasControlURLs['canvas_arrow-left'];controls+="<a href='javascript:#{WIDGET_ID}.prevPage()'>";controls+=imgMarkup(leftArrowSrc,'','','');controls+="</a> ";}
else
{var leftArrowSrc=canvasControlURLs['canvas_arrow-left-D'];controls+=imgMarkup(leftArrowSrc,'','','')+" ";}
for(var i=this.mRange.min();i<this.mRange.max();i++)
{if(i==currentPage)
{controls+="<span class='current_page'>"+(i+1)+"</span> ";}
else
{controls+="<a href='javascript:#{WIDGET_ID}.setPage("+i+")'>"+(i+1)+"</a> ";}}
if(this.p_canNavigateToNext())
{var rightArrowSrc=canvasControlURLs['canvas_arrow-right'];controls+="<a href='javascript:#{WIDGET_ID}.nextPage()'>";controls+=imgMarkup(rightArrowSrc,'','','');controls+="</a>";}
else
{var rightArrowSrc=canvasControlURLs['canvas_arrow-right-D'];controls+=imgMarkup(rightArrowSrc,'','','');}}
var template=new Template(controls);var myControls=template.evaluate({WIDGET_ID:this.instanceID});this.getElementById("pagination_controls").update(myControls);widgetDiv.select(".paginated_only").invoke(this.p_isPaginated()?'show':'hide');widgetDiv.select(".non_paginated_only").invoke(this.p_isPaginated()?'hide':'show');if(this.runningInApp)
{this.setPreferenceForKey(controls,"x-paginationSpanContents");}
else
{NotificationCenter.postNotification(new IWNotification("paginationSpanContents",this.p_mediaGridID(),{controls:controls}));}},p_setAnchorsUnderElementToHREF:function(element,href)
{$(element).select('a').map(function(anchor){anchor.href=href;});},p_updateCanvasControls:function()
{var canvasControlURLs=this.preferenceForKey("canvas controls");this.div().select('.canvas').each(function(img)
{var canvasControlName="canvas_"+img.classNames().toArray()[1];setImgSrc(img,canvasControlURLs[canvasControlName]);});},p_updateBackToIndex:function()
{var element=this.getElementById("back_to_index");this.p_showBackToIndex()?element.show():element.hide();if(!this.runningInApp)
{this.p_setAnchorsUnderElementToHREF(element,this.p_indexURL());}},p_updateSubscribe:function()
{this.div().select(".subscribe").invoke(this.p_showSubscribe()?'show':'hide');if(!this.runningInApp)
{var feedURL="javascript:"+this.instanceID+(this.p_mediaIndex()?".mediaIndexSubscribe()":".photocastSubscribe()")
var self=this;this.div().select(".subscribe").each(function(element)
{self.p_setAnchorsUnderElementToHREF(element,feedURL);});}},mediaIndexSubscribe:function()
{window.location=this.p_feedURL();},photocastSubscribe:function()
{photocastHelper(this.p_feedURL());},p_updateSlideshow:function()
{this.div().select(".play_slideshow").invoke(this.p_showSlideshow()?'show':'hide');},p_mediaIndex:function()
{var mediaIndex=null;if(this.preferences)
{mediaIndex=this.preferenceForKey("mediaIndex");}
if(mediaIndex===undefined)
{mediaIndex=false;}
return mediaIndex;},p_currentPage:function()
{var currentPage=0;if(this.preferences)
{currentPage=this.preferenceForKey("x-currentPage");}
if(!currentPage)
{currentPage=0;}
return currentPage;},p_entriesPerPage:function()
{var entriesPerPage=null;if(this.preferences)
{entriesPerPage=this.preferenceForKey("entriesPerPage");}
if(entriesPerPage==undefined)
{entriesPerPage=99;}
return entriesPerPage;},p_entryCount:function()
{var entryCount=null;if(this.preferences)
{entryCount=this.preferenceForKey("entryCount");}
if(entryCount==undefined)
{entryCount=0;}
return entryCount;},p_indexURL:function()
{return this.preferenceForKey("indexURL");},p_feedURL:function()
{return this.preferenceForKey("feedURL");},p_isPaginated:function()
{return(this.p_entryCount()>this.p_entriesPerPage());},p_pageCount:function()
{return Math.ceil(this.p_entryCount()/this.p_entriesPerPage());},p_updateRange:function()
{var pageCount=this.p_pageCount();var currentPage=this.p_currentPage();if(currentPage>=pageCount)
{currentPage=pageCount-1;this.setPreferenceForKey(currentPage,"x-currentPage");}
if(pageCount<=5||this.mRange.length()<3||this.mRange.max()>pageCount)
{this.mRange.setMax(Math.min(5,pageCount));}
if(currentPage<this.mRange.min())
{this.mRange.shift(currentPage-this.mRange.min());}
else if(currentPage>=this.mRange.max())
{this.mRange.shift(currentPage-this.mRange.max()+1);}}});

View File

@@ -0,0 +1,2 @@
(function(){var strings={};strings['Subscribe']='Subscribe';strings['Back to Index']='Back to Index';strings['Add Photo']='Add Photo';strings['Play Slideshow']='Play Slideshow';RegisterWidgetStrings("com-apple-iweb-widget-headercontrols",strings);})();

View File

@@ -0,0 +1,67 @@
//
// iWeb - navbar.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var NavBar=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-NavBar",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);if(!this.preferenceForKey("useStaticFeed")&&this.preferenceForKey("dotMacAccount"))
{var depthPrefix=this.preferenceForKey("path-to-root");if(!depthPrefix||depthPrefix=="")
depthPrefix="./";this.xml_feed=depthPrefix+"?webdav-method=truthget&depth=infinity&ns=iweb&filterby=in-navbar";}
else
{this.xml_feed="feed.xml";if(this.sitePath)
{this.xml_feed=this.sitePath+"/"+this.xml_feed;}}
this.changedPreferenceForKey("navbar-css");this.regenerate();}},regenerate:function()
{new Ajax.Request(this.xml_feed,{method:'get',onSuccess:this.populateNavItems.bind(this)});return true;},getStyleElement:function(key)
{if(!this.styleElement)
{var head=document.getElementsByTagName("head")[0];if(head)
{var newElement=document.createElement("style");newElement.type="text/css";head.appendChild(newElement);this.styleElement=newElement;}}
return this.styleElement;},substWidgetPath:function(text)
{var result=text.replace(/\$WIDGET_PATH/gm,this.widgetPath);return result;},addCSSSelectorPrefix:function(text)
{var prefix="div#"+this.instanceID+" ";text=text.replace(/\/\*[^*]*\*+([^/][^*]*\*+)*\//gm,"");text=text.replace(/(^\s*|\}\s*)([^{]+)({[^}]*})/gm,function(match,beforeSelectorList,selectorList,propertyList){var result=beforeSelectorList;var selectors=selectorList.split(",");for(var i=0;i<selectors.length;i++){result+=prefix+selectors[i];if(i+1<selectors.length)result+=",";}
result+=propertyList;return result;});return text;},changedPreferenceForKey:function(key)
{if(key=="navbar-css")
{var text=this.preferenceForKey(key);if(!text)
{text="";}
text=this.substWidgetPath(text);text=this.addCSSSelectorPrefix(text);var styleElement=this.getStyleElement();if(styleElement)
{if(!windowsInternetExplorer)
{var node=document.createTextNode(text);if(node)
{while(styleElement.hasChildNodes())
{styleElement.removeChild(styleElement.firstChild);}
styleElement.appendChild(node);}}
else
{styleElement.styleSheet.cssText=text;}}}},populateNavItems:function(req)
{var items;var feedRoot=ajaxGetDocumentElement(req);if(feedRoot){var parsedFeed=this.getAtomFeedItems(feedRoot);var items=parsedFeed.resultArray;var currentPageGUID=null;var isCollectionPage="NO";var curPagePat=null;if(this.runningInApp)
curPagePat=/\.#current#.$/;else
{currentPageGUID=this.preferenceForKey("current-page-GUID");isCollectionPage=this.preferenceForKey("isCollectionPage");}
var navDiv=this.div("navbar-list");var navBgDiv=navDiv.parentNode;$(navBgDiv).ensureHasLayoutForIE();while(navDiv.firstChild){navDiv.removeChild(navDiv.firstChild);}
var depthPrefix=this.preferenceForKey("path-to-root");if(!depthPrefix||depthPrefix=="")
depthPrefix="./";for(var x=0;x<items.length;x++){var navItem=document.createElement("li");var anchor=document.createElement("a");var title=items[x].title;var pageGUID=items[x].GUID;title=title.replace(/ /g,"\u00a0")+" ";var url=items[x].url;if(!this.runningInApp&&!url.match(/^http:/i))
url=depthPrefix+url;var inAppCurPage=this.runningInApp&&curPagePat.exec(unescape(new String(url)));if(inAppCurPage)
{url=url.replace(curPagePat,"");}
if(pageGUID==currentPageGUID||inAppCurPage){navItem.className='current-page';if(!this.runningInApp&&isCollectionPage!="YES"){url="";}}
else
navItem.className='noncurrent-page';anchor.setAttribute("href",url);anchor.appendChild(document.createTextNode(title));navItem.appendChild(anchor);navDiv.appendChild(navItem);}
if(this.preferences&&this.preferences.postNotification){this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);}}},getAtomFeedItems:function(feedNode)
{var results=new Array;var pageOrder=new Array;if(feedNode)
{var generator="";var generatorElt=getFirstElementByTagName(feedNode,"generator");if(generatorElt&&generatorElt.firstChild){generator=allData(generatorElt);}
var pageGUIDs,pageGUIDsElt;for(var entryElt=feedNode.firstChild;entryElt;entryElt=entryElt.nextSibling){var isInNavbarElt=null;if(!pageGUIDs&&(pageGUIDsElt=findChild(entryElt,"site-navbar","urn:iweb:"))){pageGUIDs=allData(pageGUIDsElt).split(",");for(var x=0;x<pageGUIDs.length;x++){var pageGUID=pageGUIDs[x];pageOrder[""+pageGUID]=x;}}
if(entryElt.nodeName=="entry"&&(isInNavbarElt=findChild(entryElt,"in-navbar","urn:iweb:"))){if(!isInNavbarElt)
continue;var pageGUID="";if(isInNavbarElt.firstChild){pageGUID=""+allData(isInNavbarElt);}else{iWLog("no navBarElt child");}
if(pageGUID=="navbar-sort")
continue;var title="";var titleElt=findChild(entryElt,"title","urn:iweb:");if(!titleElt){iWLog("No iWeb title");titleElt=findChild(entryElt,"title");}
if(titleElt&&titleElt.firstChild){title=allData(titleElt);}
var linkElt=getFirstElementByTagName(entryElt,'link');url=linkElt.getAttribute("href");if(!url&&linkElement.firstChild){url=allData(linkElement);}
results[results.length]={title:title,url:url,GUID:pageGUID};}}}
if(pageGUIDs){results=$(results).reject(function(result){return(pageOrder[result.GUID]===undefined);});results.sort(function(lhs,rhs){return pageOrder[lhs.GUID]-pageOrder[rhs.GUID];});}
return{resultArray:results};},onload:function()
{},onunload:function()
{}});function findChild(element,nodeName,namespace)
{var child;for(child=element.firstChild;child;child=child.nextSibling){if(child.localName==nodeName||child.baseName==nodeName){if(!namespace){return child;}
var childNameSpace=child.namespaceURI;if(childNameSpace==namespace){return child;}}}
return null;}
function getFirstElementByTagName(node,tag_name){var elements=node.getElementsByTagName(tag_name);if(elements.length){return elements[0];}
else{return findChild(node,tag_name);}}
function allData(node)
{node=node.firstChild;var data=node.data;while((node=node.nextSibling)){data+=node.data;}
return data;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -0,0 +1,423 @@
//
// iWeb - WidgetCommon.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var widgets=[];var identifiersToStringLocalizations=[];var Widget=Class.create({initialize:function(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID)
{this.instanceID=instanceID;this.widgetPath=widgetPath;this.sharedPath=sharedPath;this.sitePath=sitePath;this.preferences=preferences;this.runningInApp=(runningInApp===undefined)?false:runningInApp;this.onloadReceived=false;if(this.preferences&&this.runningInApp==true)
{this.preferences.widget=this;setTransparentGifURL(this.sharedPath.stringByAppendingPathComponent("None.gif"));}
this.div().widget=this;window[instanceID]=this;widgets.push(this);widgets[instanceID]=this;if(!this.constructor.instances)
{this.constructor.instances=new Array();}
this.constructor.instances.push(this);}},div:function()
{var divID=this.instanceID;if(arguments.length==1)
{divID=this.instanceID+"-"+arguments[0];}
return $(divID);},onload:function()
{this.onloadReceived=true;},onunload:function()
{},didBecomeSelected:function()
{},didBecomeDeselected:function()
{},didBeginEditing:function()
{},didEndEditing:function()
{},setNeedsDisplay:function()
{},preferenceForKey:function(key)
{var value;if(this.preferences)
value=this.preferences[key];return value;},initializeDefaultPreferences:function(prefs)
{var self=this;$H(prefs).each(function(pair)
{if(self.preferenceForKey(pair.key)===undefined)
{self.setPreferenceForKey(pair.value,pair.key,false);}});},setPreferenceForKey:function(preference,key,registerUndo)
{if(this.runningInApp)
{if(registerUndo===undefined)
registerUndo=true;if((registerUndo==false)&&this.preferences.disableUndoRegistration)
this.preferences.disableUndoRegistration();this.preferences[key]=preference;if((registerUndo==false)&&this.preferences.enableUndoRegistration)
this.preferences.enableUndoRegistration();}
else
{this.preferences[key]=preference;this.changedPreferenceForKey(key);}},changedPreferenceForKey:function(key)
{},postNotificationWithNameAndUserInfo:function(name,userInfo)
{if(window.NotificationCenter!==undefined)
{NotificationCenter.postNotification(new IWNotification(name,null,userInfo));}},sizeWillChange:function()
{},sizeDidChange:function()
{},widgetWidth:function()
{var enclosingDiv=this.div();if(enclosingDiv)
return enclosingDiv.offsetWidth;else
return null;},widgetHeight:function()
{var enclosingDiv=this.div();if(enclosingDiv)
return enclosingDiv.offsetHeight;else
return null;},getInstanceId:function(id)
{var fullId=this.instanceID+"-"+id;if(arguments.length==2)
{fullId+=("$"+arguments[1]);}
return fullId;},getElementById:function(id)
{var fullId=this.getInstanceId.apply(this,arguments);return $(fullId);},localizedString:function(string)
{return LocalizedString(this.widgetIdentifier,string);},showView:function(viewName)
{var futureView=this.m_views[viewName];if((futureView!=this.m_currentView)&&(futureView!=this.m_futureView))
{this.m_futureView=futureView;if(this.m_fadeAnimation)
{this.m_fadeAnimation.stop();}
var previousView=this.m_currentView;this.m_currentView=futureView;var currentView=this.m_currentView;this.m_futureView=null;this.m_fadeAnimation=new SimpleAnimation(function(){delete this.m_fadeAnimation;}.bind(this));this.m_fadeAnimation.pre=function()
{if(previousView)
{previousView.ensureDiv().setStyle({zIndex:0,opacity:1});}
if(currentView)
{currentView.ensureDiv().setStyle({zIndex:1,opacity:0});currentView.show();currentView.render();}}
this.m_fadeAnimation.post=function()
{!previousView||previousView.hide();!currentView||currentView.ensureDiv().setStyle({zIndex:'',opacity:1});!currentView||!currentView.doneFadingIn||currentView.doneFadingIn();}
this.m_fadeAnimation.update=function(now)
{!currentView||currentView.ensureDiv().setOpacity(now);!previousView||previousView.ensureDiv().setOpacity(1-now);}.bind(this);this.m_fadeAnimation.start();}}});Widget.onload=function()
{for(var i=0;i<widgets.length;i++)
{widgets[i].onload();}}
Widget.onunload=function()
{for(var i=0;i<widgets.length;i++)
{widgets[i].onunload();}}
function RegisterWidgetStrings(identifier,strings)
{identifiersToStringLocalizations[identifier]=strings;}
function LocalizedString(identifier,string)
{var localized=undefined;var localizations=identifiersToStringLocalizations[identifier];if(localizations===undefined)
{iWLog("warning: no localizations for widget "+identifier+", (key:"+string+")");}
else
{localized=localizations[string];}
if(localized===undefined)
{iWLog("warning: couldn't find a localization for '"+string+"' for widget "+identifier);localized=string;}
return localized;}
function WriteLocalizedString(identifier,string)
{document.write(LocalizedString(identifier,string));}
var JSONFeedRendererWidget=Class.create(Widget,{initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);}},changedPreferenceForKey:function(key)
{try
{var value=this.preferenceForKey(key);if(key=="sfr-shadow")
{if(value!=null)
{this.sfrShadow=eval(value);}
else
{this.sfrShadow=null;}
this.renderFeedItems("sfr-shadow");}
if(key=="sfr-stroke")
{if(value!==null)
this.sfrStroke=eval(value);else
this.sfrStroke=null;this.invalidateFeedItems("sfr-stroke");}
if(key=="sfr-reflection")
{if(value!==null)
{this.sfrReflection=eval(value);}
else
{this.sfrReflection=null;}
this.invalidateFeedItems("sfr-reflection");}}
catch(e)
{iWLog("JSONFeedRendererWidget: exception");debugPrintException(e);}},invalidateFeedItems:function(reason)
{trace('invalidateFeedItems(%s)',reason);if(this.pendingRender!==null)
{clearTimeout(this.pendingRender);}
this.pendingRender=setTimeout(function()
{this.pendingRender=null;this.renderFeedItems(reason);}.bind(this),50);},rerenderImage:function(imgGroupDiv,imgDiv,imageUrlString,entryHasImage,photoProportions,imageWidth,positioningHandler,onloadHandler)
{imgGroupDiv.update();if(entryHasImage)
{imgGroupDiv.strokeApplied=false;imgGroupDiv.reflectionApplied=false;imgGroupDiv.shadowApplied=false;imgGroupDiv.setStyle({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});imgGroupDiv.style.position='relative';imgDiv.style.position='relative';var imageUrl=imageUrlString||transparentGifURL();var image=IWCreateImage(imageUrl);image.load(function(image,imgDiv,imgGroupDiv,positioningHandler,onloadHandler)
{var cropDiv=this.croppingDivForImage(image,photoProportions,imageWidth);imgGroupDiv.appendChild(cropDiv);if(positioningHandler)
{positioningHandler();}
if(image.sourceURL()!==transparentGifURL())
{this.applyEffects(imgGroupDiv);}
if(onloadHandler)
{onloadHandler();}}.bind(this,image,imgDiv,imgGroupDiv,positioningHandler,onloadHandler));}},croppingDivForImage:function(image,kind,width)
{var croppedSize=function(originalSize,cropKind,width)
{if(cropKind=="Square")
{return new IWSize(width,width);}
else if(cropKind=="Landscape")
{return new IWSize(width,width*(3/4));}
else if(cropKind=="Portrait")
{return new IWSize(width,width*(4/3));}
else
{var scaleFactor=width/originalSize.width;return originalSize.scale(scaleFactor,scaleFactor,true);}};var cropDiv=null;if(image.loaded())
{var img=$(document.createElement('img'));img.src=image.sourceURL();var natural=image.naturalSize();cropDiv=$(document.createElement("div"));cropDiv.appendChild(img);var croppingDivForImage_helper=function(loadedImage)
{if(loadedImage)
{natural=new IWSize(loadedImage.width,loadedImage.height);}
var cropped=croppedSize(natural,kind,width);var scaleFactor=cropped.width/natural.width;if(natural.aspectRatio()>cropped.aspectRatio())
{scaleFactor=cropped.height/natural.height;}
var scaled=natural.scale(scaleFactor);var offset=new IWPoint(Math.abs(scaled.width-cropped.width)/2,Math.abs(scaled.height-cropped.height)/2);img.setStyle({width:px(scaled.width),height:px(scaled.height),marginLeft:px(-offset.x),marginTop:px(-offset.y),position:'relative'});cropDiv.setStyle({width:px(cropped.width),height:px(cropped.height),overflow:"hidden",position:'relative'});cropDiv.className="crop";}
if(windowsInternetExplorer&&effectiveBrowserVersion<7&&img.src.indexOf(transparentGifURL())!=-1)
{var originalImage=new Image();originalImage.src=img.originalSrc;if(originalImage.complete)
{croppingDivForImage_helper(originalImage);}
else
{originalImage.onload=croppingDivForImage_helper.bind(null,originalImage);}}
else
{croppingDivForImage_helper(null);}}
return cropDiv;},applyEffects:function(div)
{if(this.sfrShadow||this.sfrReflection||this.sfrStroke)
{if((div.offsetWidth===undefined)||(div.offsetHeight===undefined)||(div.offsetWidth===0)||(div.offsetHeight===0))
{setTimeout(JSONFeedRendererWidget.prototype.applyEffects.bind(this,div),0)
return;}
if(this.sfrStroke&&(div.strokeApplied==false))
{this.sfrStroke.applyToElement(div);div.strokeApplied=true;}
if(this.sfrReflection&&(div.reflectionApplied==false))
{this.sfrReflection.applyToElement(div);div.reflectionApplied=true;}
if(this.sfrShadow&&(!this.disableShadows)&&(div.shadowApplied==false))
{this.sfrShadow.applyToElement(div);div.shadowApplied=true;}
if(this.runningInApp&&(window.webKitVersion<=419)&&this.preferences.setNeedsDisplay)
{this.preferences.setNeedsDisplay();}}
if(windowsInternetExplorer)
{var cropDivs=div.select(".crop");var cropDiv=cropDivs[cropDivs.length-1];if(cropDiv)
{cropDiv.onclick=function()
{var anchorNode=div.parentNode;var targetHref=locationHRef();while(anchorNode&&(anchorNode.tagName!="A"))
{anchorNode=anchorNode.parentNode}
if(anchorNode)
{targetHref=anchorNode.href;}
window.location=targetHref;};cropDiv.onmouseover=function()
{this.style.cursor='pointer';}}}},summaryExcerpt:function(descriptionHTML,maxSummaryLength)
{var div=document.createElement("div");div.innerHTML=descriptionHTML;if(maxSummaryLength>0)
{var model=new HTMLTextModel(div);model.truncateAroundPosition(maxSummaryLength,"...");}
else if(maxSummaryLength===0)
{div.innerHTML="";}
return div.innerHTML;}});var PrefMarkupWidget=Class.create(Widget,{initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp)
{if(instanceID)
{$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);}},onload:function()
{if(!this.runningInApp)
{this.setUpSubDocumentOnLoad();}},setUpSubDocumentOnLoad:function()
{var self=this;var oIFrame=this.getElementById("frame");if(oIFrame)
{setTimeout(function(){self.loadedSubDocument()},250);}},loadedSubDocument:function()
{var oIFrame=this.getElementById("frame");var oSubDocument=oIFrame.contentWindow||oIFrame.contentDocument;if(oSubDocument.document)
{oSubDocument=oSubDocument.document;}
if(oSubDocument.body)
{this.fixTargetOnElements(oSubDocument,"a");this.fixTargetOnElements(oSubDocument,"form");}
else
{var self=this;setTimeout(function(){self.loadedSubDocument()},250);}},fixTargetOnElements:function(doc,tagName)
{var elements=doc.getElementsByTagName(tagName);for(var i=0;i<elements.length;i++)
{var target=elements[i].target;if(target===undefined||target=="")
elements[i].target="_top";}}});function IWScrollbar(scrollbar)
{}
IWScrollbar.prototype._init=function()
{var style=null;var element=null;this._track=$(document.createElement("div"));style=this._track.style;style.height="100%";style.width="100%";this.scrollbar.appendChild(this._track);element=$(document.createElement("div"));element.style.position="absolute";this._setObjectStart(element,0);this._track.appendChild(element);element=$(document.createElement("div"));element.style.position="absolute";this._track.appendChild(element);element=$(document.createElement("div"));element.style.position="absolute";windowsInternetExplorer||this._setObjectEnd(element,0);this._track.appendChild(element);this._thumb=$(document.createElement("div"));style=this._thumb.style;style.position="absolute";this._setObjectSize(this._thumb,this.minThumbSize);this._track.appendChild(this._thumb);element=$(document.createElement("div"));element.style.position="absolute";this._setObjectStart(element,0);this._thumb.appendChild(element);element=$(document.createElement("div"));element.style.position="absolute";this._thumb.appendChild(element);element=$(document.createElement("div"));element.style.position="absolute";windowsInternetExplorer||this._setObjectEnd(element,0);this._thumb.appendChild(element);this.setSize(this.size);this.setTrackStart(this.trackStartPath,this.trackStartLength);this.setTrackMiddle(this.trackMiddlePath);this.setTrackEnd(this.trackEndPath,this.trackEndLength);this.setThumbStart(this.thumbStartPath,this.thumbStartLength);this.setThumbMiddle(this.thumbMiddlePath);this.setThumbEnd(this.thumbEndPath,this.thumbEndLength);this._thumb.style.display="none";Event.observe(this._track,"mousedown",this._mousedownTrackHandler,false);Event.observe(this._thumb,"mousedown",this._mousedownThumbHandler,false);}
IWScrollbar.prototype.remove=function()
{this.scrollbar.removeChild(this._track);}
IWScrollbar.prototype._captureEvent=function(event)
{event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mousedownThumb=function(event)
{Event.observe(document,"mousemove",this._mousemoveThumbHandler,true);Event.observe(document,"mouseup",this._mouseupThumbHandler,true);Event.observe(document,"mouseover",this._captureEventHandler,true);Event.observe(document,"mouseout",this._captureEventHandler,true);this._thumbStart_temp=this._getMousePosition(event);this._scroll_thumbStartPos=this._getThumbStartPos();event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mousemoveThumb=function(event)
{var delta=this._getMousePosition(event)-this._thumbStart_temp;var new_pos=this._scroll_thumbStartPos+delta;this.scrollTo(this._contentPositionForThumbPosition(new_pos));event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mouseupThumb=function(event)
{Event.stopObserving(document,"mousemove",this._mousemoveThumbHandler,true);Event.stopObserving(document,"mouseup",this._mouseupThumbHandler,true);Event.stopObserving(document,"mouseover",this._captureEventHandler,true);Event.stopObserving(document,"mouseout",this._captureEventHandler,true);delete this._thumbStart_temp;delete this._scroll_thumbStartPos;event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mousedownTrack=function(event)
{this._track_mouse_temp=this._getMousePosition(event)-this._trackOffset;if(event.altKey)
{this.scrollTo(this._contentPositionForThumbPosition(this._track_mouse_temp-(this._thumbLength/2)));delete this._track_mouse_temp;}
else
{this._track_scrolling=true;Event.observe(this._track,"mousemove",this._mousemoveTrackHandler,true);Event.observe(this._track,"mouseover",this._mouseoverTrackHandler,true);Event.observe(this._track,"mouseout",this._mouseoutTrackHandler,true);Event.observe(document,"mouseup",this._mouseupTrackHandler,true);this._trackScrollOnePage(this);this._track_timer=setInterval(this._trackScrollDelay,500,this);}
event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._trackScrollDelay=function(self)
{if(!self._track_scrolling)return;clearInterval(self._track_timer);self._trackScrollOnePage(self);self._track_timer=setInterval(self._trackScrollOnePage,150,self);}
IWScrollbar.prototype._mousemoveTrack=function(event)
{this._track_mouse_temp=this._getMousePosition(event)-this._trackOffset;event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mouseoverTrack=function(event)
{this._track_mouse_temp=this._getMousePosition(event)-this._trackOffset;this._track_scrolling=true;event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mouseoutTrack=function(event)
{this._track_scrolling=false;event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._mouseupTrack=function(event)
{clearInterval(this._track_timer);Event.stopObserving(this._track,"mousemove",this._mousemoveTrackHandler,true);Event.stopObserving(this._track,"mouseover",this._mouseoverTrackHandler,true);Event.stopObserving(this._track,"mouseout",this._mouseoutTrackHandler,true);Event.stopObserving(document,"mouseup",this._mouseupTrackHandler,true);delete this._track_mouse_temp;delete this._track_scrolling;delete this._track_timer;event.stopPropagation();event.preventDefault();}
IWScrollbar.prototype._trackScrollOnePage=function(self)
{if(!self._track_scrolling)return;var deltaScroll=Math.round(self._trackLength*self._getViewToContentRatio());if(self._track_mouse_temp<self._thumbStart)
self.scrollByThumbDelta(-deltaScroll);else if(self._track_mouse_temp>(self._thumbStart+self._thumbLength))
self.scrollByThumbDelta(deltaScroll);}
IWScrollbar.prototype.setScrollArea=function(scrollarea)
{if(this.scrollarea)
{Event.stopObserving(this.scrollbar,"mousewheel",this.scrollarea._mousewheelScrollHandler,true);Event.stopObserving(this.scrollbar,"DOMMouseScroll",this.scrollarea._mousewheelScrollHandler,true);}
this.scrollarea=scrollarea;Event.observe(this.scrollbar,"mousewheel",this.scrollarea._mousewheelScrollHandler,true);Event.observe(this.scrollbar,"DOMMouseScroll",this.scrollarea._mousewheelScrollHandler,true);}
IWScrollbar.prototype.refresh=function()
{this._trackOffset=this._computeTrackOffset();this._trackLength=this._computeTrackLength();var ratio=this._getViewToContentRatio();if(ratio>=1.0||!this._canScroll())
{if(this.autohide)
{this.hide();}
this._thumb.style.display="none";this.scrollbar.style.appleDashboardRegion="none";}
else
{this._thumbLength=Math.max(Math.round(this._trackLength*ratio),this.minThumbSize);this._numScrollablePixels=this._trackLength-this._thumbLength-(2*this.padding);this._setObjectLength(this._thumb,this._thumbLength);if(windowsInternetExplorer)
{this._setObjectStart(this._thumb.down().next(),this.thumbStartLength);this._setObjectLength(this._thumb.down().next(),this._thumbLength
-this.thumbStartLength-this.thumbEndLength);this._setObjectStart(this._thumb.down().next(1),this._thumbLength-this.thumbEndLength);this._setObjectLength(this._thumb.down().next(1),this.thumbEndLength);if(!this.fixedUpIEPNGBGs)
{fixupIEPNGBGsInTree(this._track);Event.stopObserving(this._track,"mousedown",this._mousedownTrackHandler);Event.stopObserving(this._thumb,"mousedown",this._mousedownThumbHandler);Event.observe(this._track,"mousedown",this._mousedownTrackHandler);Event.observe(this._thumb,"mousedown",this._mousedownThumbHandler);this.fixedUpIEPNGBGs=true;}}
this._thumb.style.display="block";this.scrollbar.style.appleDashboardRegion="dashboard-region(control rectangle)";this.show();}
this.verticalHasScrolled();this.horizontalHasScrolled();}
IWScrollbar.prototype.setAutohide=function(autohide)
{this.autohide=autohide;if(this._getViewToContentRatio()>=1.0&&autohide)
{this.hide();}
else
{this.show();}}
IWScrollbar.prototype.hide=function()
{this._track.style.display="none";this.hidden=true;}
IWScrollbar.prototype.show=function()
{this._track.style.display="block";this.hidden=false;}
IWScrollbar.prototype.setSize=function(size)
{this.size=size;this._setObjectSize(this.scrollbar,size);this._setObjectSize(this._track.down().next(),size);this._setObjectSize(this._thumb.down().next(),size);}
IWScrollbar.prototype.setTrackStart=function(imgpath,length)
{this.trackStartPath=imgpath;this.trackStartLength=length;var element=this._track.down();element.style.background="url("+imgpath+") no-repeat top left";this._setObjectLength(element,length);this._setObjectSize(element,this.size);this._setObjectStart(this._track.down().next(),length);}
IWScrollbar.prototype.setTrackMiddle=function(imgpath)
{this.trackMiddlePath=imgpath;this._track.down().next().style.background="url("+imgpath+") "+this._repeatType+" top left";}
IWScrollbar.prototype.setTrackEnd=function(imgpath,length)
{this.trackEndPath=imgpath;this.trackEndLength=length;var element=this._track.down().next(1);element.style.background="url("+imgpath+") no-repeat top left";this._setObjectLength(element,length);this._setObjectSize(element,this.size);windowsInternetExplorer||this._setObjectEnd(this._track.down().next(),length);}
IWScrollbar.prototype.setThumbStart=function(imgpath,length)
{this.thumbStartPath=imgpath;this.thumbStartLength=length;var element=this._thumb.down();element.style.background="url("+imgpath+") no-repeat top left";this._setObjectLength(element,length);this._setObjectSize(element,this.size);this._setObjectStart(this._thumb.down().next(),length);}
IWScrollbar.prototype.setThumbMiddle=function(imgpath)
{this.thumbMiddlePath=imgpath;this._thumb.down().next().style.background="url("+imgpath+") "+this._repeatType+" top left";}
IWScrollbar.prototype.setThumbEnd=function(imgpath,length)
{this.thumbEndPath=imgpath;this.thumbEndLength=length;var element=this._thumb.down().next(1);element.style.background="url("+imgpath+") no-repeat top left";this._setObjectLength(element,length);this._setObjectSize(element,this.size);windowsInternetExplorer||this._setObjectEnd(this._thumb.down().next(),length);}
IWScrollbar.prototype._contentPositionForThumbPosition=function(thumb_pos)
{if(this._getViewToContentRatio()>=1.0)
{return 0;}
else
{return(thumb_pos-this.padding)*((this._getContentLength()-this._getViewLength())/this._numScrollablePixels);}}
IWScrollbar.prototype._thumbPositionForContentPosition=function(page_pos)
{if(this._getViewToContentRatio()>=1.0)
{return this.padding;}
else
{var result=this.padding+(page_pos/((this._getContentLength()-this._getViewLength())/this._numScrollablePixels));if(isNaN(result))
result=0;return result;}}
IWScrollbar.prototype.scrollByThumbDelta=function(deltaScroll)
{if(deltaScroll==0)
return;this.scrollTo(this._contentPositionForThumbPosition(this._thumbStart+deltaScroll));}
function IWVerticalScrollbar(scrollbar)
{this.scrollarea=null;this.scrollbar=$(scrollbar);this.minThumbSize=28;this.padding=-1;this.autohide=true;this.hidden=true;this.size=19;this.trackStartPath=transparentGifURL();this.trackStartLength=18;this.trackMiddlePath=transparentGifURL();this.trackEndPath=transparentGifURL();this.trackEndLength=18;this.thumbStartPath=transparentGifURL();this.thumbStartLength=9;this.thumbMiddlePath=transparentGifURL();this.thumbEndPath=transparentGifURL();this.thumbEndLength=9;this._track=null;this._thumb=null;this._trackOffset=0;this._trackLength=0;this._numScrollablePixels=0;this._thumbLength=0;this._repeatType="repeat-y";this._thumbStart=this.padding;var _self=this;this._captureEventHandler=function(event){_self._captureEvent(event);};this._mousedownThumbHandler=function(event){_self._mousedownThumb(event);};this._mousemoveThumbHandler=function(event){_self._mousemoveThumb(event);};this._mouseupThumbHandler=function(event){_self._mouseupThumb(event);};this._mousedownTrackHandler=function(event){_self._mousedownTrack(event);};this._mousemoveTrackHandler=function(event){_self._mousemoveTrack(event);};this._mouseoverTrackHandler=function(event){_self._mouseoverTrack(event);};this._mouseoutTrackHandler=function(event){_self._mouseoutTrack(event);};this._mouseupTrackHandler=function(event){_self._mouseupTrack(event);};this._init();}
IWVerticalScrollbar.prototype=new IWScrollbar(null);IWVerticalScrollbar.prototype.scrollTo=function(pos)
{this.scrollarea.verticalScrollTo(pos);}
IWVerticalScrollbar.prototype._setObjectSize=function(object,size)
{object.style.width=size+"px";}
IWVerticalScrollbar.prototype._setObjectLength=function(object,length)
{object.style.height=length+"px";}
IWVerticalScrollbar.prototype._setObjectStart=function(object,start)
{object.style.top=start+"px";}
IWVerticalScrollbar.prototype._setObjectEnd=function(object,end)
{object.style.bottom=end+"px";}
IWVerticalScrollbar.prototype._getMousePosition=function(event)
{if(event!=undefined)
return Event.pointerY(event);else
return 0;}
IWVerticalScrollbar.prototype._getThumbStartPos=function()
{return this._thumb.offsetTop;}
IWVerticalScrollbar.prototype._computeTrackOffset=function()
{var obj=this.scrollbar;var curtop=0;while(obj.offsetParent)
{curtop+=obj.offsetTop;obj=obj.offsetParent;}
return curtop;}
IWVerticalScrollbar.prototype._computeTrackLength=function()
{return this.scrollbar.offsetHeight;}
IWVerticalScrollbar.prototype._getViewToContentRatio=function()
{return this.scrollarea.viewToContentHeightRatio;}
IWVerticalScrollbar.prototype._getContentLength=function()
{return this.scrollarea.content.scrollHeight;}
IWVerticalScrollbar.prototype._getViewLength=function()
{return this.scrollarea.viewHeight;}
IWVerticalScrollbar.prototype._canScroll=function()
{return this.scrollarea.scrollsVertically;}
IWVerticalScrollbar.prototype.verticalHasScrolled=function()
{var new_thumb_pos=this._thumbPositionForContentPosition(this.scrollarea.content.scrollTop);this._thumbStart=new_thumb_pos;this._thumb.style.top=new_thumb_pos+"px";}
IWVerticalScrollbar.prototype.horizontalHasScrolled=function()
{}
function IWHorizontalScrollbar(scrollbar)
{this.scrollarea=null;this.scrollbar=$(scrollbar);this.minThumbSize=28;this.padding=-1;this.autohide=true;this.hidden=true;this.size=19;this.trackStartPath=transparentGifURL();this.trackStartLength=18;this.trackMiddlePath=transparentGifURL();this.trackEndPath=transparentGifURL();this.trackEndLength=18;this.thumbStartPath=transparentGifURL();this.thumbStartLength=9;this.thumbMiddlePath=transparentGifURL();this.thumbEndPath=transparentGifURL();this.thumbEndLength=9;this._track=null;this._thumb=null;this._trackOffset=0;this._trackLength=0;this._numScrollablePixels=0;this._thumbLength=0;this._repeatType="repeat-x";this._thumbStart=this.padding;var _self=this;this._captureEventHandler=function(event){_self._captureEvent(event);};this._mousedownThumbHandler=function(event){_self._mousedownThumb(event);};this._mousemoveThumbHandler=function(event){_self._mousemoveThumb(event);};this._mouseupThumbHandler=function(event){_self._mouseupThumb(event);};this._mousedownTrackHandler=function(event){_self._mousedownTrack(event);};this._mousemoveTrackHandler=function(event){_self._mousemoveTrack(event);};this._mouseoverTrackHandler=function(event){_self._mouseoverTrack(event);};this._mouseoutTrackHandler=function(event){_self._mouseoutTrack(event);};this._mouseupTrackHandler=function(event){_self._mouseupTrack(event);};this._init();}
IWHorizontalScrollbar.prototype=new IWScrollbar(null);IWHorizontalScrollbar.prototype.scrollTo=function(pos)
{this.scrollarea.horizontalScrollTo(pos);}
IWHorizontalScrollbar.prototype._setObjectSize=function(object,size)
{object.style.height=size+"px";}
IWHorizontalScrollbar.prototype._setObjectLength=function(object,length)
{object.style.width=length+"px";}
IWHorizontalScrollbar.prototype._setObjectStart=function(object,start)
{object.style.left=start+"px";}
IWHorizontalScrollbar.prototype._setObjectEnd=function(object,end)
{object.style.right=end+"px";}
IWHorizontalScrollbar.prototype._getMousePosition=function(event)
{if(event!=undefined)
return Event.pointerX(event);else
return 0;}
IWHorizontalScrollbar.prototype._getThumbStartPos=function()
{return this._thumb.offsetLeft;}
IWHorizontalScrollbar.prototype._computeTrackOffset=function()
{var obj=this.scrollbar;var curtop=0;while(obj.offsetParent)
{curtop+=obj.offsetLeft;obj=obj.offsetParent;}
return curtop;}
IWHorizontalScrollbar.prototype._computeTrackLength=function()
{return this.scrollbar.offsetWidth;}
IWHorizontalScrollbar.prototype._getViewToContentRatio=function()
{return this.scrollarea.viewToContentWidthRatio;}
IWHorizontalScrollbar.prototype._getContentLength=function()
{return this.scrollarea.content.scrollWidth;}
IWHorizontalScrollbar.prototype._getViewLength=function()
{return this.scrollarea.viewWidth;}
IWHorizontalScrollbar.prototype._canScroll=function()
{return this.scrollarea.scrollsHorizontally;}
IWHorizontalScrollbar.prototype.verticalHasScrolled=function()
{}
IWHorizontalScrollbar.prototype.horizontalHasScrolled=function()
{var new_thumb_pos=this._thumbPositionForContentPosition(this.scrollarea.content.scrollLeft);this._thumbStart=new_thumb_pos;this._thumb.style.left=new_thumb_pos+"px";}
function IWScrollArea(content)
{this.content=$(content);this.scrollsVertically=true;this.scrollsHorizontally=true;this.singlepressScrollPixels=10;this.viewHeight=0;this.viewToContentHeightRatio=1.0;this.viewWidth=0;this.viewToContentWidthRatio=1.0;this._scrollbars=new Array();var _self=this;this._refreshHandler=function(){_self.refresh();};this._keyPressedHandler=function(){_self.keyPressed(event);};this._mousewheelScrollHandler=function(event){_self.mousewheelScroll(event);};this.content.style.overflow="hidden";this.content.scrollTop=0;this.content.scrollLeft=0;Event.observe(this.content,"mousewheel",this._mousewheelScrollHandler,true);Event.observe(this.content,"DOMMouseScroll",this._mousewheelScrollHandler,true);this.refresh();var c=arguments.length;for(var i=1;i<c;++i)
{this.addScrollbar(arguments[i]);}}
IWScrollArea.prototype.addScrollbar=function(scrollbar)
{scrollbar.setScrollArea(this);this._scrollbars.push(scrollbar);scrollbar.refresh();}
IWScrollArea.prototype.removeScrollbar=function(scrollbar)
{var scrollbars=this._scrollbars;var c=scrollbars.length;for(var i=0;i<c;++i)
{if(scrollbars[i]==scrollbar)
{scrollbars.splice(i,1);break;}}}
IWScrollArea.prototype.remove=function()
{Event.stopObserving(this.content,"mousewheel",this._mousewheelScrollHandler,true);Event.stopObserving(this.content,"DOMMouseScroll",this._mousewheelScrollHandler,true);var scrollbars=this._scrollbars;var c=scrollbars.length;for(var i=0;i<c;++i)
{scrollbars[i].setScrollArea(null);}}
IWScrollArea.prototype.refresh=function()
{this.viewHeight=this.content.offsetHeight;this.viewWidth=this.content.offsetWidth;if(this.content.scrollHeight>this.viewHeight)
{this.viewToContentHeightRatio=this.viewHeight/this.content.scrollHeight;this.verticalScrollTo(this.content.scrollTop);}
else
{this.viewToContentHeightRatio=1.0;this.verticalScrollTo(0);}
if(this.content.scrollWidth>this.viewWidth)
{this.viewToContentWidthRatio=this.viewWidth/this.content.scrollWidth;this.horizontalScrollTo(this.content.scrollLeft);}
else
{this.viewToContentWidthRatio=1.0;this.horizontalScrollTo(0);}
var scrollbars=this._scrollbars;var c=scrollbars.length;for(var i=0;i<c;++i)
{scrollbars[i].refresh();}}
IWScrollArea.prototype.focus=function()
{Event.observe(document,"keypress",this._keyPressedHandler,true);}
IWScrollArea.prototype.blur=function()
{Event.stopObserving(document,"keypress",this._keyPressedHandler,true);}
IWScrollArea.prototype.reveal=function(element)
{var offsetY=0;var obj=element;do
{offsetY+=obj.offsetTop;obj=obj.offsetParent;}while(obj&&obj!=this.content);var offsetX=0;obj=element;do
{offsetX+=obj.offsetLeft;obj=obj.offsetParent;}while(obj&&obj!=this.content);this.verticalScrollTo(offsetY);this.horizontalScrollTo(offsetX);}
IWScrollArea.prototype.verticalScrollTo=function(new_content_top)
{if(!this.scrollsVertically)
return;var bottom=this.content.scrollHeight-this.viewHeight;if(new_content_top<0)
{new_content_top=0;}
else if(new_content_top>bottom)
{new_content_top=bottom;}
this.content.scrollTop=new_content_top;var scrollbars=this._scrollbars;var c=scrollbars.length;for(var i=0;i<c;++i)
{scrollbars[i].verticalHasScrolled();}}
IWScrollArea.prototype.horizontalScrollTo=function(new_content_left)
{if(!this.scrollsHorizontally)
return;var right=this.content_width-this.viewWidth;if(new_content_left<0)
{new_content_left=0;}
else if(new_content_left>right)
{new_content_left=right;}
this.content.scrollLeft=new_content_left;var scrollbars=this._scrollbars;var c=scrollbars.length;for(var i=0;i<c;++i)
{scrollbars[i].horizontalHasScrolled();}}
IWScrollArea.prototype.keyPressed=function(event)
{var handled=true;if(event.altKey)
return;if(event.shiftKey)
return;switch(event.keyIdentifier)
{case"Home":this.verticalScrollTo(0);break;case"End":this.verticalScrollTo(this.content.scrollHeight-this.viewHeight);break;case"Up":this.verticalScrollTo(this.content.scrollTop-this.singlepressScrollPixels);break;case"Down":this.verticalScrollTo(this.content.scrollTop+this.singlepressScrollPixels);break;case"PageUp":this.verticalScrollTo(this.content.scrollTop-this.viewHeight);break;case"PageDown":this.verticalScrollTo(this.content.scrollTop+this.viewHeight);break;case"Left":this.horizontalScrollTo(this.content.scrollLeft-this.singlepressScrollPixels);break;case"Right":this.horizontalScrollTo(this.content.scrollLeft+this.singlepressScrollPixels);break;default:handled=false;}
if(handled)
{event.stopPropagation();event.preventDefault();}}
IWScrollArea.prototype.mousewheelScroll=function(event)
{var deltaScroll=event.wheelDelta?(event.wheelDelta/120*this.singlepressScrollPixels):(event.detail/-2*this.singlepressScrollPixels);this.verticalScrollTo(this.content.scrollTop-deltaScroll);event.stopPropagation();event.preventDefault();}
var View=Class.create({initialize:function(widget,parentDiv)
{this.m_widget=widget;this.m_parentDiv=parentDiv;this.m_divInstanceId=this.m_divId;this.hide();},ensureDiv:function()
{var div=this.m_widget.div(this.m_divInstanceId);if(!div)
{div=new Element('div',{'id':this.m_widget.getInstanceId(this.m_divInstanceId)});div.addClassName(this.m_divClass);this.m_parentDiv.appendChild(div);}
return $(div);},hide:function()
{this.ensureDiv().hide();},show:function()
{this.ensureDiv().show();},render:function()
{},resize:function()
{}});var StatusView=Class.create(View,{initialize:function($super,widget,parentDiv)
{$super(widget,parentDiv);this.render();this.hide();},render:function()
{var markup="<table class='StatusMessageTable'><tr><td>";if(this.badgeImage)
{markup+=imgMarkup(this.m_widget.widgetPath+"/"+this.badgeImage,"","id='"+this.p_badgeImgId()+"'","");}
markup+="</td></tr></table>";if(this.upperRightBadgeWidth&&this.upperRightBadgeHeight)
{var badgeURL=(this.upperRightBadge)?(this.m_widget.widgetPath+"/"+this.upperRightBadge):transparentGifURL();markup+=imgMarkup(badgeURL,"","class='StatusUpperRightBadge' width='"+this.upperRightBadgeWidth+"' height='"+this.upperRightBadgeHeight+"' ","");}
var overlayPath=this.m_widget.sharedPath.stringByAppendingPathComponent("Translucent-Overlay.png");markup+=imgMarkup(overlayPath,"position: absolute; top: 0; left: 0;","id='"+this.p_overlayImgId()+"' width='700' height='286' ","");if(this.statusMessageKey)
{markup+="<div id='"+this.p_statusMessageBlockId()+"' class='StatusMessageBlock' ><span>"+
this.m_widget.localizedString(this.statusMessageKey)+"</span></div>";}
this.ensureDiv().update(markup);this.resize();},resize:function()
{var widgetWidth=(this.runningInApp)?window.innerWidth:this.m_widget.div().offsetWidth;var widgetHeight=(this.runningInApp)?window.innerHeight:this.m_widget.div().offsetHeight;if(this.badgeImage)
{var badgeImageEl=$(this.p_badgeImgId());var badgeSize=new IWSize(this.badgeImageWidth,this.badgeImageHeight);if((badgeSize.width>widgetWidth)||(badgeSize.height>widgetHeight))
{var widgetSize=new IWSize(widgetWidth,widgetHeight);badgeSize=badgeSize.scaleToFit(widgetSize);}
badgeImageEl.width=badgeSize.width;badgeImageEl.height=badgeSize.height;}
var overlayNativeWidth=700;var overlayNativeHeight=286;var overlayWidth=Math.max(widgetWidth,overlayNativeWidth);var overlayHeight=overlayNativeHeight;var overlayTop=Math.min(((widgetHeight/2)-overlayNativeHeight),0);var overlayLeft=Math.min(((widgetWidth/2)-(overlayNativeWidth/2)),0);var overlayImage=$(this.p_overlayImgId());overlayImage.width=overlayWidth;overlayImage.height=overlayHeight;overlayImage.setStyle({left:px(overlayLeft),top:px(overlayTop)});var statusMessageBlock=$(this.p_statusMessageBlockId());if(statusMessageBlock)
{var leftValue=px(Math.max(((widgetWidth-statusMessageBlock.offsetWidth)/2),0));var positionStyles={left:leftValue};if(this.statusMessageVerticallyCentered)
{var topValue=px(Math.max(((widgetHeight-statusMessageBlock.offsetHeight)/2),0));positionStyles.top=topValue;}
statusMessageBlock.setStyle(positionStyles);}
if(this.footerView)
{this.footerView.resize();}},doneFadingIn:function()
{this.m_widget.setPreferenceForKey(true,"x-viewDoneFadingIn",false);},p_badgeImgId:function()
{return this.m_widget.getInstanceId(this.m_divId+"-badge");},p_overlayImgId:function()
{return this.m_widget.getInstanceId(this.m_divId+"-overlay");},p_statusMessageBlockId:function()
{return this.m_widget.getInstanceId(this.m_divId+"-messageBlock");}});

View File

@@ -0,0 +1,171 @@
////////////////////////////////////////////////////////////////////////////////
//
// iWeb - iWPopUpSlideshow.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
////////////////////////////////////////////////////////////////////////////////
var slideWidth;var slideHeight;var frameHeight;var frameWidth;var scroller;var slideshow;var thumbnails;var hud;var thumbMatte=89;var pickerHeight=100;var browser;var baseURL="http://www.me.com/1/slideshow/";var windowWidth=800;var windowHeight=800;function initSlideshow(imageStream,index,parameters){browser=new BrowserDetectLite();if(checkBrowser())
{alphaRules();if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientHeight)
{windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}
else if(self.innerWidth&&self.innerHeight)
{windowWidth=self.innerWidth;windowHeight=self.innerHeight;}
else if(document.body&&document.body.clientWidth&&document.body.clientHeight)
{windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
slideWidth=windowWidth-200;slideHeight=windowHeight-290;frameHeight=slideHeight+50;frameWidth=slideWidth-20;var frame=appendDiv(document.body,'frame',frameWidth,frameHeight);var frameTop=Math.max(Math.round((windowHeight-frameHeight)/2),0);frame.style.marginTop=frameTop+'px';var slideMatte=appendDiv(frame,'matte',slideWidth,frameHeight);slideMatte.style.marginLeft=Math.round((frameWidth-slideWidth)/2)+"px";slideMatte.style.marginRight=Math.round((frameWidth-slideWidth)/2)+"px";var photos=[];for(var i=0;i<imageStream.length;++i)
{photos.push(imageStream[i].slideshowValue("image"));}
function onchange(index)
{selectThumb(index);}
parameters.movieMode=kAutoplayMovie;slideshow=new Slideshow(slideMatte,photos,onchange,parameters);if(parameters.hasOwnProperty("transitionIndex"))
{slideshow.setTransitionIndex(parameters.transitionIndex,0);}
initControls();var initThumbFade=function(){thumbnails.fadeHandler=null;thumbnails.fade(0.80,0,4000);};var initControlFade=function(){hud.fadeHandler=null;hud.fade(0.80,0,4000);};initThumbnailPicker(index!=null?index:0,imageStream);thumbnails.fadeHandler=setTimeout(initThumbFade,1000);hud.fadeHandler=setTimeout(initControlFade,1000);slideshow.playHandler=setTimeout(beginPlay.bind(null,index),0);addEvent(document,'onkeydown',arrowKeyDown,true);addEvent(document,'onkeyup',arrowKeyUp,true);}}
function beginPlay(index)
{clearInterval(slideshow.playHandler);slideshow.playHandler=null;if(index!=null&&index>0)
{slideshow.paused=false;slideshow.showPhotoNumber(index,true);}
else
{slideshow.start();}}
function initThumbnailPicker(startPoint,imageStream)
{var thumbnailZone=appendDiv(document.body,'thumbnailZone');var thumbnailPicker=appendDiv(thumbnailZone,'thumbnailPicker');var thumbStrip=appendDiv(thumbnailPicker,'thumbStrip');var pickerWidth=Math.min((imageStream.length*89)+2,frameWidth);thumbnailZone.style.width=windowWidth+"px";thumbnailZone.style.height=pickerHeight+25+"px";thumbnailZone.style.top="10px";thumbnailPicker.style.width=pickerWidth+"px";thumbnailPicker.style.height=pickerHeight+"px";thumbnailPicker.style.left=Math.round((windowWidth-pickerWidth)/2)+"px";thumbStrip.style.left='0px';$(thumbnailPicker).setOpacity(thumbnailPicker,0.8);addEvent(thumbnailZone,'onmouseover',thumbnailFadeIn,false);addEvent(thumbnailZone,'onmouseout',thumbnailFadeOut,false);var results=generateThumbs(imageStream);selectThumb(startPoint);initScroller(startPoint);thumbnails=new hoverControls('thumbnailPicker');}
function initControls(){var controlZone=appendDiv(document.body,'controlZone');var controls=appendDiv(controlZone,'controls');var backButton;var forwardButton;var playButton;var pauseButton;var frameTop=Math.max(Math.round((windowHeight-frameHeight)/2),0);controlZone.style.top=frameTop+frameHeight+"px";if($('matte').style.marginLeft){controls.style.left=Math.round((windowWidth-177)/2)+parseInt($('matte').style.marginLeft,10)+"px";}else{controls.style.left=Math.round((windowWidth-177)/2)+parseInt($('matte').offsetLeft,10)+"px";}
if(browser.supportsPNGs){backButton=appendImage(controls,baseURL+'images/arrow_left.png','backbutton');playButton=appendImage(controls,baseURL+'images/play.png','playbutton',null,null,true);pauseButton=appendImage(controls,baseURL+'images/pause.png','pausebutton');forwardButton=appendImage(controls,baseURL+'images/arrow_right.png','forwardbutton');}else{controls.style.background='url('+baseURL+'images/controls.gif) center center no-repeat';backButton=appendImage(controls,baseURL+'images/arrow_left.gif','backbutton');playButton=appendImage(controls,baseURL+'images/play.gif','playbutton',null,null,true);pauseButton=appendImage(controls,baseURL+'images/pause.gif','pausebutton');forwardButton=appendImage(controls,baseURL+'images/arrow_right.gif','forwardbutton');}
$(controls).setOpacity(0.8);addEvent(backButton,'onmousedown',backClick,false);addEvent(backButton,'onmouseup',previous,false);addEvent(playButton,'onmousedown',playClick,false);addEvent(playButton,'onmouseup',restart,false);addEvent(pauseButton,'onmousedown',pauseClick,false);addEvent(pauseButton,'onmouseup',stop,false);addEvent(forwardButton,'onmousedown',forwardClick,false);addEvent(forwardButton,'onmouseup',next,false);addEvent(controlZone,'onmouseover',hudFadeIn);addEvent(controlZone,'onmouseout',hudFadeOut);hud=new hoverControls('controls');}
function selectThumb(index)
{var thumbPicker=$('thumbStrip');var thumbs=thumbPicker.select('img');for(var i=0;i<thumbs.length;++i)
{var thumb=thumbs[i];var className=(i==index)?'selectedthumb':'thumb';if(thumb.className!=className)
{thumb.className=className;}}}
var thumbWidth=69;var thumbHeight=69;function thumbnailLoaded(thumbnail,index)
{var thumbPicker=$('thumbStrip');var thumbPickerPlaceholder=$('thumb'+index);if(thumbPickerPlaceholder)
{var naturalSize=thumbnail.naturalSize();var imageScale=thumbWidth/naturalSize.width<thumbHeight/naturalSize.height?thumbWidth/naturalSize.width:thumbHeight/naturalSize.height;var scaledWidth=naturalSize.width*imageScale;var scaledHeight=naturalSize.height*imageScale;var horizontalMargin=px(Math.round((thumbWidth-scaledWidth)/2)+7);var verticalMargin=px(Math.round((thumbHeight-scaledHeight)/2));thumbPickerPlaceholder.width=scaledWidth;thumbPickerPlaceholder.height=scaledHeight;thumbPickerPlaceholder.setStyle({margin:verticalMargin+" "+horizontalMargin});thumbPickerPlaceholder.src=thumbnail.sourceURL();}
else
{setTimeout(thumbnailLoaded.bind(null,thumbnail,index),100);}}
function generateThumbs(imageStream)
{var thumbPicker=$('thumbStrip');thumbPicker.style.width=(imageStream.length*89)+"px";var markup="";for(var i=0,len=imageStream.length;i<len;++i)
{markup+='<img width="'+thumbWidth+'" height="'+thumbHeight+'" id="thumb'+i+'" style="margin: 0 7px" onclick="selectThumb('+i+'); slideshow.showPhotoNumber('+i+', true);" onfocus="blur()">';}
thumbPicker.innerHTML=markup;var index=0;$A(imageStream).invoke('micro').each(function(thumbnail){thumbnail.load(thumbnailLoaded.bind(null,thumbnail,index),index>=10);index++;});return true;}
function initScroller(startPoint){var thumbZone=$('thumbnailPicker');var scrollbar=appendDiv(thumbZone,"scrollbar");scrollbar.style.top="84px";scrollbar.style.left=0;scrollbar.style.width=thumbZone.getWidth()-2+"px";scrollbar.style.height="15px";var bar=appendDiv(scrollbar,"bar");bar.style.top=0;bar.style.left=0;bar.style.width="100%";bar.style.height="13px";var dragTool=appendDiv(scrollbar,"dragtool");dragTool.style.top="1px";dragTool.style.left=0;dragTool.style.width="26px";dragTool.style.height="13px";dragTool=$(appendImage(dragTool,'http://www.me.com/1/slideshow/images/dragger.gif',null,24,13));dragTool.setStyle({margin:'0 1px'});var ruler=appendDiv(scrollbar,"ruler");ruler.style.top=0;ruler.style.left=0;scroller=new Scroller();if(startPoint!=null){scroller.jumpTo(startPoint);}
if(browser.isIE6x&&browser.isWin){scrollbar.style.top=parseInt(scrollbar.style.top,10)-2+'px';bar.style.height=parseInt(bar.style.height,10)+2+'px';scrollbar.style.width=parseInt(scrollbar.style.width,10)+2+'px';}else if(browser.isSafariJaguar){bar.style.width=$('thumbnailPicker').getWidth()-3+'px';}}
function checkBrowser(){var languageinfo=getLanguage();if(browser.isSafari||browser.isFirefox1up||browser.isNS7up||browser.isIE55up||browser.isCamino){return true;}else if(getCookie('browsewarning')=='true'){return true;}else{setCookie('browsewarning','true');setCookie('continue',window.location.href);switch(languageinfo){case'de':window.location=baseURL+'messaging/4/browser_req.html';break;case'fr':window.location=baseURL+'messaging/3/browser_req.html';break;case'ja':window.location=baseURL+'messaging/2/browser_req.html';break;default:window.location=baseURL+'messaging/1/browser_req.html';}
return false;}}
function thumbnailFadeIn(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseEnter($('thumbnailZone'),evt)){if(!thumbnails.holdFade){scroller.jumpTo(slideshow.currentPhotoNumber);slideshow.pause();thumbnails.fade(0.90,0.90,0);}}}catch(e){}}
function thumbnailFadeOut(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseLeave($('thumbnailZone'),evt)){if(!thumbnails.holdFade){thumbnails.fade(0.30,0,2000);if(slideshow.playHandler===null){slideshow.resume();}}}}catch(e){}}
function hudFadeIn(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseEnter($('controlZone'),evt)){hud.fade(0.80,0.80,0);}}catch(e){}}
function hudFadeOut(evt){try{evt=(evt)?evt:((window.event)?window.event:"");if(checkMouseLeave($('controlZone'),evt)&&$(controls).getOpacity()>0.05){hud.fade(0.40,0,2000);if(slideshow.playHandler===null){slideshow.resume();}}}catch(e){}}
function stop(){slideshow.pause();slideshow.playHandler=-1;$('playbutton').style.display='';$('pausebutton').src=browser.supportsPNGs?baseURL+'images/pause.png':baseURL+'images/pause.gif';$('pausebutton').style.display='none';return false;}
function pauseClick(){$('pausebutton').src=browser.supportsPNGs?baseURL+'images/pause_on.png':baseURL+'images/pause_on.gif';return false;}
function restart(){slideshow.playHandler=null;$('pausebutton').style.display='';$('playbutton').src=browser.supportsPNGs?baseURL+'images/play.png':baseURL+'images/play.gif';$('playbutton').style.display='none';if($('controls').getOpacity()>0.05)
{hud.fade(0.90,0,5000);}
slideshow.playHandler=setTimeout(function(){slideshow.resume();},1500);}
function playClick(){$('playbutton').src=browser.supportsPNGs?baseURL+'images/play_on.png':baseURL+'images/play_on.gif';return false;}
function forwardClick(){$('forwardbutton').src=browser.supportsPNGs?baseURL+'images/arrow_right_on.png':baseURL+'images/arrow_right_on.gif';return false;}
function next(){$('forwardbutton').src=browser.supportsPNGs?baseURL+'images/arrow_right.png':baseURL+'images/arrow_right.gif';slideshow.advance();return false;}
function backClick(){$('backbutton').src=browser.supportsPNGs?baseURL+'images/arrow_left_on.png':baseURL+'images/arrow_left_on.gif';return false;}
function previous(){$('backbutton').src=browser.supportsPNGs?baseURL+'images/arrow_left.png':baseURL+'images/arrow_left.gif';slideshow.goBack();return false;}
function arrowKeyDown(evt){evt=(evt)?evt:((window.event)?window.event:"");var keyCode=evt.which?evt.which:evt.keyCode;switch(keyCode){case 39:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
forwardClick();break;case 34:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
forwardClick();break;case 37:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
backClick();break;case 33:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
backClick();break;case 32:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
if(slideshow.playHandler==-1){playClick();}else{pauseClick();}
break;}
if((slideshow.photos.length*thumbMatte)>(scroller.getContentClipW()-scroller.getContentL())){scroller.jumpTo(slideshow.currentPhotoNumber,'left');}else if((slideshow.photos.length*thumbMatte)<-scroller.getContentL()){scroller.jumpTo(slideshow.currentPhotoNumber,'right');}}
function arrowKeyUp(evt){evt=(evt)?evt:((window.event)?window.event:"");var keyCode=evt.which?evt.which:evt.keyCode;switch(keyCode){case 39:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
next();break;case 34:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
next();break;case 37:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
previous();break;case 33:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
previous();break;case 32:evt.cancelBubble=true;if(evt.stopPropagation){evt.stopPropagation();}
if(slideshow.playHandler==-1){restart();}else{stop();}
break;case 36:slideshow.pause();slideshow.resetSlideshow(0);if(slideshow.playHandler!=-1){slideshow.play();}
break;case 35:slideshow.pause();slideshow.resetSlideshow(slideshow.photos.length-1);if(slideshow.playHandler!=-1){slideshow.play();}
break;}
if((slideshow.currentPhotoNumber*thumbMatte)>(scroller.getContentClipW()-scroller.getContentL())){scroller.jumpTo(slideshow.currentPhotoNumber,'left');}else if((slideshow.currentPhotoNumber*thumbMatte)<-scroller.getContentL()){scroller.jumpTo(slideshow.currentPhotoNumber,'right');}}
function heightOffset(browser){if(browser.isIE5xMac){return 15;}else if(browser.isSafari){return 23;}else if(browser.isFirefox&&browser.isWin){return 25;}else if(browser.isNS6up&&browser.isWin){return 30;}else if(browser.isCamino){return 40;}else if(browser.isMozilla){return 42;}else if(browser.isIEWin){return 49;}else{return 0;}}
function widthOffset(browser){if(browser.isIE5xMac){return 5;}else{return 0;}}
function BrowserDetectLite(){var ua=navigator.userAgent.toLowerCase();this.ua=ua;this.isGecko=(ua.indexOf('gecko')!=-1);this.isMozilla=(this.isGecko&&ua.indexOf("gecko/")+14==ua.length);this.isFirefox=(this.isGecko&&ua.indexOf("firefox")!=-1);this.isCamino=(this.isGecko&&ua.indexOf("camino")!=-1);this.isSafari=(this.isGecko&&ua.indexOf("safari")!=-1);this.isNS=((this.isGecko)?(ua.indexOf('netscape')!=-1):((ua.indexOf('mozilla')!=-1)&&(ua.indexOf('spoofer')==-1)&&(ua.indexOf('compatible')==-1)&&(ua.indexOf('opera')==-1)&&(ua.indexOf('webtv')==-1)&&(ua.indexOf('hotjava')==-1)));this.isIE=((ua.indexOf("msie")!=-1)&&(ua.indexOf("opera")==-1)&&(ua.indexOf("webtv")==-1));this.isOpera=(ua.indexOf("opera")!=-1);this.isKonqueror=(ua.indexOf("konqueror")!=-1);this.isIcab=(ua.indexOf("icab")!=-1);this.isAol=(ua.indexOf("aol")!=-1);this.isWebtv=(ua.indexOf("webtv")!=-1);this.isOmniweb=(ua.indexOf("omniweb")!=-1);this.isDreamcast=(ua.indexOf("dreamcast")!=-1);this.isIECompatible=((ua.indexOf("msie")!=-1)&&!this.isIE);this.isNSCompatible=((ua.indexOf("mozilla")!=-1)&&!this.isNS&&!this.isMozilla);this.versionMinor=parseFloat(navigator.appVersion);if(this.isNS&&this.isGecko){this.versionMinor=parseFloat(ua.substring(ua.lastIndexOf('/')+1));}
else if(this.isFirefox){this.versionMinor=parseFloat(ua.substring(ua.lastIndexOf('/')+1));}
else if(this.isSafari){this.versionMinor=parseFloat(ua.substring(ua.lastIndexOf('/')+1));}
else if(this.isIE&&this.versionMinor>=4){this.versionMinor=parseFloat(ua.substring(ua.indexOf('msie ')+5));}
else if(this.isOpera){if(ua.indexOf('opera/')!=-1){this.versionMinor=parseFloat(ua.substring(ua.indexOf('opera/')+6));}
else{this.versionMinor=parseFloat(ua.substring(ua.indexOf('opera ')+6));}}
else if(this.isKonqueror){this.versionMinor=parseFloat(ua.substring(ua.indexOf('konqueror/')+10));}
else if(this.isIcab){if(ua.indexOf('icab/')!=-1){this.versionMinor=parseFloat(ua.substring(ua.indexOf('icab/')+6));}
else{this.versionMinor=parseFloat(ua.substring(ua.indexOf('icab ')+6));}}
else if(this.isWebtv){this.versionMinor=parseFloat(ua.substring(ua.indexOf('webtv/')+6));}
this.versionMajor=parseInt(this.versionMinor,10);this.geckoVersion=((this.isGecko)?ua.substring((ua.lastIndexOf('gecko/')+6),(ua.lastIndexOf('gecko/')+14)):-1);this.isWin=(ua.indexOf('win')!=-1);this.isWin32=(this.isWin&&(ua.indexOf('95')!=-1||ua.indexOf('98')!=-1||ua.indexOf('nt')!=-1||ua.indexOf('win32')!=-1||ua.indexOf('32bit')!=-1));this.isMac=(ua.indexOf('mac')!=-1);this.isUnix=(ua.indexOf('unix')!=-1||ua.indexOf('linux')!=-1||ua.indexOf('sunos')!=-1||ua.indexOf('bsd')!=-1||ua.indexOf('x11')!=-1);this.isNS4below=(this.isNS&&this.versionMajor<=4);this.isNS4x=(this.isNS&&this.versionMajor==4);this.isNS40x=(this.isNS4x&&this.versionMinor<4.5);this.isNS47x=(this.isNS4x&&this.versionMinor>=4.7);this.isNS4up=(this.isNS&&this.versionMinor>=4);this.isNS6x=(this.isNS&&this.versionMajor==6);this.isNS6up=(this.isNS&&this.versionMajor>=6);this.isNS7up=(this.isNS&&this.versionMajor>=7);this.isIEWin=(this.isIE&this.isWin);this.isIE4below=(this.isIE&&this.versionMajor<=4);this.isIE4x=(this.isIE&&this.versionMajor==4);this.isIE4up=(this.isIE&&this.versionMajor>=4);this.isIE5x=(this.isIE&&this.versionMajor==5);this.isIE55=(this.isIE&&this.versionMinor==5.5);this.isIE5up=(this.isIE&&this.versionMajor>=5);this.isIE55up=(this.isIE&&this.versionMinor>=5.5);this.isIE6x=(this.isIE&&this.versionMajor==6);this.isIE6up=(this.isIE&&this.versionMajor>=6);this.isIE7x=(this.isIE&&this.versionMajor==7);this.isIE7up=(this.isIE&&this.versionMajor>=7);this.isIE8x=(this.isIE&&this.versionMajor==8);this.isIE8up=(this.isIE&&this.versionMajor>=8);this.isSafariJaguar=(this.isSafari&&this.versionMajor<100);this.isFirefox1up=(this.isFirefox&&this.versionMinor>=1);this.isIE4xMac=(this.isIE4x&&this.isMac);this.isIE5xMac=(this.isIE5up&&this.isMac);this.supportsOnload=(!this.isOpera&&!this.isIcab&&!this.isIE4below&&!this.isNS4below);this.supportsPNGs=(!this.isIE||this.versionMajor>=8);}
function getLanguage(){var languageInfo;languageInfo=navigator.language?navigator.language:(navigator.userLanguage?navigator.userLanguage:"");if(languageInfo.indexOf('-')>-1){languageInfo=languageInfo.substr(0,2);}
return languageInfo;}
function alphaRules(){if(browser===null){browser=new BrowserDetectLite();}
if(browser.isWin&&browser.isIE){document.styleSheets[0].addRule("img","filter: alpha(opacity=100)",0);}}
function appendDiv(parentObj,divId,width,height,makeInvisible){var divObj=document.createElement('div');if(width!=null){divObj.style.width=width+'px';}
if(height!=null){divObj.style.height=height+'px';}
if(makeInvisible){divObj.style.display='none';}
divObj=parentObj.appendChild(divObj);if(divId!=null){divObj.setAttribute('id',divId);}
return divObj;}
function appendImage(parentObj,src,imgId,width,height,makeInvisible){var imgObj=document.createElement('img');imgObj.src=src;if(width!=null){imgObj.style.width=width+'px';}
if(height!=null){imgObj.style.height=height+'px';}
if(makeInvisible){imgObj.style.display='none';}
imgObj=parentObj.appendChild(imgObj);if(imgId!=null){imgObj.setAttribute('id',imgId);}
return imgObj;}
function addEvent(object,event,functionName,capture)
{if(object.addEventListener)
{event=event.length>2?event.substring(2):event;capture=capture?capture:false;object.addEventListener(event,functionName,capture);}
else if(object.attachEvent)
{object.attachEvent(event,functionName);}
else
{try
{object.setAttribute(event,functionName);}
catch(e)
{}}}
function hoverControls(divId){this.timer=1;this.fadeHandler=null;this.divId=divId;this.start=null;this.end=null;this.holdFade=false;this.restartFade=false;var me=this;this.fade=function(start,end,ms)
{start=$(this.divId).getOpacity();if(this.animation)
{this.animation.stop();}
if(this.fadeHandler)
{clearInterval(this.fadeHandler);}
this.animation=new SimpleAnimation(function(){});this.animation.startOpacity=start;this.animation.endOpacity=end;this.animation.duration=ms;this.animation.pre=function()
{$(me.divId).setOpacity(this.startOpacity);}
this.animation.post=function()
{$(me.divId).setOpacity(this.endOpacity);}
this.animation.update=function(now)
{$(me.divId).setOpacity(this.startOpacity+now*(this.endOpacity-this.startOpacity));}
this.animation.start();}}
function Scroller(){var scrollW=$('thumbnailPicker').getWidth();var speed=4;var mouseY;var mouseX;var clickLeft=false;var clickRight=false;var clickDrag=false;var timer=setTimeout(function(){},500);var leftL;var leftT;var rightL;var rightT;var dragL;var dragT;var rulerL;var rulerT;var contentL;var contentW;var contentClipW;var scrollLength;var startX;var scrollbarOffset;var leftH;var leftW;var rightH;var rightW;var dragH;var dragW;var me=this;var eventLoader=function eventLoader(){scrollbarOffset=IWChildOffset($('scrollbar'),document.body);dragL=parseInt($('dragtool').style.left,10);dragT=parseInt($('dragtool').style.top,10);rulerT=parseInt($('ruler').style.top,10);rulerL=parseInt($('ruler').style.left,10);contentW=$('thumbStrip').getWidth();contentClipW=$('thumbnailPicker').getWidth();dragH=$('dragtool').getHeight();dragW=$('dragtool').getWidth();scrollLength=((scrollW-dragW)/(contentW-contentClipW));window.onresize=me.resetPosition;if(contentW<contentClipW){$('scrollbar').style.display='none';}
document.onmousedown=down;document.onmousemove=move;document.onmouseup=up;};this.resetPosition=function resetPosition(){scrollbarOffset=IWChildOffset($('scrollbar'),document.body);};var down=function down(e){getMouse(e);startX=(mouseX-dragL);if(mouseX>=leftL&&(mouseX<=(leftL+leftW))&&mouseY>=leftT&&(mouseY<=(leftT+leftH))){clickLeft=true;return me.scrollLeft();}
else if(mouseX>=rightL&&(mouseX<=(rightL+rightW))&&mouseY>=rightT&&(mouseY<=(rightT+rightH))){clickRight=true;return me.scrollRight();}
else if(mouseY>=dragT&&(mouseY<=(dragT+dragH+4))&&mouseX>=rulerL&&(mouseX<=(rulerL+scrollW))){clickDrag=true;if(thumbnails){thumbnails.holdFade=true;}
return move(e);}
else{return true;}};var move=function move(e){if(clickDrag&&contentW>contentClipW){getMouse(e);dragL=mouseX-(dragW/2);if(dragL<(rulerL)){dragL=rulerL;}
if(dragL>(rulerL+scrollW-dragW)){dragL=(rulerL+scrollW-dragW);}
contentL=-((dragL-rulerL)*(1/scrollLength));moveTo();return false;}};var up=function(e){clearTimeout(timer);clickLeft=false;clickRight=false;clickDrag=false;if(thumbnails&&thumbnails.holdFade){thumbnails.holdFade=false;getMouse(e);var thumbZone=$('thumbnailZone');var zoneOffset=IWChildOffset(thumbZone,document.body);var zoneR=zoneOffset.x+thumbZone.getWidth();var zoneB=zoneOffset.y+thumbZone.getHeight();if((mouseX+scrollbarOffset.x)>zoneOffset.x&&(mouseX+scrollbarOffset.x)<zoneR&&(mouseY+scrollbarOffset.y)>zoneOffset.y&&(mouseY+scrollbarOffset.y)<zoneB){}else{thumbnails.fade(0.30,0,2000);slideshow.resume();}}
return true;};var getL=function getL(){contentL=parseInt($('thumbStrip').style.left,10);};var getMouse=function getMouse(e){if(typeof scrollbarOffset=='undefined'||typeof rightOffset=='undefined'){me.resetPosition();}
if(typeof event!='undefined'){mouseY=event.clientY+document.body.scrollTop-scrollbarOffset.y;mouseX=event.clientX+document.body.scrollLeft-scrollbarOffset.x;}else{mouseY=e.pageY-scrollbarOffset.y;mouseX=e.pageX-scrollbarOffset.x;}};this.jumpTo=function jumpTo(slideCount,slidePosition){if(contentW>contentClipW){getL();if(slidePosition=='left'){contentL=(-slideCount*thumbMatte);}else if(slidePosition=='right'){contentL=(-slideCount*thumbMatte)+contentClipW;}else{contentL=Math.round((contentClipW/2)-(slideCount*thumbMatte)-(thumbMatte/2));}
if(contentL<scrollW-contentW){contentL=scrollW-contentW;}else if(contentL>0){contentL=0;}
dragL=contentL*(scrollW-dragW)/(scrollW-contentW);if(dragL<0){dragL=0;}
return moveTo();}else{return false;}};var moveTo=function moveTo(){$('thumbStrip').style.left=contentL+"px";$('dragtool').style.left=dragL+"px";$('ruler').style.left=dragL+"px";return true;};this.scrollLeft=function scrollLeft(){getL();if(clickLeft&&contentW>contentClipW){if(contentL<0){dragL=dragL-(speed*scrollLength);if(dragL<(rulerL))
{dragL=rulerL;}
contentL=contentL+speed;if(contentL>0)
{contentL=0;}
moveTo();timer=setTimeout(me.scrollLeft,25);}}
return false;};this.scrollRight=function scrollRight(){getL();if(clickRight&&contentW>contentClipW){if(contentL>-(contentW-contentClipW)){dragL=dragL+(speed*scrollLength);if(dragL>(rulerL+scrollW-dragH))
{dragL=(rulerL+scrollW-dragH);}
contentL=contentL-speed;if(contentL<-(contentW-contentClipW))
{contentL=-(contentW-contentClipW);}
moveTo();timer=setTimeout(me.scrollRight,25);}}
return false;};this.getContentL=function getContentL(){return contentL;};this.getContentW=function getContentW(){return contentW;};this.getContentClipL=function getContentClipL(){return contentClipL;};this.getContentClipW=function getContentClipW(){return contentClipW;};eventLoader();}
function isParent(container,containee){var isParentBool=false;while(!isParentBool&&containee){isParentBool=container==containee;containee=containee.parentNode;}
return isParentBool;}
function checkMouseEnter(element,evt){if(evt.fromElement){return!isParent(element,evt.fromElement);}
else if(evt.relatedTarget){return!isParent(element,evt.relatedTarget);}
else{return true;}}
function checkMouseLeave(element,evt){if(evt.toElement){return!isParent(element,evt.toElement);}
else if(evt.relatedTarget){return!isParent(element,evt.relatedTarget);}
else{return true;}}
function setCookie(c_name,value)
{document.cookie=c_name+"="+escape(value);}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=")
if(c_start!=-1)
{c_start=c_start+c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if(c_end==-1)c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))}}
return""}

344
no/Scripts/iWebDebug.js Normal file
View File

@@ -0,0 +1,344 @@
//
// iWeb - iWebDebug.js
// Copyright (c) 2007-2008 Apple Inc. All rights reserved.
//
var debugTabString=" ";var cEscapeMap={"\n":"\\n","\t":"\\t","\'":"\\''","\b":"\\b","\r":"\\r","\f":"\\f","\\":"\\\\"};var gPendingOutput="";function cEscape(s)
{var r="";for(var i=0;i<s.length;++i)
{var ch=s.charAt(i);var cc=s.charCodeAt(i);var cr=cEscapeMap[ch];if(cr!==undefined)
{ch=cr;}
else if(cc<0x20)
{r+=('\\'+cc.toString(8));}
else if(cc>0x7e)
{r+=('\\u'+('0000'+cc.toString(16)).slice(-4));}
else
{r+=ch;}}
return r;}
function cUnescape(s)
{throw Unimplemented;}
function convertTextForHTML(s)
{s=s.replace(/&/g,"&amp;");s=s.replace(/</g,"&lt;");s=s.replace(/\n/g,"<br/>");s=s.replace(/ /g,"&nbsp;");return s;}
function debugPrintDiv()
{var debugDiv=$("debugDiv");if(debugDiv===null)
{if(document.body!==null)
{debugDiv=$(document.createElement("div"));if(debugDiv)
{var debugDivWrapper=document.createElement("div");debugDivWrapper.id="debugDivWrapper";debugDiv.id="debugDiv";var debugDivClearButton=document.createElement("input");debugDivClearButton.title="Clear Debug Area";debugDivClearButton.value="Clear";debugDivClearButton.type="button";debugDivClearButton.onclick=debugClear;debugDiv.innerHTML=gPendingOutput;debugDivWrapper.appendChild(debugDivClearButton);debugDivWrapper.appendChild(debugDiv)
document.body.appendChild(debugDivWrapper);}}}
if(debugDiv&&debugDiv.initialized!=true)
{debugDiv.setStyle({textAlign:"left",zOrder:0,backgroundColor:"#ffff99",marginTop:"10px",opacity:"1.0",fontFamily:"Courier",fontSize:"10pt",border:"2px solid red"});debugDiv.initialized=true;}
return debugDiv;}
function debugRelocateDiv()
{var debugDiv=$("debugDiv");if(debugDiv!=null)
{debugDiv.parentNode.removeChild(debugDiv);document.body.appendChild(debugDiv);}}
function debugClear()
{var debugDiv=$("debugDiv");if(debugDiv)
{debugDiv.innerHTML="";}}
function debugPrintHtml(s)
{var debugDiv=debugPrintDiv();if(debugDiv)
{debugDiv.innerHTML=debugDiv.innerHTML+s;}
else
{gPendingOutput+=s+"<br/>";}}
var debugPrintUsesNSLog=true;function debugPrint(s)
{if(debugPrintUsesNSLog&&window.console&&window.console.NSLog)
{window.console.NSLog(s);}
else
{s=convertTextForHTML(String(s));var debugDiv=debugPrintDiv();if(debugDiv)
{debugDiv.innerHTML=debugDiv.innerHTML+s+"<br/>";}
else
{gPendingOutput+=s+"<br/>";}}}
function Undefined()
{}
Undefined.prototype.toString=function()
{return"undefined";}
function asObject(v)
{if(typeof v=="number")
{return Number(v);}
if(typeof v=="object")
{return v;}
if(typeof v=="string")
{return v;}
if(typeof v=="boolean")
{return Boolean(v);}
if(typeof v=="undefined")
{return new Undefined();}
debugPrint("### didn't wrap value of type "+typeof v);return null;}
function stringWithFormat()
{var result="";for(var i=0;i<arguments.length;++i)
{var arg=asObject(arguments[i]);var argString="null";if(arg!==null)
{if(arg===undefined)
{argString="<arg "+i+" undefined>";}
else
{if(arg.toString!==undefined)
{argString=arg.toString();}
else
{argString="<arg "+i+" does not define toString()>";}}}
var pos=result.indexOf("%s");if(pos>=0)
{result=result.substr(0,pos)+argString+result.substr(pos+"%s".length);}
else
{if(i>0)
{result+=" ";}
result+=argString;}}
return result;}
var trace=function(){};function print()
{debugPrint(stringWithFormat.apply(this,arguments));}
function valueTypeString(value)
{if(value===null)
{return"null";}
var valueType=typeof value;if(valueType=="object")
{if(value.constructor==Array)
{return"Array";}
if(value.constructor==Number)
{return"Number";}
if(value.constructor==String)
{return"String";}
return"Object";}
return valueType;}
function isObject(obj)
{return obj&&typeof obj=="object";}
function isArray(obj)
{return isObject(obj)&&obj.constructor==Array;}
function isArrayLike(obj)
{return isObject(obj)&&obj.constructor===undefined&&obj.length!==undefined&&obj.item!==undefined;}
function debugObjectToString(name,obj)
{var resultString="";if(arguments.length==1)
{obj=arguments[0];name="";}
else
{name+=" = ";}
if(obj===undefined)
{resultString+=stringWithFormat("%s(undefined)\n",name);}
else if(obj===null)
{resultString+=stringWithFormat("%snull\n",name);}
else if((obj.constructor)&&obj.constructor==Function)
{resultString+=stringWithFormat("%s(function)\n",name);}
else if(isArray(obj))
{resultString+=stringWithFormat("%sarray of %s %s [\n",name,obj.length,obj.length==1?"item":"items");for(var i=0;i<obj.length;++i)
{resultString+=stringWithFormat(" %s : %s,\n",i,debugValueToString(obj[i]));}
resultString+=stringWithFormat("]\n");}
else if(isArrayLike(obj))
{resultString+=stringWithFormat("%s'array' of %s %s [\n",name,obj.length,obj.length==1?"item":"items");for(var i=0;i<obj.length;++i)
{resultString+=stringWithFormat(" %s : %s,\n",i,debugValueToString(obj[i]));}
resultString+=stringWithFormat("]\n");}
else if(isObject(obj))
{resultString+=stringWithFormat("%sobject {\n",name);try
{var fieldWidth=0;var keys=$H(obj).keys().sort();$A(keys).each(function(key)
{fieldWidth=Math.max(fieldWidth,key.length);});$A(keys).each(function(key)
{var attr=key;attrStr=(attr+" ").substring(0,fieldWidth);try
{resultString+=stringWithFormat(" %s : %s\n",attrStr,debugValueToString(obj[attr]));}
catch(e)
{print(e);print(" !!!attr=",attr,"(type is %s)",typeof obj[attr]);}});}
catch(e)
{debugPrintException(e);print(" ## can't enumerate object contents. Might be IE 7.");}
resultString+=stringWithFormat("}\n");}
else
{resultString+=stringWithFormat("%s%s(%s)\n",name,valueTypeString(obj),debugValueToString(obj));}
return resultString;}
function debugPrintObject(name,obj)
{if(arguments.length==1)
{obj=arguments[0];name="";}
else
{name+=" = ";}
if(obj===undefined)
{print("%s(undefined)",name);}
else if(obj===null)
{print("%snull",name);}
else if((obj.constructor)&&obj.constructor==Function)
{print("%s(function)",name);}
else if(isArray(obj))
{print("%sarray of %s %s [",name,obj.length,obj.length==1?"item":"items");for(var i=0;i<obj.length;++i)
{print(" %s : %s,",i,debugValueToString(obj[i]));}
print("]");}
else if(isArrayLike(obj))
{print("%s'array' of %s %s [",name,obj.length,obj.length==1?"item":"items");for(var i=0;i<obj.length;++i)
{print(" %s : %s,",i,debugValueToString(obj[i]));}
print("]");}
else if(isObject(obj))
{print("%sobject {",name);try
{var fieldWidth=0;var keys=$H(obj).keys().sort();$A(keys).each(function(key)
{fieldWidth=Math.max(fieldWidth,key.length);});$A(keys).each(function(key)
{var attr=key;attrStr=(attr+" ").substring(0,fieldWidth);try
{print(" %s : %s",attrStr,debugValueToString(obj[attr]));}
catch(e)
{print(e);print(" !!!attr=",attr,"(type is %s)",typeof obj[attr]);}});}
catch(e)
{debugPrintException(e);print(" ## can't enumerate object contents. Might be IE 7.");}
print("}");}
else
{print("%s%s(%s)",name,valueTypeString(obj),debugValueToString(obj));}}
var printObject=debugPrintObject;function debugPrintException(e)
{print("# Exception: %s",e.name);print("# Message : %s",e.message);if(e.sourceURL)
{var file=e.sourceURL.match(/[^\/]*$/);if(file!==null)
{print("# File : %s, Line:%s",file[0],e.line);}}}
function indentHtmlString(s)
{var r=debugTabString+s;r=r.replace(/<br\/>/g,"<br/>"+debugTabString);return r;}
function indentString(s)
{var r=debugTabString+s;r=r.replace(/\n/g,"\n"+debugTabString);return r;}
function debugValueToString(value,maxLength,parentStack,attributeStack,refs)
{var result="";var valueType=valueTypeString(value);if(arguments.length==1)
{maxLength=800;}
if(parentStack===undefined)
{parentStack=[];}
if(attributeStack===undefined)
{attributeStack=["this"];}
if(refs===undefined)
{refs={value:"this"};}
if(valueType=="null")
{result="null";}
else if(valueType=="function")
{result="(function)";}
else if(valueType=="undefined")
{result="(undefined)";}
else if(valueType=="Object")
{if(parentStack.length>2)
{result="...";}
else
{var first=true;var fieldWidth=0;var attrs=$H(value).keys().sort();$A(attrs).each(function(attr)
{fieldWidth=Math.max(fieldWidth,attr.length);});var newParentStack=parentStack.concat(value);$A(attrs).each(function(attr)
{var nextMaxLength=maxLength-result.length-2-(attr.length+2);var valueAttrString;var subValue=value[attr];if(typeof subValue!="function")
{if(!first)
{result=result+", ";}
first=false;if(typeof subValue=="object"&&newParentStack.contains(subValue))
{var index=$A(newParentStack).indexOf(value[attr]);valueAttrString="#cycle("+attributeStack[index]+")";}
else if(typeof subValue=="object"&&refs[subValue]!==undefined)
{valueAttrString="#ref("+refs[subValue]+")";}
else
{try
{var newAttributePath=attributeStack[attributeStack.length-1]+"."+attr;var newAttributeStack=attributeStack.concat(newAttributePath);refs[value[attr]]=newAttributePath;valueAttrString=debugValueToString(value[attr],nextMaxLength,newParentStack,newAttributeStack,refs);}
catch(e)
{valueAttrString="#exception";}}
var newResult=result+attr+": "+valueAttrString;if(newResult.length>maxLength)
{result+="...";}
else
{result=newResult;}}});}
result="{"+result+"}";}
else if(valueType=="Array")
{var arrayLength=value.length;for(var i=0;i<arrayLength;++i)
{if(i!==0)
{result=result+", ";}
var nextMaxLength=maxLength-result.length;var newResult=result+debugValueToString(value[i],nextMaxLength);if(newResult.length>maxLength)
{result+="...";break;}
result=newResult;}
result="["+result+"]";}
else if(valueType=="number")
{result=value.toString();}
else if(valueType=="boolean")
{result=value.toString();}
else if(valueType=="string")
{result='"'+value.toString()+'"';}
else
{result="(UNKNOWN TYPE: "+valueType+")";}
return result;}
var gFadeElement;var gFadeDelta=0;var gFadeTimeout=0;function nextFadeStep()
{var oldOpacity=(gFadeElement.style.opacity-0);if(((gFadeDelta>0)&&(oldOpacity<gFadeTarget))||((gFadeDelta<0)&&(oldOpacity>gFadeTarget)))
{var newOpacity=gFadeDelta+oldOpacity;gFadeElement.style.opacity=newOpacity;setTimeout(nextFadeStep,gFadeTimeout);}
else
{gFadeDelta=0;}}
function startFadeIn(element)
{if(gFadeDelta===0.0)
{setTimeout(nextFadeStep,gFadeTimeout);}
gFadeElement=element;gFadeTimeout=20;gFadeTarget=1.0;gFadeDelta=0.1;}
function startFadeOut(element)
{if(gFadeDelta===0.0)
{setTimeout(nextFadeStep,gFadeTimeout);}
gFadeElement=element;gFadeTimeout=20;gFadeTarget=0.0;gFadeDelta=-0.1;}
function onMouseOverDebugMenu()
{if(window.event.shiftKey)
{var debugMenu=$("debugMenu");debugMenu.setStyle({height:"",width:""});startFadeIn(debugMenu);}}
function documentResourceURL(ext)
{resourceUrl="";htmlUrl=document.URL;while((htmlUrl.length>0)&&(htmlUrl.slice(-5)!=".html"))
{htmlUrl=htmlUrl.slice(0,-1);}
if(htmlUrl.length>0)
{var components=htmlUrl.split("/");var filename=components.pop();filename=filename.slice(0,-5);var folderName=filename+"_files";components.push(folderName);components.push(filename+ext);resourceUrl=components.join("/");}
return resourceUrl;}
function showCSS()
{cssUrl=documentResourceURL(".css");if(cssUrl.length>0)
{window.open(cssUrl,"CSS");}}
function showJavaScript()
{cssUrl=documentResourceURL(".js");if(cssUrl.length>0)
{window.open(cssUrl,"JavaScript");}}
function closeDebugMenu()
{var debugMenu=$("debugMenu");debugMenu.setStyle({height:"10px",width:"10px"});startFadeOut(debugMenu);}
function dumpEntryData()
{var myEntryData="not defined";try{myEntryData=entryData;}catch(e){}
debugPrintObject(myEntryData);}
function dumpEntryURLs()
{var myEntryURLs="not defined";try{myEntryURLs=entryURLs;}catch(e){}
debugPrintObject(myEntryURLs);}
function jsEvalClick()
{try
{var text=$("jstext").value;debugPrint(text);eval(text);}
catch(e)
{debugPrint("** Exception **");debugPrintObject(e);}}
function scriptNodes()
{var result=[];var body=document.body;debugPrint(body.tagName);var html=body.parentNode;debugPrint(html.tagName);var head=$$('head');for(var i=0;i<head.childNodes.length;++i)
{var node=head.childNodes[i];if(node.nodeName=="SCRIPT")
{result.push(node);}}
return result;}
function showAllScripts()
{var scripts=scriptNodes();var scriptUrls=[];for(var i=0;i<scripts.length;++i)
{if(scripts[i].src!=="")
{scriptUrls.push(scripts[i].src);}}
debugPrintHtml('<br/><b>Scripts used on this page:</b><br/>');for(i=0;i<scriptUrls.length;++i)
{url=scriptUrls[i];var s='<a href="%url%" target="code">%url%</a><br/>';s=s.replace(/%url%/g,url);debugPrintHtml(s);}}
var gVariables={};var gVariableCount=0;var gRenderItemCount=0;var gRootVariables=[];function addInspectorVariable(varName)
{gRootVariables.push(varName);renderInspector();}
function inspect(varName)
{addInspectorVariable(varName);}
function getVariableId(variable)
{for(v in gVariables)
{if(gVariables[v].object===variable)
{return v;}}
var vid="vid"+gVariableCount++;record={};record.object=variable;record.id=vid;record.open=false;record.showFunctions=false;gVariables[vid]=record;return vid;}
function clickItem(vid)
{gVariables[vid].open=!gVariables[vid].open;renderInspector();}
function toggleFuncs(vid)
{gVariables[vid].showFunctions=!gVariables[vid].showFunctions;renderInspector();}
function clickDelete(vid)
{for(var index in gRootVariables)
{if(gRootVariables[index]==vid)
{gRootVariables.splice(index,1);renderInspector();return;}}}
function makeControlSpan(vid,functionName,flag,onString,offString)
{var span=document.createElement("span");span.setAttribute("onclick",functionName+"('"+vid+"');");span.innerText=flag?onString:offString;return span;}
function renderInspectorItem(name,thing,parent,parentStack)
{gRenderItemCount++;var div=$(document.createElement("div"));div.setStyle({left:"30px",position:"relative"});var span=document.createElement("span");var text=" "+name+" = ";var vid;if(typeof thing=="object")
{if(thing.constructor==Array)
{text+="array["+thing.length+"] "+debugValueToString(thing);}
else
{text+="object "+debugValueToString(thing);}
vid=getVariableId(thing);span=makeControlSpan(vid,"clickItem",gVariables[vid].open,"-","+");}
else
{span.innerText="-";text+=debugValueToString(thing);}
var textNode=document.createTextNode(text);div.appendChild(span);div.appendChild(textNode);var closeSpan=null;if(gRootVariables.contains(name))
{closeSpan=makeControlSpan(name,"clickDelete",true,"[X]","[X]");div.appendChild(closeSpan);}
if(typeof thing=="object")
{if((gVariables[vid].open)&&!parentStack.contains(thing))
{var funcSpan=makeControlSpan(vid,"toggleFuncs",gVariables[vid].showFunctions,"[F]","[f]");div.insertBefore(funcSpan,closeSpan);try
{$H(thing).keys().sort().each(function(item)
{if((typeof thing[item]!="function")||(gVariables[vid].showFunctions))
{renderInspectorItem(item,thing[item],div,parentStack.concat(thing[item]));}});}
catch(e)
{}}}
parent.appendChild(div);}
function renderInspector()
{gRenderItemCount=0;var inspectorDiv=$("inspect");if(inspectorDiv===null)
{inspectorDiv=$(document.createElement("div"));inspectorDiv.id="inspect";inspectorDiv.setStyle({backgroundColor:"#d8d8d8",fontFamily:"Courier",fontSize:"10pt"});document.body.appendChild(inspectorDiv);}
while(inspectorDiv.childNodes.length>0)
{inspectorDiv.removeChild(inspectorDiv.childNodes[0]);}
var emptyArray=[];for(var index in gRootVariables)
{if(emptyArray[index]===undefined)
{var thing=eval(gRootVariables[index]);renderInspectorItem(gRootVariables[index],eval(gRootVariables[index]),inspectorDiv,[]);}}}
function evalOnKeyUp(e)
{if(e.keyIdentifier=="Enter")
{jsEvalClick();}}
function iWebDebugPanelInit()
{var headerLayer=document.body;var debugMenu=$(document.createElement("div"));debugMenu.id="debugMenu";debugMenu.setStyle({backgroundColor:"#ffff99",position:"fixed",left:0,top:0,width:"10px",height:"10px",padding:"10px",opacity:0,fontFamily:"Lucida Grande",fontSize:"10px",zIndex:100,overflow:"hidden",border:"1px solid black"});debugMenu.onmouseover=onMouseOverDebugMenu;headerLayer.appendChild(debugMenu);var myCommentsVersion="not defined";try{myCommentsVersion=commentJavascriptVersion;}catch(e){}
debugMenu.innerHTML="<b><u>JavaScript Debug Options</u></b>"+"<div style='float:right'><a href='#' onclick='closeDebugMenu();'>Close</a></div><br/>"+"<br/>"+"<a href='#' onclick='showCSS();'>Show Page CSS</a><br/>"+"<a href='#' onclick='showJavaScript();'>Show Page JavaScript</a><br/>"+"<a href='#' onclick='showAllScripts();'>List all scripts</a><br/>"+"<br/>"+"<a href='#' onclick='dumpEntryData();'>Show comment entryData</a><br/>"+"<a href='#' onclick='dumpEntryURLs();'>Show comment summaryData</a><br/>"+"<a href='#' onclick='debugClear();'>Clear debug output</a><br/>"+"<br/>"+"<textarea id='jstext' cols='40' rows='4'/>inspect(window);</textarea><br/>"+"<br/><hr/>"+"Comment js version: "+myCommentsVersion;var textArea=$('jstext');if(textArea)
{textArea.onkeyup=function(e)
{if(e.keyIdentifier=="Enter")
{try
{var text=$("jstext").value;debugPrintHtml(text.bold()+"<br/>");eval(text);}
catch(e)
{debugPrint("** Exception **");debugPrintObject(e);}
if(textArea.setSelectionRange)
{textArea.setSelectionRange(0,textArea.value.length);}
e.cancelBubble=true;}};}
renderInspector();}

339
no/Scripts/iWebImage.js Normal file
View File

@@ -0,0 +1,339 @@
//
// iWeb - iWebImage.js
// Copyright 2007-2008 Apple Inc.
// All rights reserved.
//
var IWAllImages={};var IWAllImageObjects={};function IWCreateImage(url)
{return IWAllImages[url]||new IWImage(url);}
var IWNamedImages={};function IWImageNamed(name)
{var url=IWNamedImages[name];return url?IWCreateImage(url):null}
function IWRegisterNamedImage(name,url)
{IWNamedImages[name]=url;}
var IWImageEnableUnload=isiPhone;var IWImage=Class.create({initialize:function(url)
{if(IWAllImages.hasOwnProperty(url))
{iWLog("warning -- use IWCreateImage rather than new IWImage and you'll get better performance");}
this.mPreventUnloading=0;this.mLoading=false;this.mLoaded=false;this.mURL=url;this.mCallbacks=[];IWAllImages[url]=this;},sourceURL:function()
{return this.mURL;},loaded:function()
{return this.mLoaded;},load:function(callback,delayCallbackIfLoaded)
{if(this.mLoaded&&(callback!=null))
{delayCallbackIfLoaded?setTimeout(callback,0):callback();}
else
{if(callback!=null)
{this.mCallbacks.push(callback);}
if(this.mLoading==false)
{this.mLoading=true;var img=new Image();IWAllImageObjects[this.sourceURL()]=img;img.onload=this.p_onload.bind(this);img.src=this.mURL;}}},unload:function(evenIfNotEnabled)
{if((evenIfNotEnabled||IWImageEnableUnload)&&this.mLoaded)
{if(this.mPreventUnloading<=0)
{this.mLoaded=false;this.mLoading=false;IWAllImageObjects[this.sourceURL()]=null;}
else
{this.mPreventedUnload=true;}}},preventUnloading:function()
{if(this.mPreventUnloading==0)
{this.mPreventedUnload=false;}
++this.mPreventUnloading;},allowUnloading:function()
{--this.mPreventUnloading;if(this.mPreventUnloading<=0&&this.mPreventedUnload)
{this.unload();}},naturalSize:function()
{(function(){return this.mNaturalSize!==undefined}).bind(this).assert();return this.mNaturalSize;},imgObject:function()
{return IWAllImageObjects[this.sourceURL()];},p_onload:function()
{this.preventUnloading();this.mLoaded=true;if(this.mNaturalSize===undefined)
{var imgObject=this.imgObject();(function(){return imgObject!==undefined}).assert();this.mNaturalSize=new IWSize(imgObject.width,imgObject.height);}
for(var i=0;i<this.mCallbacks.length;++i)
{this.mCallbacks[i]();}
this.mCallbacks=[];this.allowUnloading();},toString:function()
{return"IWImage("+this.mNaturalSize+", "+this.mURL+")";}});function IWCreateLoadingArea()
{if(IWSharedLoadingAreaManager==null)
{IWSharedLoadingAreaManager=new IWLoadingAreaManager();}
return IWSharedLoadingAreaManager.createLoadingArea();}
var IWLoadingAreaManager=Class.create({initialize:function()
{var div=$(document.createElement("div"));div.setStyle({visibility:"hidden",position:"absolute",width:0,height:0,overflow:"hidden"});document.body.appendChild(div);this.mCurrentLoadingArea=div;},createLoadingArea:function()
{var loadingArea=document.createElement('div');this.mCurrentLoadingArea.appendChild(loadingArea);return loadingArea;}});var IWSharedLoadingAreaManager=null;var IWSharedEffectRegistry=null;var allStyleSheetsLoaded=false;var timeStyleSheetsAppearedInDOM=null;function IWCreateEffectRegistry()
{if(IWSharedEffectRegistry==null)
{IWSharedEffectRegistry=new IWEffectRegistry();}
return IWSharedEffectRegistry;}
var IWEffectRegistry=Class.create({initialize:function()
{this.mEffects=null;},registerEffects:function(effects)
{this.mEffects=effects;},applyEffects:function()
{var effectQueue=[];effectQueue=effectQueue.concat(this.p_queueForEffectType("crop"));effectQueue=effectQueue.concat(this.p_queueForEffectType("stroke"));effectQueue=effectQueue.concat(this.p_queueForEffectType("reflection"));effectQueue=effectQueue.concat(this.p_queueForEffectType("shadow"));this.p_applyEffectsFromQueue(effectQueue);},p_queueForEffectType:function(effectType)
{var effectQueue=[];var i=0;var effectClass=effectType+"_"+i++;while(effect=this.mEffects[effectClass])
{effectQueue=effectQueue.concat(this.p_queueForEffectClass(effect,effectClass));effectClass=effectType+"_"+i++;}
return effectQueue;},p_queueForEffectClass:function(effect,effectClass,elementList)
{var effectQueue=[];var elements=elementList||$$("."+effectClass);while(elements&&elements.length>0)
{var element=elements.shift();var children=element.select("."+effectClass);if(children.length>0)
{elements=elements.minusArray(children);effectQueue=effectQueue.concat(this.p_queueForEffectClass(effect,effectClass,children));}
effectQueue.push({element:element,effect:effect});}
return effectQueue;},p_allStyleSheetsLoaded:function()
{if(isCamino||isFirefox)
{if(timeStyleSheetsAppearedInDOM!=null)
{duration=(new Date().getTime())-timeStyleSheetsAppearedInDOM;if(duration>100)
{allStyleSheetsLoaded=true;timeStyleSheetsAppearedInDOM=null;}}
else if(!allStyleSheetsLoaded)
{for(var i=0,sheetCount=document.styleSheets.length;i<sheetCount;i++)
{var styleSheet=document.styleSheets[i];if(styleSheet.href&&styleSheet.href.indexOf("Moz.css")!=-1)
{timeStyleSheetsAppearedInDOM=new Date().getTime();}}}}
else
{allStyleSheetsLoaded=true;}
return allStyleSheetsLoaded;},p_applyEffectsFromQueue:function(queue)
{var startTime=new Date().getTime();var duration=0;var readyToApplyEffects=this.p_allStyleSheetsLoaded();while(queue.length>0&&duration<100&&readyToApplyEffects)
{var queueEntry=queue.shift();if(queueEntry&&queueEntry.effect&&queueEntry.element)
{queueEntry.effect.applyToElement(queueEntry.element);}
duration=(new Date().getTime())-startTime;}
if(queue.length>0)
{setTimeout(this.p_applyEffectsFromQueue.bind(this,queue),0);}
else
{performPostEffectsFixups();}}});function IWChildOffset(child,parent,positionedOnly)
{var l=0;var t=0;if(parent)
{var current=child;while(current&&current!=parent)
{if(!positionedOnly||(current.style.position=="absolute")||(current.style.position=="relative"))
{l+=current.offsetLeft;t+=current.offsetTop;}
current=current.parentNode;}}
return new IWPoint(l,t);}
function IWImageExtents(ancestor,images,left,top,right,bottom)
{var unionedBounds=new IWRect(left,top,right-left,bottom-top);for(var e=0;e<images.length;++e)
{var imageClippedBounds=new IWRect(images[e].offsetLeft,images[e].offsetTop,images[e].offsetWidth,images[e].offsetHeight);if(ancestor)
{var current=images[e].parentNode;while(current&&current!=ancestor)
{if((current.style.position=="absolute")||(current.style.position=="relative"))
{imageClippedBounds.origin.x+=current.offsetLeft||0;imageClippedBounds.origin.y+=current.offsetTop||0;}
var testForHidden=function(str)
{return str=='hidden';};var clipX=[current.style.overflow,current.style.overflowX].any(testForHidden);var clipY=[current.style.overflow,current.style.overflowY].any(testForHidden);if(clipX||clipY)
{var currentRect=new IWRect(clipX?current.offsetLeft:imageClippedBounds.origin.x,clipY?current.offsetTop:imageClippedBounds.origin.y,clipX?current.offsetWidth:imageClippedBounds.size.width,clipY?current.offsetHeight:imageClippedBounds.size.height);imageClippedBounds=imageClippedBounds.intersection(currentRect);}
current=current.parentNode;}}
if((imageClippedBounds.size.width>0)&&(imageClippedBounds.size.height>0))
{if((unionedBounds.size.width>0)&&(unionedBounds.size.height>0))
{unionedBounds=unionedBounds.union(imageClippedBounds);}
else
{unionedBounds=imageClippedBounds.clone();}}}
var extents={left:unionedBounds.origin.x,top:unionedBounds.origin.y,right:unionedBounds.origin.x+unionedBounds.size.width,bottom:unionedBounds.origin.y+unionedBounds.size.height};return extents;}
function IWEffectChildren(element,imagesOnly)
{element=$(element);var inlineBlocks=element.select('.inline-block');return element.descendants().findAll(function(child){if((!imagesOnly&&child.match("div.badge-fill"))||child.match("img"))
{var inline=false;for(var index=0,end=inlineBlocks.length;inline==false&&index<end;++index)
{inline=child.descendantOf(inlineBlocks[index]);}
return inline==false;}
else
{return false;}});}
function IWClippingNode(node)
{if(node)
{if(node.style&&(node.style.overflow||node.style.overflowX||node.style.overflowY))
{if([node.style.overflow,node.style.overflowX,node.style.overflowY].include('hidden'))
return node;}
else
{return IWClippingNode(node.parentNode);}}
return null;}
var IWShadow=Class.create({initialize:function(params)
{this.mBlurRadius=params.blurRadius;this.mOffset=params.offset;this.mColor=params.color;this.mOpacity=params.opacity;},applyToElement:function(shadowed)
{var framePos=new IWPoint(shadowed.offsetLeft,shadowed.offsetTop);var frameSize=new IWSize(shadowed.offsetWidth,shadowed.offsetHeight);var opacity=1.0;if(shadowed!=null)
{shadowed=$(shadowed);opacity=shadowed.getStyle('opacity');if(windowsInternetExplorer)
{var newRoot=$(shadowed.cloneNode(false));shadowed.parentNode.insertBefore(newRoot,shadowed);var shadow=$(document.createElement('DIV'));var shadowContents=shadowed.cloneNodeExcludingIDs(true);shadow.appendChild(shadowContents);shadow.select('map').each(function(mapElement){mapElement.parentNode.removeChild(mapElement);});shadow.select(".IWReflection").invoke("remove");newRoot.appendChild(shadow);newRoot.appendChild(shadowed);shadowed.setStyle({top:0,left:0});var blurRadius=this.mBlurRadius*0.5;var xOffset=this.mOffset.x-(this.mBlurRadius*0.6);var yOffset=this.mOffset.y-(this.mBlurRadius*0.6);shadow.setStyle({position:"absolute",left:px(xOffset-500),top:px(yOffset-500),width:px(frameSize.width+1000),height:px(frameSize.height+1000)});shadowContents.setStyle({position:"absolute",left:px(500),top:px(500),padding:0,margin:0});shadow.style.filter="progid:DXImageTransform.Microsoft.MaskFilter()"+" progid:DXImageTransform.Microsoft.MaskFilter(color="+this.mColor+")"+" progid:DXImageTransform.Microsoft.Alpha(opacity="+this.mOpacity*opacity*100+")"+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+blurRadius+")";if(newRoot.hasClassName("inline-block"))
{var rootTop=newRoot.style.top;var rootMarginTop=newRoot.style.marginTop;if(rootTop&&!rootMarginTop)
{rootTop=(toPixelsAtElement(newRoot,rootTop,true));newRoot.style.marginTop=px(-rootTop);}
else if(!rootTop&&rootMarginTop)
{rootMarginTop=(toPixelsAtElement(newRoot,rootMarginTop,true));newRoot.style.rootTop=px(-rootMarginTop);}
else if(rootTop&&rootMarginTop)
{rootTop=(toPixelsAtElement(newRoot,rootTop,true));rootMarginTop=(toPixelsAtElement(newRoot,rootMarginTop,true));if(rootTop!=rootMarginTop)
{newRoot.style.rootTop=px(-rootMarginTop);}}}
if(shadowed.offsetTop!=0)
{var top=shadowed.style.top;top=top?(toPixelsAtElement(shadowed,top,true)):0;top-=shadowed.offsetTop;shadowed.style.top=px(top);}}
else
{var sourceElements=IWEffectChildren(shadowed,false);var extents=IWImageExtents(shadowed,sourceElements,0,0,frameSize.width,frameSize.height);var canvas=undefined;if(shadowed.sandwich&&shadowed.sandwich.canvas)
{canvas=shadowed.sandwich.canvas;}
extents.left-=Math.max(this.mBlurRadius-this.mOffset.x,0);extents.top-=Math.max(this.mBlurRadius-this.mOffset.y,0);extents.right+=Math.max(this.mBlurRadius+this.mOffset.x,0);extents.bottom+=Math.max(this.mBlurRadius+this.mOffset.y,0);extents.left=Math.floor(extents.left);extents.top=Math.floor(extents.top);extents.right=Math.ceil(extents.right);extents.bottom=Math.ceil(extents.bottom);var leftOffset=extents.left;var topOffset=extents.top;extents.right-=extents.left;extents.bottom-=extents.top;extents.left=0;extents.top=0;var width=extents.right-extents.left;var height=extents.bottom-extents.top;if(canvas===undefined)
{canvas=$(document.createElement("canvas"));}
var context=canvas.getContext?canvas.getContext("2d"):null;var canvasCanDrawShadow=context?context.shadowColor:false;if(canvasCanDrawShadow)
{$(canvas).setAttribute("width",width);$(canvas).setAttribute("height",height);$(canvas).setStyle({position:"absolute",top:px(topOffset),left:px(leftOffset)});var workingCanvas=undefined;if(shadowed.sandwich&&shadowed.sandwich.workingCanvas)
{workingCanvas=shadowed.sandwich.workingCanvas;}
if(workingCanvas===undefined)
{workingCanvas=canvas.cloneNode(false);}
var self=this;var sandwich=shadowed.sandwich||{};sandwich.loadedElements=[];sandwich.elementCount=sourceElements.length;sandwich.loadedElementCount=0;sandwich.canvas=canvas;sandwich.workingCanvas=workingCanvas;shadowed.sandwich=sandwich;sandwich.onImageLoad=function(j,img,image)
{var offset=IWChildOffset(img,shadowed,true);this.loadedElements[j]={imgObject:image.imgObject(),left:offset.x-leftOffset,top:offset.y-topOffset,width:img.offsetWidth,height:img.offsetHeight,render:function(context){context.drawImage(this.imgObject,this.left,this.top,this.width,this.height);}};this.loadedElementCount++;if(this.loadedElementCount==this.elementCount)
{this.renderShadow()}}
sandwich.registerDiv=function(j,div)
{var offset=IWChildOffset(div,shadowed,true);this.loadedElements[j]={divElement:div,left:offset.x-leftOffset,top:offset.y-topOffset,width:div.offsetWidth,height:div.offsetHeight,render:function(context){var div=this.divElement;var color=div.getStyle('background-color');var opacity=parseFloat(div.style.opacity||1);context.save();context.globalAlpha*=opacity;context.fillStyle=color;context.fillRect(this.left,this.top,this.width,this.height);context.restore();}};this.loadedElementCount++;if(this.loadedElementCount==this.elementCount)
{this.renderShadow()}}
sandwich.renderShadow=function()
{if(canvas.parentNode===null)
{shadowed.insertBefore(canvas,shadowed.firstChild);}
canvas.parentNode.insertBefore(workingCanvas,canvas);var context=workingCanvas.getContext("2d");new IWRect(0,0,width,height).clear(context);var bgImage=shadowed.getStyle('background-image');var hasBGImage=bgImage&&bgImage.indexOf('url(')==0;var bgColor=shadowed.getStyle('background-color');var alphaComponent=self.p_alphaComponent(bgColor);IWAssert(function(){return alphaComponent==0||alphaComponent==1},"alpha must be 0 or 1 for background color if shadow is applied");var fillBackground=(hasBGImage||alphaComponent>0);var divBounds=new IWRect(-leftOffset,-topOffset,frameSize.width,frameSize.height).round();if(fillBackground)
{context.fillStyle='rgba(0,0,0,1)';divBounds.fill(context);}
for(var k=0;k<this.loadedElements.length;++k)
{var loaded=this.loadedElements[k];var clipper=$(IWClippingNode(sourceElements[k]));if(clipper&&clipper.descendantOf(shadowed))
{var clipToShadow=IWChildOffset(clipper,shadowed,true);context.save();context.rect(clipToShadow.x-leftOffset,clipToShadow.y-topOffset,clipper.offsetWidth,clipper.offsetHeight);context.clip();loaded.render(context);context.restore();}
else
{loaded.render(context);}}
context=canvas.getContext("2d");new IWRect(0,0,width,height).clear(context);var drawImageUnshadowed=true;context.globalAlpha=opacity;if(context.shadowColor)
{var usingShadowAlpha=true;context.save();usingShadowAlpha=!(isWebKit&&isEarlyWebKitVersion);if(usingShadowAlpha)
{var components=self.mColor.toLowerCase().match(/#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/);if(components&&components.length>=4)
{context.shadowColor="rgba("+parseInt(components[1],16)+", "+parseInt(components[2],16)+", "+parseInt(components[3],16)+", "+self.mOpacity+")";}
else
{components=self.mColor.match(/rgb\(([0-9\.]+),[ ]*([0-9\.]+),[ ]*([0-9\.]+)\)/);if(components&&components.length>=4)
{context.shadowColor="rgba("+components[1]+", "+components[2]+", "+components[3]+", "+self.mOpacity+")";}
else
{iWLog("not using shadow alpha, failed to match "+self.mColor);usingShadowAlpha=false;}}}
if(usingShadowAlpha==false)
{context.globalAlpha*=self.mOpacity;context.shadowColor=self.mColor;}
context.shadowBlur=self.mBlurRadius;context.shadowOffsetX=self.mOffset.x;context.shadowOffsetY=self.mOffset.y;context.drawImage(workingCanvas,0,0);context.restore();if(usingShadowAlpha==false)
{drawImageUnshadowed=self.mOpacity<1.0;}
else
{drawImageUnshadowed=false;}}
if(drawImageUnshadowed)
{context.drawImage(workingCanvas,0,0);}
if(fillBackground)
{divBounds.clear(context);context.save();context.globalAlpha=opacity;context.rect(divBounds.origin.x,divBounds.origin.y,divBounds.size.width,divBounds.size.height);context.clip();for(var k=0;k<this.loadedElements.length;++k)
{this.loadedElements[k].render(context);}
context.restore();}
if(workingCanvas.parentNode)
{workingCanvas.parentNode.removeChild(workingCanvas);delete this.workingCanvas;this.workingCanvas=null;}
for(var j=0;j<sourceElements.length;++j)
{sourceElements[j].style.opacity=0.0;}};if(sourceElements.length>0)
{for(var j=0;j<sourceElements.length;++j)
{var element=$(sourceElements[j]);if(element.match('img'))
{var image=IWCreateImage(element.src);image.load(sandwich.onImageLoad.bind(sandwich,j,element,image));}
else if(element.match('div'))
{sandwich.registerDiv(j,element);}}}
else
{sandwich.renderShadow();}
workingCanvas.style.visibility="hidden";}}}},p_alphaComponent:function(color)
{var alpha=1.0;if(color&&color.indexOf('rgba(')!=-1)
{if(color.match(/rgba\((?:\s*\S+\s*,\s*){3}(\S+)\s*\)/))
{alpha=RegExp.$1;}}
return alpha;}});var IWReflection=Class.create({initialize:function(parameters)
{this.mOpacity=parameters.opacity;this.mOffset=Math.max(parameters.offset,1);this.mFadeSustain=0.4;this.mMaxSustain=120;},applyToElement:function(div)
{var bounds=new IWRect(div.offsetLeft,div.offsetTop,div.offsetWidth,div.offsetHeight);var reflectionHeight=Math.min(div.offsetHeight*this.mFadeSustain,this.mMaxSustain)*0.75;if(div!=null)
{var imgs=IWEffectChildren(div,true);var extents=IWImageExtents(div,imgs,0,0,bounds.size.width,bounds.size.height);var totalWidth=extents.right-extents.left;var totalHeight=extents.bottom-extents.top;var leftOffset=extents.left;var topOffset=extents.top;var bottomOffset=totalHeight-bounds.size.height;if(windowsInternetExplorer)
{var reflection=$(document.createElement("div"));reflection.setStyle({position:"absolute",left:px(extents.left),top:px(bounds.size.height),marginTop:px(this.mOffset),width:px(totalWidth),height:px(reflectionHeight),overflow:"hidden",filter:'progid:DXImageTransform.Microsoft.Alpha(opacity='+(this.mOpacity*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=100)'});reflection.addClassName("IWReflection");var flipped=$(document.createElement("div"));flipped.setStyle({position:"relative",width:px(totalWidth),height:px(totalHeight),filter:'flipv'});var cloned=$(div.cloneNode(true));cloned.setStyle({left:px(-extents.left),top:px(-extents.top),position:"absolute"});cloned.className=cloned.className.replace(/(shadow_\d+)/g,'');reflection.appendChild(flipped);flipped.appendChild(cloned);div.insertBefore(reflection,div.firstChild);}
else
{var reflection=$(document.createElement("canvas"));extents.right-=extents.left;extents.bottom-=extents.top;extents.left=0;extents.top=0;reflection.setAttribute("width",extents.right-extents.left);reflection.setAttribute("height",reflectionHeight+this.mOffset/2);reflection.setStyle({position:"absolute",top:px(bounds.size.height),marginTop:px(this.mOffset),left:px(leftOffset)});div.insertBefore(reflection,div.firstChild);var context=reflection.getContext("2d");context.clearRect(0,0,reflection.width,reflection.height);var sandwich={};sandwich.loadedImgs=[];sandwich.imgCount=imgs.length;var self=this;sandwich.onImageLoad=function(j,img,image){var offset=IWChildOffset(img,div,true);this.loadedImgs[j]={imgObject:image.imgObject(),left:offset.x-leftOffset,top:offset.y-topOffset-bottomOffset,width:img.offsetWidth,height:img.offsetHeight};var allImagesLoaded=false;if(this.loadedImgs.length>=this.imgCount)
{allImagesLoaded=true;for(var k=0;allImagesLoaded&&k<this.loadedImgs.length;++k)
{if(this.loadedImgs[k]===undefined)
{allImagesLoaded=false;}}}
if(allImagesLoaded)
{context.save();context.translate(0,bounds.size.height-1);context.scale(1,-1);for(var k=0;k<this.loadedImgs.length;++k)
{var loadedImg=this.loadedImgs[k];var clipper=$(IWClippingNode(imgs[k]));if(clipper&&clipper.descendantOf(div))
{var clipOffset=IWChildOffset(clipper,div,true);context.save();context.rect(clipOffset.x-leftOffset,clipOffset.y-topOffset-bottomOffset,clipper.offsetWidth,clipper.offsetHeight);context.clip();context.drawImage(loadedImg.imgObject,loadedImg.left,loadedImg.top,loadedImg.width,loadedImg.height);context.restore();}
else
{context.drawImage(loadedImg.imgObject,loadedImg.left,loadedImg.top,loadedImg.width,loadedImg.height);}}
context.restore();context.save();context.globalCompositeOperation="destination-out";var gradient=context.createLinearGradient(0,0,0,reflection.height);gradient.addColorStop(1,"rgba(255, 255, 255, 1.0)");gradient.addColorStop(0,"rgba(255, 255, 255, "+(1-self.mOpacity)+")");context.fillStyle=gradient;if(navigator.appVersion.indexOf('WebKit')!=-1)
{context.rect(0,0,reflection.width,reflection.height*2);context.fill();}
else
{context.fillRect(0,0,reflection.width,reflection.height*2);}
context.restore();}};for(var j=0;j<imgs.length;++j)
{var img=imgs[j];var image=IWCreateImage(img.src);image.load(sandwich.onImageLoad.bind(sandwich,j,img,image));}}}}});var kLeft=0,kTopLeft=1,kTop=2,kTopRight=3,kRight=4,kBottomRight=5,kBottom=6,kBottomLeft=7,kPartCount=8;var IWStrokeParts=Class.create({initialize:function(strokeParts,maxImageSize,shouldClip,strokeWidth)
{this.mStrokeParts=strokeParts;this.mMaxImageSize=maxImageSize;this.mShouldClip=shouldClip;if(shouldClip)
{this.mStrokeWidth=strokeWidth;}},p_imageLayout:function(imageSize)
{var strokeParts=this.mStrokeParts;var hDelta=this.mMaxImageSize.width-imageSize.width;var vDelta=this.mMaxImageSize.height-imageSize.height;var topLeft=strokeParts[kTopLeft].rect;var topRight=strokeParts[kTopRight].rect.offset(-hDelta,0);var bottomRight=strokeParts[kBottomRight].rect.offset(-hDelta,-vDelta);var bottomLeft=strokeParts[kBottomLeft].rect.offset(0,-vDelta);var top=strokeParts[kTop].rect;top.size.width=topRight.origin.x-top.origin.x;var right=strokeParts[kRight].rect.offset(-hDelta,0);right.size.height=bottomRight.origin.y-right.origin.y;var bottom=strokeParts[kBottom].rect.offset(0,-vDelta);bottom.size.width=bottomRight.origin.x-bottom.origin.x;var left=strokeParts[kLeft].rect;left.size.height=bottomLeft.origin.y-left.origin.y;return[left,topLeft,top,topRight,right,bottomRight,bottom,bottomLeft];},p_imageMarkup:function(imageSize,zIndex)
{var markup='';var layoutRects=this.p_imageLayout(imageSize);for(var index=kLeft;index<kPartCount;++index)
{var style=layoutRects[index].position();if(zIndex)
{style+='z-index: '+zIndex+';';}
markup+=imgMarkup(this.mStrokeParts[index].url,style);}
return markup;},markupForImageStreamEntry:function(imageStreamEntry,imageSize)
{var rect=new IWRect(0,0,imageSize.width,imageSize.height);var clippingDivPre='';var clippingDivPost='';var thumbRect=rect.clone();if(this.mShouldClip)
{var left=(this.mStrokeWidth/2+1);var top=(this.mStrokeWidth/2+1);var clippingRect=new IWRect(left,top,(imageSize.width-this.mStrokeWidth-2),(imageSize.height-this.mStrokeWidth-2));clippingDivPre='<div style="overflow: hidden; '+clippingRect.position()+'">';clippingDivPost='</div>';thumbRect.origin.x-=left;thumbRect.origin.y-=top;}
var markup='<div class="framedImage" style="'+rect.position()+'">';markup+=clippingDivPre;markup+=imageStreamEntry.thumbnailMarkupForRect(thumbRect);markup+=clippingDivPost;markup+=this.p_imageMarkup(imageSize,2);markup+='</div>';return markup;},applyToElement:function(div)
{div=$(div);if(div!=null)
{if(div.parentNode)
{$(div.parentNode).ensureHasLayoutForIE();}
var size=new IWSize(div.offsetWidth,div.offsetHeight);div.insert(this.p_imageMarkup(size,(div.hasClassName("aboveStrokesAndFrames")?-1:"auto")));if(!div.hasClassName("flowDefining"))
{if(div.style.position!='absolute')
{var divRect=new IWRect(0,0,div.offsetWidth,div.offsetHeight);var unionRect=IWZeroRect();var layoutRects=this.p_imageLayout(size);layoutRects.each(function(r)
{unionRect=unionRect.union(r);});var padding=divRect.paddingToRect(unionRect);var marginLeft=Element.getStyle(div,"marginLeft");marginLeft=marginLeft?(toPixelsAtElement(div,marginLeft,false)):0;var marginTop=Element.getStyle(div,"marginTop");marginTop=marginTop?(toPixelsAtElement(div,marginTop,true)):0;var marginRight=Element.getStyle(div,"marginRight");marginRight=marginRight?(toPixelsAtElement(div,marginRight,false)):0;var marginBottom=Element.getStyle(div,"marginBottom");marginBottom=marginBottom?(toPixelsAtElement(div,marginBottom,true)):0;if(windowsInternetExplorer)
{div.setStyle({marginLeft:px(Math.max(0,padding.left-1)+marginLeft),marginTop:px(Math.max(0,padding.top-1)+marginTop),marginRight:px(Math.max(0,padding.right-1)+marginRight),marginBottom:px(Math.max(0,padding.bottom-1)+marginBottom)});if(effectiveBrowserVersion==7)
{updateListOfIE7FloatsFix(div);}}
else
{div.setStyle({marginLeft:px(padding.left+marginLeft),marginTop:px(padding.top+marginTop),marginRight:px(padding.right+marginRight),marginBottom:px(padding.bottom+marginBottom)});}}}}},strokeExtra:function(imageSize)
{if(!imageSize)
{imageSize=this.mMaxImageSize;}
rect=new IWRect(IWZeroPoint(),imageSize);var layout=this.p_imageLayout(rect.size);var unionRect=IWZeroRect();layout.each(function(r)
{unionRect=unionRect.union(r);});return rect.paddingToRect(unionRect);}});var IWStroke=Class.create({initialize:function(strokeURL,strokeRect,maxImageSize)
{this.mStrokeURL=strokeURL;this.mStrokeRect=strokeRect;this.mMaxImageSize=maxImageSize;},p_strokeRect:function(imageSize)
{var hScale=imageSize.width/this.mMaxImageSize.width;var vScale=imageSize.height/this.mMaxImageSize.height;var strokeRect=this.mStrokeRect.scale(hScale,vScale,true);return strokeRect;},p_imageMarkup:function(imageSize,zIndex)
{var style=this.p_strokeRect(imageSize).position();if(zIndex)
{style+='z-index: '+zIndex+';';}
return imgMarkup(this.mStrokeURL,style);},markupForImageStreamEntry:function(imageStreamEntry,imageSize)
{var rect=new IWRect(0,0,imageSize.width,imageSize.height);var markup='<div class="framedImage" style="'+rect.position()+'">';markup+=imageStreamEntry.thumbnailMarkupForRect(rect);markup+=this.p_imageMarkup(imageSize,2);markup+='</div>';return markup;},applyToElement:function(div)
{div=$(div);if(div!=null)
{if(div.parentNode)
{$(div.parentNode).ensureHasLayoutForIE();}
var size=new IWSize(div.offsetWidth,div.offsetHeight);div.insert(this.p_imageMarkup(size,(div.hasClassName("aboveStrokesAndFrames")?-1:"auto")));if(!div.hasClassName("flowDefining"))
{if(div.style.position!='absolute')
{var divRect=new IWRect(0,0,div.offsetWidth,div.offsetHeight);var padding=divRect.paddingToRect(this.mStrokeRect);var marginLeft=Element.getStyle(div,"marginLeft");marginLeft=marginLeft?(toPixelsAtElement(div,marginLeft,false)):0;var marginTop=Element.getStyle(div,"marginTop");marginTop=marginTop?(toPixelsAtElement(div,marginTop,true)):0;var marginRight=Element.getStyle(div,"marginRight");marginRight=marginRight?(toPixelsAtElement(div,marginRight,false)):0;var marginBottom=Element.getStyle(div,"marginBottom");marginBottom=marginBottom?(toPixelsAtElement(div,marginBottom,true)):0;div.setStyle({marginLeft:px(padding.left+marginLeft),marginTop:px(padding.top+marginTop),marginRight:px(padding.right+marginRight),marginBottom:px(padding.bottom+marginBottom)});if(windowsInternetExplorer&&effectiveBrowserVersion==7)
{updateListOfIE7FloatsFix(div);}}}}},strokeExtra:function(imageSize)
{if(imageSize===undefined)
{imageSize=this.mMaxImageSize;}
var imageRect=new IWRect(IWZeroPoint(),imageSize);return imageRect.paddingToRect(this.p_strokeRect(imageSize));}});var IWEmptyStroke=Class.create({initialize:function()
{},markupForImageStreamEntry:function(imageStreamEntry,imageSize)
{var rect=new IWRect(0,0,imageSize.width,imageSize.height);var markup='<div class="framedImage" style="'+rect.position()+'">';markup+=imageStreamEntry.thumbnailMarkupForRect(rect);markup+='</div>';return markup;},applyToElement:function(div)
{},strokeExtra:function()
{return new IWPadding(0,0,0,0);}});var kSFRFrameTopLeft=0;var kSFRFrameTop=1;var kSFRFrameTopRight=2;var kSFRFrameRight=3;var kSFRFrameBottomRight=4;var kSFRFrameBottom=5;var kSFRFrameBottomLeft=6;var kSFRFrameLeft=7;var kSFRFrameClip=0;var kSFRFrameStretchEvenly=1;var kSFRFrameStretchToFit=2;var IWPhotoFrame=Class.create({initialize:function(images,maskImages,tilingMode,assetScale,leftInset,topInset,rightInset,bottomInset,unscaledLeftWidth,unscaledTopHeight,unscaledRightWidth,unscaledBottomHeight,leftTileHeight,topTileWidth,rightTileHeight,bottomTileWidth,adornmentURL,adornmentPosition,adornmentSize,minimumAssetScale)
{this.mImages=images;this.mMaskImages=maskImages;this.mTilingMode=tilingMode;this.mLeftInset=leftInset;this.mTopInset=topInset;this.mRightInset=rightInset;this.mBottomInset=bottomInset;this.mUnscaledLeftWidth=unscaledLeftWidth;this.mUnscaledTopHeight=unscaledTopHeight;this.mUnscaledRightWidth=unscaledRightWidth;this.mUnscaledBottomHeight=unscaledBottomHeight;this.mLeftTileHeight=leftTileHeight;this.mTopTileWidth=topTileWidth;this.mRightTileHeight=rightTileHeight;this.mBottomTileWidth=bottomTileWidth;this.mAdornmentURL=adornmentURL;this.mAdornmentPosition=adornmentPosition;this.mAdornmentSize=adornmentSize;this.mMinimumAssetScale=minimumAssetScale;this.setAssetScale(assetScale);},setAssetScale:function(assetScale)
{assetScale=Math.min(assetScale,1.0);assetScale=Math.max(this.mMinimumAssetScale,assetScale);this.mAssetScale=assetScale;this.mLeftWidth=this.scaledValue(this.mUnscaledLeftWidth);this.mTopHeight=this.scaledValue(this.mUnscaledTopHeight);this.mRightWidth=this.scaledValue(this.mUnscaledRightWidth);this.mBottomHeight=this.scaledValue(this.mUnscaledBottomHeight);},scaledValue:function(valueToScale)
{return Math.ceil(valueToScale*this.mAssetScale);},markupForImageStreamEntry:function(imageStreamEntry,size)
{var oldAssetScale=this.mAssetScale;var maximumScale=this.maximumAssetScaleForImageSize(size);if((maximumScale<oldAssetScale)&&(maximumScale>=this.mMinimumAssetScale))
{this.setAssetScale(maximumScale);}
var coverageRect=this.coverageRect(new IWRect(0,0,size.width,size.height));var imageRect=new IWRect(-coverageRect.origin.x,-coverageRect.origin.y,size.width,size.height);coverageRect=coverageRect.offsetToOrigin();var markup='<div class="framedImage" style="'+coverageRect.position()+'">';markup+=imageStreamEntry.thumbnailMarkupForRect(imageRect);if(maximumScale>=this.mMinimumAssetScale)
{if(this.mImages!=null)
{markup+=this.p_buildFrame(this.mImages,coverageRect.size,2);}
if(this.mAdornmentURL!=null)
{markup+=this.p_adornmentMarkupForRect(imageRect,2);}
if(this.mMaskImages)
{}}
markup+='</div>';if(oldAssetScale!=this.mAssetScale)this.setAssetScale(oldAssetScale);return markup;},strokeExtra:function()
{var adornmentExtraTopMargin=0;if(this.mAdornmentURL)
{adornmentExtraTopMargin=Math.max(0,(this.scaledValue(this.mAdornmentSize.height)-this.mTopHeight)/2.0-this.mAdornmentPosition.y);}
return new IWPadding(this.mLeftWidth-this.scaledValue(this.mLeftInset),this.mTopHeight-this.scaledValue(this.mTopInset)+adornmentExtraTopMargin,this.mRightWidth-this.scaledValue(this.mRightInset),this.mBottomHeight-this.scaledValue(this.mBottomInset));},applyToElement:function(div)
{div=$(div);if(div!=null)
{if(div.parentNode)
{$(div.parentNode).ensureHasLayoutForIE();}
var markup='';var divRect=new IWRect(0,0,div.offsetWidth,div.offsetHeight);if((divRect.size.width>=(this.scaledValue(this.mLeftInset)+this.scaledValue(this.mRightInset)))&&(divRect.size.height>=(this.scaledValue(this.mTopInset)+this.scaledValue(this.mTopInset))))
{if(this.mImages!=null)
{var coverageRect=this.coverageRect(divRect);var containerRect=new IWRect(coverageRect.origin.x,coverageRect.origin.y,0,0);markup+='<div style="'+containerRect.position()+'">';markup+=this.p_buildFrame(this.mImages,coverageRect.size,(div.hasClassName("aboveStrokesAndFrames")?-1:"auto"));markup+='</div>';}
if(this.mAdornmentURL!=null)
{markup+=this.p_adornmentMarkupForRect(divRect);}}
div.insert(markup);if(!div.hasClassName("flowDefining"))
{if(div.style.position!='absolute')
{var frameExtra=this.strokeExtra();var marginLeft=Element.getStyle(div,"marginLeft");marginLeft=marginLeft?(toPixelsAtElement(div,marginLeft,false)):0;var marginTop=Element.getStyle(div,"marginTop");marginTop=marginTop?(toPixelsAtElement(div,marginTop,true)):0;var marginRight=Element.getStyle(div,"marginRight");marginRight=marginRight?(toPixelsAtElement(div,marginRight,false)):0;var marginBottom=Element.getStyle(div,"marginBottom");marginBottom=marginBottom?(toPixelsAtElement(div,marginBottom,true)):0;div.setStyle({marginLeft:px(frameExtra.left+marginLeft),marginTop:px(frameExtra.top+marginTop),marginRight:px(frameExtra.right+marginRight),marginBottom:px(frameExtra.bottom+marginBottom)});if(windowsInternetExplorer&&effectiveBrowserVersion==7)
{updateListOfIE7FloatsFix(div);}}}}},maximumAssetScaleForImageSize:function(in_imgSize)
{var maxScale=1;if((in_imgSize.width>this.mLeftInset+this.mRightInset)&&(in_imgSize.height>this.mTopInset+this.mBottomInset))
{maxScale=1;}
else if((in_imgSize.width<Math.ceil(this.mLeftInset*this.mMinimumAssetScale)+Math.ceil(this.mRightInset*this.mMinimumAssetScale))||(in_imgSize.height<Math.ceil(this.mTopInset*this.mMinimumAssetScale)+Math.ceil(this.mBottomInset*this.mMinimumAssetScale)))
{maxScale=0;}
else
{var maxWidthScale=1;var floatEpsilon=0.0000001;if(((this.mLeftInset+this.mRightInset)>=in_imgSize.width)&&((this.mLeftInset+this.mRightInset)>0))
{var leftChunkRatio=Math.floor(this.mLeftInset/(this.mLeftInset+this.mRightInset)*in_imgSize.width)/this.mLeftInset;var rightChunkRatio=Math.floor(this.mRightInset/(this.mLeftInset+this.mRightInset)*in_imgSize.width)/this.mRightInset;leftChunkRatio-=floatEpsilon;rightChunkRatio-=floatEpsilon;maxWidthScale=Math.max(leftChunkRatio,rightChunkRatio);if(in_imgSize.width<(Math.ceil(this.mLeftInset*maxWidthScale)+Math.ceil(this.mRightInset*maxWidthScale)))
{maxWidthScale=Math.min(leftChunkRatio,rightChunkRatio);}
if((maxWidthScale<this.mMinimumAssetScale)||in_imgSize.width<(Math.ceil(this.mLeftInset*maxWidthScale)+Math.ceil(this.mRightInset*maxWidthScale)))
{maxWidthScale=this.mMinimumAssetScale;}}
var maxHeightScale=1;if(((this.mTopInset+this.mBottomInset)>=in_imgSize.height)&&((this.mTopInset+this.mBottomInset)>0))
{var topChunkRatio=Math.floor(this.mTopInset/(this.mTopInset+this.mBottomInset)*in_imgSize.height)/this.mTopInset;var bottomChunkRatio=Math.floor(this.mBottomInset/(this.mTopInset+this.mBottomInset)*in_imgSize.height)/this.mBottomInset;topChunkRatio-=floatEpsilon;bottomChunkRatio-=floatEpsilon;maxHeightScale=Math.max(topChunkRatio,bottomChunkRatio);if(in_imgSize.height<(Math.ceil(this.mTopInset*maxHeightScale)+Math.ceil(this.mBottomInset*maxHeightScale)))
{maxHeightScale=Math.min(topChunkRatio,bottomChunkRatio);}
if((maxHeightScale<this.mMinimumAssetScale)||in_imgSize.height<(Math.ceil(this.mTopInset*maxHeightScale)+Math.ceil(this.mBottomInset*maxHeightScale)))
{maxHeightScale=this.mMinimumAssetScale;}}
maxScale=Math.min(maxWidthScale,maxHeightScale);}
return maxScale;},coverageRect:function(rect)
{var left=rect.origin.x+this.scaledValue(this.mLeftInset);var top=rect.origin.y+this.scaledValue(this.mTopInset);var right=rect.maxX()-this.scaledValue(this.mRightInset);var bottom=rect.maxY()-this.scaledValue(this.mBottomInset);left-=this.mLeftWidth;right+=this.mRightWidth;top-=this.mTopHeight;bottom+=this.mBottomHeight;return(new IWRect(left,top,right-left,bottom-top)).round();},p_buildFrame:function(images,size,zIndex)
{var width=size.width;var height=size.height;var startX=this.mLeftWidth;var endX=width-this.mRightWidth;var startY=this.mTopHeight;var endY=height-this.mBottomHeight;var markup="";var zIndexStyle=zIndex?('z-index: '+zIndex+';'):'';if((startX<=endX+1)&&(startY<=endY+1))
{var imageRect=new IWRect(0.0,0.0,this.mLeftWidth,this.mTopHeight);markup=imgMarkup(images[kSFRFrameTopLeft].sourceURL(),imageRect.position()+zIndexStyle);imageRect=new IWRect(0.0,(height-this.mBottomHeight),this.mLeftWidth,this.mBottomHeight);markup+=imgMarkup(images[kSFRFrameBottomLeft].sourceURL(),imageRect.position()+zIndexStyle);imageRect=new IWRect((width-this.mRightWidth),0.0,this.mRightWidth,this.mTopHeight);markup+=imgMarkup(images[kSFRFrameTopRight].sourceURL(),imageRect.position()+zIndexStyle);imageRect=new IWRect((width-this.mRightWidth),(height-this.mBottomHeight),this.mRightWidth,this.mBottomHeight);markup+=imgMarkup(images[kSFRFrameBottomRight].sourceURL(),imageRect.position()+zIndexStyle);var naturalSize=new IWSize(this.mLeftWidth,this.scaledValue(this.mLeftTileHeight));imageRect=new IWRect(0.0,startY,naturalSize.width,naturalSize.height);markup+=this.p_tiles(images[kSFRFrameLeft].sourceURL(),imageRect,startY,endY,true,zIndex);naturalSize=new IWSize(this.mRightWidth,this.scaledValue(this.mRightTileHeight));imageRect=new IWRect(width-this.mRightWidth,startY,naturalSize.width,naturalSize.height);markup+=this.p_tiles(images[kSFRFrameRight].sourceURL(),imageRect,startY,endY,true,zIndex);naturalSize=new IWSize(this.scaledValue(this.mTopTileWidth),this.mTopHeight);imageRect=new IWRect(startX,0.0,naturalSize.width,naturalSize.height);markup+=this.p_tiles(images[kSFRFrameTop].sourceURL(),imageRect,startX,endX,false,zIndex);naturalSize=new IWSize(this.scaledValue(this.mBottomTileWidth),this.mBottomHeight);imageRect=new IWRect(startX,height-this.mBottomHeight,naturalSize.width,naturalSize.height);markup+=this.p_tiles(images[kSFRFrameBottom].sourceURL(),imageRect,startX,endX,false,zIndex);}
return markup;},p_adornmentRectForRect:function(rect)
{var adornmentCenter=new IWPoint();rect=this.coverageRect(rect);adornmentCenter.x=(rect.size.width-(this.mLeftWidth+this.mRightWidth))*this.mAdornmentPosition.x;adornmentCenter.x+=rect.origin.x+this.mLeftWidth;adornmentCenter.y=this.mTopHeight/2.0+(rect.origin.y+this.mAdornmentPosition.y);var scaledAdornmentSize=new IWSize(this.scaledValue(this.mAdornmentSize.width),this.scaledValue(this.mAdornmentSize.height));var adornmentOrigin=new IWPoint(adornmentCenter.x-(scaledAdornmentSize.width/2.0),adornmentCenter.y-(scaledAdornmentSize.height/2.0));var adornmentRect=new IWRect(adornmentOrigin,scaledAdornmentSize);return adornmentRect;},p_adornmentMarkupForRect:function(rect,zIndex)
{var zIndexStyle=zIndex?('z-index: '+zIndex+';'):'';return imgMarkup(this.mAdornmentURL,this.p_adornmentRectForRect(rect).position()+zIndexStyle);},p_tiles:function(imageURL,imageRect,start,end,vertical,zIndex)
{var markup="";if(start<end)
{var zIndexStyle=zIndex?('z-index: '+zIndex+';'):'';var tileRect=imageRect.clone();var tilingMode=this.mTilingMode;if(vertical)
{tileRect.size.height=Math.ceil(end-start);if(imageRect.size.height==1)
{tilingMode=kSFRFrameStretchToFit;}}
else
{tileRect.size.width=Math.ceil(end-start);if(imageRect.size.width==1)
{tilingMode=kSFRFrameStretchToFit;}}
if(tilingMode==kSFRFrameStretchToFit)
{markup+=imgMarkup(imageURL,tileRect.position()+zIndexStyle);}
else
{var naturalSize=imageRect.size;var offset=(vertical?naturalSize.height:naturalSize.width);var maxTiles=Math.ceil((end-start)/offset);if(offset<5||maxTiles>20)
{IWAssert(function(){return true},"Please remove this assert and the surrouding block.");iWLog("Too many frame image tiles are getting generated. Performance may be affected.");}
if(tilingMode==kSFRFrameStretchEvenly)
{offset=(end-start)/maxTiles;if(vertical)
{imageRect.size.height=offset;}
else
{imageRect.size.width=offset;}}
else if(tilingMode==kSFRFrameClip)
{markup+='<div style="'+tileRect.position()+'overflow: hidden; ">';imageRect.origin.x=0;imageRect.origin.y=0;}
for(var i=0;i<maxTiles;++i)
{var left=Math.round(imageRect.origin.x);var right=Math.round(imageRect.origin.x+imageRect.size.width);var top=Math.round(imageRect.origin.y);var bottom=Math.round(imageRect.origin.y+imageRect.size.height);var roundedRect=new IWRect(left,top,(right-left),(bottom-top));markup+=imgMarkup(imageURL,roundedRect.position()+zIndexStyle);imageRect=vertical?imageRect.offset(0.0,offset):imageRect.offset(offset,0.0);}
if(tilingMode==kSFRFrameClip)
{markup+="</div>";}}}
return markup;}});

742
no/Scripts/iWebMediaGrid.js Normal file
View File

@@ -0,0 +1,742 @@
//
// iWeb - iWebMediaGrid.js
// Copyright 2007-2008 Apple Inc.
// All rights reserved.
//
var IWAllFeeds={};function IWCreateFeed(url)
{var feed=IWAllFeeds[url];if(feed==null)
{feed=new IWFeed(url);}
return feed;}
var IWFeed=Class.create({initialize:function(url)
{if(url)
{if(IWAllFeeds.hasOwnProperty(url))
{iWLog("warning -- use IWCreateFeed rather than new IWFeed and you'll get better performance");}
this.mURL=url;this.mLoading=false;this.mLoaded=false;this.mCallbacks=[];this.mImageStream=null;IWAllFeeds[url]=this;}},sourceURL:function()
{return this.mURL;},load:function(baseURL,callback)
{if(this.mLoaded&&(callback!=null))
{callback(this.mImageStream);}
else
{if(callback!=null)
{this.mCallbacks.push(callback);}
if(this.mLoading==false)
{this.mLoading=true;this.p_sendRequest(baseURL);}}},p_sendRequest:function(baseURL)
{var url=this.mURL.toRelativeURL(baseURL);new Ajax.Request(url,{method:'get',onSuccess:this.p_onload.bind(this,baseURL),onFailure:this.p_requestFailed.bind(this,baseURL)});},p_requestFailed:function(baseURL,req)
{iWLog("There was a problem ("+req.status+") retrieving the feed:\n\r"+req.statusText);if(req.status==500)
{iWLog("working around status 500 by trying again...");window.setTimeout(this.p_sendRequest.bind(this,baseURL),100);}},p_onload:function(baseURL,req)
{var collectionItem;var doc=ajaxGetDocumentElement(req);var items=$A(doc.getElementsByTagName('item'));this.mImageStream=this.p_interpretItems(baseURL,items);this.p_postLoadCallbacks(this.mImageStream);},p_postLoadCallbacks:function(imageStream)
{for(var i=0;i<this.mCallbacks.length;++i)
{this.mCallbacks[i](imageStream);}
this.mLoaded=true;},p_applyEntryOrder:function(imageStream,entryGUIDs)
{var orderedStream=[];var guidToIndex=[];for(var i=0;i<imageStream.length;i++)
{var streamEntryGUID=imageStream[i].guid();if(streamEntryGUID)
{guidToIndex[streamEntryGUID]=i;}}
for(var i=0;i<entryGUIDs.length;i++)
{var index=guidToIndex[entryGUIDs[i]];if(index!==undefined)
{orderedStream.push(imageStream[index]);}}
(function(){return orderedStream.length==entryGUIDs.length}).assert();return orderedStream;},p_firstElementByTagNameNS:function(element,ns,tag)
{var child=null;for(child=element.firstChild;child!=null;child=child.nextSibling)
{if(child.baseName==tag||child.localName==tag)
{if(ns==null||ns==""||child.namespaceURI==ns)
{break;}}}
return child;}});var IWStreamEntry=Class.create({initialize:function(thumbnailURL,title,richTitle,guid)
{if(arguments.length>0)
{if(thumbnailURL)
{this.mThumbnail=IWCreateImage(thumbnailURL);}
if(title)
{this.mTitle=title.stringByEscapingXML().stringByConvertingNewlinesToBreakTags();}
if(richTitle)
{this.mRichTitle=richTitle;}
if(guid)
{this.mGUID=guid;}}},setThumbnailURL:function(thumbnailURL)
{this.mThumbnail=IWCreateImage(thumbnailURL);},loadThumbnail:function(callback)
{this.thumbnail().load(callback);},unloadThumbnail:function()
{this.thumbnail().unload();},thumbnailNaturalSize:function()
{return this.thumbnail().naturalSize();},thumbnail:function()
{return this.mThumbnail;},micro:function()
{return this.thumbnail();},mipThumbnail:function()
{return this.thumbnail();},title:function()
{return this.mTitle;},richTitle:function()
{return this.mRichTitle?this.mRichTitle:this.mTitle;},metric:function()
{return null;},guid:function()
{return this.mGUID;},isMovie:function()
{return false;},commentGUID:function()
{return null;},showCommentIndicator:function()
{return true;},badgeMarkupForRect:function(rect)
{return IWStreamEntryBadgeMarkup(rect,this.isMovie(),this.showCommentIndicator()?this.commentGUID():null);},thumbnailMarkupForRect:function(rect)
{return imgMarkup(this.thumbnail().sourceURL(),rect.position(),"",this.mTitle)+
this.badgeMarkupForRect(rect);},didInsertThumbnailMarkupIntoDocument:function()
{}});function IWStreamEntryBadgeMarkup(rect,isMovie,commentGUID)
{var kBadgeWidth=16.0;var kBadgeHeight=16.0;var badgeRect=new IWRect(rect.origin.x,rect.maxY()-kBadgeHeight,rect.size.width,kBadgeHeight);var markup="";if(isMovie)
{markup+='<div style="background-color: black; '+badgeRect.position()+iWOpacity(0.75)+'"></div>';}
var badgeSize=new IWSize(kBadgeWidth,kBadgeHeight);if(isMovie)
{var movieImage=IWImageNamed("movie overlay");var movieRect=new IWRect(badgeRect.origin,badgeSize);markup+=imgMarkup(movieImage.sourceURL(),movieRect.position(),'class="badge-overlay"');}
var commentLocation=new IWPoint(badgeRect.maxX()-kBadgeWidth,badgeRect.origin.y);if(commentGUID)
{var commentImage=IWImageNamed("comment overlay");var commentRect=new IWRect(commentLocation,badgeSize);markup+=imgMarkup(commentImage.sourceURL(),commentRect.position()+"display: none; ",'class="badge-overlay" id="comment-badge-'+commentGUID+'"');}
return markup;}
var IWCommentableStreamEntry=Class.create(IWStreamEntry,{initialize:function($super,assetURL,showCommentIndicator,thumbnailURL,title,richTitle,guid)
{$super(thumbnailURL,title,richTitle,guid);this.mAssetURL=assetURL;this.mShowCommentIndicator=showCommentIndicator;},commentGUID:function()
{return this.guid();},showCommentIndicator:function()
{return this.mShowCommentIndicator;},didInsertThumbnailMarkupIntoDocument:function()
{if(this.mAssetURL&&hostedOnDM())
{IWCommentCountForURL(this.mAssetURL,this.p_commentCountCallback.bind(this));}
else
{this.p_commentCountCallback(0);}},commentAssetURL:function()
{return this.mAssetURL;},p_commentCountCallback:function(commentCount)
{this.mCommentCount=commentCount;if(this.mCommentCount>0)
{$('comment-badge-'+this.commentGUID()).show();}}});var IWImageStreamEntry=Class.create(IWCommentableStreamEntry,{initialize:function($super,assetURL,showCommentIndicator,imageURL,thumbnailURL,microURL,mipThumbnailURL,title,richTitle,guid)
{$super(assetURL,showCommentIndicator,thumbnailURL,title,richTitle,guid);this.mImage=IWCreateImage(imageURL);if(microURL)
{this.mMicro=IWCreateImage(microURL);}
if(mipThumbnailURL)
{this.mMIPThumbnail=IWCreateImage(mipThumbnailURL);}},setImageURL:function(imageURL)
{this.mImage=IWCreateImage(imageURL);},image:function()
{return this.mImage;},micro:function()
{return this.mMicro?this.mMicro:this.thumbnail();},mipThumbnail:function()
{return this.mMIPThumbnail?this.mMIPThumbnail:this.thumbnail();},targetURL:function()
{return this.mImage.sourceURL();},slideshowValue:function(imageType)
{var image=this[imageType]();return{image:image,caption:this.title()};}});var IWMovieStreamEntry=Class.create(IWCommentableStreamEntry,{initialize:function($super,assetURL,showCommentIndicator,movieURL,thumbnailURL,title,richTitle,movieParams,guid)
{$super(assetURL,showCommentIndicator,thumbnailURL,title,richTitle,guid);this.mMovieURL=movieURL;this.mMovieParams=movieParams;},movieURL:function()
{return this.mMovieURL;},targetURL:function()
{return this.movieURL();},isMovie:function()
{return true;},setMovieParams:function(params)
{this.mMovieParams=params;},slideshowValue:function(imageType)
{return{image:this.thumbnail(),movieURL:this.movieURL(),caption:this.title(),params:this.mMovieParams};}});var IWMediaStreamPageEntry=Class.create(IWStreamEntry,{initialize:function($super,targetPageURL,thumbnailURL,title,richTitle,guid)
{if(arguments.length>0)
{$super(thumbnailURL,title,richTitle,guid);this.mTargetPageURL=targetPageURL;}},thumbnailNaturalSize:function()
{return new IWSize(4000,3000);},targetURL:function()
{return this.mTargetPageURL;},positionedThumbnailMarkupForRect:function(rect)
{return IWMediaStreamPageEntryPositionedThumbnailMarkupForRect(this.mThumbnail,rect);}});function IWMediaStreamPageEntryPositionedThumbnailMarkupForRect(thumbnail,rect)
{var thumbnailSize=thumbnail.naturalSize();var scale=Math.max(rect.size.width/thumbnailSize.width,rect.size.height/thumbnailSize.height);var imageSize=thumbnailSize.scale(scale,scale,true);var imagePosition=new IWPoint((rect.size.width-imageSize.width)/2,(rect.size.height-imageSize.height)/2);imagePosition=imagePosition.scale(1,1,true);var imageRect=new IWRect(imagePosition,imageSize);return imgMarkup(thumbnail.sourceURL(),imageRect.position());}
var IWMediaStreamPhotoPageEntryPrefs={};var IWMediaStreamPhotoPageEntries={};function IWMediaStreamPhotoPageSetPrefs(slideshowPrefs)
{IWMediaStreamPhotoPageEntryPrefs=slideshowPrefs;}
var IWMediaStreamPhotoPageEntryUniqueId=0;var IWMediaStreamPhotoPageEntry=Class.create(IWMediaStreamPageEntry,{initialize:function($super,streamScriptURL,targetPageURL,title,contentsFunction,guid)
{$super(targetPageURL,null,title,null,guid);this.mStreamScriptURL=streamScriptURL;this.mContentsFunction=contentsFunction;},loadThumbnail:function(callback)
{this.mThumbnailCallback=callback;this.mSlideshowId='gridEntry'+IWMediaStreamPhotoPageEntryUniqueId++;IWMediaStreamPhotoPageEntries[this.mSlideshowId]=this;var loadingArea=IWCreateLoadingArea();var uniqueId='iFrame_'+new Date().getTime()+IWMediaStreamPhotoPageEntryUniqueId;loadingArea.innerHTML='<iframe id='+uniqueId+' src="streamloader.html?scriptURL='+this.mStreamScriptURL+'&id='+this.mSlideshowId+'" style="position: absolute; visibility: hidden; ">'+'</iframe>';},streamDidLoad:function(media)
{this.mMedia=media;if(this.mMedia&&this.mMedia.length>0)
{this.mThumbnail=this.mMedia[0].mipThumbnail();this.mThumbnail.load(this.mThumbnailCallback);}
else
{this.mThumbnailCallback();}},metric:function()
{var photoCount=0;var clipCount=0;if(this.mMedia)
{for(var index=0;index<this.mMedia.length;++index)
{if(this.mMedia[index].isMovie())
++clipCount;else
++photoCount;}}
return this.mContentsFunction(photoCount,clipCount);},thumbnailMarkupForRect:function(rect)
{var markup="";if(this.mThumbnail)
{markup='<div id="'+this.mSlideshowId+'" style="overflow: hidden; '+rect.position()+'" onclick="window.location.href = \''+this.targetURL()+'\'">'+
this.positionedThumbnailMarkupForRect(rect)+'<div id="'+this.mSlideshowId+'-slideshow_placeholder" style="position: absolute; left: 0px; top: 0px; height: 100%; width: 100%; overflow: hidden; ">'+'</div>'+'</div>';}
return markup;},didInsertThumbnailMarkupIntoDocument:function()
{if(this.mThumbnail)
{if(isiPhone==false)
{var prefs=IWMediaStreamPhotoPageEntryPrefs;prefs["mediaStreamObject"]={load:function(media,baseURL,callback){callback(media);}.bind(null,this.mMedia)};new SlideshowGlue(this.mSlideshowId,'../Scripts/Widgets/Slideshow','../Scripts/Widgets/SharedResources','..',prefs);}}}});function IWMediaStreamPhotoPageSetMediaStream(mediaStream,slideshowId)
{mediaStream.load(IWMediaStreamPhotoPageEntryPrefs.baseURL,function(slideshowId,media)
{IWMediaStreamPhotoPageEntries[slideshowId].streamDidLoad(media);}.bind(null,slideshowId));}
var IWMediaStreamMediaPageEntryUniqueId=0;var IWMediaStreamMediaPageEntry=Class.create(IWMediaStreamPageEntry,{initialize:function($super,targetPageURL,thumbnailURL,title,contents,isMovie,guid)
{$super(targetPageURL,thumbnailURL,title,null,guid);this.mContents=contents;this.mIsMovie=isMovie;},isMovie:function()
{return this.mIsMovie;},metric:function()
{return this.mContents;},thumbnailMarkupForRect:function(rect)
{var badgeRect=new IWRect(new IWPoint(0,0),rect.size);var thumbnailMarkup=this.positionedThumbnailMarkupForRect(rect)+this.badgeMarkupForRect(badgeRect);var idAttribute="";var playButtonMarkup="";if(this.isMovie())
{this.mPlayButtonId='movieEntry'+IWMediaStreamMediaPageEntryUniqueId++;idAttribute='id="'+this.mPlayButtonId+'"';playButtonMarkup='<div id="'+this.mPlayButtonId+'-play_button" class="play_button">'+'<div>'+'</div>'+'</div>';}
var markup='<div '+idAttribute+' style="overflow: hidden; '+rect.position()+'" onclick="window.location.href = \''+this.targetURL()+'\'">'+
thumbnailMarkup+
playButtonMarkup+'</div>';return markup;},didInsertThumbnailMarkupIntoDocument:function()
{if(this.isMovie())
{if(isiPhone==false)
{new PlayButton(this.mPlayButtonId,'../Scripts/Widgets/PlayButton','../Scripts/Widgets/SharedResources','..',{});}}}});var gPhotoFormats=[];var gClipFormats=[];function IWCreateMediaCollection(url,slideshowEnabled,transitionIndex,photoFormats,clipFormats)
{var feed=IWAllFeeds[url];if(feed==null)
{if(gPhotoFormats.length==0)
{gPhotoFormats=photoFormats;}
if(gClipFormats.length==0)
{gClipFormats=clipFormats;}
feed=new IWMediaCollection(url,slideshowEnabled,transitionIndex);}
return feed;}
var IWMediaCollection=Class.create(IWFeed,{initialize:function($super,url,slideshowEnabled,transitionIndex)
{$super(url);this.mSlideshowEnabled=slideshowEnabled;this.mTransitionIndex=transitionIndex;},p_interpretItems:function(baseURL,items)
{var iWebNamespace='http://www.apple.com/iweb';var thumbnailNamespace='urn:iphoto:property';var truthFeed=this.mURL.indexOf('?webdav-method=truthget')!=-1;if(truthFeed)
{iWebNamespace=thumbnailNamespace="urn:iweb:";}
if(IWMediaStreamPhotoPageSetPrefs)
{IWMediaStreamPhotoPageSetPrefs({slideshowEnabled:this.mSlideshowEnabled,fadeIn:true,showOnMouseOver:true,photoDuration:2,startIndex:1,scaleMode:"fill",transitionIndex:this.mTransitionIndex,imageType:"mipThumbnail",movieMode:kPosterFrameOnly,baseURL:baseURL});}
var mediaStream=[];for(var i=0;i<items.length;++i)
{var item=items[i];var link=null;if(truthFeed)
{link=this.p_firstElementByTagNameNS(item,iWebNamespace,'link');}
if(link==null)
{link=item.getElementsByTagName('link')[0];}
if(link!=null)
{var titleText='';var title=item.getElementsByTagName('title')[0];if(title!=null)
{titleText=title.firstChild.nodeValue;}
var skip=false;if(truthFeed)
{title=this.p_firstElementByTagNameNS(item,iWebNamespace,'title');if(title!=null)
{titleText=title.firstChild.nodeValue;}
else
{skip=true;}}
if(skip==false)
{var pageURL=link.firstChild.nodeValue.toRelativeURL(baseURL);var entry=null;var guidNode=item.getElementsByTagName('useritemguid')[0];var guid=null;if(guidNode!=null)
{guid=guidNode.firstChild.nodeValue;}
var thumbnail=this.p_firstElementByTagNameNS(item,thumbnailNamespace,'thumbnail')||item.getElementsByTagName('thumbnail')[0];if(thumbnail)
{var thumbnailURL=transparentGifURL();if(thumbnail.firstChild&&thumbnail.firstChild.nodeValue)
{thumbnailURL=thumbnail.firstChild.nodeValue.toRelativeURL(baseURL);}
var contentsText=null;var contents=this.p_firstElementByTagNameNS(item,iWebNamespace,'contents');if(contents)
{contentsText=contents.firstChild.nodeValue;}
var isMovie=false;var isMovieValue=this.p_firstElementByTagNameNS(item,iWebNamespace,'is-movie');if(isMovieValue&&isMovieValue.firstChild&&isMovieValue.firstChild.nodeValue)
{isMovie=(isMovieValue.firstChild.nodeValue=='true');}
entry=new IWMediaStreamMediaPageEntry(pageURL,thumbnailURL,titleText,contentsText,isMovie,guid);}
else
{var pageName=pageURL.lastPathComponent().stringByDeletingPathExtension();var pageScriptURL=pageURL.stringByDeletingLastPathComponent().stringByAppendingPathComponent(pageName+"_files").stringByAppendingPathComponent(pageName+".js");entry=new IWMediaStreamPhotoPageEntry(pageScriptURL,pageURL,titleText,albumContentsFunction,guid);}
mediaStream.push(entry);}}}
return mediaStream;}});function albumContentsFunction(photoCount,clipCount)
{var contents="";photoFormat=gPhotoFormats[Math.min(photoCount,2)];clipFormat=gClipFormats[Math.min(clipCount,2)];photoFormat=photoFormat.replace(/%d/,photoCount);clipFormat=clipFormat.replace(/%d/,clipCount);if(clipFormat&&clipFormat.length>0&&photoCount==0)
{contents=clipFormat;}
else
{contents=photoFormat;if(clipFormat&&clipFormat.length>0)
{contents+=", "+clipFormat;}}
return contents;}
function IWCreatePhotocast(url,showCommentIndicator)
{var feed=IWAllFeeds[url];if(feed==null)
{feed=new IWPhotocast(url,showCommentIndicator);}
return feed;}
var IWPhotocast=Class.create(IWFeed,{initialize:function($super,url,showCommentIndicator)
{$super(url);this.mShowCommentIndicator=showCommentIndicator;},p_interpretItems:function(baseURL,items)
{var imageStream=[];for(var i=0;i<items.length;++i)
{var item=items[i];enclosure=item.getElementsByTagName('enclosure')[0];if(enclosure!=null)
{var titleText='';var title=item.getElementsByTagName('title')[0];if(title&&title.firstChild&&title.firstChild.nodeValue)
{titleText=title.firstChild.nodeValue;}
var iWebNamespace='http://www.apple.com/iweb';var thumbnailNamespace='urn:iphoto:property';var richTitleHTML;var richTitle=this.p_firstElementByTagNameNS(item,iWebNamespace,'richTitle');if(richTitle&&richTitle.firstChild&&richTitle.firstChild.nodeValue)
{richTitleHTML=richTitle.firstChild.nodeValue.stringByUnescapingXML();}
var guidNode=item.getElementsByTagName('guid')[0];var guid=null;if(guidNode!=null)
{guid=guidNode.firstChild.nodeValue;}
var thumbnail=this.p_firstElementByTagNameNS(item,thumbnailNamespace,'thumbnail')||item.getElementsByTagName('thumbnail')[0];IWAssert(function(){return thumbnail!=null},"Could not get thumbnail from feed. Server configuration may have changed.");if(thumbnail)
{var entry=null;var type=enclosure.getAttribute("type").split("/");var thumbnailURL=thumbnail.firstChild.nodeValue.toRebasedURL(baseURL);if(type[0]=="video")
{var movieURL=enclosure.getAttribute('url').toRebasedURL(baseURL);var movieParams=null;var movieParamsElement=this.p_firstElementByTagNameNS(item,iWebNamespace,'movieParams');if(movieParamsElement&&movieParamsElement.firstChild&&movieParamsElement.firstChild.nodeValue)
{var movieParamsJSON=movieParamsElement.firstChild.nodeValue.stringByUnescapingXML();movieParams=eval('('+movieParamsJSON+')');}
var assetURL=movieURL.stringByDeletingLastPathComponent();IWAssert(function(){return assetURL!=null},"could not determine asset URL for movie: "+movieURL);entry=new IWMovieStreamEntry(assetURL,this.mShowCommentIndicator,movieURL,thumbnailURL,titleText,richTitleHTML,movieParams,guid);}
else
{var imageURL=enclosure.getAttribute('url').toRebasedURL(baseURL);var assetURL=imageURL.urlStringByDeletingQueryAndFragment().stringByDeletingPathExtension();var microURL=null;var micro=this.p_firstElementByTagNameNS(item,iWebNamespace,'micro');if(micro&&micro.firstChild&&micro.firstChild.nodeValue)
{microURL=micro.firstChild.nodeValue.toRebasedURL(baseURL);}
if(!microURL)
{microURL=(imageURL.urlStringByDeletingQueryAndFragment()+"?derivative=micro").toRebasedURL(baseURL);}
var mipThumbnailURL=null;var mipThumbnail=this.p_firstElementByTagNameNS(item,iWebNamespace,'mip-thumbnail');if(mipThumbnail&&mipThumbnail.firstChild&&mipThumbnail.firstChild.nodeValue)
{mipThumbnailURL=mipThumbnail.firstChild.nodeValue.toRebasedURL(baseURL);}
if(!mipThumbnailURL)
{mipThumbnailURL=(imageURL.urlStringByDeletingQueryAndFragment()+"?derivative=mip&alternate=thumb").toRebasedURL(baseURL);}
IWAssert(function(){return assetURL!=null},"could not determine asset URL for image: "+imageURL);entry=new IWImageStreamEntry(assetURL,this.mShowCommentIndicator,imageURL,thumbnailURL,microURL,mipThumbnailURL,titleText,richTitleHTML,guid);}
imageStream.push(entry);}}}
return imageStream;}});var kPhotoViewMovieControllerHeight=16;var kShowMovie=0;var kAutoplayMovie=1;var kPosterFrameOnly=2;function setFrameOptionallyMovingContents(element,frame,moveContents)
{var oldOrigin=new IWPoint(element.offsetLeft,element.offsetTop);$(element).setStyle({left:px(frame.origin.x),top:px(frame.origin.y),width:px(frame.size.width),height:px(frame.size.height)});var offset=new IWPoint(oldOrigin.x-frame.origin.x,oldOrigin.y-frame.origin.y);if(moveContents)
{offsetChildren(element,offset,false);}
return offset;}
function offsetChildren(element,offset,reverse)
{for(var node=element.firstChild;node;node=node.nextSibling)
{var left=parseFloat(node.style.left||0);var top=parseFloat(node.style.top||0);$(node).setStyle({left:px(reverse?left-offset.x:left+offset.x),top:px(reverse?top-offset.y:top+offset.y)});}}
var PhotoViewWaitingForDonePlaying=[];function PhotoViewDonePlaying(index)
{PhotoViewWaitingForDonePlaying[index]();return false;}
var PhotoView=Class.create({initialize:function(container,scaleMode,reflectionHeight,reflectionOffset,backgroundColor,movieMode,captionHeight)
{this.scaleMode="fit";this.reflectionHeight=0;this.reflectionOffset=0;this.backgroundColor="black";this.movieMode=kShowMovie;this.captionHeight=0;if(scaleMode)
{this.scaleMode=scaleMode;}
if(reflectionHeight)
{this.reflectionHeight=reflectionHeight;if(reflectionOffset)
{this.reflectionOffset=reflectionOffset;}
if(windowsInternetExplorer)
{this.reflection=document.createElement("img");}
else
{this.reflection=document.createElement("canvas");}}
if(captionHeight)
{this.captionHeight=captionHeight;this.caption=document.createElement("div");}
if(backgroundColor)
{this.backgroundColor=backgroundColor;}
if(movieMode!==undefined)
{this.movieMode=movieMode;}
var div=document.createElement("div");var canvas=document.createElement("canvas");if(canvas.getContext&&!isOpera)
{div.appendChild(canvas);this.canvas=canvas;}
else
{var img=document.createElement("img");img.src=transparentGifURL();div.appendChild(img);this.img=img;}
if(this.reflection)
{div.appendChild(this.reflection);}
if(this.caption)
{div.appendChild(this.caption);}
container.appendChild(div);this.box=container;this.div=div;this.initStyle();},boxSize:function()
{return{width:this.box.offsetWidth,height:this.box.offsetHeight};},initStyle:function()
{var box_size=this.boxSize();$(this.div).setStyle({position:"absolute",width:px(box_size.width),height:px(box_size.height),backgroundColor:this.backgroundColor});if(this.canvas)
{$(this.canvas).setStyle({position:"absolute",left:0,top:0});$(this.canvas).setAttribute("width",box_size.width);$(this.canvas).setAttribute("height",box_size.height-Math.max(this.reflectionHeight+this.reflectionOffset,this.captionHeight));if(!windowsInternetExplorer)
{this.canvas.style.zIndex="inherit";}}
else if(this.img)
{this.img.style.position="absolute";}
if(this.reflection)
{this.reflection.style.position="absolute";if(!windowsInternetExplorer)
{this.reflection.setAttribute("width",box_size.width);this.reflection.setAttribute("height",this.reflectionHeight);}}
if(this.caption)
{$(this.caption).setStyle({position:"absolute",top:px(box_size.height-this.captionHeight*0.6),left:0,width:px(box_size.width)});this.caption.className="caption";}
this.resetSizeAndPosition();},setImage:function(photo)
{if(this.photo!==photo)
{if(this.photo)
{this.photo.image.allowUnloading();this.photo.image.unload();}
if(photo)
{photo.image.preventUnloading();}}
this.photo=photo;this.image=photo.image;this.movieURL=null;if(this.movieMode!=kPosterFrameOnly&&photo.movieURL)
{this.movieURL=photo.movieURL;}
if(this.caption)
{this.caption.innerHTML=photo.caption||'';}
var box_size=this.boxSize();box_size.height-=Math.max(this.reflectionHeight+this.reflectionOffset,this.captionHeight);if(this.movieURL&&box_size.height>kPhotoViewMovieControllerHeight)
{box_size.height-=kPhotoViewMovieControllerHeight;}
var box_aspect=box_size.height/box_size.width;var img_size=this.image.naturalSize();var img_aspect=img_size.height/img_size.width;var w=box_size.width;var h=box_size.height;if((img_aspect>box_aspect&&this.scaleMode=="fit")||(img_aspect<box_aspect&&this.scaleMode=="fill"))
{var ratio=box_size.height/img_size.height;if(this.scaleMode=="fit")
ratio=Math.min(ratio,1.0);w=Math.round(img_size.width*ratio);h=Math.round(img_size.height*ratio);}
else if((img_aspect<box_aspect&&this.scaleMode=="fit")||(img_aspect>box_aspect&&this.scaleMode=="fill"))
{var ratio=box_size.width/img_size.width;if(this.scaleMode=="fit")
ratio=Math.min(ratio,1.0);w=Math.round(img_size.width*ratio);h=Math.round(img_size.height*ratio);}
var x=Math.floor((box_size.width-w)/2);var y=Math.floor((box_size.height-h)/2);if(this.canvas)
{if(this.scaleMode=="fit")
{if(this.canvas.width!=w||this.canvas.height!=h)
{if(true)
{var newCanvas=this.canvas.cloneNode(false);newCanvas.setAttribute("width",w);newCanvas.setAttribute("height",h);this.canvas.parentNode.replaceChild(newCanvas,this.canvas);this.canvas=newCanvas;}
else
{this.canvas.setAttribute("width",w);this.canvas.setAttribute("height",h);}
$(this.canvas).setStyle({top:px(y),left:px(x)});}
if(w>0&&h>0)
{var context=this.canvas.getContext("2d");context.clearRect(0,0,w,h);context.drawImage(this.image.imgObject(),0,0,w,h);}}
else
{if(w>0&&h>0)
{var context=this.canvas.getContext("2d");context.clearRect(0,0,this.canvas.width,this.canvas.height);context.drawImage(this.image.imgObject(),x,y,w,h);}}}
else if(this.img)
{$(this.img).src=this.image.sourceURL();$(this.img).setStyle({width:px(w),height:px(h),top:px(y),left:px(x)});}
this.updateReflection(x,y,w,h);if(windowsInternetExplorer)
{setTimeout(this.updateReflection.bind(this,x,y,w,h),0);}
if(this.movieURL)
{this.movieRect=new IWRect(x,y,w,h);this.p_updateMovieRect();}},willAnimate:function()
{if(this.caption&&this.caption.parentNode==this.div)
{this.div.removeChild(this.caption);}},didAnimate:function()
{if(this.caption&&this.caption.parentNode!=this.div)
{this.div.appendChild(this.caption);}},transitionComplete:function()
{if(this.movieURL&&this.movieMode!=kPosterFrameOnly)
{this.p_showMovie();}},updateReflection:function(x,y,w,h)
{if(this.reflection)
{var opacity=0.5;this.reflection.style.top=px(y+h+this.reflectionOffset);if(windowsInternetExplorer)
{this.reflection.src=this.image.sourceURL();$(this.reflection).setStyle({left:px(x),width:px(w),height:px(h)});this.reflection.style.filter='flipv'+' progid:DXImageTransform.Microsoft.Alpha(opacity='+opacity*100+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+this.reflectionHeight/h*100+')';}
else if(this.reflection.getContext)
{if(true)
{var newReflection=this.reflection.cloneNode(false);newReflection.setAttribute("width",w);this.reflection.parentNode.replaceChild(newReflection,this.reflection);this.reflection=newReflection;}
else
{this.reflection.setAttribute("width",w);}
this.reflection.style.left=px(x);if(w>0&&this.reflection.height>0)
{var context=this.reflection.getContext("2d");context.clearRect(0,0,w,this.reflection.height);context.save();context.translate(0,h-1);context.scale(1,-1);context.drawImage(this.image.imgObject(),0,0,w,h);context.restore();context.save();var gradient=context.createLinearGradient(0,0,0,this.reflectionHeight);gradient.addColorStop(1,this.backgroundColor);var partiallyOpaque="rgba(0,0,0,"+opacity+")";var components=this.backgroundColor.toLowerCase().match(/#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/);if(components&&components.length>=4)
{partiallyOpaque="rgba("+parseInt(components[1],16)+", "+parseInt(components[2],16)+", "+parseInt(components[3],16)+", "+opacity+")";}
gradient.addColorStop(0,partiallyOpaque);context.fillStyle=gradient;if(navigator.appVersion.indexOf('WebKit')!=-1)
{context.rect(0,0,w,this.reflectionHeight*2);context.fill();}
else
{context.fillRect(0,0,w,this.reflectionHeight*2);}
context.restore();}}}},updateSize:function()
{this.initStyle();if(this.photo)
{this.photo.image.load(this.setImage.bind(this,this.photo));}},setZIndex:function(zIndex)
{this.div.style.zIndex=zIndex;},upper:function()
{this.setZIndex(1);},lower:function()
{this.setZIndex(0);},show:function()
{this.div.style.visibility="visible";},hide:function()
{this.p_destroyMovie();this.div.style.visibility="hidden";},upperShown:function()
{this.upper();this.show();},upperHidden:function()
{this.hide();this.upper();},lowerShown:function()
{this.lower();this.show();},lowerHidden:function()
{this.hide();this.lower();},setClipPx:function(top,width,height,left)
{this.div.style.clip="rect("+top+"px "+width+"px "+height+"px "+left+"px)";},setLeftPx:function(left)
{this.div.style.left=px(left);},setTopPx:function(top)
{this.div.style.top=px(top);},setClipToMax:function()
{var size=this.boxSize();this.div.style.clip="rect(0px "+size.width+"px "+size.height+"px 0px)";},resetSizeAndPosition:function()
{$(this.div).setStyle({left:0,top:0});this.setClipToMax();},setOpacity:function(opacity)
{IWSetDivOpacity(this.div,opacity)},p_appendParamToObject:function(name,value)
{var param=document.createElement("param");param.name=name;param.value=value;this.object.appendChild(param);},p_stopMovie:function()
{var movie=this.movieID?document[this.movieID]:null;if(movie)
{var status=null;try
{status=movie.GetPluginStatus();}
catch(e)
{status=null;}
if(status==null||status.startsWith("Error:")||status=="Waiting"||status=="Loading")
{}
else
{if(status=="Playable"||status=="Complete")
{if(movie.GetRate()>0)
{movie.Stop();}}}}},p_destroyMovie:function()
{if(this.movieID)
{this.p_stopMovie();var movie=document[this.movieID];if(movie)
{movie.style.display="none";}
this.div.removeChild(this.object);delete this.object;delete this.movieIndex;delete this.movieID;}},p_movieDidFinish:function()
{NotificationCenter.postNotification(new IWNotification("PhotoViewMovieDidEnd",this,{}));},p_timeString:function(time)
{var seconds=Math.floor(time);var frames=(time-seconds)*30;var minutes=Math.floor(seconds/60);var hours=Math.floor(minutes/60);seconds-=minutes*60;minutes-=hours*60;if(minutes<10)
{minutes="0"+minutes;}
if(seconds<10)
{seconds="0"+seconds;}
frames=Math.round(frames*10)/10;if(frames<10)
{frames="0"+frames;}
var timeString=hours+":"+minutes+":"+seconds+":"+frames;return timeString;},p_movieHeight:function()
{var movieHeight=this.movieRect.size.height;if(this.photo.params.movieShowController)
{movieHeight+=kPhotoViewMovieControllerHeight;}
return movieHeight;},p_updateMovieRect:function()
{if(this.object)
{this.object.setAttribute("width",this.movieRect.size.width);this.object.setAttribute("height",this.p_movieHeight());$(this.object).setStyle({position:"absolute",left:px(this.movieRect.origin.x),top:px(this.movieRect.origin.y)});}},p_showMovie:function()
{this.object=document.createElement("object");if(this.object)
{this.movieIndex=PhotoViewWaitingForDonePlaying.length;this.movieID="photoViewMovie"+this.movieIndex;this.object.id=this.movieID;if(!windowsInternetExplorer)
{this.object.type="video/quicktime";this.object.setAttribute("data",this.movieURL);this.object.style.zIndex="inherit";}
this.p_updateMovieRect();var shouldAutoplay=this.movieMode==kAutoplayMovie||this.photo.params.movieAutoPlay;this.p_appendParamToObject("controller",this.photo.params.movieShowController?"true":"false");this.p_appendParamToObject("autoplay",shouldAutoplay?"true":"false");this.p_appendParamToObject("scale","tofit");this.p_appendParamToObject("volume","12800");this.p_appendParamToObject("loop",this.photo.params.movieLoop!="SFDMovieNoLoop"?"true":"false");this.p_appendParamToObject("starttime",this.p_timeString(this.photo.params.movieStartTime*this.photo.params.movieDuration));this.p_appendParamToObject("endtime",this.p_timeString(this.photo.params.movieEndTime*this.photo.params.movieDuration));this.p_appendParamToObject("src",this.movieURL);PhotoViewWaitingForDonePlaying[this.movieIndex]=this.p_movieDidFinish.bind(this);this.p_appendParamToObject("qtnext1","<javascript:PhotoViewDonePlaying("+this.movieIndex+");>");this.div.appendChild(this.object);if(windowsInternetExplorer)
{this.object.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";this.object.codebase="http://www.apple.com/qtactivex/qtplugin.cab";}}},setMovieTime:function(time)
{if(this.object)
{var movie=document[this.movieID];movie.Stop();movie.SetTime(time*movie.GetDuration());}},p_updateMovieParams:function()
{if(this.object)
{var movie=document[this.movieID];if(movie)
{var params=$H(this.photo.params);var self=this;params.each(function(pair)
{if(pair.key=="movieShowController")
{if(movie.GetControllerVisible()!=pair.value)
{movie.SetControllerVisible(pair.value);self.object.setAttribute("height",self.p_movieHeight());}}
else if(pair.key=="movieLoop")
{movie.SetIsLooping(pair.value!="SFDMovieNoLoop");}
else if(pair.key=="movieAutoPlay")
{movie.SetAutoPlay(pair.value||this.movieMode==kAutoplayMovie);}
else if(pair.key=="movieStartTime")
{movie.SetStartTime(pair.value*movie.GetDuration());}
else if(pair.key=="movieEndTime")
{movie.SetEndTime(pair.value*movie.GetDuration());}});}}},setMovieParams:function(params)
{var photo=this.photo;$H(params).each(function(pair)
{photo.params[pair.key]=pair.value;});this.p_updateMovieParams();}});var SimpleAnimation=Class.create({initialize:function(oncomplete)
{this.duration=500;this.from=0.0;this.to=1.0;if(oncomplete!=null){this.oncomplete=oncomplete;}},animationComplete:function()
{delete this.animation;delete this.animator;this.post();if(this.oncomplete!=null){this.oncomplete();}},stop:function()
{if(this.animation!=null){this.animator.stop();this.post();delete this.animation;delete this.animator;}},start:function()
{this.stop();this.pre();var self=this;var animator=new AppleAnimator(this.duration,13);animator.oncomplete=function(){self.animationComplete();};this.animator=animator;this.framecount=0;var update=function(animation,now,first,done){self.update(now);++self.framecount;}
this.animation=new AppleAnimation(this.from,this.to,update);animator.addAnimation(this.animation);animator.start();},pre:function()
{},post:function()
{},update:function(now)
{}});var TransitionEffect=Class.create({initialize:function(current,next,oncomplete,shouldTighten)
{this.current=current;this.next=next;this.oncomplete=oncomplete;this.shouldTighten=shouldTighten;this.effects=[{name:"Random",method:"random"},{name:"Jump",method:"jump"},{name:"Fade",method:"fade"},{name:"Wipe",directions:[{name:"Right",method:"wipeRight"},{name:"Left",method:"wipeLeft"},{name:"Down",method:"wipeDown"},{name:"Up",method:"wipeUp"},{name:"In",method:"wipeIn"},{name:"Out",method:"wipeOut"}]},{name:"Close",directions:[{name:"Horizontal",method:"wipeCloseHoriz"},{name:"Vertical",method:"wipeCloseVert"}]},{name:"Open",directions:[{name:"Horizontal",method:"wipeOpenHoriz"},{name:"Vertical",method:"wipeOpenVert"}]},{name:"Reveal",directions:[{name:"Right",method:"slideOffRight"},{name:"Left",method:"slideOffLeft"},{name:"Down",method:"slideOffDown"},{name:"Up",method:"slideOffUp"}]},{name:"Slide On",directions:[{name:"Right",method:"slideOnRight"},{name:"Left",method:"slideOnLeft"},{name:"Down",method:"slideOnDown"},{name:"Up",method:"slideOnUp"}]},{name:"Push",directions:[{name:"Right",method:"pushRight"},{name:"Left",method:"pushLeft"},{name:"Down",method:"pushDown"},{name:"Up",method:"pushUp"}]},{name:"Fade Through Black",method:"fadeThroughBlack"}];},doEffect:function(effect)
{this[effect]();},random:function()
{var supportedEffects=[2,6,8,9];var idx=Math.floor(Math.random()*supportedEffects.length);var num=supportedEffects[idx];var effect=this.effects[num];var method=effect.directions?effect.directions[0].method:effect.method;this.doEffect(method);},animationComplete:function()
{delete this.animation;if(this.oncomplete!=null){this.oncomplete();}},jump:function()
{this.stop();this.next.upperShown();this.current.lowerHidden();this.animationComplete();},tighten:function(horiz,vert)
{if(this.shouldTighten&&(vert||horiz))
{var top=99999;var left=99999;var right=0;var bottom=0;function expand(div)
{for(var node=div.firstChild;node;node=node.nextSibling)
{var t=node.offsetTop;var l=node.offsetLeft;left=Math.min(left,l);top=Math.min(top,t);right=Math.max(right,l+node.offsetWidth);bottom=Math.max(bottom,t+node.offsetHeight);}}
expand(this.current.div);expand(this.next.div);if(vert==false||horiz==false)
{var boxSize=this.current.boxSize();if(vert==false)
{top=0;bottom=boxSize.height;}
if(horiz==false)
{left=0;right=boxSize.width;}}
var frame=new IWRect(left,top,right-left,bottom-top);this.current.originalFrame=new IWRect(this.current.div.offsetLeft,this.current.div.offsetTop,this.current.div.offsetWidth,this.current.div.offsetHeight);this.next.originalFrame=new IWRect(this.next.div.offsetLeft,this.next.div.offsetTop,this.next.div.offsetWidth,this.next.div.offsetHeight);this.current.offset=setFrameOptionallyMovingContents(this.current.div,frame,true);this.next.offset=setFrameOptionallyMovingContents(this.next.div,frame,true);}},loosen:function(loosenHoriz,loosenVert)
{if(this.shouldTighten&&(loosenHoriz||loosenVert))
{setFrameOptionallyMovingContents(this.current.div,this.current.originalFrame,false);setFrameOptionallyMovingContents(this.next.div,this.next.originalFrame,false);offsetChildren(this.current.div,this.current.offset,true);offsetChildren(this.next.div,this.next.offset,true);}},fade:function()
{this.stop();var self=this;this.animation=new SimpleAnimation(function(){self.animationComplete();});this.animation.pre=function()
{self.tighten(true,true);self.current.upperShown();self.next.lowerShown();self.current.setOpacity(1.0);self.next.setOpacity(1.0);}
this.animation.post=function()
{self.loosen(true,true);self.next.upperShown();self.next.setOpacity(1.0);self.current.lowerHidden();self.current.setOpacity(1.0);}
this.animation.update=function(now)
{self.current.setOpacity(1.0-now);}
this.animation.start();},fadeThroughBlack:function()
{this.stop();var self=this;this.animation=new SimpleAnimation(function(){self.animationComplete();});this.animation.pre=function()
{self.tighten(true,true);self.current.upperShown();self.next.lowerShown();self.current.setOpacity(1.0);self.next.setOpacity(0.0);}
this.animation.post=function()
{self.loosen(true,true);self.next.upperShown();self.next.setOpacity(1.0);self.current.lowerHidden();self.current.setOpacity(1.0);}
this.animation.update=function(now)
{if(now<0.5)
{self.current.setOpacity((0.5-now)*2);}
else
{self.current.lowerHidden();self.next.setOpacity((now-0.5)*2);}}
this.animation.start();},doWipe:function(wiper,inFlag,tightenHoriz,tightenVert)
{this.stop();var self=this;this.animation=new SimpleAnimation(function(){self.animationComplete();});this.animation.pre=function()
{self.current.resetSizeAndPosition();self.width=parseInt(self.current.div.style.width);self.height=parseInt(self.current.div.style.height);self.tighten(tightenHoriz,tightenVert);if(inFlag){wiper.call(self,self.animation.from);self.next.upperShown();self.current.lowerShown();}
else{self.current.upperShown();self.next.lowerShown();}}
this.animation.post=function()
{self.loosen(tightenHoriz,tightenVert);self.next.upperShown();self.next.resetSizeAndPosition();self.current.lowerHidden();self.current.resetSizeAndPosition();}
this.animation.update=function(now)
{wiper.call(self,now);}
this.animation.start();},wipeRight:function()
{this.doWipe(function(now)
{this.current.setClipPx(0,this.width,this.height,now*this.width);});},wipeLeft:function()
{this.doWipe(function(now)
{this.current.setClipPx(0,this.width-now*this.width,this.height,0);});},wipeDown:function()
{this.doWipe(function(now)
{this.current.setClipPx(now*this.height,this.width,this.height,0);});},wipeUp:function()
{this.doWipe(function(now)
{this.current.setClipPx(0,this.width,this.height-now*this.height,0);});},wipeIn:function()
{this.doWipe(function(now)
{var x=this.width*(1-now)/2;var y=this.height*(1-now)/2;this.next.setClipPx(y,this.width-x,this.height-y,x);},true);},wipeOut:function()
{this.doWipe(function(now)
{var x=this.width*now/2;var y=this.height*now/2;this.current.setClipPx(y,this.width-x,this.height-y,x);});},wipeCloseHoriz:function()
{this.doWipe(function(now)
{var x=this.width*now/2;this.current.setClipPx(0,this.width-x,this.height,x);});},wipeCloseVert:function()
{this.doWipe(function(now)
{var y=this.height*now/2;this.current.setClipPx(y,this.width,this.height-y,0);});},wipeOpenHoriz:function()
{this.doWipe(function(now)
{var x=this.width*(1-now)/2;this.next.setClipPx(0,this.width-x,this.height,x);},true);},wipeOpenVert:function()
{this.doWipe(function(now)
{var y=this.height*(1-now)/2;this.next.setClipPx(y,this.width,this.height-y,0);},true);},slideOffRight:function()
{this.doWipe(function(now)
{var x=now*this.width;this.current.setLeftPx(x+(this.width-parseInt(this.current.div.style.width))/2);},false,true,true);},slideOffLeft:function()
{this.doWipe(function(now)
{var x=now*this.width;this.current.setClipPx(0,this.width,this.height,x);this.current.setLeftPx(-x);});},slideOffDown:function()
{this.doWipe(function(now)
{var y=now*this.height;this.current.setClipPx(0,this.width,this.height-y,0);this.current.setTopPx(y);});},slideOffUp:function()
{this.doWipe(function(now)
{var y=now*this.width;this.current.setClipPx(y,this.width,this.height,0);this.current.setTopPx(-y);});},slideOnRight:function()
{this.doWipe(function(now)
{var x=(1-now)*this.width;this.next.setClipPx(0,this.width,this.height,x);this.next.setLeftPx(-x);},true);},slideOnLeft:function()
{this.doWipe(function(now)
{var x=now*this.width;this.next.setClipPx(0,x,this.height,0);this.next.setLeftPx(this.width-x);},true);},slideOnDown:function()
{this.doWipe(function(now)
{var y=(1-now)*this.height;this.next.setClipPx(y,this.width,this.height,0);this.next.setTopPx(-y);},true);},slideOnUp:function()
{this.doWipe(function(now)
{var y=now*this.height;this.next.setClipPx(0,this.width,y,0);this.next.setTopPx(this.height-y);},true);},pushRight:function()
{this.doWipe(function(now)
{var x=now*this.width;this.current.setLeftPx(x+(this.width-parseInt(this.current.div.style.width))/2);this.next.setLeftPx(x-this.width+(this.width-parseInt(this.current.div.style.width))/2);},false,true,true);},pushLeft:function()
{this.doWipe(function(now)
{var x=now*this.width;this.current.setClipPx(0,this.width,this.height,x);this.current.setLeftPx(-x);this.next.setClipPx(0,x,this.height,0);this.next.setLeftPx(this.width-x);});},pushDown:function()
{this.doWipe(function(now)
{var y=now*this.height;this.current.setClipPx(0,this.width,this.height-y,0);this.current.setTopPx(y);this.next.setClipPx(this.height-y,this.width,this.height,0);this.next.setTopPx(y-this.height);});},pushUp:function()
{this.doWipe(function(now)
{var y=now*this.height;this.current.setClipPx(y,this.width,this.height,0);this.current.setTopPx(-y);this.next.setClipPx(0,this.width,y,0);this.next.setTopPx(this.height-y);});},stop:function()
{if(this.animation!=null){this.animation.stop();delete this.animation;}}});var Slideshow=Class.create({initialize:function(container,photos,onchange,options)
{this.reflectionHeight=0;this.reflectionOffset=0;this.backgroundColor='black';this.scaleMode="fit";this.movieMode=kShowMovie;this.advanceAnchor=null;this.captionHeight=0;this.shouldTighten=true;if(options)
{if(options.reflectionHeight)
{this.reflectionHeight=parseFloat(options.reflectionHeight);}
if(options.reflectionOffset)
{this.reflectionOffset=parseFloat(options.reflectionOffset);}
if(options.backgroundColor)
{this.backgroundColor=options.backgroundColor;}
if(options.scaleMode)
{this.scaleMode=options.scaleMode;}
if(options.movieMode!==undefined)
{this.movieMode=options.movieMode;}
if(options.advanceAnchor!==undefined)
{this.advanceAnchor=options.advanceAnchor;}
if(options.captionHeight!==undefined)
{this.captionHeight=options.captionHeight;}
if(options.shouldTighten!==undefined)
{this.shouldTighten=options.shouldTighten;}}
this.background=new PhotoView(container,this.scaleMode,0,0,this.backgroundColor,false,false,0);this.current={view:new PhotoView(container,this.scaleMode,this.reflectionHeight,this.reflectionOffset,this.backgroundColor,this.movieMode,this.captionHeight)};this.prev={view:new PhotoView(container,this.scaleMode,this.reflectionHeight,this.reflectionOffset,this.backgroundColor,this.movieMode,this.captionHeight)};this.next={view:new PhotoView(container,this.scaleMode,this.reflectionHeight,this.reflectionOffset,this.backgroundColor,this.movieMode,this.captionHeight)};this.current.view.upperShown();this.prev.view.lowerHidden();this.next.view.lowerHidden();this.photos=photos;this.onchange=onchange;this.paused=true;this.photoDuration=5000;this.currentPhotoNumber=0;this.selectedTransition="random";this.lastPhotoChange=new Date();},updateSize:function()
{this.background.updateSize();this.current.view.updateSize();this.prev.view.updateSize();this.next.view.updateSize();this.p_updateAnchorSize();},transitionComplete:function(number)
{this.transition.current.didAnimate();this.transition.next.didAnimate();this.transition.next.transitionComplete();delete this.transition;if(this.onchange!=null){this.onchange(number);}},showPhotoNumber:function(number,skipTransition)
{this.p_showPhotoNumber(number,skipTransition,true);},p_updateAnchorSize:function()
{if(this.advanceAnchor)
{var box_size=this.current.view.boxSize();$(this.advanceAnchor).setStyle({position:"absolute",width:px(box_size.width),height:px(box_size.height)});if(windowsInternetExplorer)
{var img=this.advanceAnchor.firstChild;if(!img)
{img=document.createElement('img');this.advanceAnchor.appendChild(img);}
img.src=transparentGifURL();img.style.width=this.advanceAnchor.style.width;img.style.height=this.advanceAnchor.style.height;}}},p_setAdvanceAnchorHandler:function()
{if(this.advanceAnchor)
{if(this.current.photo&&this.current.photo.movieURL)
{this.advanceAnchor.style.display='none';this.advanceAnchor.href='';this.advanceAnchor.onclick=function(){return false;};}
else
{this.advanceAnchor.style.display='';this.advanceAnchor.href='#'+this.nextPhotoNumber();this.advanceAnchor.onclick=function(i){setTimeout(this.showPhotoNumber.bind(this,i,true),0);}.bind(this,this.nextPhotoNumber());}}},p_showPhotoNumber:function(number,skipTransition,override)
{this.cancelNextPhotoTimer();if(this.transition!=null)
{this.transition.stop();delete this.transition;}
var transitionTime=500;var current=this.current;var prev=this.prev;var next=this.next;if(next.photo==undefined||next.photo!==this.photos[number])
{if(prev.photo!=undefined&&prev.photo===this.photos[number])
{next=prev;}
else if(override)
{next.photo=this.photos[number];}
else
{return;}}
if(next.photo.image.loaded()==false)
{next.photo.image.load(arguments.callee.bind(this,number,skipTransition,false));return;}
if(next.view.image==undefined||next.view.image!==next.photo.image)
{next.view.setImage(next.photo);}
var self=this;current.view.willAnimate();next.view.willAnimate();this.transition=new TransitionEffect(current.view,next.view,function(){self.transitionComplete(number);},this.shouldTighten);if(skipTransition||(new Date()).getTime()-this.lastPhotoChange.getTime()<transitionTime)
{this.transition.jump();}
else
{this.transition.doEffect(this.selectedTransition);}
this.currentPhotoNumber=number;this.lastPhotoChange=new Date();this.current=next;this.p_setAdvanceAnchorHandler();if(next===prev)
{this.prev=this.next;this.next=current;this.prev.photo=this.photos[this.prevPhotoNumber()];this.prev.photo.image.load(this.prev.view.setImage.bind(this.prev.view,this.prev.photo));}
else
{this.prev=current;this.next=prev;this.next.photo=this.photos[this.nextPhotoNumber()];this.next.photo.image.load(this.next.view.setImage.bind(this.next.view,this.next.photo));}
this.startNextPhotoTimer();},start:function()
{this.paused=false;this.showPhotoNumber(0);},pause:function()
{if(!this.paused){this.paused=true;this.cancelNextPhotoTimer();}},resume:function()
{if(this.paused){this.paused=false;this.startNextPhotoTimer();}},inactivate:function()
{this.pause();this.current.view.p_stopMovie();},startNextPhotoTimer:function(time)
{if(this.paused){return;}
if(this.nextPhotoTimer!=null){(function(){return false}).assert("trying to set overlapping timer");return;}
var self=this;var timedAdvance=function()
{delete self.nextPhotoTimer;var canAdvance=true;if(this.current.view.movieURL!=null)
{var movie=document[this.current.view.movieID];var status=null;try
{status=movie.GetPluginStatus();}
catch(e)
{status=null;}
if(status==null||status.startsWith("Error:"))
{}
else
{var time=movie.GetTime();var duration=movie.GetDuration();var timeScale=movie.GetTimeScale();var timeRemaining=duration-time;var timeRemainingInMS=timeRemaining/timeScale*1000;if(status=="Waiting"||status=="Loading")
{canAdvance=false;this.startNextPhotoTimer(timeRemainingInMS);}
else if(status=="Playable"||status=="Complete")
{if(timeRemainingInMS>0)
{canAdvance=false;this.startNextPhotoTimer(timeRemainingInMS);}}}}
if(canAdvance)
{self.advance();}}.bind(this)
this.nextPhotoTimer=setTimeout(timedAdvance,time||this.photoDuration);},cancelNextPhotoTimer:function()
{if(this.nextPhotoTimer!=null){clearTimeout(this.nextPhotoTimer);delete this.nextPhotoTimer;}},halt:function()
{this.cancelNextPhotoTimer();},unhalt:function()
{this.startNextPhotoTimer();},nextPhotoNumber:function()
{var number=this.currentPhotoNumber+1;if(number>=this.photos.length){number=0;}
return number;},prevPhotoNumber:function()
{var number=this.currentPhotoNumber-1;if(number<0){number=this.photos.length-1;}
return number;},advance:function()
{this.showPhotoNumber(this.nextPhotoNumber());},goBack:function()
{this.showPhotoNumber(this.prevPhotoNumber());},setMovieTime:function(time)
{this.current.view.setMovieTime(time);},setMovieParams:function(params)
{this.current.view.setMovieParams(params);},setImage:function(image)
{var current=this.current;current.photo.image=image;current.photo.image.load(current.view.setImage.bind(current.view,current.photo));},getAvailableTransitions:function()
{var te=new TransitionEffect;return te.effects;},setTransitionIndex:function(effectId,directionId)
{var effects=this.getAvailableTransitions();var effect=effects[effectId];if(effect!=null){if(effect.directions==null){if(effect.method!=null){this.selectedTransition=effect.method;}}
else{var dir=effect.directions[directionId];if(dir!=null&&dir.method!=null){this.selectedTransition=dir.method;}}}}});var IWHorizontalAlignment={kImageAlignLeft:0,kImageAlignCenter:1,kImageAlignRight:2}
var IWVerticalAlignment={kImageAlignTop:0,kImageAlignMiddle:1,kImageAlignBottom:2}
var IWPhotoGridLayoutConstants={kBorderThickness:6.0,vTextOffsetFromImage:5.0,vTextOffsetFromBottom:10.0,vTopSpacing:5.0,hMinSpacing:15.0}
var latestImageStream=null;var latestIndex=null;function IWStartSlideshow(url,imageStream,index,fullScreen)
{var windowWidth=800;var windowHeight=800;if(fullScreen)
{windowWidth=screen.availWidth;windowHeight=screen.availHeight;}
else
{if(screen.availHeight>975)
{windowWidth=1000;windowHeight=950;}
else if(screen.availHeight>775)
{windowWidth=800;windowHeight=750;}
else
{windowWidth=711;windowHeight=533;}}
windowWidth=Math.min(screen.availWidth,windowWidth);windowHeight=Math.min(screen.availHeight,windowHeight);var windowLeft=Math.round((screen.availWidth-windowWidth)/2);var windowTop=Math.round((screen.availHeight-windowHeight)/2)-25;windowTop=Math.max(windowTop,0);var slideWindow=window.open(url,'slideshow','scrollbars=no,titlebar=no,location=no,status=no,toolbar=no,resizable=no,width='+windowWidth+',height='+windowHeight+',top='+windowTop+',left='+windowLeft);if(slideWindow.screenY&&slideWindow.screenY>windowTop)
{slideWindow.screenY=windowTop;}
latestImageStream=imageStream;latestIndex=index;slideWindow.focus();return false;}
function IWUpdateVerticalAlignment(element)
{element=$(element);function setVerticalAlignmentAndClearClass(element,valign)
{var table=$(document.createElement("table"));table.setStyle({width:"100%",height:"100%",borderSpacing:0});var tr=document.createElement("tr");table.appendChild(tr);var td=document.createElement("td");td.setAttribute("valign",valign);tr.appendChild(td);element.className=element.className.replace(new RegExp('\\bvalign-'+valign+'\\b'),"");element.parentNode.replaceChild(table,element);td.appendChild(element);if(windowsInternetExplorer)
{var html=table.parentElement.innerHTML;table.parentElement.innerHTML=html;}}
var middleAligns=element.select('.valign-middle');for(var i=0;i<middleAligns.length;++i)
{setVerticalAlignmentAndClearClass(middleAligns[i],"middle");}
var bottomAligns=element.select('.valign-bottom');for(var i=0;i<bottomAligns.length;++i)
{setVerticalAlignmentAndClearClass(bottomAligns[i],"bottom");}}
function IWShowDiv(div,show)
{div.style.display=show?"inline":"none";}
function IWToggleDetailView(showDetail,index,divID,headerViewID,footerViewID,detailViewID,shadow)
{var grid=$(divID);var header=$(headerViewID);var footer=$(footerViewID);var detail=$(detailViewID);var showGrid=!showDetail;function showHide()
{IWShowDiv(grid,showGrid);IWShowDiv(header,showGrid);IWShowDiv(footer,showGrid);IWShowDiv(detail,showDetail);}
if(showDetail)
{var detailWidget=widgets[detailViewID];function showDetailView()
{showHide();detailWidget.willShow(index);IWSetSpacerHeight(grid,detailWidget.height());window.scrollTo(0,0);}
if(index!==undefined)
{detailWidget.showPhotoNumber(index,showDetailView);}
else
{showDetailView();}}
else
{showHide();if(isSafari&&!isEarlyWebKitVersion&&shadow)
{$(divID).select('.framedImage').each(function(framed)
{var renderShadowJob=shadow.applyToElement.bind(shadow,framed);IWJobQueue.sharedJobQueue.addJob(renderShadowJob);});}
if(grid.style.height)
{IWSetSpacerHeight(grid,parseFloat(grid.style.height));}}}
function IWSetSpacerHeight(photogrid,height)
{var parent=$(photogrid.parentNode);var spacers=parent.select('.spacer');var spacer=spacers[spacers.length-1];if(initialSpacerHeight==0)
{initialSpacerHeight=parseInt(spacer.style.height);}
var spacerHeight=Math.max(parseInt(photogrid.style.top)+height-spacer.offsetTop,initialSpacerHeight);spacer.style.height=spacer.style.lineHeight=px(spacerHeight);}
function IWLayoutPhotoGrid(divID,layout,stroke,imageStream,range,shadow,valignClass,opacity,slideshowParameters,slideshowURL,headerViewID,detailViewID,footerViewID,layoutOptions)
{if(range.length()==0)
{return;}
IWJobQueue.sharedJobQueue.clearJobs();function toggleDetailViewNotification(notification)
{var userInfo=notification.userInfo();IWToggleDetailView(userInfo.showDetailView,userInfo.index,divID,headerViewID,footerViewID,detailViewID,shadow);}
var showPhotoIndex=undefined;var hash=location.hash;if(hash.length>1)
{if(hash.match(/^\#(\d+)$/))
{var idx=RegExp.$1;if(idx<imageStream.length)
{showPhotoIndex=parseInt(idx);}}}
if(isiPhone)
{slideshowURL=slideshowURL.stringByDeletingLastPathComponent().stringByAppendingPathComponent("phoneshow.html");}
slideshowURL=slideshowURL.stringByAppendingAsQueryString(slideshowParameters);if(detailViewID!=null)
{var detailView=widgets[detailViewID];if(!detailView.preferenceForKey("mediaStreamObject"))
{if(showPhotoIndex!==undefined)
{detailView.setPreferenceForKey(showPhotoIndex,"startIndex");}
var mediaStreamObject={load:function(baseURL,callback){callback(imageStream);}};detailView.setPreferenceForKey(mediaStreamObject,"mediaStreamObject");NotificationCenter.addObserver(null,toggleDetailViewNotification,DetailViewToggleNotification,divID);if(slideshowParameters)
{detailView.setPlaySlideshowFunction(IWStartSlideshow.bind(null,slideshowURL,imageStream,0,slideshowParameters["fullScreen"]));}}}
var photogrid=$(divID);photogrid.innerHTML="";for(var i=0;i<range.length();++i)
{var frame=$(document.createElement('div'));var translation=layout.translationForTileAtIndex(i);var size=layout.tileSize();frame.style.cssText=iWPosition(true,translation.x,translation.y,size.width,size.height);frame.hide();photogrid.appendChild(frame);}
var textBoxSize=layout.mTextBoxSize;var renderThumb=function(i,streamIndex)
{var imageStreamEntry=imageStream[streamIndex];var wrapper=photogrid.childNodes[i];var textPos=layout.translationForTextAtIndexWithOffset(i,null);var textMarkup="";if(textBoxSize.height>0)
{var richTitle=imageStreamEntry.richTitle();if(richTitle==null)
{richTitle=imageStreamEntry.title();}
var valignClassName='';if(valignClass)
{valignClassName=' '+valignClass;}
var metric=imageStreamEntry.metric();if(metric!=null&&metric.length>0)
{metric='<span class="metric">'+metric+'</span>';}
else
{metric="";}
var showTitle=layoutOptions?layoutOptions.showTitle:true;var showMetric=layoutOptions?layoutOptions.showMetric:true;var richCaption='<div class="caption'+valignClassName+'">'+
(showTitle?('<span class="title">'+richTitle+'</span>'):'')+
((showTitle&&showMetric)?'<br />':'')+
(showMetric?metric:'')+'</div>';var opacityMarkup='';if(opacity<0.999)
{opacityMarkup=windowsInternetExplorer?" filter: progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity*100+"); ":" opacity: "+opacity+"; ";}
var overflowMarkup="overflow: hidden; ";textMarkup='<div style="'+iWPosition(true,textPos.x,textPos.y,textBoxSize.width,textBoxSize.height)+opacityMarkup+overflowMarkup+'">'+
richCaption+'</div>';}
var thumbnailSize=imageStreamEntry.thumbnailNaturalSize();var scale=layout.p_scaleForImageOfSize(thumbnailSize);var scaledImageSize=thumbnailSize.scale(scale,scale,true);if(Math.abs(scaledImageSize.width-thumbnailSize.width)<=2&&Math.abs(scaledImageSize.height-thumbnailSize.height)<=2)
{scaledImageSize=thumbnailSize;}
var frameMarkup=stroke.markupForImageStreamEntry(imageStreamEntry,scaledImageSize);wrapper.insert(frameMarkup);wrapper.insert(textMarkup);if(textMarkup.length>0)
{var textWrapper=wrapper.lastChild;textWrapper.style.zIndex=1;}
IWUpdateVerticalAlignment(wrapper);var framed=$(wrapper).selectFirst('.framedImage');var framePos=layout.translationForImageOfSizeAtIndexWithOffset(new IWSize(parseFloat(framed.style.width||0),parseFloat(framed.style.height||0)),i,null);framed.setStyle({left:px(framePos.x),top:px(framePos.y),zIndex:1});if(detailViewID)
{var anchor=$(document.createElement("a"));anchor.setStyle({position:"absolute",left:framed.style.left,top:framed.style.top,width:framed.style.width,height:framed.style.height,zIndex:1});anchor.href='#'+streamIndex;anchor.onclick=IWToggleDetailView.bind(null,true,streamIndex,divID,headerViewID,footerViewID,detailViewID,shadow);if(windowsInternetExplorer&&(effectiveBrowserVersion>=7))
{var img=document.createElement('img');img.src=transparentGifURL();img.style.width=framed.style.width;img.style.height=framed.style.height;anchor.appendChild(img);}
framed.parentNode.insertBefore(anchor,framed.nextSibling);}
IWSetDivOpacity(framed,opacity);wrapper.show();if(shadow)
{if(windowsInternetExplorer)
{var imgs=framed.select('img');var left=0,top=0;var right=parseFloat(framed.style.width||0);var bottom=parseFloat(framed.style.height||0);for(var e=0;e<imgs.length;++e)
{var style=imgs[e].style;var l=parseFloat(style.left||0);var t=parseFloat(style.top||0);left=Math.min(l,left);top=Math.min(t,top);right=Math.max(l+parseFloat(style.width||0),right);bottom=Math.max(t+parseFloat(style.height||0),bottom);}
framed.setStyle({left:px(parseFloat(framed.style.left||0)+left),top:px(parseFloat(framed.style.top||0)+top),width:px(right-left),height:px(bottom-top)});var framedChildren=framed.childNodes;for(var c=0;c<framedChildren.length;++c)
{var child=framedChildren[c];if(child.nodeType==Node.ELEMENT_NODE)
{child.style.left=px(parseFloat(child.style.left||0)-left);child.style.top=px(parseFloat(child.style.top||0)-top);}}
var blurRadius=shadow.mBlurRadius*.75;var xOffset=shadow.mOffset.x-blurRadius;var yOffset=shadow.mOffset.y-blurRadius;var shadowDiv=framed.cloneNodeExcludingIDs(true);shadowDiv.style.left=px(framePos.x+xOffset);shadowDiv.style.top=px(framePos.y+yOffset);shadowDiv.style.filter="progid:DXImageTransform.Microsoft.MaskFilter()"+" progid:DXImageTransform.Microsoft.MaskFilter(color="+shadow.mColor+")"+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+blurRadius+")"+" progid:DXImageTransform.Microsoft.Alpha(opacity="+shadow.mOpacity*opacity*100+")";framed.parentNode.insertBefore(shadowDiv,framed);}
else
{if(!isEarlyWebKitVersion)
{shadow.applyToElement(framed);}}}
imageStreamEntry.didInsertThumbnailMarkupIntoDocument();imageStreamEntry.unloadThumbnail();};for(var i=0;i<range.length();++i)
{var streamIndex=range.location()+i;var renderThumbJob=renderThumb.bind(null,i,streamIndex);imageStream[streamIndex].loadThumbnail(IWJobQueue.prototype.addJob.bind(IWJobQueue.sharedJobQueue,renderThumbJob));}
var headerView=widgets[headerViewID];if(headerView)
{if(slideshowParameters)
{headerView.setPlaySlideshowFunction(IWStartSlideshow.bind(null,slideshowURL,imageStream,0,slideshowParameters["fullScreen"]));}
headerView.setPreferenceForKey(imageStream.length,"entryCount");}
function setFooterOffset(height)
{var footer=$(footerViewID);var footerOffsetTop=photogrid.offsetTop+height-layout.mBottomPadding;footer.style.top=px(footerOffsetTop);}
var gridHeight=layout.totalHeightForCount(range.length());setFooterOffset(gridHeight);IWSetSpacerHeight(photogrid,gridHeight);photogrid.style.height=px(gridHeight);if(showPhotoIndex!==undefined)
{IWToggleDetailView(true,showPhotoIndex,divID,headerViewID,footerViewID,detailViewID,shadow);}}
var initialSpacerHeight=0;var IWPhotoGridLayout=Class.create({initialize:function(columnCount,maxImageSize,textBoxSize,tileSize,topPadding,bottomPadding,spacing,framePadding)
{this.mColumnCount=columnCount;this.mMaxImageSize=maxImageSize;this.mTextBoxSize=textBoxSize;this.mTileSize=tileSize;this.mTopPadding=topPadding;this.mBottomPadding=bottomPadding;this.mSpacing=spacing;this.mFramePadding=framePadding;this.mCachedDataValid=true;},tileSize:function()
{return this.mTileSize;},translationForTileAtIndex:function(index)
{var tileSize=this.mTileSize;var columnCount=this.mColumnCount;var translation=new IWPoint(tileSize.width*(index%columnCount)+IWPhotoGridLayoutConstants.kBorderThickness,tileSize.height*Math.floor(index/columnCount)+IWPhotoGridLayoutConstants.kBorderThickness+this.mTopPadding+IWPhotoGridLayoutConstants.vTopSpacing);return translation;},translationForImageOfSizeAtIndexWithOffset:function(imageSize,index,offset)
{var tileSize=this.mTileSize;var translation=new IWPoint(0,0);var imageAreaSize=new IWSize(tileSize.width,tileSize.height-(IWPhotoGridLayoutConstants.vTextOffsetFromImage+this.mTextBoxSize.height+IWPhotoGridLayoutConstants.vTextOffsetFromBottom));translation.x+=(imageAreaSize.width-imageSize.width)/2;translation.y+=(imageAreaSize.height-imageSize.height);if(offset!=null)
{translation.x+=offset.translation.width;translation.y+=offset.translation.height;}
return translation;},translationForTextAtIndexWithOffset:function(index,offset)
{var tileSize=this.mTileSize;var textBoxSize=this.mTextBoxSize;var translation=new IWPoint((tileSize.width-textBoxSize.width)/2.0,(tileSize.height-textBoxSize.height)-IWPhotoGridLayoutConstants.vTextOffsetFromBottom);if(offset!=null)
{translation.x+=offset.translation.width;translation.y+=offset.translation.height;}
return translation;},totalHeightForCount:function(count)
{if(count==0)
count=1;var columnCount=this.mColumnCount;var lastRow=Math.floor((count+columnCount-1)/columnCount);var tileSize=this.mTileSize;return tileSize.height*lastRow+IWPhotoGridLayoutConstants.kBorderThickness*2+this.mTopPadding+this.mBottomPadding;},p_scaleForImageOfSize:function(imageSize)
{var maxImageSize=this.mMaxImageSize;return Math.min((maxImageSize.width-this.mFramePadding.width)/imageSize.width,(maxImageSize.height-this.mFramePadding.height)/imageSize.height);}});var IWJobQueue=Class.create({initialize:function()
{this.mJobQueue=[];this.mTimeout=null;},addJob:function(job)
{this.mJobQueue.push(job);this.p_setTimeout();},clearJobs:function(job)
{this.p_cancelTimeout();this.mJobQueue=[];},p_runQueuedJobs:function()
{this.p_cancelTimeout();var startTime=new Date().getTime();var duration=0;while(this.mJobQueue.length>0&&duration<100)
{var job=this.mJobQueue.shift();if(job)
{job();}
duration=(new Date().getTime())-startTime;}
if(this.mJobQueue.length>0)
{this.p_setTimeout();}},p_cancelTimeout:function()
{if(this.mTimeout!=null)
{clearTimeout(this.mTimeout);this.mTimeout=null;}},p_setTimeout:function()
{if(this.mTimeout==null)
{this.mTimeout=setTimeout(this.p_runQueuedJobs.bind(this),0);}}});IWJobQueue.sharedJobQueue=new IWJobQueue();var AppleAnimator=Class.create({initialize:function(duration,interval,optionalFrom,optionalTo,optionalCallback)
{this.startTime=0;this.duration=duration;this.interval=interval;this.animations=new Array;this.timer=null;this.oncomplete=null;this._firstTime=true;var self=this;this.animate=function(self){function limit_3(a,b,c){return a<b?b:(a>c?c:a);}
var T,time;var ease;var time=(new Date).getTime();var dur=self.duration;var done;T=limit_3(time-self.startTime,0,dur);time=T/dur;ease=0.5-(0.5*Math.cos(Math.PI*time));done=T>=dur;var array=self.animations;var c=array.length;var first=self._firstTime;for(var i=0;i<c;++i)
{array[i].doFrame(self,ease,first,done,time);}
if(done)
{self.stop();if(self.oncomplete!=null)
{self.oncomplete();}}
self._firstTime=false;}
if(optionalFrom!==undefined&&optionalTo!==undefined&&optionalCallback!==undefined)
{this.addAnimation(new AppleAnimation(optionalFrom,optionalTo,optionalCallback));}},start:function(){if(this.timer==null)
{var timeNow=(new Date).getTime();var interval=this.interval;this.startTime=timeNow-interval;this.timer=setInterval(this.animate.bind(null,this),interval);}},stop:function(){if(this.timer!=null)
{clearInterval(this.timer);this.timer=null;}},addAnimation:function(animation){this.animations[this.animations.length]=animation;}});var AppleAnimation=Class.create({initialize:function(from,to,callback)
{this.from=from;this.to=to;this.callback=callback;this.now=from;this.ease=0;this.time=0;},doFrame:function(animation,ease,first,done,time){var now;if(done)
now=this.to;else
now=this.from+(this.to-this.from)*ease;this.now=now;this.ease=ease;this.time=time;this.callback(animation,now,first,done);}});function IWCommentSummaryInfoForURL(resourceURL,callback)
{function handleSummaryData(request)
{var result={};if(request.responseText)
{var r=request.responseText.match(/.*= ((true)|(false));.*\n.*= (\d+)/);if(r)
{result.enabled=(r[1]=="true");result.count=Number(r[4]);}}
callback(result);}
var summaryURL=resourceURL+"?wsc=summary.js&ts="+(new Date().getTime());new Ajax.Request(summaryURL,{method:'get',onSuccess:handleSummaryData,onFailure:callback.bind(null,{})});}
function IWCommentCountForURL(resourceURL,callback)
{function myCallback(info)
{if(info.count===undefined)
info.count=0;callback(info.count);}
IWCommentSummaryInfoForURL(resourceURL,myCallback);}

1025
no/Scripts/iWebSite.js Normal file

File diff suppressed because it is too large Load Diff