1
0

Fix for detail hash

Imgage preload
This commit is contained in:
Fredrik Erlandsson 2011-12-20 13:34:45 +01:00
parent a2cfa32c48
commit 9d3b519551

View File

@ -407,6 +407,14 @@ function startImageFlow(userSet) {
mosaicResize(); mosaicResize();
} }
function hideDetailView() {
$('#detailView').hide();
slideShowMode = detailViewMode = false;
if (slideShow !== null) { clearTimeout(slideShow); }
slideShow = null;
updateHash();
}
function setKeys() { function setKeys() {
/* Fixes the back button issue */ /* Fixes the back button issue */
/* window.onunload = function() /* window.onunload = function()
@ -438,7 +446,8 @@ document = null;
} }
function bodyLoad(vm, bgcolor) { function bodyLoad(vm, bgcolor) {
var h, co; var h, co, view;
viewMode = vm;
/* Parse hash */ /* Parse hash */
h = $.parseQuery(window.location.hash.substring(1)); h = $.parseQuery(window.location.hash.substring(1));
if (h.img !== undefined) { if (h.img !== undefined) {
@ -448,7 +457,7 @@ function bodyLoad(vm, bgcolor) {
swatchSkin(h.bgcolor); swatchSkin(h.bgcolor);
} }
if (h.viewMode !== undefined) { if (h.viewMode !== undefined) {
viewMode = vm = h.viewMode; vm = h.viewMode;
} }
/* end parse hash */ /* end parse hash */
@ -476,9 +485,10 @@ function bodyLoad(vm, bgcolor) {
} }
if (typeof slideshowImages !== 'undefined' && !slideshowImages.length) { if (typeof slideshowImages !== 'undefined' && !slideshowImages.length) {
vm = 'grid'; viewMode = vm = 'grid';
} }
switch (vm) { if (vm === 'detail') {view = viewMode; focusImage(currentImg, h.redirected);} else {view = vm;}
switch (view) {
case 'carousel': case 'carousel':
startImageFlow(false); startImageFlow(false);
break; break;
@ -488,13 +498,11 @@ function bodyLoad(vm, bgcolor) {
case 'mosaic': case 'mosaic':
switchToMosaic(false); switchToMosaic(false);
break; break;
case 'detail':
focusImage(currentImg, h.redirected);
break;
default: default:
mosaicResize(); mosaicResize();
checkCookie(); checkCookie();
} }
$('#loading').hide(); $('#loading').hide();
window.setTimeout("preFetch()", 500); window.setTimeout("preFetch()", 500);
setKeys(); setKeys();
@ -554,15 +562,12 @@ function bodyLoad(vm, bgcolor) {
} }
function preFetch() { function preFetch() {
/* for (var i = 0; i < slideshowImages.length; i++) { var i, cache = [];
var tempImage = new Element('img', {'src': slideshowImages[i][0]}); for (i = 0; i < slideshowImages.length; i=i+1) {
}*/ // var tempImage = new Element('img', {'src': slideshowImages[i][0]});
var cacheImage = document.createElement('img');
cacheImage.src = slideshowImages[i][0];
cache.push(cacheImage);
}
} }
function hideDetailView() {
$('#detailView').hide();
slideShowMode = detailViewMode = false;
if (slideShow !== null) { clearTimeout(slideShow); }
slideShow = null;
updateHash();
}