ImageGrid/ui (gen4)/experiments/browse-dialog.html

217 lines
3.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<link rel="stylesheet" href="browse-dialog.css">
<style>
.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;
}
::-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 {
}
</style>
<script src="../ext-lib/jquery.js"></script>
<script src="../ext-lib/jquery-ui.js"></script>
<script src="../lib/jli.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'], function(k, o){
keyboard = k
object = o
Browser = object.makeConstructor('Browser',
BrowserClassPrototype,
BrowserPrototype)
b = 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()
})
$(function(){
$('.container').first().remove()
$('.container').draggable({
cancel: ".path .dir, .list div"
})
//browser.focus()
})
</script>
<body>
<button onclick="pop()">&lt;</button>
<button onclick="push()">&gt;</button>
<button onclick="prev()">^</button>
<button onclick="next()">v</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 : -->