mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
tweaking + some refactoring and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0a57cb7c3a
commit
6a7f440bc7
@ -317,10 +317,17 @@ body {
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
|
||||
.browse-widget.key-bindings .list>.ignore .text:first-child {
|
||||
.browse-widget.key-bindings .list>.ignore-list .text:first-child {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
.browse-widget.key-bindings .list>.ignored .text:first-child {
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
}
|
||||
.browse-widget.key-bindings .list>.info {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.browse-widget.key-bindings .list>div .text:not(:first-child) {
|
||||
display: inline;
|
||||
@ -337,10 +344,6 @@ body {
|
||||
.browse-widget.key-bindings.browse .list>div .text:last-child {
|
||||
margin-right: 0em;
|
||||
}
|
||||
.browse-widget.key-bindings.browse .list>.ignored .text:first-child {
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.browse-widget.key-bindings .list>div:not(.selected):not(.mode):nth-child(even) {
|
||||
background: rgba(0, 0, 0, 0.03);
|
||||
|
||||
@ -50,7 +50,7 @@ module.GLOBAL_KEYBOARD = {
|
||||
ignore: [
|
||||
'Esc',
|
||||
'Up', 'Down', 'Enter',
|
||||
'R', 'L', 'G',
|
||||
'R', 'L', 'G', 'T',
|
||||
],
|
||||
|
||||
Esc: 'toggleSlideshow: "off" -- Exit slideshow',
|
||||
@ -648,6 +648,7 @@ var KeyboardActions = actions.Actions({
|
||||
Object.keys(keys)
|
||||
.forEach(function(mode){
|
||||
var ignored = actions.keyboard[mode].ignore || []
|
||||
var bound_ignored = []
|
||||
|
||||
// section heading...
|
||||
make(keys[mode].doc ?
|
||||
@ -660,48 +661,65 @@ var KeyboardActions = actions.Actions({
|
||||
.append($('<span>')
|
||||
.addClass('doc')
|
||||
.html(keys[mode].doc))
|
||||
: mode)
|
||||
// XXX should sections be searchable???
|
||||
//.addClass('mode not-searchable')
|
||||
.addClass('mode not-filterd-out')
|
||||
: mode,
|
||||
{
|
||||
not_filtered_out: true,
|
||||
// XXX should sections be searchable???
|
||||
//not_searchable: true,
|
||||
})
|
||||
.addClass('mode')
|
||||
|
||||
/* XXX not sure if we need this like this...
|
||||
// unpropagated keys...
|
||||
make(['Unpropagated keys:',
|
||||
// bindings...
|
||||
var c = 0
|
||||
Object.keys(keys[mode]).forEach(function(action){
|
||||
action != 'doc'
|
||||
// NOTE: wee need the button spec to be
|
||||
// searchable, thus we are not using
|
||||
// the keys attr as in .browseActions(..)
|
||||
&& make([action, ' ', '$BUTTONS']
|
||||
.concat($('<span>')
|
||||
.addClass('text')
|
||||
.html(keys[mode][action]
|
||||
// mark key if it is in ignored...
|
||||
.map(function(s){
|
||||
s = s.split('+')
|
||||
var k = s.pop()
|
||||
var i = ignored.indexOf(k)
|
||||
i >= 0
|
||||
&& bound_ignored
|
||||
.push(ignored[i])
|
||||
s.push(k
|
||||
+ (i >= 0 ? '<sup>*</sup>' : ''))
|
||||
return s.join('+') })
|
||||
.join(' / '))))
|
||||
.addClass('key '
|
||||
+ (action == 'IGNORE' ? 'ignored' : ''))
|
||||
&& c++
|
||||
})
|
||||
|
||||
// no keys in view mode...
|
||||
// XXX is adding info stuff like this a correct
|
||||
// thing to do in code?
|
||||
c == 0 && !edit
|
||||
&& make('No bindings...',
|
||||
{
|
||||
disabled: true,
|
||||
hide_on_search: true,
|
||||
})
|
||||
.addClass('info')
|
||||
|
||||
// unpropagated and unbound keys...
|
||||
make(['Unpropagated and unbound keys:',
|
||||
// NOTE: this blank is so as to avoid
|
||||
// sticking the action and keys
|
||||
// together in path...
|
||||
' ',
|
||||
'$BUTTONS',
|
||||
(ignored).join(' / ')])
|
||||
.addClass('ignore')
|
||||
//*/
|
||||
|
||||
// bindings...
|
||||
Object.keys(keys[mode])
|
||||
.forEach(function(action){
|
||||
action == 'Ignored' && console.log('!!!!!!!')
|
||||
action != 'doc'
|
||||
// NOTE: wee need the button
|
||||
// spec to be searchable,
|
||||
// thus we are not using
|
||||
// the keys attr as in
|
||||
// .browseActions(..)
|
||||
&& make([action, ' ', '$BUTTONS']
|
||||
.concat(keys[mode][action]
|
||||
// mark key if it is in ignored...
|
||||
.map(function(s){
|
||||
s = s.split('+')
|
||||
var k = s.pop()
|
||||
s.push(k
|
||||
+ (ignored.indexOf(k) >= 0 ?
|
||||
'*'
|
||||
: ''))
|
||||
return s.join('+') })
|
||||
.join(' / ')))
|
||||
.addClass('key'
|
||||
+ (action == 'Ignored' ? ' ignored' : ''))
|
||||
})
|
||||
ignored
|
||||
.filter(function(k){
|
||||
return bound_ignored.indexOf(k) == -1 })
|
||||
.join(' / ')])
|
||||
.addClass('ignore-list')
|
||||
|
||||
// controls...
|
||||
if(edit){
|
||||
@ -721,6 +739,19 @@ var KeyboardActions = actions.Actions({
|
||||
.addClass('new')
|
||||
}
|
||||
})
|
||||
|
||||
// notes...
|
||||
// XXX is adding info stuff like this a correct
|
||||
// thing to do in code?
|
||||
make('---')
|
||||
make($('<span>')
|
||||
.addClass('text')
|
||||
.html('<sup>*</sup> keys not propogated to next section.'),
|
||||
{
|
||||
disabled: true ,
|
||||
hide_on_search: true,
|
||||
})
|
||||
.addClass('info')
|
||||
}, {
|
||||
cls: [
|
||||
'key-bindings',
|
||||
|
||||
@ -859,7 +859,7 @@ function buildKeybindingsHelp(keybindings, shifted_keys, actions, doc_getter){
|
||||
|
||||
if(handler == 'IGNORE'){
|
||||
// XXX do we show ignored keys???
|
||||
var doc = 'Ignored'
|
||||
var doc = handler
|
||||
//continue
|
||||
|
||||
// custom doc getter...
|
||||
|
||||
@ -831,6 +831,24 @@ var BrowserPrototype = {
|
||||
// //
|
||||
// push_on_open: <bool>,
|
||||
//
|
||||
// // If true this element will be uncondionally hidden on search...
|
||||
// //
|
||||
// // NOTE: this is equivalent to setting .hide-on-search class
|
||||
// // on the element...
|
||||
// hide_on_search: <bool>,
|
||||
//
|
||||
// // If true the item will not get searched...
|
||||
// //
|
||||
// // NOTE: this is equivalent to setting .not-searchable class
|
||||
// // on the element...
|
||||
// not_searchable: <bool>,
|
||||
//
|
||||
// // If true item will not get hidden on filtering...
|
||||
// //
|
||||
// // NOTE: this is equivalent to setting .not-filtered-out class
|
||||
// // on the element...
|
||||
// not_filtered_out: <bool>,
|
||||
//
|
||||
// // element button spec...
|
||||
// buttons: <bottons>,
|
||||
// }
|
||||
@ -1011,8 +1029,9 @@ var BrowserPrototype = {
|
||||
|
||||
// XXX revise signature...
|
||||
var make = function(p, traversable, disabled, buttons){
|
||||
var opts = {}
|
||||
|
||||
var hidden = false
|
||||
var push_on_open = false
|
||||
|
||||
if(that.options.holdSize){
|
||||
// we've started, no need to hold the size any more...
|
||||
@ -1022,13 +1041,12 @@ var BrowserPrototype = {
|
||||
|
||||
// options passed as an object...
|
||||
if(traversable != null && typeof(traversable) == typeof({})){
|
||||
var opts = traversable
|
||||
opts = traversable
|
||||
|
||||
traversable = opts.traversable
|
||||
disabled = opts.disabled
|
||||
buttons = opts.buttons
|
||||
|
||||
hidden = opts.hidden
|
||||
push_on_open = opts.push_on_open
|
||||
}
|
||||
|
||||
buttons = buttons
|
||||
@ -1063,9 +1081,11 @@ var BrowserPrototype = {
|
||||
var txt = p.join('')
|
||||
// XXX check if traversable...
|
||||
p = $(p.map(function(t){
|
||||
return t == '$BUTTONS' ?
|
||||
$('<span/>')
|
||||
.addClass('button-container')[0]
|
||||
return t == '$BUTTONS' ?
|
||||
$('<span/>')
|
||||
.addClass('button-container')[0]
|
||||
: t instanceof jQuery ?
|
||||
t[0]
|
||||
: $('<span>')
|
||||
.addClass('text')
|
||||
// here we also replace empty strings with ...
|
||||
@ -1114,10 +1134,17 @@ var BrowserPrototype = {
|
||||
// append text elements...
|
||||
.append(p)
|
||||
|
||||
!traversable && res.addClass('not-traversable')
|
||||
disabled && res.addClass('disabled')
|
||||
hidden && res.addClass('hidden')
|
||||
push_on_open && res.attr('push-on-open', 'on')
|
||||
res.addClass([
|
||||
!traversable ? 'not-traversable' : '',
|
||||
disabled ? 'disabled' : '',
|
||||
hidden ? 'hidden' : '',
|
||||
opts.hide_on_search ? 'hide-on-search' : '',
|
||||
(opts.hide_on_search || opts.not_searchable) ? 'not-searchable' : '',
|
||||
opts.not_filtered_out ? 'not_filtered_out' : '',
|
||||
].join(' '))
|
||||
|
||||
opts.push_on_open && res.attr('push-on-open', 'on')
|
||||
|
||||
|
||||
// buttons...
|
||||
// button container...
|
||||
@ -1464,7 +1491,7 @@ var BrowserPrototype = {
|
||||
var browser = this.dom
|
||||
|
||||
// show all...
|
||||
if(pattern == null || pattern.trim() == '*'){
|
||||
if(pattern == null || pattern.trim() == '*' || pattern == ''){
|
||||
browser.find('.filtered-out')
|
||||
.removeClass('filtered-out')
|
||||
// clear the highlighting...
|
||||
@ -1473,6 +1500,10 @@ var BrowserPrototype = {
|
||||
|
||||
// basic filter...
|
||||
} else {
|
||||
// hide stuff that needs to be unconditionally hidden...
|
||||
browser.find('.hide-on-search')
|
||||
.addClass('filtered-out')
|
||||
|
||||
var p = RegExp('('
|
||||
+ pattern
|
||||
.trim()
|
||||
@ -1491,6 +1522,7 @@ var BrowserPrototype = {
|
||||
function(i, e){
|
||||
!e.hasClass('not-filterd-out')
|
||||
&& e.addClass('filtered-out')
|
||||
|
||||
e.removeClass('selected')
|
||||
},
|
||||
// NOTE: setting this to true will not remove disabled
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user