| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | <!DOCTYPE html> | 
					
						
							|  |  |  | <html> | 
					
						
							| 
									
										
										
										
											2015-06-20 14:28:33 +03:00
										 |  |  | <link rel="stylesheet" href="browse-dialog.css"> | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | <style> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 20:51:43 +03:00
										 |  |  | /* scrollbar setup... */ | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | ::-webkit-scrollbar { | 
					
						
							|  |  |  | 	width: 10px; | 
					
						
							| 
									
										
										
										
											2015-06-19 19:13:11 +03:00
										 |  |  | 	height: 10px; | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | } | 
					
						
							|  |  |  | ::-webkit-scrollbar-button { | 
					
						
							|  |  |  | 	display: none; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ::-webkit-scrollbar-track { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ::-webkit-scrollbar-track-piece { | 
					
						
							| 
									
										
										
										
											2015-06-19 19:13:11 +03:00
										 |  |  | 	background: transparent; | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-06-19 19:13:11 +03:00
										 |  |  | ::-webkit-scrollbar-track-piece { | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | 	background: rgba(0, 0, 0, 0.05); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-06-19 19:13:11 +03:00
										 |  |  | ::-webkit-scrollbar-thumb { | 
					
						
							|  |  |  | 	background: rgba(0, 0, 0, 0.15); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | ::-webkit-scrollbar-thumb:hover { | 
					
						
							|  |  |  | 	background: rgba(0, 0, 0, 0.3); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ::-webkit-scrollbar-corner { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ::-webkit-resizer { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 20:51:43 +03:00
										 |  |  | /* testbed... */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .container { | 
					
						
							|  |  |  | 	display: inline-block; | 
					
						
							|  |  |  | 	position: absolute; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	top: 100px; | 
					
						
							|  |  |  | 	left: 100px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	box-shadow: rgba(0,0,0,0.5) 0.1em 0.1em 0.4em; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* make the container expand only to a certain size, then scroll */ | 
					
						
							|  |  |  | 	/* XXX need to: | 
					
						
							|  |  |  | 		- auto-scroll vertically | 
					
						
							|  |  |  | 		- use custom scroll bars | 
					
						
							|  |  |  | 		- shorten path to fit width | 
					
						
							|  |  |  | 			i.e. manage width manually when at max-width... | 
					
						
							|  |  |  | 	*/ | 
					
						
							|  |  |  | 	max-height: 60vh; | 
					
						
							|  |  |  | 	max-width: 60vw; | 
					
						
							|  |  |  | 	height: auto; | 
					
						
							|  |  |  | 	width: auto; | 
					
						
							|  |  |  | 	overflow-y: auto; | 
					
						
							|  |  |  | 	overflow-x: hidden; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 21:28:09 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* theaming... */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | body.dark { | 
					
						
							|  |  |  | 	background: black; | 
					
						
							|  |  |  | 	color: white; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .dark ::-webkit-scrollbar-track-piece { | 
					
						
							|  |  |  | 	background: rgba(255, 255, 255, 0.05); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | .dark ::-webkit-scrollbar-thumb { | 
					
						
							|  |  |  | 	background: rgba(255, 255, 255, 0.15); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | .dark ::-webkit-scrollbar-thumb:hover { | 
					
						
							|  |  |  | 	background: rgba(255, 255, 255, 0.3); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | .dark .container { | 
					
						
							|  |  |  | 	border: solid 1px rgba(255, 255, 255, 0.2); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | </style> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script src="../ext-lib/jquery.js"></script> | 
					
						
							|  |  |  | <script src="../ext-lib/jquery-ui.js"></script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script src="../lib/jli.js"></script> | 
					
						
							| 
									
										
										
										
											2015-06-20 20:51:43 +03:00
										 |  |  | <script src="../lib/toggler.js"></script> | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 19:07:13 +03:00
										 |  |  | <script src="../ext-lib/require.js"></script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 14:50:54 +03:00
										 |  |  | <!--script src="browse-dialog.js"></script--> | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var TREE = { | 
					
						
							|  |  |  | 	dir_a: {}, | 
					
						
							|  |  |  | 	dir_b: { | 
					
						
							|  |  |  | 		file1: 'this is a file', | 
					
						
							|  |  |  | 		file2: 'this is a file', | 
					
						
							|  |  |  | 		file3: 'this is a file', | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	dir_c: { | 
					
						
							|  |  |  | 		file1: 'this is a file', | 
					
						
							|  |  |  | 		dir_b: { | 
					
						
							|  |  |  | 			file1: 'this is a file', | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2015-03-03 05:27:47 +03:00
										 |  |  | 		dir_c: {}, | 
					
						
							|  |  |  | 		dir_d: {}, | 
					
						
							|  |  |  | 		dir_e: {}, | 
					
						
							|  |  |  | 		dir_f: {}, | 
					
						
							|  |  |  | 		dir_g: {}, | 
					
						
							|  |  |  | 		dir_h: {}, | 
					
						
							|  |  |  | 		dir_i: {}, | 
					
						
							|  |  |  | 		dir_j: {}, | 
					
						
							|  |  |  | 		dir_k: {}, | 
					
						
							|  |  |  | 		dir_l: {}, | 
					
						
							|  |  |  | 		dir_m: {}, | 
					
						
							|  |  |  | 		dir_o: {}, | 
					
						
							|  |  |  | 		dir_p: {}, | 
					
						
							|  |  |  | 		dir_q: {}, | 
					
						
							|  |  |  | 		dir_r: {}, | 
					
						
							|  |  |  | 		dir_s: {}, | 
					
						
							|  |  |  | 		dir_t: {}, | 
					
						
							|  |  |  | 		dir_u: {}, | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	file: 'this is a file', | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-02-13 02:28:42 +03:00
										 |  |  | // add some recursion for testing... | 
					
						
							|  |  |  | TREE.dir_d = TREE.dir_c.dir_b | 
					
						
							|  |  |  | TREE.dir_a.tree = TREE | 
					
						
							| 
									
										
										
										
											2015-02-14 03:30:13 +03:00
										 |  |  | TREE.dir_c.tree = TREE | 
					
						
							| 
									
										
										
										
											2015-02-13 02:28:42 +03:00
										 |  |  | TREE.dir_c.dir_b.tree = TREE | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 19:07:13 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-16 20:40:08 +03:00
										 |  |  | //--- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 19:07:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 14:50:54 +03:00
										 |  |  | requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, browser){ | 
					
						
							| 
									
										
										
										
											2015-03-16 20:40:08 +03:00
										 |  |  | 	keyboard = k | 
					
						
							|  |  |  | 	object = o | 
					
						
							| 
									
										
										
										
											2015-02-12 19:07:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 14:50:54 +03:00
										 |  |  | 	b = browser.Browser($('.container').last(), { | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | 			list: function(path){ | 
					
						
							| 
									
										
										
										
											2015-05-25 20:02:47 +03:00
										 |  |  | 				console.log('>>>', path) | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | 				var cur = TREE | 
					
						
							|  |  |  | 				path.forEach(function(p){ | 
					
						
							|  |  |  | 					cur = cur[p] | 
					
						
							|  |  |  | 				}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				return Object.keys(cur) | 
					
						
							|  |  |  | 					.filter(function(k){ | 
					
						
							|  |  |  | 						// XXX stub... | 
					
						
							|  |  |  | 						return typeof(cur[k]) != typeof('str') | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 		.focus() | 
					
						
							| 
									
										
										
										
											2015-06-20 20:51:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	b.path = '/dir_a/tree/dir_c' | 
					
						
							| 
									
										
										
										
											2015-02-12 19:07:13 +03:00
										 |  |  | }) | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | $(function(){ | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	$('.container').first().remove() | 
					
						
							| 
									
										
										
										
											2015-02-14 03:30:13 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-14 03:37:24 +03:00
										 |  |  | 	$('.container').draggable({  | 
					
						
							|  |  |  | 			cancel: ".path .dir, .list div"  | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | 	//browser.focus() | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 20:51:43 +03:00
										 |  |  | var themeToggler = CSSClassToggler('body', | 
					
						
							|  |  |  | 		[ | 
					
						
							|  |  |  | 			'none',  | 
					
						
							|  |  |  | 			'light', | 
					
						
							|  |  |  | 			'dark',  | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 		function(state){ | 
					
						
							|  |  |  | 			$('#theme').text(state) | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <body> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 14:50:54 +03:00
										 |  |  | <button onclick="b.pop()"><</button> | 
					
						
							|  |  |  | <button onclick="b.push()">></button> | 
					
						
							|  |  |  | <button onclick="b.prev()">^</button> | 
					
						
							|  |  |  | <button onclick="b.next()">v</button> | 
					
						
							| 
									
										
										
										
											2015-02-12 17:16:00 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-20 20:51:43 +03:00
										 |  |  | <br> | 
					
						
							|  |  |  | <br> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Theme: <button id="theme" onclick="themeToggler()">none</button> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | <div class="container"> | 
					
						
							|  |  |  | 	<div class="browse"> | 
					
						
							|  |  |  | 		<!-- title, optional --> | 
					
						
							|  |  |  | 		<div class="v-block title"> | 
					
						
							|  |  |  | 			[title] | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | 		<!-- current path --> | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 		<div class="v-block path"> | 
					
						
							|  |  |  | 			<div class="dir"> | 
					
						
							|  |  |  | 				[dir] | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 			<div class="dir"> | 
					
						
							|  |  |  | 				[dir] | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 			<div class="dir"> | 
					
						
							|  |  |  | 				[dir] | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-18 00:13:30 +03:00
										 |  |  | 		<!-- path list --> | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 		<div class="v-block list"> | 
					
						
							|  |  |  | 			<div> | 
					
						
							|  |  |  | 				[dir] | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 			<div> | 
					
						
							|  |  |  | 				[dir] | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 			<div> | 
					
						
							|  |  |  | 				[dir] | 
					
						
							|  |  |  | 			</div> | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<!-- info, optional --> | 
					
						
							|  |  |  | 		<div class="v-block info"> | 
					
						
							|  |  |  | 			[info] | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		<!-- buttons, optional --> | 
					
						
							|  |  |  | 		<div class="v-block actions"> | 
					
						
							|  |  |  | 			[actions] | 
					
						
							|  |  |  | 		</div> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-21 16:45:20 +03:00
										 |  |  | <div class="container"> | 
					
						
							|  |  |  | </div> | 
					
						
							| 
									
										
										
										
											2015-02-12 15:12:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | </body> | 
					
						
							|  |  |  | </html> | 
					
						
							| 
									
										
										
										
											2015-02-28 12:04:43 +03:00
										 |  |  | <!-- vim:set ts=4 sw=4 : --> |