ami/src/ami.js/sidebars/channelssb.js

76 lines
1.8 KiB
JavaScript

#include utility.js
var AmiChannelsSidebar = function() {
var sbName = 'chanList',
body = $e(),
activeChannel = undefined;
var setTitle;
var rowEven = false;
var createChannel = function(channelInfo) {
var toString = function() {
var str = '';
if(channelInfo.hasPassword())
str += '*';
if(channelInfo.isTemporary())
str += '[';
str += channelInfo.getName();
if(channelInfo.isTemporary())
str += ']';
return str;
};
var nameElem = $e({
attrs: { style: { display: 'black' } },
child: toString(),
}),
elem = $e({
attrs: {
className: (rowEven ? 'rowEven' : 'rowOdd'),
},
child: [nameElem],
});
rowEven = !rowEven;
return {
getElement: function() {
return elem;
},
setActive: function(state) {
elem.style.fontWeight = state ? 'bold' : null;
},
update: function() {
nameElem.textContent = toString();
},
};
};
return {
getName: function() { return sbName; },
isWide: function() { return false; },
getBody: function() { return body; },
apply: function(obj) {
setTitle = obj.setTitle;
},
reloadStrings: function() {
setTitle(AmiStrings.getMenuString('chans'));
},
add: function(channelInfo) {
//
},
update: function(name, channelInfo) {
//
},
remove: function(name) {
//
},
switch: function(name) {
//
},
};
};