Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Vildravn
today-in-wow-widget
Commits
089a5dd2
Commit
089a5dd2
authored
Dec 15, 2020
by
Vildravn
Browse files
Make region a widgetParameter, remove faction
parent
f7a00739
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
+4
-12
Today in WoW.js
Today in WoW.js
+4
-12
No files found.
Today in WoW.js
View file @
089a5dd2
...
...
@@ -14,15 +14,6 @@
In case something breaks, open an issue at: https://gitlab.com/vildravn/today-in-wow-widget/-/issues
*/
/*
Widget Configuration
REGION - The region you want to show data of; Accepts 'EU' or 'US'
FACTION - What faction's data you want to show; Accepts 'alliance' or 'horde'
*/
const
REGION
=
''
;
const
FACTION
=
''
;
/*
Colors
*/
...
...
@@ -67,6 +58,7 @@ const slBosses = {
}
// -----------------------------
const
REGION
=
(
args
.
widgetParameter
.
toUpperCase
()
==
'
US
'
?
'
US
'
:
'
EU
'
);
const
cheerio
=
importModule
(
'
cheerio
'
);
let
$
=
undefined
;
...
...
@@ -100,8 +92,8 @@ async function createWidget(size) {
widget
.
backgroundColor
=
colors
.
bg
;
if
(
size
==
'
medium
'
)
{
if
(
REGION
&&
FACTION
)
{
widget
.
url
=
REGION
==
'
E
U
'
?
'
https://www.wowhead.com/world-quests/sl/
eu
'
:
'
https://www.wowhead.com/world-quests/sl/
na
'
;
if
(
REGION
)
{
widget
.
url
=
(
REGION
==
'
U
S
'
?
'
https://www.wowhead.com/world-quests/sl/
na
'
:
'
https://www.wowhead.com/world-quests/sl/
eu
'
)
;
let
whData
=
await
fetchData
(
"
https://www.wowhead.com
"
,
"
loadString
"
);
$
=
cheerio
.
load
(
whData
);
...
...
@@ -280,4 +272,4 @@ async function fetchData(url, type = 'loadJSON') {
const
req
=
new
Request
(
url
);
const
resp
=
await
req
[
type
]();
return
resp
;
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
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