Commit 089a5dd2 authored by Vildravn's avatar Vildravn
Browse files

Make region a widgetParameter, remove faction

parent f7a00739
......@@ -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 == 'EU' ? 'https://www.wowhead.com/world-quests/sl/eu' : 'https://www.wowhead.com/world-quests/sl/na';
if (REGION) {
widget.url = (REGION == 'US' ? '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
}
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