diff --git a/scripts/injection.js b/scripts/injection.js index c77bf4ef..aaead34d 100644 --- a/scripts/injection.js +++ b/scripts/injection.js @@ -722,6 +722,21 @@ let page = realPath === "" ? pages[0] : pages.find(p => (!p.exclude || !p.exclud document.querySelector('.t-wrap').remove(); } + // viewer.js + let touchStartTime = 0; + document.addEventListener("touchstart", e => { + if(e.target.className !== 'viewer-canvas') return; + touchStartTime = Date.now(); + }, { passive: true }); + document.addEventListener("touchend", e => { + if(e.target.className !== 'viewer-canvas') return; + if(Date.now() - touchStartTime < 150) { + let viewerContainer = e.target.closest('.viewer-container'); + viewerContainer.querySelector('.viewer-close').click(); + console.log('close'); + } + }, { passive: false }); + chrome.runtime.sendMessage({ action: "inject", files: [