minor refactoring, tweaking and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-06-04 04:28:08 +03:00
parent 878c866f3f
commit 35f91f6642
2 changed files with 51 additions and 33 deletions

View File

@ -157,7 +157,9 @@ requirejs([
dialog.container = $('.container').first()[0] dialog.container = $('.container').first()[0]
dialog.update() dialog
.update()
.focus()
//$('.container').first().append(dialog.render()) //$('.container').first().append(dialog.render())
}) })

View File

@ -2841,6 +2841,36 @@ var BrowserPrototype = {
: this.container.appendChild(value)) : this.container.appendChild(value))
this.__dom = value }, this.__dom = value },
// Extended .get(..) to support:
// - 'pagetop'
// - 'pagebottom'
// - searching for items via DOM / jQuery objects
// XXX currently direct match only...
// ...should we add containment search -- match closest item containing obj...
//
// XXX add support for pixel offset...
// XXX
get: function(pattern){
var p = pattern
pattern = arguments[0] =
// DOM element...
// XXX should we also check for content???
pattern instanceof HTMLElement ?
function(e){ return e.dom === p }
// jQuery object...
// XXX should we also check for content???
: (typeof(jQuery) != 'undefined' && pattern instanceof jQuery) ?
function(e){ return p.is(e.dom) }
: pattern
return pattern == 'pagetop' ?
// XXX
false
: pattern == 'pagebottom' ?
// XXX
false
// call parent...
: object.parent(BrowserPrototype.get, this).call(this, ...arguments) },
// Element renderers... // Element renderers...
// //
@ -3169,36 +3199,30 @@ var BrowserPrototype = {
}, },
// XXX scroll...
// XXX add target posotion (top/bottom/center) -- where to place the item...
scrollTo: function(pattern){
},
center: function(pattern){
return this.scrollTo(pattern, 'center', ...[...arguments].slice(1)) },
// Custom events handlers... // Custom events handlers...
// //
// XXX keep element on screen if it's off or out of bounds....
__focus__: function(evt, elem){ __focus__: function(evt, elem){
;(elem.dom.classList.contains('list') ? ;(elem.dom.classList.contains('list') ?
elem.dom.querySelector('.item') elem.dom.querySelector('.item')
: elem.dom) : elem.dom)
.focus() }, .focus() },
// XXX add support for pixel offset... // Custom events...
// XXX //
get: function(pattern){ // XXX make this different from html event...
var p = pattern // XXX trigger this from kb handler...
pattern = arguments[0] = keyhandled: makeEventMethod('keyhandled', function(){
// DOM element... }),
// XXX should we also check for content???
pattern instanceof HTMLElement ?
function(e){ return e.dom === p }
// jQuery object...
// XXX should we also check for content???
: (typeof(jQuery) != 'undefined' && pattern instanceof jQuery) ?
function(e){ return p.is(e.dom) }
: pattern
return pattern == 'pagetop' ?
// XXX
false
: pattern == 'pagebottom' ?
// XXX
false
// call parent...
: object.parent(BrowserPrototype.get, this).call(this, ...arguments) },
// Navigation... // Navigation...
// //
@ -3252,18 +3276,10 @@ var BrowserPrototype = {
this.focus(this.get('pagebottom')) }, this.focus(this.get('pagebottom')) },
// XXX // XXX
pageUp: function(){ pageUp: function(){
var ref = this.get('pagetop') this.scrollTo(this.get('pagetop'), 'bottom') },
// XXX get element closest to pageHeight above top...
var target = null
this.scrollTo(target)
},
// XXX should we scroll to the bottom elem (current behavior) or to the one after it??? // XXX should we scroll to the bottom elem (current behavior) or to the one after it???
pageDown: function(){ pageDown: function(){
this.scrollTo(this.get('pagebottom')) }, this.scrollTo(this.get('pagebottom'), 'top') },
// XXX scroll...
scrollTo: function(elem){
},
} }