Hallo FuchsFan , wenn dass das offizielle update ist, könntest Du das bitte mal verlinken? Ansonsten hätte ich gern die Quelle/Source als Link (wenn möglich).
Hier ein funktionierender Button:
JavaScript
// JavaScript Document
// B_AddonsUpdate.uc.js
// Das Script erstellt einen Button, der die AddOns updatet. Das .svg-Icon kann - je nach Hover-Zustand - mit zwei unterschiedlichen Farben gefüllt werden [fill].
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'addons-update-button', // Id des Buttons
label = 'Add-ons Update', // Bezeichnung des Buttons
tooltiptext = 'Add-ons aktualisieren',
// Icon-------------------------------------------------------
icon = '16synchronization-13_moz.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon enthält
iconColOu = 'currentColor', // Farbe des Icons (nur .svg-Datei mit [moz-context-properties], bei anderen Icons hat const iconColOu keine Funktion)
iconColOv = 'yellow', // Farbe des Icons beim Überfahren des Buttons (nur .svg-Datei mit [moz-context-properties], bei anderen Icons hat const iconColOv keine Funktion)
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity, stroke-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.fill = iconColOu;
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
const button = document.getElementById(id);
//over
button.addEventListener('mouseover', () => {
button.style.fill = iconColOv;
});
//out
button.addEventListener('mouseout', () => {
button.style.fill = iconColOu;
});
//contextmenu
button.addEventListener('contextmenu', e => {
if (event.button === 2) {
e.preventDefault();
}
});
//click
button.addEventListener('click', () => {
if (event.button == 0) {
update();
}
});
//----
function update () {
let targetUpdateMessage=null;
let categories=null;
openTrustedLinkIn('about:addons', 'tab');
addEventListener('pageshow', function onPageshow(event) {
let document = event.target;
if (document.URL != 'about:addons')
return;
removeEventListener('pageshow', onPageshow);
categories = document.getElementById('categories');
targetUpdateMessage = document.querySelector('#page-header .main-heading #updates-message');
const configObserver = { attributes: true };
const observerUpdateMessage = new MutationObserver(callback);
observerUpdateMessage.observe(targetUpdateMessage, configObserver);
document.querySelector('addon-page-options panel-item[action="check-for-updates"]').click();
});
const callback = (mutationList, observer) => {
for (const mutation of mutationList) {
if (mutation.type === 'attributes') {
message = targetUpdateMessage.getAttribute('state');
if( message == "manual-updates-found" ) {
setTimeout(function() {
gBrowser.selectedTab.linkedBrowser.reload();
}, 1000);
categories.querySelector('button[viewid="addons://updates/available"]').click();
return;
}
else if( message == "none-found" )
{
return;
}
else if( message == "installed" )
{
document.querySelector('addon-page-options panel-item[action="view-recent-updates"]').click();
setTimeout(function() {
categories.querySelector('button[viewid="addons://updates/recent"]').click();
}, 1000);
return;
}
}
}
}
};
})();
Alles anzeigen
