1
0

Reindent and JSLint take 1.

This commit is contained in:
Fredrik Erlandsson 2011-11-13 19:54:20 +01:00
parent b24d37b1a0
commit 82e0f3896f

View File

@ -1,3 +1,6 @@
/*jslint browser: true, regexp: true, sub: false, vars: false, white: false, nomen: false, sloppy: true, undef: true, plusplus: true */
/*global jQuery, $ */
var viewMode = ""; var viewMode = "";
var skimimg = 0; var skimimg = 0;
var hash = ""; var hash = "";
@ -7,7 +10,7 @@ var savedHeight = 0;
var savedWidth = 0; var savedWidth = 0;
$(window).resize(function () { $(window).resize(function () {
if (window.innerHeight == savedHeight && window.innerWidth == savedWidth) return; if (window.innerHeight === savedHeight && window.innerWidth === savedWidth) { return; }
savedHeight = window.innerHeight; savedHeight = window.innerHeight;
savedWidth = window.innerWidth; savedWidth = window.innerWidth;
mosaicResize(); mosaicResize();
@ -28,7 +31,7 @@ function swatchSkin(intSkin){
$('p.giTitle').css("color", "#a9a9a9"); $('p.giTitle').css("color", "#a9a9a9");
$("#dkgrey").addClass("dkgrey sel dkgrey-with-sel-with-swatch"); $("#dkgrey").addClass("dkgrey sel dkgrey-with-sel-with-swatch");
bgcolor = "dkgrey"; bgcolor = "dkgrey";
break break;
// ltgrey // ltgrey
case 'ltgrey': case 'ltgrey':
case 2: case 2:
@ -47,9 +50,7 @@ function swatchSkin(intSkin){
$("#white").addClass("white sel white-with-sel-with-swatch"); $("#white").addClass("white sel white-with-sel-with-swatch");
bgcolor = "white"; bgcolor = "white";
break; break;
// Black // Black is default
case 'black' :
case 0 :
default: default:
$('div.gallery-thumb-round').css('backgroundPosition', "0px 0px"); $('div.gallery-thumb-round').css('backgroundPosition', "0px 0px");
$('#mosaicTable,.pear').css('backgroundColor', "#000"); $('#mosaicTable,.pear').css('backgroundColor', "#000");
@ -71,68 +72,64 @@ function scaleIt(v,sliding){
toggleReflex(true); toggleReflex(true);
$(".p-photo").each(function (i) { $(".p-photo").each(function (i) {
$(this).attr({height: size + 'px', width: size + 'px'}); $(this).attr({height: size + 'px', width: size + 'px'});
$(this).css({height: size+'px',width: size+'px'});}); $(this).css({height: size + 'px', width: size + 'px'});
});
$(".g-photo").css({width: size + 'px'}); $(".g-photo").css({width: size + 'px'});
if(!mosaicView && !sliding) if (!mosaicView && !sliding) {
toggleReflex(false); toggleReflex(false);
}
thumbPadding(); thumbPadding();
} }
function setCookie(c_name,value,expiredays) function setCookie(c_name, value, expiredays) {
{
var exdate = new Date(); var exdate = new Date();
exdate.setDate(exdate.getDate() + expiredays); exdate.setDate(exdate.getDate() + expiredays);
document.cookie=c_name+ "=" +escape(value)+ document.cookie = c_name + "=" + escape(value) + ((expiredays === null) ? "" : ";expires=" + exdate.toGMTString());
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} }
function getCookie(c_name) function getCookie(c_name) {
{ if (document.cookie.length > 0) {
if (document.cookie.length>0)
{
c_start = document.cookie.indexOf(c_name + "="); c_start = document.cookie.indexOf(c_name + "=");
if (c_start!=-1) if (c_start !== -1) {
{
c_start = c_start + c_name.length + 1; c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start); c_end = document.cookie.indexOf(";", c_start);
if (c_end==-1) c_end=document.cookie.length; if (c_end === -1) {
c_end = document.cookie.length;
}
return unescape(document.cookie.substring(c_start, c_end)); return unescape(document.cookie.substring(c_start, c_end));
} }
} }
return ""; return "";
} }
function checkCookie() function checkCookie() {
{
var co = getCookie('slider'); var co = getCookie('slider');
if (co!=null && co!="") if (co !== null && co !== "") {
{
$('#imgSlider').slider("value", co); $('#imgSlider').slider("value", co);
} }
co = getCookie('swatchSkin'); co = getCookie('swatchSkin');
if (co!=null && co!="") if (co !== null && co !== "") {
{
swatchSkin(co); swatchSkin(co);
} else {
swatchSkin('black');
} }
else
{swatchSkin('black');}
} }
var iRatio = iWidth = iHeight=0; var iRatio = 0, iWidth = 0, iHeight = 0;
//Set a updating timer so users can't update before the image has appeard.. //Set a updating timer so users can't update before the image has appeard..
function swatchImg(imageId) function swatchImg(imageId) {
{ if (imageId < 0 || imageId >= slideshowImages.length) {
if( imageId < 0 || imageId >= slideshowImages.length) return; return;
}
currentImg = imageId; currentImg = imageId;
iWidth = parseFloat(slideshowImages[imageId][2].replace(/,/gi, ".")); iWidth = parseFloat(slideshowImages[imageId][2].replace(/,/gi, "."));
iHeight = parseFloat(slideshowImages[imageId][3].replace(/,/gi, ".")); iHeight = parseFloat(slideshowImages[imageId][3].replace(/,/gi, "."));
iRatio = iWidth / iHeight; iRatio = iWidth / iHeight;
if(isNaN(iRatio)) iRatio=1.3333; if (isNaN(iRatio)) {
iRatio = 1.3333;
if( mosaicView ) }
{ if (mosaicView) {
$('#mosaicDetail').hide(); $('#mosaicDetail').hide();
$('#imageTitle').html("<h2>" + slideshowImages[imageId][4] + "</h2>"); $('#imageTitle').html("<h2>" + slideshowImages[imageId][4] + "</h2>");
$('#mosaicImg').attr('src', slideshowImages[imageId][0]); $('#mosaicImg').attr('src', slideshowImages[imageId][0]);
$('#mosaicImg').css('cursor', "pointer"); $('#mosaicImg').css('cursor', "pointer");
$('#mosaicDetail').show("slow"); $('#mosaicDetail').show("slow");
@ -140,49 +137,61 @@ function swatchImg(imageId)
mosaicResize(); mosaicResize();
/* Set controls for hover view. */ /* Set controls for hover view. */
(currentImg==0) ? $('#prev_detail').addClass('prev_detail_disabled') : $('#prev_detail').removeClass('prev_detail_disabled'); if (currentImg === 0) {
(currentImg!=0) ? $('#prev_detail').addClass('prev_detail') : $('#prev_detail').removeClass('prev_detail'); $('#prev_detail').addClass('prev_detail_disabled');
(currentImg==slideshowImages.length-1) ? $('#next_detail').addClass('next_detail_disabled') : $('#next_detail').removeClass('next_detail_disabled'); $('#prev_detail').removeClass('prev_detail');
(currentImg!=slideshowImages.length-1) ? $('#next_detail').addClass('next_detail') : $('#next_detail').removeClass('next_detail'); } else {
$('#prev_detail').removeClass('prev_detail_disabled');
$('#prev_detail').addClass('prev_detail');
}
if (currentImg === slideshowImages.length - 1) {
$('#next_detail').addClass('next_detail_disabled');
$('#next_detail').removeClass('next_detail');
} else {
$('#next_detail').removeClass('next_detail_disabled');
$('#next_detail').addClass('next_detail');
}
/* Update image and title in focus view */ /* Update image and title in focus view */
$('#img_detail').attr('src', slideshowImages[currentImg][0]); $('#img_detail').attr('src', slideshowImages[currentImg][0]);
$('#imageTitleLabel').html("<h2>" + slideshowImages[imageId][4] + "</h2>"); $('#imageTitleLabel').html("<h2>" + slideshowImages[imageId][4] + "</h2>");
if( detailViewMode ) if (detailViewMode) {
{
//Image count. //Image count.
$.get(slideshowImages[currentImg][6]); $.get(slideshowImages[currentImg][6]);
} }
updateHash(); updateHash();
$('#info_detail').attr('href', slideshowImages[currentImg][1]); $('#info_detail').attr('href', slideshowImages[currentImg][1]);
} }
function getViewMode()
{ function getViewMode() {
var vm = detailViewMode ? "detail" : viewMode; var vm = detailViewMode ? "detail" : viewMode;
if(vm !== '') if (vm !== '') {
vm = "&viewMode=" + vm; vm = "&viewMode=" + vm;
}
return vm; return vm;
} }
function updateHash()
{ function updateHash() {
var img = ""; var img = "";
if(currentImg !== 0) if (currentImg !== 0) {
img = "img=" + currentImg; img = "img=" + currentImg;
}
hash = "#" + img + getViewMode() + "&bgcolor=" + bgcolor; hash = "#" + img + getViewMode() + "&bgcolor=" + bgcolor;
window.location.hash = hash; window.location.hash = hash;
} }
function getAlbumHash(img)
{ function getAlbumHash(img) {
return "#img=" + img + getViewMode() + "&bgcolor=" + bgcolor; return "#img=" + img + getViewMode() + "&bgcolor=" + bgcolor;
} }
var currentImg = 0; var currentImg = 0;
var mosaicView = false; var mosaicView = false;
function mosaicResize() function mosaicResize() {
{ if ($('#mosaicGridContainer').length === 0) {
if($('#mosaicGridContainer').length == 0) return; //no element found return; //no element found
}
var myWidth = 0, myHeight = 0; var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) { if (typeof (window.innerWidth) === 'number') {
//Non-IE //Non-IE
myWidth = window.innerWidth; myWidth = window.innerWidth;
myHeight = window.innerHeight; myHeight = window.innerHeight;
@ -195,61 +204,79 @@ function mosaicResize()
myWidth = document.body.clientWidth; myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight; myHeight = document.body.clientHeight;
} }
if($('#imageflow').length != 0) if ($('#imageflow').length !== 0) {
$('#imageflow').css({'height': (myHeight - 53) + 'px', 'width': (((myWidth * 0.5) < (myHeight - 53)) ? myWidth : ((myHeight - 65) * 2)) + 'px'}); $('#imageflow').css({'height': (myHeight - 53) + 'px', 'width': (((myWidth * 0.5) < (myHeight - 53)) ? myWidth : ((myHeight - 65) * 2)) + 'px'});
}
$('#detailImageView').css({'height': myHeight - 165 + "px"}); $('#detailImageView').css({'height': myHeight - 165 + "px"});
(iRatio>(myWidth/(myHeight-165))) ? $('#img_detail').css({'height': myWidth/iRatio+"px",'width': myWidth+"px"}) : $('#img_detail').css({'height': myHeight-165+"px",'width': (myHeight-165)*iRatio+"px"}); if (iRatio > (myWidth / (myHeight - 165))) {
if(iHeight<(myHeight-165)&&iWidth<myWidth) $('#img_detail').css({'height': myWidth / iRatio + "px", 'width': myWidth + "px"});
} else {
$('#img_detail').css({'height': myHeight - 165 + "px", 'width': (myHeight - 165) * iRatio + "px"});
}
if (iHeight < (myHeight - 165) && iWidth < myWidth) {
$('#img_detail').css({'height': iHeight + "px", 'width': iWidth + "px"}); $('#img_detail').css({'height': iHeight + "px", 'width': iWidth + "px"});
}
myWidth = myWidth - 7; myWidth = myWidth - 7;
myHeight = myHeight - $('#g-site-status').outerHeight(true); myHeight = myHeight - $('#g-site-status').outerHeight(true);
$('#pearFlowPadd').css({'height': myHeight - 90 - (Math.round(myWidth / 2.4)) + 'px'}); $('#pearFlowPadd').css({'height': myHeight - 90 - (Math.round(myWidth / 2.4)) + 'px'});
($('#paginator').length != 0) ? myHeight-=165: myHeight-=138; if ($('#paginator').length !== 0) { myHeight -= 165; } else { myHeight -= 138; }
$('#g-header').css('top', $('#gsNavBar').outerHeight(true) + $('#g-site-status').outerHeight(true) - 4); $('#g-header').css('top', $('#gsNavBar').outerHeight(true) + $('#g-site-status').outerHeight(true) - 4);
if($('#g-movie').length) if ($('#g-movie').length) {
myHeight += 18; myHeight += 18;
if ( !mosaicView )
{
$('#mosaicGridContainer').css({'height': (myHeight+33)+"px", 'width': myWidth+"px"});
} }
else if (!mosaicView) {
{ $('#mosaicGridContainer').css({'height': (myHeight + 33) + "px", 'width': myWidth + "px"});
} else {
$('#mosaicDetail').css('width', Math.floor(myWidth * 0.65) + "px"); $('#mosaicDetail').css('width', Math.floor(myWidth * 0.65) + "px");
$('#mosaicGridContainer').css({'height': (myHeight + 33) + "px", 'width': Math.floor(myWidth * 0.35) + "px"}); $('#mosaicGridContainer').css({'height': (myHeight + 33) + "px", 'width': Math.floor(myWidth * 0.35) + "px"});
//Resize the image.. //Resize the image..
myWidth = myWidth * 0.65; myWidth = myWidth * 0.65;
(iRatio>(myWidth/myHeight)) ? $('#mosaicImg').attr({height: myWidth/iRatio,width: myWidth}) : $('#mosaicImg').attr({height: myHeight,width: myHeight*iRatio}); if (iRatio > (myWidth / myHeight)) {
if(iHeight<myHeight&&iWidth<myWidth) $('#mosaicImg').attr({height:iHeight, width:iWidth}); $('#mosaicImg').attr({height: myWidth / iRatio, width: myWidth});
} else {
$('#mosaicImg').attr({height: myHeight, width: myHeight * iRatio});
}
if (iHeight < myHeight && iWidth < myWidth) {
$('#mosaicImg').attr({height: iHeight, width: iWidth});
}
} }
thumbPadding(); thumbPadding();
if($('#conf_imageflow').length) refresh(); if ($('#conf_imageflow').length) {
refresh();
} }
}
function thumbPadding() { function thumbPadding() {
/* Padding on thumbs to make them flow nicer */ /* Padding on thumbs to make them flow nicer */
var size = Math.ceil((mosaicView) ? $('#imgSlider').slider('value')/2 : $('#imgSlider').slider('value'))+10; size = Math.ceil((mosaicView) ? $('#imgSlider').slider('value') / 2 : $('#imgSlider').slider('value')) + 10;
var width =$('#mosaicGridContainer').innerWidth()-15; width = $('#mosaicGridContainer').innerWidth() - 15;
var margin = width/Math.floor(width/size)-size; margin = width / Math.floor(width / size) - size;
console.log(size, width, margin, "px"); console.log(size, width, margin, "px");
$('.gallery-thumb').css({'margin-left': Math.ceil(margin / 2) + 'px', 'margin-right': Math.floor(margin / 2) + 'px'}); $('.gallery-thumb').css({'margin-left': Math.ceil(margin / 2) + 'px', 'margin-right': Math.floor(margin / 2) + 'px'});
} }
function bodyLoad(vm, bgcolor) { function bodyLoad(vm, bgcolor) {
/* Parse hash */ /* Parse hash */
hash = window.location.hash; hash = window.location.hash;
var h = $.parseQuery(hash.substring(1)); var h = $.parseQuery(hash.substring(1));
if(h.img != undefined) if (h.img !== undefined) {
currentImg = parseInt(h.img); currentImg = parseInt(h.img, 10);
if(h.bgcolor != undefined) }
if (h.bgcolor !== undefined) {
swatchSkin(h.bgcolor); swatchSkin(h.bgcolor);
if(h.viewMode != undefined) }
if (h.viewMode !== undefined) {
viewMode = vm = h.viewMode; viewMode = vm = h.viewMode;
}
/* end parse hash */ /* end parse hash */
if(navigator.appName == "Microsoft Internet Explorer") $('.track').each(function(s){$(this).css('top', '-16px');}); //Fix for IE's poor page rendering. if (navigator.appName === "Microsoft Internet Explorer") {
$('.track').each(function (s) {$(this).css('top', '-16px'); }); //Fix for IE's poor page rendering.
}
/* /*
58.5 225 58.5 225
32.5 125 32.5 125
@ -260,21 +287,20 @@ function bodyLoad(vm, bgcolor) {
if (!$('#mosaicGridContainer').length) { $('#loading').hide(); maxSize = 0; return; } if (!$('#mosaicGridContainer').length) { $('#loading').hide(); maxSize = 0; return; }
//Set event for Thumb Click. //Set event for Thumb Click.
$('.p-photo').each(function(index){ $(this).click(function(){ $('.p-photo').each(function (index) { $(this).click(function () { if (mosaicView) { swatchImg(index); } else {focusImage(index); } }); });
mosaicView ? swatchImg(index) : focusImage(index) ;}); });
$('#slideshow').click(function () { startSlideshow(); }); $('#slideshow').click(function () { startSlideshow(); });
$('#mosaicDetail').click(function () { focusImage(currentImg); }); $('#mosaicDetail').click(function () { focusImage(currentImg); });
$('#prev_detail').click(function () { swatchImg(currentImg - 1); }); $('#prev_detail').click(function () { swatchImg(currentImg - 1); });
$('#next_detail').click(function () { swatchImg(currentImg + 1); }); $('#next_detail').click(function () { swatchImg(currentImg + 1); });
co = getCookie('swatchSkin'); co = getCookie('swatchSkin');
if (co==null || co=="") if (co === null || co === "") {
swatchSkin(bgcolor); swatchSkin(bgcolor);
}
if(typeof slideshowImages != 'undefined') if (typeof slideshowImages !== 'undefined' && !slideshowImages.length) {
if(!slideshowImages.length)
vm = 'grid'; vm = 'grid';
}
switch (vm) { switch (vm) {
case 'carousel': case 'carousel':
startImageFlow(false); startImageFlow(false);
@ -297,15 +323,14 @@ if(typeof slideshowImages != 'undefined')
setKeys(); setKeys();
} }
function switchToGrid(userSet) function switchToGrid(userSet) {
{
if (userSet === true) { if (userSet === true) {
viewMode = "grid"; viewMode = "grid";
} }
toggleReflex(true); toggleReflex(true);
$('#pearImageFlow,#pearFlowPadd').hide(); $('#pearImageFlow,#pearFlowPadd').hide();
$('#mosaicTable').show(); $('#mosaicTable').show();
if(!$('#mosaicGridContainer').length) return; if (!$('#mosaicGridContainer').length) { return; }
mosaicView = false; mosaicView = false;
maxSize = 225; maxSize = 225;
checkCookie(); checkCookie();
@ -316,15 +341,14 @@ function switchToGrid(userSet)
mosaicResize(); mosaicResize();
} }
function switchToMosaic(userSet) function switchToMosaic(userSet) {
{
if (userSet === true) { if (userSet === true) {
viewMode = "mosaic"; viewMode = "mosaic";
} }
toggleReflex(false); toggleReflex(false);
$('#pearImageFlow,#pearFlowPadd').hide(); $('#pearImageFlow,#pearFlowPadd').hide();
$('#mosaicTable').show(); $('#mosaicTable').show();
if(!$('#mosaicGridContainer').length) return; if (!$('#mosaicGridContainer').length) { return; }
mosaicView = true; mosaicView = true;
maxSize = 125; maxSize = 125;
checkCookie(); checkCookie();
@ -335,64 +359,55 @@ function switchToMosaic(userSet)
swatchImg(currentImg); swatchImg(currentImg);
mosaicResize(); mosaicResize();
} }
var slideShowMode=false var slideShowMode = false;
function startSlideshow() function startSlideshow() {
{
slideShowMode = true; slideShowMode = true;
$('#play_detail').hide(); $('#play_detail').hide();
$('#pause_detail').show(); $('#pause_detail').show();
$('#detailView').fadeIn('slow'); $('#detailView').fadeIn('slow');
hideHoverV = setTimeout("hideHoverView()",3000); hideHoverV = setTimeout(hideHoverView(), 3000);
slideShowId = currentImg; slideShowId = currentImg;
slideShowId = 0; slideShowId = 0;
togglePlayPause(); togglePlayPause();
} }
var slideShow = null; var slideShow = null;
var slideShowId; var slideShowId;
function slideShowUpdate(id) function slideShowUpdate(id) {
{ if (id > slideshowImages.length) {
if(id > slideshowImages.length)
{
id = 0; id = 0;
} }
swatchImg(id); swatchImg(id);
slideShow = setTimeout("slideShowUpdate(" + (id + 1) + ")", 1000); slideShow = setTimeout("slideShowUpdate(" + (id + 1) + ")", 1000);
} }
function togglePlayPause() function togglePlayPause() {
{ //We are paused
if(slideShow == null)//We are paused if (slideShow === null) {
{
$('#play_detail').hide(); $('#play_detail').hide();
$('#pause_detail').show(); $('#pause_detail').show();
slideShow = setTimeout("slideShowUpdate(" + (slideShowId + 1) + ")", 1000); slideShow = setTimeout("slideShowUpdate(" + (slideShowId + 1) + ")", 1000);
} } else { //We are playing
else //We are playing
{
$('#pause_detail').hide(); $('#pause_detail').hide();
$('#play_detail').show(); $('#play_detail').show();
clearTimeout(slideShow); clearTimeout(slideShow);
slideShow = null; slideShow = null;
} }
} }
function focusImage(id, redirected) function focusImage(id, redirected) {
{
currentImg = id; currentImg = id;
$('#imageTitleLabel').html("<h2>" + slideshowImages[id][4] + "</h2>"); $('#imageTitleLabel').html("<h2>" + slideshowImages[id][4] + "</h2>");
$('#play_detail').hide(); $('#play_detail').hide();
$('#pause_detail').hide(); $('#pause_detail').hide();
swatchImg(id); swatchImg(id);
$('#detailView').fadeIn('slow'); $('#detailView').fadeIn('slow');
hideHoverV = setTimeout("hideHoverView()",3000); hideHoverV = setTimeout(hideHoverView(), 3000);
detailViewMode = true; detailViewMode = true;
updateHash(); updateHash();
//Image count. //Image count.
if(!redirected) if (!redirected) { $.get(slideshowImages[currentImg][6]); }
$.get(slideshowImages[currentImg][6]);
$('#info_detail').attr('href', slideshowImages[currentImg][1]); $('#info_detail').attr('href', slideshowImages[currentImg][1]);
} }
var pearCarousel; var pearCarousel;
function startImageFlow(userSet) function startImageFlow(userSet) {
{
if (userSet === true) { if (userSet === true) {
viewMode = "carousel"; viewMode = "carousel";
} }
@ -403,8 +418,8 @@ function startImageFlow(userSet)
toggleReflex(true); toggleReflex(true);
if (!pearCarousel) { if (!pearCarousel) {
for (var i = 0; i < slideshowImages.length; i++) { for (i = 0; i < slideshowImages.length; i++) {
var img = '<div class="item"><img class="content" src="'+slideshowImages[i][0]+'"/><div class="caption">'+$('#mosaicGridContainer img').eq(i).attr('alt')+'"</div></div>'; //var img = '<div class="item"><img class="content" src="' + slideshowImages[i][0] + '"/><div class="caption">' + $('#mosaicGridContainer img').eq(i).attr('alt') + '"</div></div>';
var img = '<img src="' + slideshowImages[i][0] + '" longdesc="' + i + '" width="' + slideshowImages[i][2] + '" height="' + slideshowImages[i][3] + '" alt="' + slideshowImages[i][4] + '" style="display: none;">'; var img = '<img src="' + slideshowImages[i][0] + '" longdesc="' + i + '" width="' + slideshowImages[i][2] + '" height="' + slideshowImages[i][3] + '" alt="' + slideshowImages[i][4] + '" style="display: none;">';
// console.log(img); // console.log(img);
$('#pearImageFlow').append(img); $('#pearImageFlow').append(img);
@ -415,20 +430,19 @@ function startImageFlow(userSet)
switchMode('carousel'); switchMode('carousel');
mosaicResize(); mosaicResize();
} }
function setKeys() function setKeys() {
{
/* Fixes the back button issue */ /* Fixes the back button issue */
/* window.onunload = function() /* window.onunload = function()
{ {
document = null; document = null;
} }
*/ $(document).keydown(function(e) */
{ $(document).keydown(function (e) {
var charCode = (e.keyCode ? e.keyCode: e.which); var charCode = e.keyCode || e.which;
switch (charCode) switch (charCode) {
{
case 32: /* Space */ case 32: /* Space */
if( slideShowMode) togglePlayPause(); if (slideShowMode) { togglePlayPause(); }
break;
case 39: /* Right arrow key */ case 39: /* Right arrow key */
case 78: /* N */ case 78: /* N */
swatchImg(currentImg + 1); swatchImg(currentImg + 1);
@ -443,12 +457,12 @@ function setKeys()
}); });
} }
function showHoverView() { function showHoverView() {
if(hideHoverV != null) clearTimeout(hideHoverV); if (hideHoverV !== null) { clearTimeout(hideHoverV); }
$('#hoverView').show(); $('#hoverView').show();
hideHoverV = setTimeout("hideHoverView()",3000); hideHoverV = setTimeout(hideHoverView(), 3000);
} }
function hideHoverView() { function hideHoverView() {
if(!hovering) $('#hoverView').fadeOut(); if (!hovering) { $('#hoverView').fadeOut(); }
hideHoverV = null; hideHoverV = null;
} }
var hideHoverV = null; var hideHoverV = null;
@ -459,31 +473,26 @@ function switchMode(mode){
updateHash(); updateHash();
} }
function preFetch() function preFetch() {
{
/* for (var i = 0; i < slideshowImages.length; i++) { /* for (var i = 0; i < slideshowImages.length; i++) {
var tempImage = new Element('img', {'src': slideshowImages[i][0]}); var tempImage = new Element('img', {'src': slideshowImages[i][0]});
}*/ }*/
} }
function toggleReflex(hide) function toggleReflex(hide) {
{
if (hide) { if (hide) {
// $$('.Fer').each(function(s) { cvi_reflex.remove(s); }); // $$('.Fer').each(function(s) { cvi_reflex.remove(s); });
$('mosaicGridContainer').select('img[class="Fer"]').each(function(s,index){ Event.observe(s, 'click', function(){ mosaicView ? swatchImg(index) : focusImage(index) ;}); }); $('mosaicGridContainer').select('img[class="Fer"]').each(function (s, index) { Event.observe(s, 'click', function () { if (mosaicView) { swatchImg(index); } else { focusImage(index); } }); });
} } else {
else {
// $$('.Fer').each(function(s) { cvi_reflex.add(s, {height: 20, distance: 0 }); }); // $$('.Fer').each(function(s) { cvi_reflex.add(s, {height: 20, distance: 0 }); });
$('mosaicGridContainer').select('canvas[class="Fer"]').each(function(s,index){ Event.observe(s, 'click', function(){ mosaicView ? swatchImg(index) : focusImage(index) ;}); }); $('mosaicGridContainer').select('canvas[class="Fer"]').each(function (s, index) { Event.observe(s, 'click', function () { if (mosaicView) { swatchImg(index); } else { focusImage(index); } }); });
} }
} }
function hideDetailView() function hideDetailView() {
{
$('#detailView').hide(); $('#detailView').hide();
slideShowMode = detailViewMode = false; slideShowMode = detailViewMode = false;
if(slideShow!=null) if (slideShow !== null) { clearTimeout(slideShow); }
clearTimeout(slideShow);
slideShow = null; slideShow = null;
updateHash(); updateHash();
} }