Habe ich evtl. ein Update für das Skript mal verpasst?
Ich denke schon, denn dies funzt tadellos (Zeile22+23 sind hier schon zusätzlich, irgendwo in der Mitte ist auch noch ein zusätzlicher Codeblock (32-40))
JavaScript
(function() {
// start customisation area----------------------------------
let buttonIcon = "16synchronization-13yellow.svg" // Name.Dateiendung des anzuzeigenden Symbols | Name.file extension of the symbol to be displayed
let buttonPath = "/chrome/css/image/" // Pfad zum Ordner der das Icon beinhaltet | Path to folder containing the icon
// end customisation area-----------------------------------
if (!window.gBrowser) return;
CustomizableUI.createWidget({
id: 'addons-update-button',
defaultArea: CustomizableUI.AREA_NAVBAR,
label: 'Add-ons Update',
tooltiptext: 'Add-ons aktualisieren',
onCommand: onCommand,
onCreated: function(button) {
button.style.listStyleImage = "url('" + PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir)) + buttonPath + buttonIcon + "')";}
});
function onCommand(event) {
let targetUpdateMessage=null;
let categories=null;
event.target.ownerGlobal.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