- Firefox-Version
- FF 134+
- Betriebssystem
- Windows 10 (getestet)
Ausgehend von diesen Beitrag:
bege
Hier das versprochene Skript, welches die vorherige Funktionalität ( <FF133) für alle Buttons wiederherstellt, welche ab FF134 nicht mehr auf einen Mausklick reagiert haben. Die bestehenden Toolbars brauchen (sollen!) dafür nicht verändert werden.
Als einzige Angabe erwartet das Skript in Zeile 11 die ID(s) der genutzten Toolbar(s), welche in dem Array toolbarIDs angegeben werden müssen. z:B:
const toolbarIDs = ['addonbar'];
oder
const toolbarIDs = ['addonbar', 'bottom_toolbar'/*, ... */] ;
JavaScript
// 'FixToolbarButtons.uc.js' by BrokenHeart💔
//
// The script adds several button-events to custom-toolbars(XUL), which were created outside the 'navigator-toolbox'.
// Firefox: 134+
//
// 29.01.2025 V0.1
(function() {
// ---------------------------------------------
const toolbarIDs = ['bottom-toolbar', 'addonbar'/*, ... */];
// ---------------------------------------------
if (!window.gBrowser)
return;
if (window.readyState !== "loading")
setTimeout( initToolbarButtonEvents, 500 );
else
window.addEventListener( "DOMContentLoaded", initToolbarButtonEvents );
window.addEventListener('aftercustomization', () =>
setTimeout(() => initToolbarButtonEvents(), 100 )
)
function initToolbarButtonEvents() {
toolbarIDs.forEach((toolbarID) => {
for (const child of document.getElementById(toolbarID).children) {
switch(child["id"]) {
case "downloads-button":
let dlButton = document.getElementById('downloads-button');
dlButton.removeEventListener('mousedown', handleDlButtonEvent);
dlButton.addEventListener('mousedown', handleDlButtonEvent);
break;
case "library-button":
let libButton = document.getElementById('library-button');
libButton.removeEventListener('mousedown', handleLibButtonEvent);
libButton.addEventListener('mousedown', handleLibButtonEvent);
break;
case "alltabs-button":
let allTabsButton = document.getElementById('alltabs-button');
allTabsButton.removeEventListener('mousedown', handleAllTabsButtonEvent);
allTabsButton.addEventListener('mousedown', handleAllTabsButtonEvent);
break;
case "firefox-view-button":
let viewButton = document.getElementById('firefox-view-button');
viewButton.removeEventListener('mousedown', handleViewButtonEvent);
viewButton.addEventListener('mousedown', handleViewButtonEvent);
break;
case "fxa-toolbar-menu-button":
let fxaMenuButton = document.getElementById('fxa-toolbar-menu-button');
fxaMenuButton.removeEventListener('mousedown', handleFxaMenuButtonEvent);
fxaMenuButton.addEventListener('mousedown', handleFxaMenuButtonEvent);
break;
case "import-button":
let importButton = document.getElementById('import-button');
importButton.removeEventListener('command', handleImportButtonEvent);
importButton.addEventListener('command', handleImportButtonEvent);
break;
}
}
})
}
function handleDlButtonEvent(event) {
DownloadsIndicatorView.onCommand(event);
}
function handleLibButtonEvent(event) {
PanelUI.showSubView("appMenu-libraryView", document.getElementById('library-button'), event);
}
function handleAllTabsButtonEvent(event) {
gTabsPanel.showAllTabsPanel(event, "alltabs-button");
}
function handleViewButtonEvent(event) {
FirefoxViewHandler.openToolbarMouseEvent(event);
}
function handleFxaMenuButtonEvent(event) {
gSync.toggleAccountPanel(document.getElementById('fxa-toolbar-menu-button'), event);
}
function handleImportButtonEvent(event) {
MigrationUtils.showMigrationWizard(window, {
entrypoint: MigrationUtils.MIGRATION_ENTRYPOINTS.BOOKMARKS_TOOLBAR,
});
}
})();
Alles anzeigen