Skip to content
This repository was archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
extracting table row creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Idrinth committed May 31, 2018
1 parent 5970c0e commit e569b1d
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions src/mods/workers.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ idrinth.workers = {
]
};
};
let makeTableRow = function (data, tag) {
tag = typeof tag === 'string'?tag:'td';
let row = {
type: "tr",
children: []
};
for(let pos=0;pos<data.length;pos++) {
row.children.push ({type: tag, content: data[pos]});
}
return row;
};
for (var count = list.length - 1; count >= 0; count--) {
let boss = idrinth.tier.list[list[count]];
let sub = idrinth.ui.buildElement({
Expand Down Expand Up @@ -244,31 +255,13 @@ idrinth.workers = {
{
type: "thead",
children: [
{
type: "tr",
children: [
{
type: "th",
content: "#"
},
{
type: "th",
content: idrinth.text.get("tier.diff.normal")
},
{
type: "th",
content: idrinth.text.get("tier.diff.hard")
},
{
type: "th",
content: idrinth.text.get("tier.diff.legend")
},
{
type: "th",
content: idrinth.text.get("tier.diff.night")
}
]
}
makeTableRow([
'#',
idrinth.text.get("tier.diff.normal"),
idrinth.text.get("tier.diff.hard"),
idrinth.text.get("tier.diff.legend"),
idrinth.text.get("tier.diff.night")
], 'th')
]
},
{
Expand Down

0 comments on commit e569b1d

Please sign in to comment.