mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
cleaned out redundant text browser...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a3bfda9a29
commit
ca7d6cdff6
@ -5416,71 +5416,6 @@ object.Constructor('HTMLBrowser',
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
|
||||||
// Text tree renderer...
|
|
||||||
//
|
|
||||||
// This is mainly designed for testing.
|
|
||||||
//
|
|
||||||
// XXX Q: how should the header item and it's sub-list be linked???
|
|
||||||
|
|
||||||
var TextBrowserClassPrototype = {
|
|
||||||
__proto__: BaseBrowser,
|
|
||||||
}
|
|
||||||
|
|
||||||
var TextBrowserPrototype = {
|
|
||||||
__proto__: BaseBrowser.prototype,
|
|
||||||
|
|
||||||
options: {
|
|
||||||
renderIndent: '\t',
|
|
||||||
},
|
|
||||||
|
|
||||||
// NOTE: we do not need .renderGroup(..) here as a group is not
|
|
||||||
// visible in text...
|
|
||||||
renderList: function(header, items, footer, options){
|
|
||||||
var that = this
|
|
||||||
return this.renderNested(null, items, null, null, options)
|
|
||||||
.join('\n') },
|
|
||||||
renderItem: function(item, i, options){
|
|
||||||
return item.current ?
|
|
||||||
`[ ${ item.text } ]`
|
|
||||||
: item.text },
|
|
||||||
renderNested: function(header, children, context, item, options){
|
|
||||||
var that = this
|
|
||||||
var nested = children
|
|
||||||
&& children
|
|
||||||
.flat()
|
|
||||||
.map(function(e){
|
|
||||||
return e instanceof Array ?
|
|
||||||
e.map(function(e){
|
|
||||||
return (that.options.renderIndent || ' ') + e })
|
|
||||||
: e })
|
|
||||||
.flat()
|
|
||||||
return (
|
|
||||||
// expanded...
|
|
||||||
header && nested ?
|
|
||||||
[
|
|
||||||
...(header == ' ' ?
|
|
||||||
// blank header...
|
|
||||||
[]
|
|
||||||
: ['- ' + header]),
|
|
||||||
nested,
|
|
||||||
]
|
|
||||||
// collapsed...
|
|
||||||
: header ?
|
|
||||||
[ '+ ' + header ]
|
|
||||||
// nested...
|
|
||||||
: nested )},
|
|
||||||
}
|
|
||||||
|
|
||||||
var TextBrowser =
|
|
||||||
module.TextBrowser =
|
|
||||||
object.Constructor('TextBrowser',
|
|
||||||
TextBrowserClassPrototype,
|
|
||||||
TextBrowserPrototype)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// shorthands...
|
// shorthands...
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user