mirror of https://github.com/gorhill/uBlock.git
Firefox: change badge color in onWidgetUnderflow
This commit is contained in:
parent
2d8ec83bff
commit
25d5166eb6
|
@ -1455,7 +1455,7 @@ vAPI.toolbarButton.init = function() {
|
||||||
} else {
|
} else {
|
||||||
this.CUIEvents = {};
|
this.CUIEvents = {};
|
||||||
|
|
||||||
this.CUIEvents.onCustomizeEnd = function() {
|
var updateBadge = function() {
|
||||||
var wId = vAPI.toolbarButton.id;
|
var wId = vAPI.toolbarButton.id;
|
||||||
var buttonInPanel = CustomizableUI.getWidget(wId).areaType === CustomizableUI.TYPE_MENU_PANEL;
|
var buttonInPanel = CustomizableUI.getWidget(wId).areaType === CustomizableUI.TYPE_MENU_PANEL;
|
||||||
|
|
||||||
|
@ -1476,9 +1476,12 @@ vAPI.toolbarButton.init = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anonymous elements need some time to be reachable
|
// Anonymous elements need some time to be reachable
|
||||||
setTimeout(this.updateBadgeStyle, 250);
|
setTimeout(this.updateBadgeStyle, 50);
|
||||||
}.bind(this.CUIEvents);
|
}.bind(this.CUIEvents);
|
||||||
|
|
||||||
|
this.CUIEvents.onCustomizeEnd = updateBadge;
|
||||||
|
this.CUIEvents.onWidgetUnderflow = updateBadge;
|
||||||
|
|
||||||
this.CUIEvents.updateBadgeStyle = function() {
|
this.CUIEvents.updateBadgeStyle = function() {
|
||||||
var css = [
|
var css = [
|
||||||
'background: #666',
|
'background: #666',
|
||||||
|
@ -1505,7 +1508,7 @@ vAPI.toolbarButton.init = function() {
|
||||||
|
|
||||||
this.onCreated = function(button) {
|
this.onCreated = function(button) {
|
||||||
button.setAttribute('badge', '');
|
button.setAttribute('badge', '');
|
||||||
setTimeout(this.CUIEvents.onCustomizeEnd, 250);
|
setTimeout(this.CUIEvents.onCustomizeEnd, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
CustomizableUI.addListener(this.CUIEvents);
|
CustomizableUI.addListener(this.CUIEvents);
|
||||||
|
|
Loading…
Reference in New Issue