aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-07-28 10:43:06 +1000
committerYuchen Pei <hi@ypei.me>2022-07-28 10:43:06 +1000
commit2e9dde6d085d68b1601c31f9938c2530ff55d77a (patch)
tree42552928079f0694c25b6816cf91017a4a6d42b7
parent395df086e12e62ae55ebc7012d94896ca8958394 (diff)
simplify close listeners in contact finder
-rw-r--r--content/contactFinder.js17
1 files changed, 3 insertions, 14 deletions
diff --git a/content/contactFinder.js b/content/contactFinder.js
index 6868b47..c55d46a 100644
--- a/content/contactFinder.js
+++ b/content/contactFinder.js
@@ -186,20 +186,8 @@ function main() {
overlay.remove();
};
- const closeListener = e => {
- const t = e.currentTarget;
- if (t.href && t.href !== document.URL) { // link navigation
- if (t.href.includes("#")) {
- window.addEventListener("hashchange", close);
- }
- return;
- }
- close();
- };
- const makeCloser = clickable => clickable.addEventListener("click", closeListener);
-
// Clicking the "outer area" closes the dialog.
- makeCloser(overlay);
+ overlay.addEventListener("click", close);
const initFrame = prefs => {
debug("initFrame");
@@ -217,6 +205,7 @@ function main() {
const closeButton = body.appendChild(contentDoc.createElement('button'));
closeButton.classList.toggle('close', true);
closeButton.textContent = 'x';
+ closeButton.addEventListener("click", close);
const content = body.appendChild(contentDoc.createElement("div"));
content.id = "content";
@@ -253,7 +242,7 @@ function main() {
}
}
- contentDoc.querySelectorAll(".close, a").forEach(makeCloser);
+ // contentDoc.querySelectorAll(".close, a").forEach(makeCloser);
debug("frame initialized");
}