Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed weather and removed infinite alert bug #175

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/base-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function d20plusEngine () {
if ($dialog[0]) {
const $pageTitle = $dialog.find(`.ui-dialog-title:visible`);
d20plus.engine._preserveCustomOptions(page);
d20plus.engine._populateCustomOptions(page, $dialog.find(`.dialog .tab-content`));
d20plus.engine._populatePageCustomOptions(page, $dialog.find(`.dialog .tab-content`));
if ($pageTitle[0] && !$(".ui-dialog-pagename:visible")[0]) {
$pageTitle.after(`<span class="ui-dialog-pagename">${page.get("name")}</span>`);
$saveBtn.off("click");
Expand Down Expand Up @@ -380,7 +380,7 @@ function d20plusEngine () {
// page.save resets current dialog, so we need to restore status quo
$(`.nav-tabs:visible [data-tab=${activeTab}]`).click();
$(`.ui-dialog-content:visible`).scrollTop(activeTabScroll);
d20plus.engine._populateCustomOptions();
d20plus.engine._populatePageCustomOptions();
}
}

Expand Down
7 changes: 3 additions & 4 deletions js/base-weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function baseWeather () {
"Waves": new Image(),
"Ripples": new Image(),
"Blood Rain": new Image(),
"Custom": new Image(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reasoning behind adding the Custom image here/removing the "cleanup when unused" step below..?

};
IMAGES.Rain.src = "https://i.imgur.com/lZrqiVk.png";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

come to think of it, do we have these in the repo anywhere? If not, we're at risk of them disappearing someday
Might be best to commit them to e.g. img/weather/* and reference the raw.github. ... URLs here (i.e. https://raw.githubusercontent.com/TheGiddyLimit/betterR20/development/img/weather/rain.png)

IMAGES.Snow.src = "https://i.imgur.com/uwLQjWY.png";
Expand Down Expand Up @@ -112,7 +113,6 @@ function baseWeather () {
case "Waves":
case "Ripples":
case "Blood Rain":
IMAGES["Custom"] = null;
return IMAGES[imageName];
case "Custom (see below)":
if (!IMAGES["Custom"] || (
Expand All @@ -124,15 +124,14 @@ function baseWeather () {
IMAGES["Custom"].onerror = () => {
if (IMAGES["Custom"]._errorSrc == null) {
IMAGES["Custom"]._errorSrc = page.get("bR20cfg_weatherTypeCustom1");
alert(`Custom weather image "${IMAGES["Custom"].src}" failed to load!`);
console.log(`Custom weather image "${IMAGES["Custom"].src}" failed to load!`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be at least a .warn if not a .error

}
IMAGES["Custom"].src = IMAGES["Rain"].src;
};
IMAGES["Custom"].src = page.get("bR20cfg_weatherTypeCustom1");
if (page.get("bR20cfg_weatherTypeCustom1")) IMAGES["Custom"].src = page.get("bR20cfg_weatherTypeCustom1");
}
return IMAGES["Custom"];
default:
IMAGES["Custom"] = null;
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/templates/template-page-weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function initHTMLpageWeather () {
</div>
<div class="pagedetails__subheader">
<h4>Custom type</h4>
<a class="tipsy-w showtip pictos" original-title="Input URL to your PNG when &quot;Custom&quot; is selected above">?</a>
<a class="tipsy-w showtip pictos" original-title="Input URL to your PNG when &quot;Custom&quot; is selected above. Broken URLs will appear as rain.">?</a>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, this is a bit subtle, and sticking the "solution" in the tooltip isn't great. Maybe we grab the classic missing texture image and chuck it in as the fallback?

</div>
<div>
<label class="sr-only">input custom image</label>
Expand Down