Skip to content
Snippets Groups Projects
Commit 807fe320 authored by Demian Katz's avatar Demian Katz
Browse files

Style fixes.

parent e63e6fa6
No related merge requests found
/*global documentID*/
var currTab = 2; var currTab = 2;
var loadingThumbs = true; var loadingThumbs = true;
var noHit; var noHit;
...@@ -68,6 +70,25 @@ function showInfo() { ...@@ -68,6 +70,25 @@ function showInfo() {
// --- PAGE LINK ACTIONS --- // // --- PAGE LINK ACTIONS --- //
var pages; var pages;
var currentPage = 0; var currentPage = 0;
function setTabs(srcs) {
var tabs = '<a onClick="showOriginal(\''+srcs['original']+'\')">Original</a>'+
'<a onClick="showPreview(\''+srcs['large']+'\',this)">Large</a>'+
'<a onClick="showPreview(\''+srcs['medium']+'\',this)">Medium</a>'+
'<a onClick="showZoom(\''+srcs['large']+'\',this)">Zoom</a>'+
'<a onClick="showInfo()">Information</a>';
$(".view .navigation").html(tabs);
// - Re-assign the click event handlers
$('.view .navigation a').each(function (index) {
$(this).click(function () {
$('.view .navigation a.selected').removeClass('selected');
$(this).addClass('selected');
currTab = index;
});
if(index == currTab) { // SET THE MIDDLE TAB (medium) TO THE ACTIVE ONE
$(this).click();
}
});
}
function loadPage(page) { function loadPage(page) {
currentPage = page; currentPage = page;
if(!pages[page]) { if(!pages[page]) {
...@@ -96,27 +117,24 @@ function setPageLinkClicks() { ...@@ -96,27 +117,24 @@ function setPageLinkClicks() {
$('.page_list .page_link:first-child').addClass('selected'); $('.page_list .page_link:first-child').addClass('selected');
} }
} }
function firstPage() {selectPage(0);} function createPageLinks() {
function prevPage() {selectPage(Math.max(0,currentPage-1));} loadingThumbs = true;
function nextPage() {
var newpage = Math.min(pages.length-1,currentPage+1);
if(!pages[newpage]) {
createPageLinks();
}
selectPage(newpage);
}
function lastPage() {
// Load all thumbnails
var currEnd = $('.page_list .page_link').size(); var currEnd = $('.page_list .page_link').size();
while(currEnd < pages.length) { //console.log(currEnd);
if(currEnd >= pages.length) {
$('.side-loading').css({'display':'none'});
} else if(pages[currEnd]) {
$('<div class="page_link new"><img src="'+pages[currEnd]['thumbnail']+'">'+pages[currEnd]['label']+'</div>').insertBefore('.side-loading'); $('<div class="page_link new"><img src="'+pages[currEnd]['thumbnail']+'">'+pages[currEnd]['label']+'</div>').insertBefore('.side-loading');
currEnd++; // Make sure we're clear so that this lock doesn't go balistic
var pageList = $('.page_list');
if (pageList.scrollHeight-pageList.scrollTop-pageList.offsetHeight < 50) {
createPageLinks();
} else {
loadingThumbs = false;
}
} }
$('.side-loading').css({'display':'none'});
setPageLinkClicks(); setPageLinkClicks();
selectPage(pages.length-1);
} }
function selectPage(newPage) { function selectPage(newPage) {
currentPage = newPage; currentPage = newPage;
loadPage(newPage); loadPage(newPage);
...@@ -132,43 +150,25 @@ function selectPage(newPage) { ...@@ -132,43 +150,25 @@ function selectPage(newPage) {
} }
} }
} }
function setTabs(srcs) { function firstPage() {selectPage(0);}
var tabs = '<a onClick="showOriginal(\''+srcs['original']+'\')">Original</a>'+ function prevPage() {selectPage(Math.max(0,currentPage-1));}
'<a onClick="showPreview(\''+srcs['large']+'\',this)">Large</a>'+ function nextPage() {
'<a onClick="showPreview(\''+srcs['medium']+'\',this)">Medium</a>'+ var newpage = Math.min(pages.length-1,currentPage+1);
'<a onClick="showZoom(\''+srcs['large']+'\',this)">Zoom</a>'+ if(!pages[newpage]) {
'<a onClick="showInfo()">Information</a>'; createPageLinks();
$(".view .navigation").html(tabs); }
// - Re-assign the click event handlers selectPage(newpage);
$('.view .navigation a').each(function (index) {
$(this).click(function () {
$('.view .navigation a.selected').removeClass('selected');
$(this).addClass('selected');
currTab = index;
});
if(index == currTab) { // SET THE MIDDLE TAB (medium) TO THE ACTIVE ONE
$(this).click();
}
});
} }
function lastPage() {
function createPageLinks() { // Load all thumbnails
loadingThumbs = true;
var currEnd = $('.page_list .page_link').size(); var currEnd = $('.page_list .page_link').size();
//console.log(currEnd); while(currEnd < pages.length) {
if(currEnd >= pages.length) {
$('.side-loading').css({'display':'none'});
} else if(pages[currEnd]) {
$('<div class="page_link new"><img src="'+pages[currEnd]['thumbnail']+'">'+pages[currEnd]['label']+'</div>').insertBefore('.side-loading'); $('<div class="page_link new"><img src="'+pages[currEnd]['thumbnail']+'">'+pages[currEnd]['label']+'</div>').insertBefore('.side-loading');
// Make sure we're clear so that this lock doesn't go balistic currEnd++;
var pageList = $('.page_list');
if (pageList.scrollHeight-pageList.scrollTop-pageList.offsetHeight < 50) {
createPageLinks();
} else {
loadingThumbs = false;
}
} }
$('.side-loading').css({'display':'none'});
setPageLinkClicks(); setPageLinkClicks();
selectPage(pages.length-1);
} }
// fit preview to screen // fit preview to screen
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment