Ich könnte noch Icons oben drauf legen:
icons.zip
Oder auch noch das (ich benutze den Button auch):
Spoiler anzeigen
JavaScript
(function() {
// ■■ START UserCustomisation ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
const buttonIcon1 = 'pulse-square_thin.svg'; // Name & Dateiendung des anzuzeigenden Symbols
// Download
const buttonIcon2 = 'downloads_thin.svg'; // Name & Dateiendung des anzuzeigenden Symbols
const buttonPath = '/chrome/icons/'; // Pfad zum Ordner der die Icons beinhaltet
const label = 'Mediasource userpref Downl./Livest.';
//const label1 = 'Mediasource userpref Livestream.';
//const label2 = 'Mediasource userpref Download';
//const tooltiptext1 = ?;
//const tooltiptext2 = ?;
// ■■ END UserCustomisation ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
const curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (location != 'chrome://browser/content/browser.xhtml')
return;
try {
CustomizableUI.createWidget({
id: 'mediasource-enabled-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
var button = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
var attributes = {
id: 'mediasource-enabled-button',
class: 'toolbarbutton-1 chromeclass-toolbar-additional',
removable: 'true',
label: label,
tooltiptext: Services.prefs.getBoolPref('media.mediasource.enabled') ?
'LiveStream' : 'Download',
oncommand: '(' + onCommand.toString() + ')()'
};
for (var a in attributes) {
button.setAttribute(a, attributes[a]);
};
function onCommand() {
var isEnabled = !Services.prefs.getBoolPref('media.mediasource.enabled');
Services.prefs.setBoolPref('media.mediasource.enabled', isEnabled);
event.target.ownerGlobal.BrowserCommands.reload();
var windows = Services.wm.getEnumerator('navigator:browser');
while (windows.hasMoreElements()) {
let button = windows.getNext().document.getElementById('mediasource-enabled-button');
if (isEnabled)
button.setAttribute('tooltiptext', 'LiveStream')
else
button.setAttribute('tooltiptext', 'Download');
};
};
return button;
}
});
} catch(e) { };
//-----------------------------------------
let sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
let uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent(`
#mediasource-enabled-button[tooltiptext="LiveStream"] {
list-style-image: url(${curProfDir}${buttonPath}${buttonIcon1});
fill: lightblue !important;
}
#mediasource-enabled-button[tooltiptext="Download"] {
list-style-image: url(${curProfDir}${buttonPath}${buttonIcon2});
fill: gold !important;
}
`), null, null);
sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
//-----------------------------------------------------------------
})();
Alles anzeigen