| Index: iconAnimation.js |
| =================================================================== |
| --- a/iconAnimation.js |
| +++ b/iconAnimation.js |
| @@ -16,35 +16,25 @@ |
| */ |
| iconAnimation = { |
| - _icons: new TabMap(), |
| - _animatedTabs: new TabMap(), |
| - _step: 0, |
| + step: 0, |
| + tabs: new TabMap(), |
| update: function(severity) |
| { |
| - if (severity == this._severity) |
| + if (severity == this.severity) |
| return; |
| - if (!this._severity) |
| + if (!this.severity) |
| this._start(); |
| - this._severity = severity; |
| + this.severity = severity; |
| }, |
| stop: function() |
| { |
| clearInterval(this._interval); |
| delete this._interval; |
| - delete this._severity; |
| - |
| - this._animatedTabs.clear(); |
| - }, |
| - registerTab: function(tab, icon) |
| - { |
| - this._icons.set(tab, icon); |
| - |
| - if (this._animatedTabs.has(tab)) |
| - this._updateIcon(tab); |
| + delete this.severity; |
| }, |
| _start: function() |
| { |
| @@ -56,14 +46,14 @@ |
| return; |
| for (var i = 0; i < tabs.length; i++) |
| - this._animatedTabs.set(tabs[i], null); |
| + this.tabs.set(tabs[i], null); |
| var interval = setInterval(function() |
| { |
| - this._step++; |
| + this.step++; |
| tabs.forEach(this._updateIcon.bind(this)); |
| - if (this._step < 10) |
| + if (this.step < 10) |
| return; |
| clearInterval(interval); |
| @@ -71,14 +61,14 @@ |
| { |
| interval = setInterval(function() |
| { |
| - this._step--; |
| + this.step--; |
| tabs.forEach(this._updateIcon.bind(this)); |
| - if (this._step > 0) |
| + if (this.step > 0) |
| return; |
| clearInterval(interval); |
| - this._animatedTabs.clear(); |
| + this.tabs.clear(); |
| }.bind(this), 100); |
| }.bind(this), 1000); |
| }.bind(this), 100); |
| @@ -114,21 +104,6 @@ |
| }, |
| _updateIcon: function(tab) |
| { |
| - var path = this._icons.get(tab); |
| - |
| - if (!path) |
| - return; |
| - |
| - if (this._step > 0) |
| - { |
| - var suffix = "-notification-" + this._severity; |
| - |
| - if (this._step < 10) |
| - suffix += "-" + this._step; |
| - |
| - path = path.replace(/(?=\..+$)/, suffix); |
| - } |
| - |
| - tab.browserAction.setIcon(path); |
| + tab.browserAction.setIcon(getTabStatus(tab).icon); |
| } |
| }; |