Skip to content

Commit

Permalink
close popup on link press
Browse files Browse the repository at this point in the history
  • Loading branch information
kuogi committed Oct 29, 2023
1 parent 40a4bc8 commit 802fadb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/main.parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,16 @@ class SourceParser {
newElement.addEventListener('click', () => {
const src = 'https://github.com/pytgcalls/pytgcalls/tree/master/' + element.getAttribute('url');

const closeButton = document.createElement('div');
closeButton.classList.add('close-button');
closeButton.addEventListener('click', () => {
const closePopup = () => {
fullscreenCodePreview.classList.add('disappear');
fullscreenCodePreview.addEventListener('animationend', () => {
fullscreenCodePreview.remove();
}, { once: true });
});
};

const closeButton = document.createElement('div');
closeButton.classList.add('close-button');
closeButton.addEventListener('click', closePopup);
closeButton.appendChild(document.createElement('div'));
closeButton.appendChild(document.createElement('div'));

Expand All @@ -242,6 +244,7 @@ class SourceParser {
urlBarOpenImage.src = '/src/assets/uprightfromsquare.svg';
const urlBarOpen = document.createElement('a');
urlBarOpen.classList.add('link');
urlBarOpen.addEventListener('click', closePopup);
urlBarOpen.target = '_blank';
urlBarOpen.href = src;
urlBarOpen.appendChild(urlBarOpenImage);
Expand Down

0 comments on commit 802fadb

Please sign in to comment.