mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-31 03:50:16 +00:00 
			
		
		
		
	added logger...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									43a2f23a0c
								
							
						
					
					
						commit
						05d8d559ee
					
				| @ -756,9 +756,9 @@ $(document).ready(function(){ | ||||
| 					<p> | ||||
| 						<a id="downloader" download="magazine.json">download magazine...</a> | ||||
| 						<input type="file" id="upload" name="files[]"/> | ||||
| 						<a href="./layout.html">alternative layout (native scroll)</a> | ||||
| 						<a href="./layout-iscroll.html">alternative layout (iscroll)</a> | ||||
| 						<a href="./layout-iscroll2.html">alternative layout (drag)</a> | ||||
| 						Alternative layout: <a href="./layout.html">native scroll</a>,  | ||||
| 						<a href="./layout-iscroll.html">iscroll</a>,  | ||||
| 						<a href="./layout-iscroll2.html">hand-written drag</a> | ||||
| 					</p> | ||||
| 
 | ||||
| 					<hr noshade color="silver"> | ||||
|  | ||||
| @ -79,32 +79,6 @@ | ||||
| <script> | ||||
| 
 | ||||
| $(document).ready(function(){ | ||||
| 	// log... | ||||
| 	/* | ||||
| 	var _log = $('<div id="log"></div>') | ||||
| 		.css({ | ||||
| 			position: 'fixed', | ||||
| 			background: 'silver', | ||||
| 			opacity: 0.5, | ||||
| 			width: 200, | ||||
| 			height: '80%', | ||||
| 			top: 10, | ||||
| 			left: 10, | ||||
| 			'z-index': 90000, | ||||
| 			overflow: 'hidden', | ||||
| 			padding: 10, | ||||
| 		}) | ||||
| 		.text('log') | ||||
| 		.appendTo($('body')) | ||||
| 	function log(text){ | ||||
| 		_log.html(_log.html() + '<br>' + text + '') | ||||
| 		_log.scrollTop(_log.prop('scrollHeight')) | ||||
| 	} | ||||
| 	function clear_log(){ | ||||
| 		_log.html('') | ||||
| 	} | ||||
| 	*/ | ||||
| 
 | ||||
| 	// keyboard... | ||||
| 	$(document) | ||||
| 		.keydown(makeKeyboardHandler({ | ||||
| @ -129,20 +103,13 @@ $(document).ready(function(){ | ||||
| 		},  | ||||
| 		function(k){console.log(k)})) | ||||
| 
 | ||||
| 	/* | ||||
| 	window.myScroll = new iScroll('viewer', { | ||||
| 		vScroll: false, | ||||
| 		snap: '.page', | ||||
| 		momentum: false, | ||||
| 		hScrollbar: false, | ||||
| 	}) | ||||
| 	*/ | ||||
| 	 | ||||
| 
 | ||||
| 	logger = Logger() | ||||
| 	var scrolling = false | ||||
| 	var _x = null | ||||
| 	$('.viewer') | ||||
| 		.on('mousedown touchstart', function(){ | ||||
| 			logger.log('[touchstart]') | ||||
| 			scrolling = true | ||||
| 			togglePageDragging('on') | ||||
| 		}) | ||||
| @ -153,11 +120,13 @@ $(document).ready(function(){ | ||||
| 			} | ||||
| 			var x = evt.clientX | ||||
| 			if(scrolling){ | ||||
| 				logger.log('[drag]') | ||||
| 				shiftMagazineTo(getMagazineShift() + (x - _x)) | ||||
| 			} | ||||
| 			_x = x | ||||
| 		}) | ||||
| 		.on('mouseup touchend', function(){ | ||||
| 			logger.log('[touchend]') | ||||
| 			scrolling = false | ||||
| 			togglePageDragging('off') | ||||
| 		}) | ||||
|  | ||||
							
								
								
									
										50
									
								
								lib/jli.js
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								lib/jli.js
									
									
									
									
									
								
							| @ -422,6 +422,56 @@ jQuery.fn.sortChildren = function(func){ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /********************************************************** logger ***/ | ||||
| 
 | ||||
| function Logger(){ | ||||
| 	_log = null | ||||
| 	return { | ||||
| 		setup: function(){ | ||||
| 			if(_log == null){ | ||||
| 				_log = $('<div id="log"></div>') | ||||
| 					.css({ | ||||
| 						position: 'fixed', | ||||
| 						background: 'silver', | ||||
| 						opacity: 0.5, | ||||
| 						width: 200, | ||||
| 						height: '80%', | ||||
| 						top: 10, | ||||
| 						left: 10, | ||||
| 						'z-index': 90000, | ||||
| 						overflow: 'hidden', | ||||
| 						padding: 10, | ||||
| 					}) | ||||
| 					.text('log') | ||||
| 					.appendTo($('body')) | ||||
| 			} else { | ||||
| 				_log.appendTo($('body')) | ||||
| 			} | ||||
| 			return this | ||||
| 		}, | ||||
| 		remove: function(){ | ||||
| 			_log.detach() | ||||
| 			return this | ||||
| 		}, | ||||
| 		log: function(text){ | ||||
| 			_log.html(_log.html() + '<br>' + text + '') | ||||
| 			_log.scrollTop(_log.prop('scrollHeight')) | ||||
| 			return this | ||||
| 		}, | ||||
| 		clear: function(){ | ||||
| 			_log.html('') | ||||
| 			return this | ||||
| 		}, | ||||
| 		get: function(){ | ||||
| 			return _log | ||||
| 		}, | ||||
| 		set: function(elem){ | ||||
| 			_log = elem | ||||
| 		} | ||||
| 	}.setup() | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /********************************************************************** | ||||
| * vim:set ts=4 sw=4 :                                                */ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user