ami/src/ami.js/sidebars/helpsb.js

46 lines
1.2 KiB
JavaScript

#include strings.js
#include utility.js
var AmiHelpSidebar = function() {
var sbName = 'helpList',
list = $e({ tag: 'table' }),
body = $e({ child: list });
var setTitle;
var clear = function() {
while(list.lastChild)
list.removeChild(list.lastChild);
};
return {
getName: function() { return sbName; },
isWide: function() { return true; },
getBody: function() { return body; },
apply: function(obj) {
setTitle = obj.setTitle;
},
reloadStrings: function() {
setTitle(AmiStrings.getMenuString('help'));
clear();
var rowEven = false;
AmiStrings.forEachHelpString(function(helpInfo) {
var row = list.insertRow(0);
row.className = rowEven ? 'rowEven' : 'rowOdd';
var title = row.insertCell(0);
title.style.width = '50%';
title.textContent = helpInfo.title + ':';
var example = row.insertCell(1);
example.appendChild($e({ tag: 'i', child: helpInfo.format }));
rowEven = !rowEven;
});
},
clear: clear,
};
};