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

Commit e569b1d

Browse files
committed
extracting table row creation
1 parent 5970c0e commit e569b1d

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

src/mods/workers.js

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ idrinth.workers = {
192192
]
193193
};
194194
};
195+
let makeTableRow = function (data, tag) {
196+
tag = typeof tag === 'string'?tag:'td';
197+
let row = {
198+
type: "tr",
199+
children: []
200+
};
201+
for(let pos=0;pos<data.length;pos++) {
202+
row.children.push ({type: tag, content: data[pos]});
203+
}
204+
return row;
205+
};
195206
for (var count = list.length - 1; count >= 0; count--) {
196207
let boss = idrinth.tier.list[list[count]];
197208
let sub = idrinth.ui.buildElement({
@@ -244,31 +255,13 @@ idrinth.workers = {
244255
{
245256
type: "thead",
246257
children: [
247-
{
248-
type: "tr",
249-
children: [
250-
{
251-
type: "th",
252-
content: "#"
253-
},
254-
{
255-
type: "th",
256-
content: idrinth.text.get("tier.diff.normal")
257-
},
258-
{
259-
type: "th",
260-
content: idrinth.text.get("tier.diff.hard")
261-
},
262-
{
263-
type: "th",
264-
content: idrinth.text.get("tier.diff.legend")
265-
},
266-
{
267-
type: "th",
268-
content: idrinth.text.get("tier.diff.night")
269-
}
270-
]
271-
}
258+
makeTableRow([
259+
'#',
260+
idrinth.text.get("tier.diff.normal"),
261+
idrinth.text.get("tier.diff.hard"),
262+
idrinth.text.get("tier.diff.legend"),
263+
idrinth.text.get("tier.diff.night")
264+
], 'th')
272265
]
273266
},
274267
{

0 commit comments

Comments
 (0)