Commit 1df4cd62 authored by Vildravn's avatar Vildravn
Browse files

More optimizations

parent 80587150
......@@ -88,40 +88,40 @@ async function createWidget(size) {
const widget = new ListWidget();
widget.setPadding(15, 15, 15, 15);
let whData = await fetchData("https://www.wowhead.com", "loadString");
$ = cheerio.load(whData);
const callings = await parseTextGroup(`#${REGION}-group-calling-quests`, `.tiw-region[data-region="${REGION}"]`);
const torghast = await parseTextGroup(`#${REGION}-group-torghast-wings`, `.tiw-region[data-region="${REGION}"]`);
const affixes = await parseImageGroup(`#${REGION}-group-mythicaffix`, `.tiw-region[data-region="${REGION}"]`);
const worldBoss = await parseTextGroup(`#${REGION}-group-epiceliteworldsl`, `.tiw-region[data-region="${REGION}"]`);
whData = undefined;
$ = undefined;
delete(whData);
delete($);
widget.backgroundColor = colors.bg;
if (size == 'medium') {
let whData = await fetchData("https://www.wowhead.com", "loadString");
$ = cheerio.load(whData);
let data = undefined;
whData = undefined;
delete(whData);
const wrapperStack = widget.addStack();
wrapperStack.layoutHorizontally();
widget.addSpacer();
const leftColumn = wrapperStack.addStack();
leftColumn.layoutVertically();
await buildTextDisplay(leftColumn, "calling quests", callings);
data = await parseTextGroup(`#${REGION}-group-calling-quests`, `.tiw-region[data-region="${REGION}"]`);
await buildTextDisplay(leftColumn, "calling quests", data);
leftColumn.addSpacer(20);
await buildTextDisplay(leftColumn, "torghast wings", torghast);
data = await parseTextGroup(`#${REGION}-group-torghast-wings`, `.tiw-region[data-region="${REGION}"]`);
await buildTextDisplay(leftColumn, "torghast wings", data);
wrapperStack.addSpacer();
const rightColumn = wrapperStack.addStack();
rightColumn.layoutVertically();
await buildAffixDisplay(rightColumn, affixes);
data = await parseImageGroup(`#${REGION}-group-mythicaffix`, `.tiw-region[data-region="${REGION}"]`);
await buildAffixDisplay(rightColumn, data);
rightColumn.addSpacer(20);
await buildTextDisplay(rightColumn, "world boss", worldBoss);
data = await parseTextGroup(`#${REGION}-group-epiceliteworldsl`, `.tiw-region[data-region="${REGION}"]`);
await buildTextDisplay(rightColumn, "world boss", data);
$ = undefined;
delete($);
} else {
const text = widget.addText(`${size} widget is currently not supported.`);
text.textColor = textStyles.header.color;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment