Summary: I think maybe these should be more separate from JX.Title, but seems to work ok. May build new favicons just for messages though. Proof of concept UI. Test Plan: Send message on one browser, see red icon in other browser. Click on menu, count and favicon switch back to normal. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16734
36 lines
674 B
JavaScript
36 lines
674 B
JavaScript
/**
|
|
* @provides phabricator-favicon
|
|
* @requires javelin-install
|
|
* javelin-dom
|
|
*/
|
|
JX.install('Favicon', {
|
|
statics: {
|
|
_favicon: null,
|
|
|
|
setFavicon: function(favicon) {
|
|
var self = JX.Favicon;
|
|
self._favicon = favicon;
|
|
self._update();
|
|
},
|
|
|
|
_update: function() {
|
|
var self = JX.Favicon;
|
|
var cur_favicon = JX.$('favicon');
|
|
|
|
if (self._favicon === null) {
|
|
self._favicon = cur_favicon.href;
|
|
}
|
|
|
|
var new_favicon = JX.$N(
|
|
'link',
|
|
{href: self._favicon,
|
|
id: 'favicon',
|
|
rel: 'shortcut icon',
|
|
});
|
|
|
|
JX.DOM.replace(cur_favicon, new_favicon);
|
|
|
|
}
|
|
}
|
|
});
|