added state saving...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-01-22 18:04:33 +04:00
parent c225a97394
commit ba9788c600
2 changed files with 41 additions and 7 deletions

View File

@ -1,10 +1,13 @@
[_] 25% Priority work
[_] 50% general todo
[X] use modes (CSS) for thumbnail/page views...
[_] 22% Priority work
[_] 40% general todo
[_] add page urls
[_] time transitions
| the goal is for slow devices to seem not to have animations at
| all and faster ones to seem to have fast animations...
[_] vanquish opacity effects
| they slow everything down considerably!
[_] add state saving to local storage
[_] add page urls
[X] add state saving to local storage
[X] use modes (CSS) for thumbnail/page views...
[_] 50% stage 1 - basic features
[_] issue browser structure
[_] global navigation bar

View File

@ -4,6 +4,8 @@
<link rel="stylesheet" href="magazine.css">
<script src="jquery.js"></script>
<script src="jquery.touchSwipe.js"></script>
<script src="jstorage.js"></script>
<script>
/* this is needed only for live resize... */
@ -40,10 +42,14 @@ $(document).ready(function(){
$('.button.next-article').swipe({click: nextArticle})
$('.button.prev-article').swipe({click: prevArticle})
loadState()
togglePageView('on')
// XXX add splash screen...
// XXX
togglePageView('on')
})
@ -359,6 +365,7 @@ function swipeUpdate(evt, phase, direction, distance){
}
// XXX store the current page...
function setCurrentPage(n, W){
if(n == null){
var cur = $('.current.page')
@ -377,9 +384,19 @@ function setCurrentPage(n, W){
var W = W == null ? cur.width() : W
mag.css({left: -n*W})
// XXX should this be here???
saveState()
return cur
}
function getPageNumber(page){
if(page == null){
page = $('.current.page')
}
return $('.page').index(page)
}
function nextPage(){
@ -436,6 +453,19 @@ function prevArticle(){
// XXX
function loadState(){
setCurrentPage(parseInt($.jStorage.get('current_page'), 0))
}
// XXX
function saveState(){
// XXX make this magazine-specific...
$.jStorage.set('current_page', getPageNumber())
}
// XXX create magazine...
function createMagazine(){
}
@ -456,7 +486,8 @@ function createPage(article, template){
<div class="viewer">
<!-- XXX add toolbars here... -->
<!-- XXX Magazine title... -->
<div class="top-toolbar">
mooo
<div class="button home">Home</div>