Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vildravn
today-in-wow-widget
Commits
2579ef69
Commit
2579ef69
authored
Dec 16, 2020
by
Vildravn
Browse files
Fix region check, widgets with no data
parent
639eadb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Today in WoW.js
View file @
2579ef69
...
...
@@ -62,7 +62,9 @@ const slBosses = {
}
// -----------------------------
const
REGION
=
(
args
.
widgetParameter
.
toUpperCase
()
==
'
US
'
?
'
US
'
:
'
EU
'
);
let
REGION
=
args
.
widgetParameter
||
'
EU
'
;
REGION
=
(
REGION
.
toUpperCase
()
==
'
US
'
?
'
US
'
:
'
EU
'
);
log
(
REGION
);
const
cheerio
=
importModule
(
'
cheerio
'
);
let
$
=
undefined
;
...
...
@@ -126,7 +128,9 @@ async function createWidget(size) {
await
buildAffixDisplay
(
rightColumn
,
data
);
rightColumn
.
addSpacer
(
20
);
data
=
await
parseTextGroup
(
`#
${
REGION
}
-group-epiceliteworldsl`
,
`.tiw-region[data-region="
${
REGION
}
"]`
);
await
buildTextDisplay
(
rightColumn
,
"
world boss
"
,
data
,
slBosses
[
data
[
0
]]);
log
(
data
);
const
bossLink
=
(
data
?
slBosses
[
data
[
0
]]
:
null
);
await
buildTextDisplay
(
rightColumn
,
"
world boss
"
,
data
,
bossLink
);
$
=
undefined
;
delete
(
$
);
...
...
@@ -168,6 +172,13 @@ async function buildTextDisplay(parent, heading, data, url) {
header
.
textColor
=
textStyles
.
header
.
color
;
header
.
font
=
textStyles
.
header
.
font
;
if
(
!
data
)
{
const
line
=
contentStack
.
addText
(
'
No data
'
);
line
.
textColor
=
textStyles
.
lineWhite
.
color
;
line
.
font
=
textStyles
.
lineWhite
.
font
;
return
;
}
for
(
const
item
of
data
)
{
const
line
=
contentStack
.
addText
(
item
);
line
.
textColor
=
textStyles
.
line
.
color
;
...
...
@@ -183,6 +194,13 @@ async function buildImageDisplay(parent, heading, data) {
header
.
textColor
=
textStyles
.
header
.
color
;
header
.
font
=
textStyles
.
header
.
font
;
if
(
!
data
)
{
const
line
=
contentStack
.
addText
(
'
No data
'
);
line
.
textColor
=
textStyles
.
lineWhite
.
color
;
line
.
font
=
textStyles
.
lineWhite
.
font
;
return
;
}
const
horizontalStack
=
contentStack
.
addStack
();
horizontalStack
.
layoutHorizontally
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment