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