Skip to content

Commit

Permalink
Firefox: change badge color in onWidgetUnderflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Deathamns committed Mar 8, 2015
1 parent 2d8ec83 commit 25d5166
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions platform/firefox/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ vAPI.toolbarButton.init = function() {
} else {
this.CUIEvents = {};

this.CUIEvents.onCustomizeEnd = function() {
var updateBadge = function() {
var wId = vAPI.toolbarButton.id;
var buttonInPanel = CustomizableUI.getWidget(wId).areaType === CustomizableUI.TYPE_MENU_PANEL;

Expand All @@ -1476,9 +1476,12 @@ vAPI.toolbarButton.init = function() {
}

// Anonymous elements need some time to be reachable
setTimeout(this.updateBadgeStyle, 250);
setTimeout(this.updateBadgeStyle, 50);
}.bind(this.CUIEvents);

this.CUIEvents.onCustomizeEnd = updateBadge;
this.CUIEvents.onWidgetUnderflow = updateBadge;

this.CUIEvents.updateBadgeStyle = function() {
var css = [
'background: #666',
Expand All @@ -1505,7 +1508,7 @@ vAPI.toolbarButton.init = function() {

this.onCreated = function(button) {
button.setAttribute('badge', '');
setTimeout(this.CUIEvents.onCustomizeEnd, 250);
setTimeout(this.CUIEvents.onCustomizeEnd, 50);
};

CustomizableUI.addListener(this.CUIEvents);
Expand Down

0 comments on commit 25d5166

Please sign in to comment.