Skip to content

Commit

Permalink
slightly better print loading err
Browse files Browse the repository at this point in the history
  • Loading branch information
mattieFM committed Feb 19, 2024
1 parent abceab5 commit c6e57f4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 7 deletions.
36 changes: 36 additions & 0 deletions www/mods/mattieFMModLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,42 @@ MATTIE.onError = function (e) {
}
};

/**
* Make loading error less obtrusive
*
* @static
* @method printLoadingError
* @param {String} url The url of the resource failed to load
*/
Graphics.printLoadingError = function(url) {
if (this._errorPrinter && !this._errorShowed && !MATTIE.ignoreWarnings) {
this._errorPrinter.innerHTML = this._makeErrorHtml('Loading Error', 'Failed to load: ' + url);
this._errorPrinter.style.fontSize = '16px';
var button = document.createElement('button');
button.innerHTML = 'Retry';
button.style.fontSize = '16px';
button.style.color = '#ffffff';
button.style.backgroundColor = '#000000';
var removeWarningsBtn = document.createElement('button');
removeWarningsBtn.innerHTML = 'Ignore All Future Warnings';
removeWarningsBtn.style.fontSize = '16px';
removeWarningsBtn.style.color = '#ffffff';
removeWarningsBtn.style.backgroundColor = '#000000';
button.onmousedown = button.ontouchstart = function(event) {

Check failure on line 1304 in www/mods/mattieFMModLoader.js

View workflow job for this annotation

GitHub Actions / build

Unexpected chained assignment
ResourceHandler.retry();
event.stopPropagation();
};
removeWarningsBtn.onmousedown = button.ontouchstart = function(event) {

Check failure on line 1308 in www/mods/mattieFMModLoader.js

View workflow job for this annotation

GitHub Actions / build

Unexpected chained assignment
ResourceHandler.retry();
MATTIE.ignoreWarnings=true;
event.stopPropagation();
};
this._errorPrinter.appendChild(button);
this._errorPrinter.appendChild(removeWarningsBtn);
this._loadingCount = -Infinity;
}
};

/**
* @description pause the game and display an html file in an iframe
*/
Expand Down
14 changes: 7 additions & 7 deletions www/mods/multiplayer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
"_multiplayer/multiplayerCompatability"
],
"danger": false,
"assets": [
{
"source": "/mods/commonLibs/_common/images/imageAssets/",
"type":"imgFolder"
}
]
"assets": [
{
"source": "/mods/commonLibs/_common/images/imageAssets/",
"type":"imgFolder"
}
]
}

0 comments on commit c6e57f4

Please sign in to comment.