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

332 lines
5.5 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<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;
}
.browse {
display: inline-block;
min-width: 300px;
width: initial;
background: gray;
color: rgba(255,255,255,0.8);
padding: 5px;
font-family: sans-serif;
}
/*
.browse:not(:focus) {
opacity: 0.8;
}
*/
.browse .v-block {
width: 100%;
height: auto;
box-sizing: border-box;
border-top: 1px solid rgba(255,255,255, 0.3);
}
.browse .v-block:first-of-type {
border-top: none;
}
.browse .v-block:empty {
display: none;
}
.browse .title {
font-weight: bold;
color: rgba(255,255,255,0.9);
padding: 5px;
padding-left: 10px;
padding-right: 10px;
}
.browse .path {
padding: 5px;
padding-left: 10px;
padding-right: 10px;
white-space: nowrap;
}
.browse .path:empty {
display: block;
}
.browse .path:before {
content: "/";
}
.browse .path .dir {
display: inline-block;
}
.browse .path .dir:after {
content: "/";
}
.browse .path .dir.cur {
opacity: 0.5;
}
.browse .path .dir.cur:after {
content: "";
}
.browse .path .dir.cur:hover {
opacity: 1;
}
.browse .path .dir.cur:empty:not([contenteditable]) {
position: relative;
width: 50px;
height: 12px;
background: transparent;
opacity: 0;
}
.browse .path .dir.cur:empty:hover:not([contenteditable]) {
opacity: 0.6;
}
.browse .path .dir.cur:empty:hover:not([contenteditable]):after {
content: "______";
border: dashed white 1px;
cursor: text;
}
/* XXX need to make this resizable up but only to a certain size (~80vh) */
/*
.browse .list {
max-height: 50vh;
}
.browse .list:empty {
display: block;
}
*/
.browse .list div {
padding: 5px;
padding-left: 10px;
padding-right: 10px;
}
.browse:focus .list div.selected,
.browse .path .dir:hover,
.browse .list div:hover {
color: white;
background: rgba(0,0,0, 0.05);
}
/* XXX need to make the next two different... */
.browse .list div.filtered-out {
opacity: 0.5;
}
.browse:not(.show-filtered-out) .list div.filtered-out {
display: none;
}
.browse .list div.disabled {
opacity: 0.3;
}
.browse:focus .list div.selected {
background: rgba(0,0,0, 0.1);
box-shadow: rgba(0,0,0,0.2) 0.1em 0.1em 0.2em;
}
.browse .list div.selected {
background: rgba(0,0,0, 0.08);
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-button {
display: none;
}
::-webkit-scrollbar-track {
}
::-webkit-scrollbar-track-piece {
background: gray;
}
::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.05);
}
::-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 : -->