Skip to content

Commit

Permalink
fix viewer being hard to close
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Jul 19, 2024
1 parent 33e8f53 commit 42e08b5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 42e08b5

Please sign in to comment.