Fix image zoom URL handling to remove width and height parameters instead of all search params
This commit is contained in:
		
							parent
							
								
									4854d40508
								
							
						
					
					
						commit
						5711618e6e
					
				@ -23,15 +23,23 @@ class MessageList extends HTMLElement {
 | 
			
		||||
    const messagesContainer = this
 | 
			
		||||
      messagesContainer.addEventListener('click', (e) => {
 | 
			
		||||
        if (e.target.tagName !== 'IMG' || e.target.classList.contains('avatar-img')) return;
 | 
			
		||||
 | 
			
		||||
        const img = e.target;
 | 
			
		||||
 | 
			
		||||
        const overlay = document.createElement('div');
 | 
			
		||||
        overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.9);display:flex;justify-content:center;align-items:center;z-index:9999;'
 | 
			
		||||
 | 
			
		||||
        const urlObj = new URL(img.currentSrc || img.src)
 | 
			
		||||
        urlObj.searchParams.delete("width");
 | 
			
		||||
        urlObj.searchParams.delete("height");
 | 
			
		||||
 | 
			
		||||
        const fullImg = document.createElement('img');
 | 
			
		||||
        const urlObj = new URL(img.src); urlObj.search = '';
 | 
			
		||||
 | 
			
		||||
        fullImg.src = urlObj.toString();
 | 
			
		||||
        fullImg.alt = img.alt;
 | 
			
		||||
        fullImg.style.maxWidth = '90%';
 | 
			
		||||
        fullImg.style.maxHeight = '90%';
 | 
			
		||||
 | 
			
		||||
        overlay.appendChild(fullImg);
 | 
			
		||||
        document.body.appendChild(overlay);
 | 
			
		||||
        overlay.addEventListener('click', () => document.body.removeChild(overlay));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user