added a dir browser...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-10-01 12:11:03 +03:00
parent 20a6b72603
commit e16e41c7e1
5 changed files with 44 additions and 5 deletions

View File

@ -20,7 +20,6 @@ console.log('>>> browse')
var keyboard = require('../keyboard')
// XXX
var object = require('../../object')
var widget = require('./widget')
@ -578,7 +577,7 @@ var BrowserPrototype = {
// NOTE: this will be set to true if make(..) is called at least once...
var interactive = false
var make = function(p, traversable){
var make = function(p, traversable, disabled){
p = p + ''
var dir = /[\\\/]\s*$/
traversable = dir.test(p) && traversable == null ? true : traversable
@ -599,6 +598,9 @@ var BrowserPrototype = {
if(!traversable){
res.addClass('not-traversable')
}
if(disabled){
res.addClass('disabled')
}
return res
}
@ -607,7 +609,7 @@ var BrowserPrototype = {
// second API: make is not called and .list(..) returns an Array
// that will get loaded as list items...
if(!interactive){
if(!interactive && res){
res.forEach(make)
}

View File

@ -15,10 +15,15 @@ var browser = require('browser')
//var DEBUG = DEBUG != null ? DEBUG : true
var walk = require('lib/widget/browse-walk')
/*********************************************************************/
//var data = require('data')
window.dirLister = walk.listDir
window.toggleFullscreenMode =
module.toggleFullscreenMode = CSSClassToggler(
document.body,

View File

@ -48,9 +48,9 @@ function makeConstructor(name, a, b){
// this is here to make Chrome output more user friendly...
// skip for IE...
if(_constructor.name == 'Constructor'
if(_constructor.name == 'Constructor'){
// skip for chrome app...
&& !(window.chrome && chrome.runtime && chrome.runtime.id)){
//&& !(window.chrome && chrome.runtime && chrome.runtime.id)){
eval('_constructor = '+ _constructor
.toString()
.replace(/Constructor/g, name))

View File

@ -17,6 +17,7 @@
},
"dependencies": {
"flickrapi": "^0.3.28",
"fs-walk": "0.0.1",
"fs.extra": "^1.2.1",
"glob": "^4.0.6",
"guarantee-events": "^1.0.0",

View File

@ -2349,6 +2349,37 @@ var ActionTreeActions = actions.Actions({
&& parent.focus()
})
}],
// XXX make this nw only...
pathListerTest: ['Interface/Path lister test (floating)...',
function(path){
var parent = this.preventClosing ? this.preventClosing() : null
// we got an argument and can exit...
if(path){
console.log('PATH:', path)
return
}
var that = this
var o = overlay.Overlay($('body'),
require('./lib/widget/browse-walk').makeWalk(null, '/')
.open(function(evt, path){
o.close()
// close the parent ui...
parent
&& parent.close
&& parent.close()
that.pathListerTest(path)
}))
.close(function(){
parent
&& parent.focus
&& parent.focus()
})
}],
drawerTest:['Interface/Drawer widget test',
function(){
drawer.Drawer($('body'),