45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
// This function is executed after the page load completes on the client
|
|
$(document).ready(function() {
|
|
});
|
|
|
|
var lightbox = null;
|
|
|
|
function updateCurrentPage() {
|
|
var currentPage = lightbox.currentPosition;
|
|
$.ajax({
|
|
url : 'ajax/setpage.php',
|
|
data : {page: currentPage},
|
|
dataType : 'json',
|
|
success : function(data, stat, jqo) {
|
|
console.log(data.message);
|
|
}
|
|
});
|
|
}
|
|
|
|
//
|
|
// This JS function is called when a user clicks on a comic.
|
|
// "showcomic.php" is called with the comic to view as a parameter.
|
|
// It returns a JSON object representing the collection of images.
|
|
// If in debug mode the javascript code is displayed in the browser.
|
|
// If not in debug mode a lightbox object is created to display the comic.
|
|
//
|
|
function showComic(comic, name) {
|
|
$("#" + comic).addClass("readborder");
|
|
toastr.success("Extracting and showing the comic \"" + name + "\"...", "Showing Comic");
|
|
$.ajax({
|
|
url : 'ajax/showcomic.php',
|
|
data : {comic: comic},
|
|
dataType : 'json',
|
|
success : function(data, stat, jqo) {
|
|
// Clear out the debug DIV and start the fancybox.
|
|
$("#debug").html("");
|
|
lightbox = SimpleLightbox.open({
|
|
items: data.images,
|
|
captions: data.captions,
|
|
startAt: data.startindex,
|
|
beforeSetContent: updateCurrentPage
|
|
});
|
|
}
|
|
});
|
|
}
|