mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
started work on the fs loader...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3eb788b02e
commit
d727691977
@ -319,7 +319,15 @@ function(path, logger){
|
|||||||
// collect the found indexes...
|
// collect the found indexes...
|
||||||
.on('match', function(path){
|
.on('match', function(path){
|
||||||
loadIndex(path, logger)
|
loadIndex(path, logger)
|
||||||
.done(function(obj){ res[path] = obj[path] })
|
.done(function(obj){
|
||||||
|
// NOTE: considering that all the paths within
|
||||||
|
// the index are relative to the preview
|
||||||
|
// dir (the parent dir to the index root)
|
||||||
|
// we do not need to include the index
|
||||||
|
// itself in the base path...
|
||||||
|
var p = path.split(INDEX_DIR)[0]
|
||||||
|
res[p] = obj[path]
|
||||||
|
})
|
||||||
})
|
})
|
||||||
// done...
|
// done...
|
||||||
.on('end', function(paths){
|
.on('end', function(paths){
|
||||||
|
|||||||
@ -1115,6 +1115,12 @@ var RibbonsPrototype = {
|
|||||||
// preview...
|
// preview...
|
||||||
var p_url = that.images.getBestPreview(img_data.id, size, img_data).url
|
var p_url = that.images.getBestPreview(img_data.id, size, img_data).url
|
||||||
|
|
||||||
|
// XXX experimental...
|
||||||
|
if(img_data.base != null){
|
||||||
|
// XXX need to check if p_url is already absolute...
|
||||||
|
p_url = img_data.base +'/'+ p_url
|
||||||
|
}
|
||||||
|
|
||||||
// update the preview if it's a new image or...
|
// update the preview if it's a new image or...
|
||||||
// XXX this should be pushed as far back as possible...
|
// XXX this should be pushed as far back as possible...
|
||||||
if(old_gid != gid
|
if(old_gid != gid
|
||||||
|
|||||||
@ -282,7 +282,7 @@ $(function(){
|
|||||||
|
|
||||||
// setup base keyboard for devel, in case something breaks...
|
// setup base keyboard for devel, in case something breaks...
|
||||||
// This branch does not drop keys...
|
// This branch does not drop keys...
|
||||||
if(module.MAX_KEY_REPEAT_RATE < 0 || module.MAX_KEY_REPEAT_RATE == null){
|
if(a.config['max-key-repeat-rate'] < 0 || a.config['max-key-repeat-rate'] == null){
|
||||||
$(document)
|
$(document)
|
||||||
.keydown(
|
.keydown(
|
||||||
keyboard.makeKeyboardHandler(
|
keyboard.makeKeyboardHandler(
|
||||||
@ -305,8 +305,7 @@ $(function(){
|
|||||||
},
|
},
|
||||||
a),
|
a),
|
||||||
function(){
|
function(){
|
||||||
// XXX get this from config...
|
return a.config['max-key-repeat-rate']
|
||||||
return module.MAX_KEY_REPEAT_RATE
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -810,8 +810,9 @@ var ViewerActions =
|
|||||||
module.ViewerActions =
|
module.ViewerActions =
|
||||||
actions.Actions({
|
actions.Actions({
|
||||||
|
|
||||||
/*
|
|
||||||
// Images...
|
// Images...
|
||||||
|
// XXX this seems like a hack...
|
||||||
|
// ...should this be here???
|
||||||
get images(){
|
get images(){
|
||||||
return this.ribbons != null ? this.ribbons.images : null
|
return this.ribbons != null ? this.ribbons.images : null
|
||||||
},
|
},
|
||||||
@ -821,7 +822,6 @@ actions.Actions({
|
|||||||
this.ribbons.images = value
|
this.ribbons.images = value
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
|
|
||||||
get screenwidth(){
|
get screenwidth(){
|
||||||
return this.ribbons != null ? this.ribbons.getScreenWidthImages() : null
|
return this.ribbons != null ? this.ribbons.getScreenWidthImages() : null
|
||||||
@ -1329,6 +1329,14 @@ module.Viewer = ImageGridFeatures.Feature({
|
|||||||
// ...this effectively sets the closest distance an image can be from
|
// ...this effectively sets the closest distance an image can be from
|
||||||
// the viewer edge...
|
// the viewer edge...
|
||||||
'fit-overflow': 0.2,
|
'fit-overflow': 0.2,
|
||||||
|
|
||||||
|
|
||||||
|
// limit key repeat to one per N milliseconds.
|
||||||
|
//
|
||||||
|
// Set this to -1 or null to run keys without any limitations.
|
||||||
|
// XXX at this point the keyboard is setup in ui.js, need to
|
||||||
|
// move to a more logical spot...
|
||||||
|
'max-key-repeat-rate': 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: ViewerActions,
|
actions: ViewerActions,
|
||||||
@ -2889,6 +2897,55 @@ module.AppControl = ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// XXX at this point this is a stub...
|
// XXX at this point this is a stub...
|
||||||
|
if(window.nodejs != null){
|
||||||
|
var file = requirejs('./file')
|
||||||
|
}
|
||||||
|
|
||||||
|
var FileSystemLoaderActions = actions.Actions({
|
||||||
|
// XXX
|
||||||
|
loadPath: ['File/',
|
||||||
|
function(path){
|
||||||
|
var that = this
|
||||||
|
// XXX does not appear to load correctly...
|
||||||
|
file.loadIndex(path)
|
||||||
|
.done(function(res){
|
||||||
|
// XXX res may contain multiple indexes, need to
|
||||||
|
// combine them...
|
||||||
|
var k = Object.keys(res)[0]
|
||||||
|
|
||||||
|
// XXX use the logger...
|
||||||
|
console.log('LOADING:', k)
|
||||||
|
|
||||||
|
var d = data.Data.fromJSON(res[k].data)
|
||||||
|
// XXX need to load tags, marks, bookmarks, ...
|
||||||
|
// XXX
|
||||||
|
|
||||||
|
// XXX need to make this segment specific...
|
||||||
|
d.base = k
|
||||||
|
|
||||||
|
// XXX STUB remove ASAP...
|
||||||
|
// ...need a real way to handle base dir, possible
|
||||||
|
// approaches:
|
||||||
|
// 1) .base attr in image, set on load and
|
||||||
|
// do not save (or ignore on load)...
|
||||||
|
// if exists prepend to all paths...
|
||||||
|
// - more to do in view-time
|
||||||
|
// + more flexible
|
||||||
|
// 2) add/remove on load/save (approach below)
|
||||||
|
// + less to do in real time
|
||||||
|
// - more processing on load/save
|
||||||
|
var img = images.Images(res[k].images)
|
||||||
|
.forEach(function(_, img){ img.base = k })
|
||||||
|
|
||||||
|
that.load({
|
||||||
|
data: d,
|
||||||
|
images: img,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
var FileSystemLoader =
|
var FileSystemLoader =
|
||||||
module.FileSystemLoader = ImageGridFeatures.Feature({
|
module.FileSystemLoader = ImageGridFeatures.Feature({
|
||||||
title: '',
|
title: '',
|
||||||
@ -2896,6 +2953,8 @@ module.FileSystemLoader = ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
tag: 'fs-loader',
|
tag: 'fs-loader',
|
||||||
|
|
||||||
|
actions: FileSystemLoaderActions,
|
||||||
|
|
||||||
isApplicable: function(){
|
isApplicable: function(){
|
||||||
return window.nodejs != null
|
return window.nodejs != null
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user