mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
tweaks and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e90f5f9b64
commit
0c3ad4efb2
@ -52,9 +52,13 @@ var browseWalk = require('lib/widget/browse-walk')
|
|||||||
// }
|
// }
|
||||||
var makeButtonControls =
|
var makeButtonControls =
|
||||||
module.makeButtonControls =
|
module.makeButtonControls =
|
||||||
function(context, cls, data){
|
function(context, cls, data, unusable_draw){
|
||||||
cls = cls instanceof Array ? cls : cls.split(/\s+/g)
|
cls = cls instanceof Array ?
|
||||||
var unusable_draw = context.config['unusable-button-draw-mode'] || 'hidden'
|
cls
|
||||||
|
: cls.split(/\s+/g)
|
||||||
|
unusable_draw = unusable_draw
|
||||||
|
|| context.config['unusable-button-draw-mode']
|
||||||
|
|| 'hidden'
|
||||||
|
|
||||||
// remove old versions...
|
// remove old versions...
|
||||||
context.dom.find('.'+ cls.join('.')).remove()
|
context.dom.find('.'+ cls.join('.')).remove()
|
||||||
@ -66,15 +70,15 @@ function(context, cls, data){
|
|||||||
evt = window.event || evt
|
evt = window.event || evt
|
||||||
var t = $(evt.target)
|
var t = $(evt.target)
|
||||||
|
|
||||||
var info = t.attr('info') || t.parents('[info]').attr('info') || ''
|
var info = t.attr('info')
|
||||||
|
|| t.parents('[info]').attr('info')
|
||||||
|
|| ''
|
||||||
|
|
||||||
context.showStatusBarInfo
|
context.showStatusBarInfo
|
||||||
&& context.showStatusBarInfo(info)
|
&& context.showStatusBarInfo(info) })
|
||||||
})
|
|
||||||
.on('mouseout', function(){
|
.on('mouseout', function(){
|
||||||
context.showStatusBarInfo
|
context.showStatusBarInfo
|
||||||
&& context.showStatusBarInfo()
|
&& context.showStatusBarInfo() })
|
||||||
})
|
|
||||||
|
|
||||||
// make buttons...
|
// make buttons...
|
||||||
Object.keys(data).forEach(function(k){
|
Object.keys(data).forEach(function(k){
|
||||||
@ -94,14 +98,18 @@ function(context, cls, data){
|
|||||||
} else {
|
} else {
|
||||||
var e = data[k].slice()
|
var e = data[k].slice()
|
||||||
var primary = e.pop()
|
var primary = e.pop()
|
||||||
primary = primary instanceof Array ? primary.slice() : primary
|
primary = primary instanceof Array ?
|
||||||
|
primary.slice()
|
||||||
|
: primary
|
||||||
var secondary = (primary instanceof Array && primary.length > 1) ?
|
var secondary = (primary instanceof Array && primary.length > 1) ?
|
||||||
primary.pop()
|
primary.pop()
|
||||||
: null
|
: null
|
||||||
secondary = typeof(secondary) == typeof('str') ?
|
secondary = typeof(secondary) == typeof('str') ?
|
||||||
keyboard.parseActionCall(secondary, context)
|
keyboard.parseActionCall(secondary, context)
|
||||||
: secondary
|
: secondary
|
||||||
primary = primary instanceof Array ? primary.shift() : primary
|
primary = primary instanceof Array ?
|
||||||
|
primary.shift()
|
||||||
|
: primary
|
||||||
primary = typeof(primary) == typeof('str') ?
|
primary = typeof(primary) == typeof('str') ?
|
||||||
keyboard.parseActionCall(primary, context)
|
keyboard.parseActionCall(primary, context)
|
||||||
: primary
|
: primary
|
||||||
@ -148,11 +156,14 @@ function(context, cls, data){
|
|||||||
})
|
})
|
||||||
.click(click)
|
.click(click)
|
||||||
.on('contextmenu', menu)
|
.on('contextmenu', menu)
|
||||||
.css(!usable ?
|
// handle unusable drawing...
|
||||||
(unusable_draw == 'hidden' ?
|
.run(function(){
|
||||||
{display: 'none'}
|
!usable
|
||||||
: {})
|
&& unusable_draw == 'hidden'
|
||||||
: {}))
|
&& this.css({display: 'none'})
|
||||||
|
!usable
|
||||||
|
&& unusable_draw == 'disabled'
|
||||||
|
&& this[0].setAttribute('disabled', '') }))
|
||||||
})
|
})
|
||||||
|
|
||||||
controls
|
controls
|
||||||
@ -3094,7 +3105,7 @@ var ButtonsActions = actions.Actions({
|
|||||||
config: {
|
config: {
|
||||||
// can be:
|
// can be:
|
||||||
// 'hidden' - draw hidden
|
// 'hidden' - draw hidden
|
||||||
// 'disabled' - draw disabled (not implemented)
|
// 'disabled' - draw disabled (XXX needs propper CSS)
|
||||||
// 'none' - do not draw
|
// 'none' - do not draw
|
||||||
// 'visible' - force draw
|
// 'visible' - force draw
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user