mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-01 20:00:10 +00:00
added individual action help generators...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3907c48efe
commit
0127e6427c
@ -590,6 +590,31 @@ function buildKeybindingsHelp(keybindings, shifted_keys){
|
||||
}
|
||||
|
||||
|
||||
// Get a list of keys associated with a given doc...
|
||||
//
|
||||
// The second argument must be a structure formated as returned by
|
||||
// buildKeybindingsHelp(...)
|
||||
//
|
||||
// Returned format:
|
||||
// {
|
||||
// <section-name> : <key-spec>
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// NOTE: <key-spec> is the same as generated by buildKeybindingsHelp(..)
|
||||
function getKeysByDoc(doc, help){
|
||||
var res = {}
|
||||
for(var mode in help){
|
||||
var name = mode
|
||||
var section = help[mode]
|
||||
if(doc in section){
|
||||
res[mode] = section[doc]
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
// Build a basic HTML table with keyboard help...
|
||||
//
|
||||
// The table will look like this:
|
||||
@ -646,6 +671,36 @@ function buildKeybindingsHelpHTML(keybindings){
|
||||
}
|
||||
|
||||
|
||||
// Build HTML for a single key definition...
|
||||
//
|
||||
// XXX not yet sure if we are handling the sections correctly...
|
||||
function getKeysByDocHTML(doc, help, combine_sections){
|
||||
var spec = getKeysByDoc(doc, help)
|
||||
var res = '<span class="key-doc">'
|
||||
|
||||
var keys = []
|
||||
|
||||
for(var section in spec){
|
||||
if(!combine_sections){
|
||||
keys = spec[section].join(', ')
|
||||
res += '<span class="section">'
|
||||
+'<span class="name">'+ section +'</span>'
|
||||
+'<span class="key">'+ keys +'</span>'
|
||||
+'</span>'
|
||||
} else {
|
||||
keys = keys.concat(spec[section])
|
||||
}
|
||||
}
|
||||
|
||||
if(combine_sections){
|
||||
res += '<span class="doc">'+ doc +'</span>'
|
||||
+'<span class="key">'+ keys.join(', ') +'</span>'
|
||||
}
|
||||
|
||||
return res + '</span>'
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Key binding editor...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user