mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			257 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			257 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			HTML
		
	
	
		
			Executable File
		
	
	
	
	
| <!DOCTYPE html>
 | |
| <html>
 | |
| <link rel="stylesheet" href="browse-dialog.css">
 | |
| <style>
 | |
| 
 | |
| /* scrollbar setup... */
 | |
| ::-webkit-scrollbar {
 | |
| 	width: 10px;
 | |
| 	height: 10px;
 | |
| }
 | |
| ::-webkit-scrollbar-button {
 | |
| 	display: none;
 | |
| }
 | |
| ::-webkit-scrollbar-track {
 | |
| }
 | |
| ::-webkit-scrollbar-track-piece {
 | |
| 	background: transparent;
 | |
| }
 | |
| ::-webkit-scrollbar-track-piece {
 | |
| 	background: rgba(0, 0, 0, 0.05);
 | |
| }
 | |
| ::-webkit-scrollbar-thumb {
 | |
| 	background: rgba(0, 0, 0, 0.15);
 | |
| }
 | |
| ::-webkit-scrollbar-thumb:hover {
 | |
| 	background: rgba(0, 0, 0, 0.3);
 | |
| }
 | |
| ::-webkit-scrollbar-corner {
 | |
| }
 | |
| ::-webkit-resizer {
 | |
| }
 | |
| 
 | |
| 
 | |
| /* 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;
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| /* 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);
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| </style>
 | |
| 
 | |
| <script src="../ext-lib/jquery.js"></script>
 | |
| <script src="../ext-lib/jquery-ui.js"></script>
 | |
| 
 | |
| <script src="../lib/jli.js"></script>
 | |
| <script src="../lib/toggler.js"></script>
 | |
| 
 | |
| <script src="../ext-lib/require.js"></script>
 | |
| 
 | |
| 
 | |
| <!--script src="browse-dialog.js"></script-->
 | |
| 
 | |
| <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',
 | |
| 		},
 | |
| 		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: {},
 | |
| 	},
 | |
| 	file: 'this is a file',
 | |
| }
 | |
| // add some recursion for testing...
 | |
| TREE.dir_d = TREE.dir_c.dir_b
 | |
| TREE.dir_a.tree = TREE
 | |
| TREE.dir_c.tree = TREE
 | |
| TREE.dir_c.dir_b.tree = TREE
 | |
| 
 | |
| 
 | |
| 
 | |
| //---
 | |
| 
 | |
| 
 | |
| requirejs(['../lib/keyboard', '../object', './browse-dialog'], function(k, o, browser){
 | |
| 	keyboard = k
 | |
| 	object = o
 | |
| 
 | |
| 	b = browser.Browser($('.container').last(), {
 | |
| 			list: function(path){
 | |
| 				console.log('>>>', path)
 | |
| 				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()
 | |
| 
 | |
| 	b.path = '/dir_a/tree/dir_c'
 | |
| })
 | |
| 
 | |
| $(function(){
 | |
| 
 | |
| 	$('.container').first().remove()
 | |
| 
 | |
| 	$('.container').draggable({ 
 | |
| 			cancel: ".path .dir, .list div" 
 | |
| 		})
 | |
| 
 | |
| 	//browser.focus()
 | |
| })
 | |
| 
 | |
| var themeToggler = CSSClassToggler('body',
 | |
| 		[
 | |
| 			'none', 
 | |
| 			'light',
 | |
| 			'dark', 
 | |
| 		],
 | |
| 		function(state){
 | |
| 			$('#theme').text(state)
 | |
| 		})
 | |
| 
 | |
| </script>
 | |
| 
 | |
| <body>
 | |
| 
 | |
| <button onclick="b.pop()"><</button>
 | |
| <button onclick="b.push()">></button>
 | |
| <button onclick="b.prev()">^</button>
 | |
| <button onclick="b.next()">v</button>
 | |
| 
 | |
| <br>
 | |
| <br>
 | |
| 
 | |
| Theme: <button id="theme" onclick="themeToggler()">none</button>
 | |
| 
 | |
| 
 | |
| <div class="container">
 | |
| 	<div class="browse">
 | |
| 		<!-- title, optional -->
 | |
| 		<div class="v-block title">
 | |
| 			[title]
 | |
| 		</div>
 | |
| 
 | |
| 		<!-- current path -->
 | |
| 		<div class="v-block path">
 | |
| 			<div class="dir">
 | |
| 				[dir]
 | |
| 			</div>
 | |
| 			<div class="dir">
 | |
| 				[dir]
 | |
| 			</div>
 | |
| 			<div class="dir">
 | |
| 				[dir]
 | |
| 			</div>
 | |
| 		</div>
 | |
| 
 | |
| 		<!-- path list -->
 | |
| 		<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>
 | |
| 
 | |
| <div class="container">
 | |
| </div>
 | |
| 
 | |
| </body>
 | |
| </html>
 | |
| <!-- vim:set ts=4 sw=4 : -->
 |