mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			614 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			614 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
export const showBadgeOnFavicon = () => {
 | 
						|
  const favicons = document.querySelectorAll('.favicon');
 | 
						|
 | 
						|
  favicons.forEach(favicon => {
 | 
						|
    const newFileName = `/favicon-badge-${favicon.sizes[[0]]}.png`;
 | 
						|
    favicon.href = newFileName;
 | 
						|
  });
 | 
						|
};
 | 
						|
 | 
						|
export const initFaviconSwitcher = () => {
 | 
						|
  const favicons = document.querySelectorAll('.favicon');
 | 
						|
 | 
						|
  document.addEventListener('visibilitychange', () => {
 | 
						|
    if (document.visibilityState === 'visible') {
 | 
						|
      favicons.forEach(favicon => {
 | 
						|
        const oldFileName = `/favicon-${favicon.sizes[[0]]}.png`;
 | 
						|
        favicon.href = oldFileName;
 | 
						|
      });
 | 
						|
    }
 | 
						|
  });
 | 
						|
};
 |