mirror of
https://github.com/KevinMidboe/planetposen-original.git
synced 2025-10-29 17:50:33 +00:00
Init commit. Added under construction banner for all pages.
This commit is contained in:
114
en/Scripts/Widgets/DetailView/DetailView.css
Normal file
114
en/Scripts/Widgets/DetailView/DetailView.css
Normal 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%;
|
||||
}
|
||||
255
en/Scripts/Widgets/DetailView/DetailView.js
Normal file
255
en/Scripts/Widgets/DetailView/DetailView.js
Normal 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=" ";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;}}});
|
||||
2
en/Scripts/Widgets/DetailView/localizedStrings.js
Normal file
2
en/Scripts/Widgets/DetailView/localizedStrings.js
Normal 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);})();
|
||||
29
en/Scripts/Widgets/FooterControls/FooterControls.css
Normal file
29
en/Scripts/Widgets/FooterControls/FooterControls.css
Normal 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;
|
||||
}
|
||||
39
en/Scripts/Widgets/FooterControls/FooterControls.js
Normal file
39
en/Scripts/Widgets/FooterControls/FooterControls.js
Normal 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);}});
|
||||
BIN
en/Scripts/Widgets/HTMLRegion/Default.png
Normal file
BIN
en/Scripts/Widgets/HTMLRegion/Default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
BIN
en/Scripts/Widgets/HTMLRegion/HTMLRegionWorldMap.png
Normal file
BIN
en/Scripts/Widgets/HTMLRegion/HTMLRegionWorldMap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
BIN
en/Scripts/Widgets/HTMLRegion/Icon.png
Normal file
BIN
en/Scripts/Widgets/HTMLRegion/Icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
53
en/Scripts/Widgets/HTMLRegion/Paste.css
Normal file
53
en/Scripts/Widgets/HTMLRegion/Paste.css
Normal 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;
|
||||
}
|
||||
|
||||
25
en/Scripts/Widgets/HTMLRegion/Paste.js
Normal file
25
en/Scripts/Widgets/HTMLRegion/Paste.js
Normal 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});
|
||||
48
en/Scripts/Widgets/HeaderControls/HeaderControls.css
Normal file
48
en/Scripts/Widgets/HeaderControls/HeaderControls.css
Normal 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;
|
||||
}
|
||||
|
||||
122
en/Scripts/Widgets/HeaderControls/HeaderControls.js
Normal file
122
en/Scripts/Widgets/HeaderControls/HeaderControls.js
Normal 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);}}});
|
||||
2
en/Scripts/Widgets/HeaderControls/localizedStrings.js
Normal file
2
en/Scripts/Widgets/HeaderControls/localizedStrings.js
Normal 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);})();
|
||||
67
en/Scripts/Widgets/Navbar/navbar.js
Normal file
67
en/Scripts/Widgets/Navbar/navbar.js
Normal 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;}
|
||||
BIN
en/Scripts/Widgets/SharedResources/None.gif
Normal file
BIN
en/Scripts/Widgets/SharedResources/None.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
BIN
en/Scripts/Widgets/SharedResources/Translucent-Overlay.png
Normal file
BIN
en/Scripts/Widgets/SharedResources/Translucent-Overlay.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
423
en/Scripts/Widgets/SharedResources/WidgetCommon.js
Normal file
423
en/Scripts/Widgets/SharedResources/WidgetCommon.js
Normal 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");}});
|
||||
Reference in New Issue
Block a user