mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-31 20:10:13 +00:00 
			
		
		
		
	added state saving...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c225a97394
								
							
						
					
					
						commit
						ba9788c600
					
				
							
								
								
									
										13
									
								
								TODO.otl
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								TODO.otl
									
									
									
									
									
								
							| @ -1,10 +1,13 @@ | |||||||
| [_] 25% Priority work | [_] 22% Priority work | ||||||
| 	[_] 50% general todo | 	[_] 40% general todo | ||||||
| 		[X] use modes (CSS) for thumbnail/page views... | 		[_] 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 | 		[_] vanquish opacity effects | ||||||
| 		| they slow everything down considerably! | 		| they slow everything down considerably! | ||||||
| 		[_] add state saving to local storage | 		[X] add state saving to local storage | ||||||
| 		[_] add page urls | 		[X] use modes (CSS) for thumbnail/page views... | ||||||
| 	[_] 50% stage 1 - basic features | 	[_] 50% stage 1 - basic features | ||||||
| 		[_] issue browser structure | 		[_] issue browser structure | ||||||
| 		[_] global navigation bar | 		[_] global navigation bar | ||||||
|  | |||||||
							
								
								
									
										35
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								index.html
									
									
									
									
									
								
							| @ -4,6 +4,8 @@ | |||||||
| <link rel="stylesheet" href="magazine.css"> | <link rel="stylesheet" href="magazine.css"> | ||||||
| <script src="jquery.js"></script> | <script src="jquery.js"></script> | ||||||
| <script src="jquery.touchSwipe.js"></script> | <script src="jquery.touchSwipe.js"></script> | ||||||
|  | <script src="jstorage.js"></script> | ||||||
|  | 
 | ||||||
| <script> | <script> | ||||||
| 
 | 
 | ||||||
| /* this is needed only for live resize... */ | /* this is needed only for live resize... */ | ||||||
| @ -40,10 +42,14 @@ $(document).ready(function(){ | |||||||
| 	$('.button.next-article').swipe({click: nextArticle}) | 	$('.button.next-article').swipe({click: nextArticle}) | ||||||
| 	$('.button.prev-article').swipe({click: prevArticle}) | 	$('.button.prev-article').swipe({click: prevArticle}) | ||||||
| 
 | 
 | ||||||
|  | 	loadState() | ||||||
|  | 
 | ||||||
|  | 	togglePageView('on') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	// XXX add splash screen... | 	// XXX add splash screen... | ||||||
| 	// XXX | 	// XXX | ||||||
| 
 | 
 | ||||||
| 	togglePageView('on') |  | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -359,6 +365,7 @@ function swipeUpdate(evt, phase, direction, distance){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // XXX store the current page... | ||||||
| function setCurrentPage(n, W){ | function setCurrentPage(n, W){ | ||||||
| 	if(n == null){ | 	if(n == null){ | ||||||
| 		var cur = $('.current.page') | 		var cur = $('.current.page') | ||||||
| @ -377,9 +384,19 @@ function setCurrentPage(n, W){ | |||||||
| 	var W = W == null ? cur.width() : W | 	var W = W == null ? cur.width() : W | ||||||
| 	mag.css({left: -n*W}) | 	mag.css({left: -n*W}) | ||||||
| 
 | 
 | ||||||
|  | 	// XXX should this be here??? | ||||||
|  | 	saveState() | ||||||
|  | 
 | ||||||
| 	return cur | 	return cur | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function getPageNumber(page){ | ||||||
|  | 	if(page == null){ | ||||||
|  | 		page = $('.current.page') | ||||||
|  | 	} | ||||||
|  | 	return $('.page').index(page)  | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function nextPage(){ | 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... | // XXX create magazine... | ||||||
| function createMagazine(){ | function createMagazine(){ | ||||||
| } | } | ||||||
| @ -456,7 +486,8 @@ function createPage(article, template){ | |||||||
| 
 | 
 | ||||||
| <div class="viewer"> | <div class="viewer"> | ||||||
| 
 | 
 | ||||||
| 	<!-- XXX add toolbars here... --> | 	<!-- XXX Magazine title... --> | ||||||
|  | 
 | ||||||
| 	<div class="top-toolbar"> | 	<div class="top-toolbar"> | ||||||
| 		mooo | 		mooo | ||||||
| 		<div class="button home">Home</div> | 		<div class="button home">Home</div> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user