mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	This commit was originally automatically generated using `tools/lint --only=eslint --fix`. It was then modified by tabbott to contain only changes to a set of files that are unlikely to result in significant merge conflicts with any open pull request, excluding about 20 files. His plan is to merge the remaining changes with more precise care, potentially involving merging parts of conflicting pull requests before running the `eslint --fix` operation. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			854 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			854 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
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));
 | 
						|
    }
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
window.favicon = exports;
 |