mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-01 20:00:10 +00:00
reworked filter startup and selection...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
898fab432b
commit
8ec239a8ba
@ -38,6 +38,7 @@
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
padding-right: 30px;
|
||||||
|
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
@ -70,6 +71,9 @@
|
|||||||
.browse .path .dir.cur:hover {
|
.browse .path .dir.cur:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
.browse .path .dir.cur[contenteditable] {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
.browse .path .dir.cur:empty:not([contenteditable]) {
|
.browse .path .dir.cur:empty:not([contenteditable]) {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 50px;
|
width: 50px;
|
||||||
|
|||||||
@ -50,6 +50,21 @@ var BrowserClassPrototype = {
|
|||||||
// path...
|
// path...
|
||||||
var path = $('<div>')
|
var path = $('<div>')
|
||||||
.addClass('v-block path')
|
.addClass('v-block path')
|
||||||
|
/*
|
||||||
|
.click(function(){
|
||||||
|
// XXX set contenteditable...
|
||||||
|
// XXX set value to path...
|
||||||
|
// XXX select all...
|
||||||
|
})
|
||||||
|
.on('blur', function(){
|
||||||
|
// XXX unset contenteditable...
|
||||||
|
})
|
||||||
|
.keyup(function(){
|
||||||
|
// XXX update path...
|
||||||
|
// - set /../..../ to path
|
||||||
|
// - use the part after the last '/' ad filter...
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
if(options.show_path == false){
|
if(options.show_path == false){
|
||||||
path.hide()
|
path.hide()
|
||||||
@ -111,7 +126,7 @@ var BrowserPrototype = {
|
|||||||
Filter: {
|
Filter: {
|
||||||
pattern: '.browse .path div.cur[contenteditable]',
|
pattern: '.browse .path div.cur[contenteditable]',
|
||||||
|
|
||||||
// keep text editing action from affecting the seelction...
|
// keep text editing action from affecting the selection...
|
||||||
ignore: [
|
ignore: [
|
||||||
'Backspace',
|
'Backspace',
|
||||||
'Left',
|
'Left',
|
||||||
@ -253,6 +268,7 @@ var BrowserPrototype = {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// add current selection indicator...
|
// add current selection indicator...
|
||||||
|
var txt
|
||||||
p.append($('<div>')
|
p.append($('<div>')
|
||||||
.addClass('dir cur')
|
.addClass('dir cur')
|
||||||
.click(function(){
|
.click(function(){
|
||||||
@ -272,10 +288,23 @@ var BrowserPrototype = {
|
|||||||
if(!that._hold_blur){
|
if(!that._hold_blur){
|
||||||
that.stopFilter()
|
that.stopFilter()
|
||||||
}
|
}
|
||||||
//that.stopFilter()
|
})
|
||||||
|
/* XXX does the right thing (replaces the later .focus(..)
|
||||||
|
* and .keyup(..)) but does not work in IE...
|
||||||
|
.on('input', function(){
|
||||||
|
that.showFiltered($(this).text())
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
// only update if text changed...
|
||||||
|
.focus(function(){
|
||||||
|
txt = $(this).text()
|
||||||
})
|
})
|
||||||
.keyup(function(){
|
.keyup(function(){
|
||||||
that.showFiltered($(this).text())
|
var cur = $(this).text()
|
||||||
|
if(txt != cur){
|
||||||
|
txt = cur
|
||||||
|
that.showFiltered(cur)
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// fill the children list...
|
// fill the children list...
|
||||||
@ -372,6 +401,8 @@ var BrowserPrototype = {
|
|||||||
//
|
//
|
||||||
// TODO need to support glob / nested patterns...
|
// TODO need to support glob / nested patterns...
|
||||||
// ..things like /**/a*/*moo/
|
// ..things like /**/a*/*moo/
|
||||||
|
//
|
||||||
|
// XXX add * support...
|
||||||
filter: function(pattern, a, b){
|
filter: function(pattern, a, b){
|
||||||
pattern = pattern == null ? '*' : pattern
|
pattern = pattern == null ? '*' : pattern
|
||||||
var ignore_disabled = typeof(a) == typeof(true) ? a : b
|
var ignore_disabled = typeof(a) == typeof(true) ? a : b
|
||||||
@ -502,13 +533,14 @@ var BrowserPrototype = {
|
|||||||
|
|
||||||
var that = this
|
var that = this
|
||||||
var e = this.dom.find('.path .dir.cur')
|
var e = this.dom.find('.path .dir.cur')
|
||||||
.text('')
|
//.text('')
|
||||||
.attr('contenteditable', true)
|
.attr('contenteditable', true)
|
||||||
.focus()
|
.focus()
|
||||||
|
|
||||||
// place the cursor...
|
// place the cursor...
|
||||||
range.setStart(e[0], 0)
|
//range.setStart(e[0], 0)
|
||||||
range.collapse(true)
|
//range.collapse(true)
|
||||||
|
range.selectNodeContents(e[0])
|
||||||
selection.removeAllRanges()
|
selection.removeAllRanges()
|
||||||
selection.addRange(range)
|
selection.addRange(range)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user