send ajax statement to the library to save current page
This commit is contained in:
parent
3aa2f5da84
commit
f1636dd3a4
1 changed files with 18 additions and 4 deletions
|
@ -67,7 +67,9 @@ function ComicBook(id, srcs, opts) {
|
|||
// the current page, can pass a default as a url hash
|
||||
var pointer = (parseInt(location.hash.substring(1),10) - 1) || 0;
|
||||
|
||||
// enables the back button
|
||||
/**
|
||||
* enables the back button
|
||||
**/
|
||||
function checkHash() {
|
||||
|
||||
var hash = parseInt(location.hash.substring(1),10) - 1 || 0;
|
||||
|
@ -101,6 +103,16 @@ function ComicBook(id, srcs, opts) {
|
|||
return (x <= canvas.width / 2) ? 'left' : 'right';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the library app where the user is up to
|
||||
**/
|
||||
function setLastPage() {
|
||||
if (!options.data.comicId) { throw 'options.data.comicId is not set.'; }
|
||||
$.get('/comic/setlastpage', { page: pointer+1, comic: options.data.comicId }, function(error){
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the canvas element for use throughout the class.
|
||||
*
|
||||
|
@ -212,6 +224,8 @@ function ComicBook(id, srcs, opts) {
|
|||
var page = pages[pointer];
|
||||
var page2 = pages[pointer + 1];
|
||||
|
||||
setLastPage();
|
||||
|
||||
if (typeof page !== "object") { throw "invalid page type '"+ typeof page +"'"; }
|
||||
|
||||
var width = page.width;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue