diff --git a/index.html b/index.html
index e96e176..04f576c 100644
--- a/index.html
+++ b/index.html
@@ -34,8 +34,9 @@
document.body.style.setProperty('--color-dark', stored_theme.colors.dark);
} catch (err) {}
}
-
+ window.ErrorLog = [];
window.onerror = (message, file, line) => {
+ window.ErrorLog.push({message, file, line})
if (typeof Blockbench != 'undefined' && Blockbench.setup_successful) return;
let error_element = document.querySelector('#loading_error_detail');
diff --git a/js/file_system.js b/js/file_system.js
index c3db1ee..f0fba48 100644
--- a/js/file_system.js
+++ b/js/file_system.js
@@ -46,7 +46,7 @@ Object.assign(Blockbench, {
Blockbench.read(fileNames, options, cb)
} else {
let isIOS = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) ||
- (navigator.userAgent.includes("Mac") && "ontouchend" in document);
+ (navigator.userAgent && navigator.userAgent.includes("Mac") && "ontouchend" in document);
if (isIOS && options.extensions && options.extensions.length > 1) {
let options = [];
@@ -59,10 +59,10 @@ Object.assign(Blockbench, {
form: {
extension: {label: 'File Type', type: 'select', options}
},
- onConfirm({extension}) {
+ onConfirm(formResult) {
$('').on('change', function(e) {
Blockbench.read(this.files, options, cb)
diff --git a/js/interface/menu.js b/js/interface/menu.js
index 1f4a78a..9115962 100644
--- a/js/interface/menu.js
+++ b/js/interface/menu.js
@@ -905,6 +905,17 @@ const MenuBar = {
Blockbench.openLink('https://www.blockbench.net/wiki/api/index');
}},
'open_dev_tools',
+ {name: 'Error Log', condition: () => window.ErrorLog.length, icon: 'error', color: 'red', keybind: {toString: () => window.ErrorLog.length.toString()}, click() {
+ let lines = window.ErrorLog.slice(0, 64).map((error) => {
+ return Interface.createElement('p', {}, `${error.message}\n - In .${error.file.split(location.origin).join('')} : ${error.line}`);
+ })
+ new Dialog({
+ id: 'error_log',
+ title: 'Error Log',
+ lines,
+ singleButton: true
+ }).show();
+ }},
{name: 'menu.help.developer.reset_storage', icon: 'fas.fa-hdd', click: () => {
if (confirm(tl('menu.help.developer.reset_storage.confirm'))) {
localStorage.clear()