mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-11-03 21:40:17 +00:00 
			
		
		
		
	added hashchange and hash state...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									659465d2aa
								
							
						
					
					
						commit
						4895fed07b
					
				
							
								
								
									
										31
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								index.html
									
									
									
									
									
								
							@ -378,6 +378,7 @@ 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})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						window.location.hash = n
 | 
				
			||||||
	// XXX should this be here???
 | 
						// XXX should this be here???
 | 
				
			||||||
	saveState()
 | 
						saveState()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -474,12 +475,24 @@ function createPage(article, template){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(document).ready(function(){
 | 
					$(document).ready(function(){
 | 
				
			||||||
	$(window).resize(function() {
 | 
						$(window)
 | 
				
			||||||
		fitNPages(PAGES_VISIBLE)
 | 
							.resize(function() {
 | 
				
			||||||
	})
 | 
								fitNPages(PAGES_VISIBLE)
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
							.bind('hashchange', function(){
 | 
				
			||||||
 | 
								// XXX this is the same as the init code below...
 | 
				
			||||||
 | 
								var n = parseInt(window.location.hash.split('#')[1])
 | 
				
			||||||
 | 
								if(n != null){
 | 
				
			||||||
 | 
									setCurrentPage(n)
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									alert('textual anchors not yet supported...')
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$('.viewer')
 | 
						$('.viewer')
 | 
				
			||||||
		.swipe({
 | 
							.swipe({
 | 
				
			||||||
@ -506,11 +519,19 @@ $(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()
 | 
						if(window.location.hash == ''){
 | 
				
			||||||
 | 
							loadState()
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							var n = parseInt(window.location.hash.split('#')[1])
 | 
				
			||||||
 | 
							if(n != null){
 | 
				
			||||||
 | 
								setCurrentPage(n)
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								alert('textual anchors not yet supported...')
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	togglePageView('on')
 | 
						togglePageView('on')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// hide the splash screen...
 | 
						// hide the splash screen...
 | 
				
			||||||
	$(window).one('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend',
 | 
						$(window).one('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend',
 | 
				
			||||||
		function(){
 | 
							function(){
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user