Commit ceb92605 authored by Vildravn's avatar Vildravn
Browse files

Merge branch '2-tappable-elements' into 'beta'

Resolve "Make more elements clickable"

See merge request !1
parents 6d29f512 8160f987
......@@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [1.2.0] - 2020-12-11
### Added
* Added links to elements other than M+, the elements can be tapped now to open a link in the browser
* Callings - Wowhead Callings guide
* Torghast Wings - Wowhead Torghast guide
* World Boss - Loot table of the specific world boss
* Widget (Empty space) - World quest map for the region
## [1.1.0] - 2020-12-11
### Changed
* Made some changes to hopefully reduce the memory usage by the widget
......
......@@ -8,7 +8,7 @@ This is a script for [Scriptable](https://scriptable.app) for iOS that parses da
* Current weekly Mythic+ affixes
* The current weekly Shadowlands world boss
The affix icons can be tapped to open the browser to read more information.
All elements can be tapped to open the browser to read more information. Tapping on an empty space on the widget will bring up Wowhead's world quest map.
## Installation
......
......@@ -9,7 +9,7 @@
Scroll down for configuration, by default the widget is configured to pull information for EU Horde.
Version: 1.1.0
Version: 1.2.0
Get latest updates at: https://gitlab.com/vildravn/today-in-wow-widget
In case something breaks, open an issue at: https://gitlab.com/vildravn/today-in-wow-widget/-/issues
*/
......@@ -56,6 +56,16 @@ const textStyles = {
}
}
/*
Shadowlands world boss lookup table
*/
const slBosses = {
Mortanis: 'https://www.wowhead.com/npc=173104/mortanis#drops',
'Nurgash Muckformed': 'https://www.wowhead.com/npc=167526/nurgash-muckformed#drops',
'Oranomonos the Everbranching': 'https://www.wowhead.com/npc=167527/oranomonos-the-everbranching#drops',
'Valinor': 'https://www.wowhead.com/npc=167524/valinor#drops'
}
// -----------------------------
const cheerio = importModule('cheerio');
......@@ -90,6 +100,8 @@ async function createWidget(size) {
widget.backgroundColor = colors.bg;
if (size == 'medium') {
widget.url = REGION == 'EU' ? 'https://www.wowhead.com/world-quests/sl/eu' : 'https://www.wowhead.com/world-quests/sl/na';
let whData = await fetchData("https://www.wowhead.com", "loadString");
$ = cheerio.load(whData);
let data = undefined;
......@@ -104,10 +116,10 @@ async function createWidget(size) {
const leftColumn = wrapperStack.addStack();
leftColumn.layoutVertically();
data = await parseTextGroup(`#${REGION}-group-calling-quests`, `.tiw-region[data-region="${REGION}"]`);
await buildTextDisplay(leftColumn, "calling quests", data);
await buildTextDisplay(leftColumn, "calling quests", data, 'https://www.wowhead.com/guides/covenant-callings-shadowlands');
leftColumn.addSpacer(20);
data = await parseTextGroup(`#${REGION}-group-torghast-wings`, `.tiw-region[data-region="${REGION}"]`);
await buildTextDisplay(leftColumn, "torghast wings", data);
await buildTextDisplay(leftColumn, "torghast wings", data, 'https://www.wowhead.com/guides/torghast-tower-of-the-damned-overview');
wrapperStack.addSpacer();
......@@ -117,7 +129,7 @@ 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);
await buildTextDisplay(rightColumn, "world boss", data, slBosses[data[0]]);
$ = undefined;
delete($);
......@@ -141,9 +153,10 @@ async function buildAffixDisplay(parent, affixes) {
await buildImageDisplay(parent, "mythic+ affixes", affixes);
}
async function buildTextDisplay(parent, heading, data) {
async function buildTextDisplay(parent, heading, data, url) {
const contentStack = parent.addStack();
contentStack.layoutVertically();
contentStack.url = url;
const header = contentStack.addText(heading.toUpperCase());
header.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