From 300dec5355c44f7ee3beaedf5e6a243cbcc6bd32 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 18 Dec 2024 16:54:19 +0100 Subject: [PATCH 1/2] EthicalAd: specific placement for Antora Based on https://github.com/readthedocs/addons/pull/473/ --- src/ethicalads.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ethicalads.js b/src/ethicalads.js index 26cd20b..ef89df4 100644 --- a/src/ethicalads.js +++ b/src/ethicalads.js @@ -147,6 +147,17 @@ export class EthicalAdsAddon extends AddonBase { placement.classList.add("ethical-alabaster"); placement.classList.add("ethical-docsify"); + placement.setAttribute("data-ea-type", "readthedocs-sidebar"); + placement.setAttribute("data-ea-style", "image"); + knownPlacementFound = true; + } + } else if (docTool.isAntora()) { + selector = "aside nav.nav-menu"; + element = document.querySelector(selector); + + if (this.elementAboveTheFold(element)) { + placement.classList.add("ethical-alabaster"); + placement.setAttribute("data-ea-type", "readthedocs-sidebar"); placement.setAttribute("data-ea-style", "image"); knownPlacementFound = true; From 4a2c290a7c90e13670f9fb69a76163cf0be91c79 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 18 Dec 2024 16:58:40 +0100 Subject: [PATCH 2/2] EthicalAd: specific placement for MdBook --- src/ethicalads.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ethicalads.js b/src/ethicalads.js index ef89df4..86e3935 100644 --- a/src/ethicalads.js +++ b/src/ethicalads.js @@ -155,6 +155,17 @@ export class EthicalAdsAddon extends AddonBase { selector = "aside nav.nav-menu"; element = document.querySelector(selector); + if (this.elementAboveTheFold(element)) { + placement.classList.add("ethical-alabaster"); + + placement.setAttribute("data-ea-type", "readthedocs-sidebar"); + placement.setAttribute("data-ea-style", "image"); + knownPlacementFound = true; + } + } else if (docTool.isMdBook()) { + selector = "nav#sidebar mdbook-sidebar-scrollbox"; + element = document.querySelector(selector); + if (this.elementAboveTheFold(element)) { placement.classList.add("ethical-alabaster");