Skip to content

Commit 2654442

Browse files
authored
CF worker: remove specific warning admonitions (#203)
In readthedocs/readthedocs-ops#1429 we made the selector to remove the "external version warning" a lot more specific. It fixed the original issue, but it resulted in not matching in other themes. This PR adds extra specific CSS selector for Furo and Book themes. Closes readthedocs/readthedocs.org#11136
1 parent 8ad2d97 commit 2654442

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dockerfiles/force-readthedocs-addons.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const badgeOnlyCssAssets =
3939
const badgeOnlyCssAssetsProxied = 'link[href="/_/static/css/badge_only.css"]';
4040
const readthedocsExternalVersionWarning =
4141
"[role=main] > div:first-child > div:first-child.admonition.warning";
42+
const readthedocsExternalVersionWarningFuroTheme =
43+
"[role=main] > div:first-child.admonition.warning";
44+
const readthedocsExternalVersionWarningBookTheme =
45+
"#main-content > div > div > article > div:first-child.admonition.warning";
4246
const readthedocsFlyout = "div.rst-versions";
4347

4448
// "readthedocsDataParse" is the "<script>" that calls:
@@ -100,6 +104,8 @@ async function handleRequest(request) {
100104
.on(badgeOnlyCssAssets, new removeElement())
101105
.on(badgeOnlyCssAssetsProxied, new removeElement())
102106
.on(readthedocsExternalVersionWarning, new removeElement())
107+
.on(readthedocsExternalVersionWarningFuroTheme, new removeElement())
108+
.on(readthedocsExternalVersionWarningBookTheme, new removeElement())
103109
.on(readthedocsFlyout, new removeElement())
104110
// NOTE: I wasn't able to reliably remove the "<script>" that parses
105111
// the "READTHEDOCS_DATA" defined previously, so we are keeping it for now.

0 commit comments

Comments
 (0)