Closed Acid-Crash closed 3 years ago
The restart item is still present in "File" menu. I have no solution for the application menu yet.
Hi @Aris-t2 I have found the alternative version of code for the Restart buttom item. It works, however seems like it moves the original item (from File) to another place (App menu). Maybe this will help in restoring your version...
(() => {
var afterbtn = document.querySelector("#appMenu-viewCache")?.content.querySelector("#appMenu-mainView #appMenu-quit-button")
|| document.querySelector("#appMenu-mainView #appMenu-quit-button");
if (!afterbtn) return;
var btn = document.createXULElement("toolbarbutton");
btn.id = "ucf-appMenu-restart-button";
btn.className = "subviewbutton subviewbutton-iconic";
btn.setAttribute("label", "Перезагрузка");
btn.setAttribute("tooltiptext", "ЛКМ: Перезапустить приложение\nCtrl+ЛКМ: Отключить загрузку содержимого из кеша и перезапустить\nShift+ЛКМ: Перезапустить без дополнений");
btn.setAttribute("shortcut", "Ctrl+Alt+Q");
btn.style.setProperty("list-style-image", 'url("chrome://browser/skin/reload.svg")', "important");
afterbtn.before(btn);
btn._restart_mozilla = function(nocache = false) {
var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
if (cancelQuit.data)
return false;
if (nocache)
Services.appinfo.invalidateCachesOnRestart();
var restart = Services.startup;
restart.quit(restart.eAttemptQuit | restart.eRestart);
};
var command = function(e) {
if (e.ctrlKey)
this._restart_mozilla(true);
else if (e.shiftKey)
e.view.safeModeRestart();
else
this._restart_mozilla();
}.bind(btn);
btn.addEventListener("command", command);
var keydown = function(e) {
if (e.keyCode == 81 && e.ctrlKey && e.altKey)
this._restart_mozilla();
}.bind(btn);
window.addEventListener("keydown", keydown);
this.appmenurestartbutton = {
destructor() {
btn.removeEventListener("command", command);
window.removeEventListener("keydown", keydown);
}
};
this.unloadlisteners.push("appmenurestartbutton");
})();
The script pointed me in the right direction.
https://github.com/Aris-t2/CustomJSforFx/blob/master/scripts/restart_item_in_menu.uc.js
Replacing
if(document.getElementById("appMenu-quit-button").previousSibling.id != "appMenu-restart-button" )
document.getElementById("appMenu-quit-button").parentNode.insertBefore(restartitem_appmenu,document.getElementById("appMenu-quit-button"));
with
var appMenuquitbutton = document.querySelector("#appMenu-viewCache")?.content.querySelector("#appMenu-mainView #appMenu-quit-button") || document.querySelector("#appMenu-mainView #appMenu-quit-button");
appMenuquitbutton.before(restartitem_appmenu);
did the trick, thanks.
Confirming, all works fine on FF81. Closing ticket
How this works: https://addons.mozilla.org/firefox/addon/restart_browser/
Describe the issue: Today I have noticed that restart_item_in_menu.uc.js stopped working in latest Nightly. Menu item is not present. P.S. restart_button.uc.js still works
What should have happened instead? When enabled new menu item should appear
Steps to reproduce the issue? Install restart_item_in_menu.uc.js Observe app menu
Method used (M1, M2 or M3): M2
System information OS & OS version: Win 10 x64 OS theme: default DPI / HiDPI resolution: 100 Firefox or Thunderbird: Firefox Firefox/Thunderbird version: 81.0a1 (2020-08-11) (64-bit) Firefox/Thunderbird theme: default Settings this issue occurs with: