| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-25 18:34:53 +04:00
										 |  |  | window.nodejs = (typeof(process) === 'object' && process.features.uv)  | 
					
						
							|  |  |  | 	? { | 
					
						
							|  |  |  | 		require: window.require, | 
					
						
							|  |  |  | 	}  | 
					
						
							|  |  |  | 	: null | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | define(function(require){ var module = {} | 
					
						
							|  |  |  | console.log('>>> ui') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //var DEBUG = DEBUG != null ? DEBUG : true
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | var keyboard = require('lib/keyboard') | 
					
						
							|  |  |  | var doc = keyboard.doc | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // compatibility...
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | var browser = require('browser') | 
					
						
							|  |  |  | var nw = require('nw') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | // XXX load only the actualy used here modules...
 | 
					
						
							|  |  |  | var actions = require('actions') | 
					
						
							|  |  |  | var data = require('data') | 
					
						
							| 
									
										
										
										
											2014-07-21 18:33:31 +04:00
										 |  |  | var ribbons = require('ribbons') | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-15 06:03:36 +04:00
										 |  |  | // XXX 
 | 
					
						
							|  |  |  | var testing = require('testing') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-02 02:55:03 +04:00
										 |  |  | var client = require('client') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-11 06:33:49 +04:00
										 |  |  | var viewer = require('viewer') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-02 02:55:03 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:33:31 +04:00
										 |  |  | // XXX add this to the global doc...
 | 
					
						
							| 
									
										
										
										
											2014-07-22 17:09:25 +04:00
										 |  |  | module.GLOBAL_KEYBOARD = { | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 	'Global bindings': { | 
					
						
							|  |  |  | 		doc: 'NOTE: binding priority is the same as the order of sections '+ | 
					
						
							|  |  |  | 			'on this page.', | 
					
						
							|  |  |  | 		pattern: '*', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		F4: { | 
					
						
							|  |  |  | 			alt: doc('Close viewer',  | 
					
						
							|  |  |  | 				function(){  | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 					window.close()  | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 					return false | 
					
						
							|  |  |  | 				}), | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		F5: doc('Full reload viewer',  | 
					
						
							|  |  |  | 			function(){  | 
					
						
							|  |  |  | 				/* | 
					
						
							|  |  |  | 				killAllWorkers() | 
					
						
							|  |  |  | 					.done(function(){ | 
					
						
							|  |  |  | 						reload()  | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 				*/ | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 				location.reload() | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		F12: doc('Show devTools',  | 
					
						
							|  |  |  | 			function(){  | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 				if(window.showDevTools != null){ | 
					
						
							|  |  |  | 					showDevTools()  | 
					
						
							|  |  |  | 					return false | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				// if no showDevTools defined pass the button further...
 | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					return true | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 			}), | 
					
						
							|  |  |  | 		// NOTE: these are for systems where F** keys are not available 
 | 
					
						
							|  |  |  | 		// 		or do other stuff...
 | 
					
						
							|  |  |  | 		R: { | 
					
						
							|  |  |  | 			/* | 
					
						
							|  |  |  | 			'ctrl+alt': doc('Reload viewer',  | 
					
						
							|  |  |  | 				function(){  | 
					
						
							|  |  |  | 					reloadViewer()  | 
					
						
							|  |  |  | 					return false | 
					
						
							|  |  |  | 				}), | 
					
						
							|  |  |  | 			*/ | 
					
						
							|  |  |  | 			'ctrl+shift': 'F5', | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// XXX testing...
 | 
					
						
							|  |  |  | 			ctrl: function(){  | 
					
						
							|  |  |  | 				event.preventDefault() | 
					
						
							|  |  |  | 				a.reverseImages()  | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		P: { | 
					
						
							|  |  |  | 			'ctrl+shift': 'F12', | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// NOTE: this is handled by the wrapper at this point, so we do 
 | 
					
						
							|  |  |  | 		// 		not have to do anything here...
 | 
					
						
							|  |  |  | 		F11: doc('Toggle full screen view', function(){  | 
					
						
							|  |  |  | 				toggleFullscreenMode()  | 
					
						
							|  |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		F: { | 
					
						
							|  |  |  | 			ctrl: 'F11', | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// XXX testing...
 | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		Home: function(){ a.firstImage() }, | 
					
						
							|  |  |  | 		End: function(){ a.lastImage() }, | 
					
						
							|  |  |  | 		Left: { | 
					
						
							|  |  |  | 			default: function(){ a.prevImage() }, | 
					
						
							| 
									
										
										
										
											2014-10-13 06:33:22 +04:00
										 |  |  | 			alt: function(){  | 
					
						
							|  |  |  | 				event.preventDefault() | 
					
						
							|  |  |  | 				a.shiftImageLeft()  | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2014-10-18 04:26:52 +04:00
										 |  |  | 			ctrl: function(){ a.prevScreen() }, | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		Right: { | 
					
						
							|  |  |  | 			default: function(){ a.nextImage() }, | 
					
						
							| 
									
										
										
										
											2014-10-13 06:33:22 +04:00
										 |  |  | 			alt: function(){  | 
					
						
							|  |  |  | 				event.preventDefault() | 
					
						
							|  |  |  | 				a.shiftImageRight()  | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2014-10-18 04:26:52 +04:00
										 |  |  | 			ctrl: function(){ a.nextScreen() }, | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-19 22:32:33 +04:00
										 |  |  | 		'(': function(){ a.prevImageInOrder() }, | 
					
						
							|  |  |  | 		')': function(){ a.nextImageInOrder() }, | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 		Up: { | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 			default: function(){ a.prevRibbon() }, | 
					
						
							|  |  |  | 			shift: function(){ a.shiftImageUp() }, | 
					
						
							|  |  |  | 			'ctrl+shift': function(){ a.shiftImageUpNewRibbon() }, | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		Down: { | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 			default: function(){ a.nextRibbon() }, | 
					
						
							|  |  |  | 			shift: function(){ a.shiftImageDown() }, | 
					
						
							|  |  |  | 			'ctrl+shift': function(){ a.shiftImageDownNewRibbon() }, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-18 17:32:41 +04:00
										 |  |  | 		'#0': function(){ a.fitMax() }, | 
					
						
							|  |  |  | 		'#1': { | 
					
						
							|  |  |  | 			default: function(){ a.fitImage() }, | 
					
						
							|  |  |  | 			ctrl: function(){  | 
					
						
							|  |  |  | 				event.preventDefault() | 
					
						
							|  |  |  | 				a.fitOrig()  | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		'#2': function(){ a.fitTwo() }, | 
					
						
							|  |  |  | 		'#3': function(){ a.fitThree() }, | 
					
						
							|  |  |  | 		'#4': function(){ a.fitFour() }, | 
					
						
							|  |  |  | 		'#5': function(){ a.fitFive() }, | 
					
						
							| 
									
										
										
										
											2014-10-15 09:06:10 +04:00
										 |  |  | 		'#6': function(){ a.fitSix() }, | 
					
						
							|  |  |  | 		'#7': function(){ a.fitSeven() }, | 
					
						
							|  |  |  | 		'#8': function(){ a.fitEight() }, | 
					
						
							|  |  |  | 		'#9': function(){ a.fitNine() }, | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2014-10-18 17:32:41 +04:00
										 |  |  | 		'+': function(){ a.zoomIn() }, | 
					
						
							|  |  |  | 		'=': '+', | 
					
						
							|  |  |  | 		'-': function(){ a.zoomOut() }, | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }	 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(function(){ | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 	// setup base keyboard for devel, in case something breaks...
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 	$(document) | 
					
						
							|  |  |  | 		.keydown( | 
					
						
							|  |  |  | 			keyboard.makeKeyboardHandler( | 
					
						
							| 
									
										
										
										
											2014-07-22 17:09:25 +04:00
										 |  |  | 				module.GLOBAL_KEYBOARD, | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 				function(k){ | 
					
						
							|  |  |  | 					window.DEBUG && console.log(k) | 
					
						
							|  |  |  | 				})) | 
					
						
							| 
									
										
										
										
											2014-08-15 06:03:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-11 06:33:49 +04:00
										 |  |  | 	window.a = testing.setupActions() | 
					
						
							| 
									
										
										
										
											2014-10-13 06:33:22 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-13 17:32:19 +04:00
										 |  |  | 	viewer.Animation.setup(a) | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                                                */ | 
					
						
							|  |  |  | return module }) |