Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisX11 committed Mar 2, 2024
2 parents c9dc685 + f7f7c00 commit 89e112d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<div>An error occurred while loading Blockbench</div>
<div id="loading_error_detail" style="color: var(--color-subtle_text);"></div>
<button onclick="isApp ? Blockbench.reload() : window.location.reload(true)" class="large" style="margin-right: auto; margin-left: auto;">Reload</button>
<button onclick="factoryResetAndReload()" class="large" style="margin-right: auto; margin-left: auto;">Factory Reset</button>
<button onclick="window.close()" class="large" style="margin-right: auto; margin-left: auto;">Quit</button>
</div>
<script>
Expand Down
7 changes: 1 addition & 6 deletions js/interface/menu_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,7 @@ const MenuBar = {
}},
'reset_layout',
{name: 'menu.help.developer.reset_storage', icon: 'fas.fa-hdd', click: () => {
if (confirm(tl('menu.help.developer.reset_storage.confirm'))) {
localStorage.clear()
Blockbench.addFlag('no_localstorage_saving')
console.log('Cleared Local Storage')
window.location.reload(true)
}
factoryResetAndReload();
}},
{name: 'menu.help.developer.unlock_projects', id: 'unlock_projects', icon: 'vpn_key', condition: () => ModelProject.all.find(project => project.locked), click() {
ModelProject.all.forEach(project => project.locked = false);
Expand Down
11 changes: 11 additions & 0 deletions js/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ const TickUpdates = {
}
}

function factoryResetAndReload() {
let lang_key = 'menu.help.developer.reset_storage.confirm';
let result = window.confirm((window.tl && tl(lang_key) != lang_key) ? tl(lang_key) : 'Are you sure you want to reset Blockbench to factory settings? This will delete all custom settings, keybindings and installed plugins.');
if (result) {
localStorage.clear();
Blockbench.addFlag('no_localstorage_saving');
console.log('Cleared Local Storage');
window.location.reload(true);
}
}

const documentReady = new Promise((resolve, reject) => {
$(document).ready(function() {
resolve()
Expand Down

0 comments on commit 89e112d

Please sign in to comment.