|
|
|
@ -7,6 +7,7 @@
@@ -7,6 +7,7 @@
|
|
|
|
|
import MEDIA_MIME_TYPES_SUPPORTED from "../environment/mediaMimeTypesSupport"; |
|
|
|
|
import cancelEvent from "../helpers/dom/cancelEvent"; |
|
|
|
|
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent"; |
|
|
|
|
import findUpTag from "../helpers/dom/findUpTag"; |
|
|
|
|
import setInnerHTML from "../helpers/dom/setInnerHTML"; |
|
|
|
|
import mediaSizes from "../helpers/mediaSizes"; |
|
|
|
|
import SearchListLoader from "../helpers/searchListLoader"; |
|
|
|
@ -129,8 +130,9 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
@@ -129,8 +130,9 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
|
|
|
|
|
attachClickEvent(this.author.container, this.onAuthorClick); |
|
|
|
|
|
|
|
|
|
const onCaptionClick = (e: MouseEvent) => { |
|
|
|
|
if(e.target instanceof HTMLAnchorElement) { // close viewer if it's t.me/ redirect
|
|
|
|
|
const onclick = (e.target as HTMLElement).getAttribute('onclick'); |
|
|
|
|
const a = findUpTag(e.target, 'A'); |
|
|
|
|
if(a instanceof HTMLAnchorElement) { // close viewer if it's t.me/ redirect
|
|
|
|
|
const onclick = a.getAttribute('onclick'); |
|
|
|
|
if(!onclick || onclick.includes('showMaskedAlert')) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -138,15 +140,15 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
@@ -138,15 +140,15 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
|
|
|
|
|
cancelEvent(e); |
|
|
|
|
|
|
|
|
|
this.close().then(() => { |
|
|
|
|
detachClickEvent(this.content.caption, onCaptionClick, {capture: true}); |
|
|
|
|
(e.target as HTMLAnchorElement).click(); |
|
|
|
|
this.content.caption.removeEventListener('click', onCaptionClick, {capture: true}); |
|
|
|
|
a.click(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
attachClickEvent(this.content.caption, onCaptionClick, {capture: true}); |
|
|
|
|
this.content.caption.addEventListener('click', onCaptionClick, {capture: true}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* public close(e?: MouseEvent) { |
|
|
|
|