Skip to content

fixed weather and removed infinite alert bug#175

Open
darthbeep wants to merge 1 commit into
TheGiddyLimit:developmentfrom
darthbeep:fix/weather-alert
Open

fixed weather and removed infinite alert bug#175
darthbeep wants to merge 1 commit into
TheGiddyLimit:developmentfrom
darthbeep:fix/weather-alert

Conversation

@darthbeep
Copy link
Copy Markdown

Made weather work again and fixed a bug that gave infinite alerts if you did custom images for weather without a url.

Comment thread js/base-weather.js
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
Copy Markdown
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

<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
Copy Markdown
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?

Comment thread js/base-weather.js
"Blood Rain": new Image(),
"Custom": new Image(),
};
IMAGES.Rain.src = "https://i.imgur.com/lZrqiVk.png";
Copy link
Copy Markdown
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)

Comment thread js/base-weather.js
"Waves": new Image(),
"Ripples": new Image(),
"Blood Rain": new Image(),
"Custom": new Image(),
Copy link
Copy Markdown
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..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants