Skip to content

Commit

Permalink
- Buttons: fixed 'Restore default buttons' entry crash (not needed an…
Browse files Browse the repository at this point in the history
…ymore since there are no more 'default buttons'), now replaced with 'Restore all buttons' (which simply restores back default settings for every button).
  • Loading branch information
regorxxx committed Feb 19, 2023
1 parent 674ce62 commit c608a15
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions buttons/helpers/buttons_merged_menu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
//17/02/23
//19/02/23

include('..\\..\\helpers\\menu_xxx.js');
include('..\\..\\helpers\\helpers_xxx.js');
Expand Down Expand Up @@ -144,23 +144,13 @@ function createButtonsMenu(name) {
});
}
menu.newEntry({entryText: 'sep'});
menu.newEntry({entryText:'Restore default buttons', func: () => {
// Restore buttons
buttonsPath = [...buttonsPathDef];
// Remove all properties
buttonsBar.list.forEach((properties) => {deleteProperties(properties);});
// Save and reload
const fileNames = buttonsPath.map((path) => {return path.split('\\').pop();});
_save(folders.data + name + '.json', JSON.stringify(fileNames, null, '\t'));
if (readmeList) {
fileNames.forEach((fileName) => {
const readmeFile = readmeList.hasOwnProperty(fileName) ? readmeList[fileName] : '';
if (readmeFile.length && _isFile(folders.xxx + 'helpers\\readme\\' + readmeFile)) {
fb.ShowPopupMessage(_open(folders.xxx + 'helpers\\readme\\' + readmeFile, utf8), readmeFile);
}
});
menu.newEntry({entryText:'Restore all buttons', func: () => {
const answer = WshShell.Popup('This will maintain the current layout but delete any customized setting on all buttons. Are you sure?', 0, 'Toolbar', popup.question + popup.yes_no);
if (answer === popup.yes) {
// Remove all properties and reload
buttonsBar.list.forEach((properties) => {deleteProperties(properties);});
window.Reload();
}
window.Reload();
}});
menu.newEntry({entryText: 'sep'});
{
Expand Down

0 comments on commit c608a15

Please sign in to comment.