diff --git a/scripts/core/table.js b/scripts/core/table.js new file mode 100644 index 00000000..f9315f1e --- /dev/null +++ b/scripts/core/table.js @@ -0,0 +1,35 @@ +const table = {} + +table.create = function (data, cols) { + let output = '\n' + + output += ' \n ' + for (let column of cols) { + output += `` + } + output += '\n \n' + + output += ' \n' + for (let groupId in data) { + const group = data[groupId] + for (let [i, item] of group.entries()) { + const rowspan = group.length > 1 ? ` rowspan="${group.length}"` : '' + output += ' ' + if (i === 0) { + const name = item.flag ? `${item.flag} ${item.name}` : item.name + output += `` + } + output += `` + output += `` + output += `` + output += '\n' + } + } + output += ' \n' + + output += '
${column}
${name}${item.channels}${item.epg}${item.status}
' + + return output +} + +module.exports = table