mirror of https://github.com/zulip/zulip.git
favicon: Remove ancient browser workarounds.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
163dfb1552
commit
c080b4da06
|
@ -123,7 +123,6 @@ function test_helper() {
|
|||
|
||||
stub('admin', 'launch');
|
||||
stub('drafts', 'launch');
|
||||
stub('favicon', 'reset');
|
||||
stub('floating_recipient_bar', 'update');
|
||||
stub('message_viewport', 'stop_auto_scrolling');
|
||||
stub('narrow', 'deactivate');
|
||||
|
@ -301,7 +300,6 @@ run_test('save_narrow', () => {
|
|||
|
||||
helper.assert_events([
|
||||
'message_viewport.stop_auto_scrolling',
|
||||
'favicon.reset',
|
||||
]);
|
||||
assert.equal(window.location.hash, '#narrow/is/private');
|
||||
|
||||
|
@ -318,7 +316,6 @@ run_test('save_narrow', () => {
|
|||
hashchange.save_narrow(operators);
|
||||
helper.assert_events([
|
||||
'message_viewport.stop_auto_scrolling',
|
||||
'favicon.reset',
|
||||
]);
|
||||
assert.equal(url_pushed, 'http://example.com/#narrow/is/starred');
|
||||
});
|
||||
|
|
|
@ -1,26 +1,5 @@
|
|||
const favicon_selector = 'link[rel="shortcut icon"]';
|
||||
|
||||
// We need to reset the favicon after changing the
|
||||
// window.location.hash or Firefox will drop the favicon. See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=519028
|
||||
exports.reset = function () {
|
||||
$(favicon_selector).detach().appendTo('head');
|
||||
};
|
||||
|
||||
exports.set = function (url) {
|
||||
if (/webkit/i.test(navigator.userAgent)) {
|
||||
// Works in Chrome 22 at least.
|
||||
// Doesn't work in Firefox 10.
|
||||
$(favicon_selector).attr('href', url);
|
||||
} else {
|
||||
// Delete and re-create the node.
|
||||
// May cause excessive work by the browser
|
||||
// in re-rendering the page (see #882).
|
||||
$(favicon_selector).remove();
|
||||
$('head').append($('<link>')
|
||||
.attr('rel', 'shortcut icon')
|
||||
.attr('href', url));
|
||||
}
|
||||
$('#favicon').attr('href', url);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ exports.changehash = function (newhash) {
|
|||
}
|
||||
message_viewport.stop_auto_scrolling();
|
||||
set_hash(newhash);
|
||||
favicon.reset();
|
||||
};
|
||||
|
||||
exports.save_narrow = function (operators) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<title>Zulip</title>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
<link href="/static/favicon.ico?v=2" rel="shortcut icon">
|
||||
<link id="favicon" rel="icon" href="/static/favicon.ico?v=2">
|
||||
{% block meta_viewport %}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue