mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added persistent aliases...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3d81db1bc2
commit
00ec10a335
57
ui (gen4)/features/alias.js
Executable file
57
ui (gen4)/features/alias.js
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
/**********************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**********************************************************************/
|
||||||
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||||
|
(function(require){ var module={} // make module AMD/node compatible...
|
||||||
|
/*********************************************************************/
|
||||||
|
|
||||||
|
var actions = require('lib/actions')
|
||||||
|
var features = require('lib/features')
|
||||||
|
|
||||||
|
var core = require('features/core')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************/
|
||||||
|
|
||||||
|
var Alias =
|
||||||
|
module.Alias = core.ImageGridFeatures.Feature({
|
||||||
|
title: '',
|
||||||
|
doc: '',
|
||||||
|
|
||||||
|
tag: 'alias',
|
||||||
|
|
||||||
|
config: {
|
||||||
|
//aliases: {
|
||||||
|
//},
|
||||||
|
},
|
||||||
|
|
||||||
|
handlers: [
|
||||||
|
['alias',
|
||||||
|
function(_, alias, target){
|
||||||
|
console.log(alias, target)
|
||||||
|
// remove alias...
|
||||||
|
if(target === null || target === false){
|
||||||
|
var aliases = this.config.aliases || {}
|
||||||
|
|
||||||
|
delete aliases[alias]
|
||||||
|
|
||||||
|
if(Object.keys(alias).length == 0){
|
||||||
|
delete this.config.aliases
|
||||||
|
}
|
||||||
|
|
||||||
|
// save alias...
|
||||||
|
} else {
|
||||||
|
var aliases = this.config.aliases = this.config.aliases || {}
|
||||||
|
|
||||||
|
aliases[alias] = target
|
||||||
|
}
|
||||||
|
}]],
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* vim:set ts=4 sw=4 : */ return module })
|
||||||
@ -19,6 +19,7 @@ require('features/recover')
|
|||||||
require('features/history')
|
require('features/history')
|
||||||
require('features/app')
|
require('features/app')
|
||||||
require('features/peer')
|
require('features/peer')
|
||||||
|
require('features/alias')
|
||||||
require('features/ui')
|
require('features/ui')
|
||||||
// XXX
|
// XXX
|
||||||
require('features/ui-blank-render')
|
require('features/ui-blank-render')
|
||||||
|
|||||||
@ -802,6 +802,9 @@ module.Keyboard = core.ImageGridFeatures.Feature({
|
|||||||
var that = this
|
var that = this
|
||||||
this.__keyboard_config = this.keybindings || GLOBAL_KEYBOARD
|
this.__keyboard_config = this.keybindings || GLOBAL_KEYBOARD
|
||||||
|
|
||||||
|
// string action call parser...
|
||||||
|
this.parseStringHandler = this.parseStringAction
|
||||||
|
|
||||||
this.toggleKeyboardHandling('on')
|
this.toggleKeyboardHandling('on')
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,8 @@ core.ImageGridFeatures.Feature('viewer-testing', [
|
|||||||
'viewer-commandline',
|
'viewer-commandline',
|
||||||
'viewer-minimal',
|
'viewer-minimal',
|
||||||
|
|
||||||
|
'alias',
|
||||||
|
|
||||||
// read-only mode...
|
// read-only mode...
|
||||||
// XXX at this point this needs some more tuneup, the following
|
// XXX at this point this needs some more tuneup, the following
|
||||||
// features are completely disabled when 'edit' is not present
|
// features are completely disabled when 'edit' is not present
|
||||||
|
|||||||
@ -2295,6 +2295,10 @@ var WidgetTestActions = actions.Actions({
|
|||||||
.attr(attrs))
|
.attr(attrs))
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
// XXX does not work -- see actions.Actions(..) for details...
|
||||||
|
testAlias: ['Test/Action alias',
|
||||||
|
'focusImage: "prev"'],
|
||||||
|
|
||||||
// action constructor for testing...
|
// action constructor for testing...
|
||||||
makeAction: ['- Test/',
|
makeAction: ['- Test/',
|
||||||
function(name){
|
function(name){
|
||||||
|
|||||||
@ -159,6 +159,7 @@ function doc(text, func){
|
|||||||
// XXX add support for suffix to return false / stop_propagation...
|
// XXX add support for suffix to return false / stop_propagation...
|
||||||
// XXX should this handle calls???
|
// XXX should this handle calls???
|
||||||
// i.e. have .call(..) / .apply(..) methods???
|
// i.e. have .call(..) / .apply(..) methods???
|
||||||
|
// XXX this is the same as actions.parseStringAction(..), reuse in a logical manner...
|
||||||
var parseActionCall =
|
var parseActionCall =
|
||||||
module.parseActionCall =
|
module.parseActionCall =
|
||||||
function parseActionCall(txt){
|
function parseActionCall(txt){
|
||||||
@ -503,6 +504,8 @@ var KeyboardPrototype = {
|
|||||||
// stop_propagation: <bool>,
|
// stop_propagation: <bool>,
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
// XXX should this be a Keyboard thing or a context thing???
|
||||||
|
// XXX revise name...
|
||||||
parseStringHandler: parseActionCall,
|
parseStringHandler: parseActionCall,
|
||||||
|
|
||||||
|
|
||||||
@ -1097,8 +1100,11 @@ function makeKeyboardHandler(keyboard, unhandled, actions){
|
|||||||
res = handler.call(actions)
|
res = handler.call(actions)
|
||||||
|
|
||||||
// action call syntax...
|
// action call syntax...
|
||||||
} else if(kb.parseStringHandler){
|
// XXX should this be a Keyboard thing or a context thing???
|
||||||
var h = kb.parseStringHandler(handler)
|
} else if(actions.parseStringHandler || kb.parseStringHandler){
|
||||||
|
//} else if(kb.parseStringHandler){
|
||||||
|
var h = (actions.parseStringHandler || kb.parseStringHandler)(handler)
|
||||||
|
//var h = kb.parseStringHandler(handler)
|
||||||
|
|
||||||
if(h && h.action in actions){
|
if(h && h.action in actions){
|
||||||
did_handling = true
|
did_handling = true
|
||||||
|
|||||||
@ -18,11 +18,11 @@
|
|||||||
"app-module-path": "^1.0.6",
|
"app-module-path": "^1.0.6",
|
||||||
"commander": "^2.11.0",
|
"commander": "^2.11.0",
|
||||||
"exiftool": "^0.0.3",
|
"exiftool": "^0.0.3",
|
||||||
"fs-extra": "^4.0.0",
|
"fs-extra": "^4.0.1",
|
||||||
"fs-walk": "^0.0.1",
|
"fs-walk": "^0.0.1",
|
||||||
"glob": "^4.0.6",
|
"glob": "^4.0.6",
|
||||||
"guarantee-events": "^1.0.0",
|
"guarantee-events": "^1.0.0",
|
||||||
"ig-actions": "^3.2.5",
|
"ig-actions": "^3.5.1",
|
||||||
"ig-features": "^3.2.6",
|
"ig-features": "^3.2.6",
|
||||||
"ig-object": "^1.0.1",
|
"ig-object": "^1.0.1",
|
||||||
"openseadragon": "^2.3.0",
|
"openseadragon": "^2.3.0",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user