diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-18 13:12:13 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-18 13:12:13 +0800 |
commit | dbe6179d42a50899bf97585b0c8437129dd408f4 (patch) | |
tree | 60d4eabbdc1b228865f2fc0e7fa17f1f7178143e | |
parent | 684203b326392688821d514f69f8d6b954a58b1b (diff) | |
parent | f76555b48a3f6c1956c933e9421cf4aba704fb21 (diff) |
Merge branch addon
-rw-r--r-- | addon/index.mjs | 1 | ||||
-rw-r--r-- | addon/manifest.json | 3 | ||||
-rw-r--r-- | src/css/dumbymap.css | 4 | ||||
-rw-r--r-- | src/dumbymap.mjs | 4 |
4 files changed, 7 insertions, 5 deletions
diff --git a/addon/index.mjs b/addon/index.mjs index d138775..5776a18 100644 --- a/addon/index.mjs +++ b/addon/index.mjs | |||
@@ -15,6 +15,7 @@ const blockSelectors = { | |||
15 | 'developer.mozilla': '.section-content', | 15 | 'developer.mozilla': '.section-content', |
16 | 'hackmd.io': '#doc > *', | 16 | 'hackmd.io': '#doc > *', |
17 | 'www.ptt.cc': '#main-content > span', | 17 | 'www.ptt.cc': '#main-content > span', |
18 | 'prosemirror.net': '.ProseMirror > *', | ||
18 | } | 19 | } |
19 | const blockSelector = blockSelectors[url.host] | 20 | const blockSelector = blockSelectors[url.host] |
20 | 21 | ||
diff --git a/addon/manifest.json b/addon/manifest.json index 93b0b65..b95fd4b 100644 --- a/addon/manifest.json +++ b/addon/manifest.json | |||
@@ -14,7 +14,8 @@ | |||
14 | "matches": [ | 14 | "matches": [ |
15 | "*://developer.mozilla.org/*", | 15 | "*://developer.mozilla.org/*", |
16 | "*://hackmd.io/*", | 16 | "*://hackmd.io/*", |
17 | "*://*.ptt.cc/*" | 17 | "*://*.ptt.cc/*", |
18 | "https://prosemirror.net/examples/*" | ||
18 | ], | 19 | ], |
19 | "js": [ | 20 | "js": [ |
20 | "dumbymap.mjs", | 21 | "dumbymap.mjs", |
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index 53f00ce..b2c5d9b 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
@@ -708,13 +708,13 @@ root { | |||
708 | } | 708 | } |
709 | 709 | ||
710 | .Showcase { | 710 | .Showcase { |
711 | z-index: 0; | 711 | z-index: 1; |
712 | } | 712 | } |
713 | 713 | ||
714 | .SemanticHtml { | 714 | .SemanticHtml { |
715 | pointer-events: none; | 715 | pointer-events: none; |
716 | 716 | ||
717 | z-index: 1; | 717 | z-index: 2; |
718 | } | 718 | } |
719 | } | 719 | } |
720 | 720 | ||
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index 2879319..1b7c685 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
@@ -171,8 +171,8 @@ export const generateMaps = (container, { | |||
171 | delete container.dataset.layout | 171 | delete container.dataset.layout |
172 | 172 | ||
173 | /** Prepare Semantic HTML part and blocks of contents inside */ | 173 | /** Prepare Semantic HTML part and blocks of contents inside */ |
174 | const htmlHolder = container.querySelector('.SemanticHtml') ?? | 174 | const htmlHolder = container.querySelector('.SemanticHtml, main, :scope > article') ?? |
175 | Array.from(container.children).find(e => e.id?.includes('main') || e.className.includes('main')) ?? | 175 | Array.from(container.children).find(e => e.id?.includes('main') || e.className?.includes?.('main')) ?? |
176 | Array.from(container.children).sort((a, b) => a.textContent.length < b.textContent.length).at(0) | 176 | Array.from(container.children).sort((a, b) => a.textContent.length < b.textContent.length).at(0) |
177 | htmlHolder.classList.add('SemanticHtml') | 177 | htmlHolder.classList.add('SemanticHtml') |
178 | 178 | ||