mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
reworked the widget.close event workings, now alot more uniform...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6a7f440bc7
commit
096fb9957e
@ -312,9 +312,9 @@ var BrowserPrototype = {
|
|||||||
'select',
|
'select',
|
||||||
'deselect',
|
'deselect',
|
||||||
|
|
||||||
//'keydown',
|
'keydown',
|
||||||
|
|
||||||
'close',
|
//'close',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Shorthand elements...
|
// Shorthand elements...
|
||||||
@ -1140,7 +1140,7 @@ var BrowserPrototype = {
|
|||||||
hidden ? 'hidden' : '',
|
hidden ? 'hidden' : '',
|
||||||
opts.hide_on_search ? 'hide-on-search' : '',
|
opts.hide_on_search ? 'hide-on-search' : '',
|
||||||
(opts.hide_on_search || opts.not_searchable) ? 'not-searchable' : '',
|
(opts.hide_on_search || opts.not_searchable) ? 'not-searchable' : '',
|
||||||
opts.not_filtered_out ? 'not_filtered_out' : '',
|
opts.not_filtered_out ? 'not-filtered-out' : '',
|
||||||
].join(' '))
|
].join(' '))
|
||||||
|
|
||||||
opts.push_on_open && res.attr('push-on-open', 'on')
|
opts.push_on_open && res.attr('push-on-open', 'on')
|
||||||
@ -1520,7 +1520,7 @@ var BrowserPrototype = {
|
|||||||
this.filter(pattern,
|
this.filter(pattern,
|
||||||
// rejected...
|
// rejected...
|
||||||
function(i, e){
|
function(i, e){
|
||||||
!e.hasClass('not-filterd-out')
|
!e.hasClass('not-filtered-out')
|
||||||
&& e.addClass('filtered-out')
|
&& e.addClass('filtered-out')
|
||||||
|
|
||||||
e.removeClass('selected')
|
e.removeClass('selected')
|
||||||
|
|||||||
@ -71,23 +71,6 @@ var OverlayPrototype = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// custom events...
|
|
||||||
close: function(handler){
|
|
||||||
// trigger the event...
|
|
||||||
if(handler == null){
|
|
||||||
this.dom.detach()
|
|
||||||
if(this.parent.children('.overlay-widget').length == 0){
|
|
||||||
this.parent.removeClass('blur')
|
|
||||||
}
|
|
||||||
this.trigger('close')
|
|
||||||
|
|
||||||
// register a handler...
|
|
||||||
} else {
|
|
||||||
this.on('close', handler)
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
},
|
|
||||||
|
|
||||||
__init__: function(parent, client, options){
|
__init__: function(parent, client, options){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
@ -128,10 +111,18 @@ var OverlayPrototype = {
|
|||||||
.addClass('blur')
|
.addClass('blur')
|
||||||
.append(this.dom)
|
.append(this.dom)
|
||||||
|
|
||||||
// pass focus to the client if it is not focused already...
|
this
|
||||||
this.on('focus click', function(){
|
// pass focus to the client if it is not focused already...
|
||||||
client.focus && client.focus()
|
.on('focus click', function(){
|
||||||
})
|
client.focus && client.focus()
|
||||||
|
})
|
||||||
|
// close...
|
||||||
|
.close(function(){
|
||||||
|
that.dom.detach()
|
||||||
|
if(that.parent.children('.overlay-widget').length == 0){
|
||||||
|
that.parent.removeClass('blur')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
this.focus()
|
this.focus()
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,20 @@ var WidgetPrototype = {
|
|||||||
deligate: proxyToDom('deligate'),
|
deligate: proxyToDom('deligate'),
|
||||||
undeligate: proxyToDom('undeligate'),
|
undeligate: proxyToDom('undeligate'),
|
||||||
|
|
||||||
|
// custom events...
|
||||||
|
close: function(handler){
|
||||||
|
// trigger...
|
||||||
|
if(handler == null){
|
||||||
|
this.parent.close
|
||||||
|
&& this.parent.close()
|
||||||
|
this.trigger('close')
|
||||||
|
|
||||||
|
// register new handler...
|
||||||
|
} else {
|
||||||
|
this.on('close', handler)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
},
|
||||||
|
|
||||||
// XXX this will not:
|
// XXX this will not:
|
||||||
// - attach dom to parent... (???)
|
// - attach dom to parent... (???)
|
||||||
@ -117,11 +131,12 @@ var WidgetPrototype = {
|
|||||||
|
|
||||||
// add keyboard handler...
|
// add keyboard handler...
|
||||||
if(this.keyboard && this.dom){
|
if(this.keyboard && this.dom){
|
||||||
this.dom.keydown(
|
this.dom
|
||||||
keyboard.makeKeyboardHandler(
|
.keydown(
|
||||||
this.keyboard,
|
keyboard.makeKeyboardHandler(
|
||||||
options.logKeys,
|
this.keyboard,
|
||||||
this))
|
options.logKeys,
|
||||||
|
this))
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.nonPropagatedEvents != null){
|
if(this.options.nonPropagatedEvents != null){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user