Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EthicalAds: use theme-logic to decide position #309

Merged
merged 25 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c646010
Packages: updated via `ncu -u` (#300)
github-actions[bot] May 6, 2024
bbe44e1
Packages: updated via `ncu -u` (#305)
github-actions[bot] May 13, 2024
79db43c
Flyout: remove privacy policy link (#303)
humitos May 13, 2024
48fd4f1
Fix the hotkeys after search modal has been opened and closed (#299)
zanderle May 14, 2024
a7ff9f5
EthicalAds: use theme-logic to decide position
humitos May 16, 2024
27fcda3
Update logic
humitos May 16, 2024
44c1e19
Add CSS for EthicalAds
humitos May 16, 2024
5a751ed
Placement bottom is a variable
humitos May 16, 2024
f1220f0
Add classes before calling `.load()`
humitos May 16, 2024
b5f33b7
Add id= attribute
humitos May 16, 2024
2e64849
Decide type and style based on placement
humitos May 16, 2024
aad71a2
Add placement bottom only if it's stickybox
humitos May 17, 2024
2ae91ae
Use the beta ad client
humitos May 17, 2024
8b7fc40
Use stickybox if we don't know the theme
humitos May 17, 2024
93ae85a
Inject CSS styles in DOM
humitos May 17, 2024
29ba0fc
Add better integration for Docusaurus and Material for MkDocs
humitos May 17, 2024
9729307
Merge branch 'main' of github.com:readthedocs/addons into humitos/ad-…
humitos May 17, 2024
c11cf07
Update tests
humitos May 17, 2024
39f0ddd
Minor updates to CSS classes and ea-style
humitos May 17, 2024
320ee15
Increase a little more the Ad size
humitos May 17, 2024
423c086
Jupyter Book (Sphinx Book Theme) added
humitos May 17, 2024
a997bfa
Packages: updated via `ncu -u` (#310)
github-actions[bot] May 21, 2024
ecc63a1
Merge branch 'main' of github.com:readthedocs/addons into humitos/ad-…
humitos May 21, 2024
5de1874
Inject ad beta client based on domain
humitos May 21, 2024
0a87791
Update tests
humitos May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions dist/readthedocs-addons.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/readthedocs-addons.js.map

Large diffs are not rendered by default.

348 changes: 156 additions & 192 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"author": "Read the Docs, Inc",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/core": "^7.24.5",
"@babel/plugin-syntax-import-assertions": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@babel/preset-env": "^7.24.5",
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@open-wc/testing": "^4.0.0",
Expand All @@ -28,7 +28,7 @@
"@rollup/plugin-replace": "^5.0.5",
"@web/dev-server-import-maps": "^0.2.0",
"@web/test-runner": "^0.18.1",
"ajv": "^8.12.0",
"ajv": "^8.13.0",
"babel-loader": "^9.1.3",
"css-loader": "^7.1.1",
"diff-match-patch": "1.0.5",
Expand All @@ -39,7 +39,7 @@
"object-path": "^0.11.8",
"prettier": "^3.2.5",
"rollup-plugin-lit-css": "^5.0.0",
"sinon": "^17.0.1",
"sinon": "^17.0.2",
"tippy.js": "^6.3.7",
"tslib": "^2.6.2",
"unfetch": "^4.2.0",
Expand Down
230 changes: 230 additions & 0 deletions src/ethicalads.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
/* Read the Docs promotional block, only applicable to RTD.org

To support sphinx_rtd_theme, a `wy-menu` element is added. Other themes are
targeted using the theme identifier and use custom elements instead of a CSS
framework html structure.

*/

div.ethical-sidebar,
div.ethical-footer {
display: block !important;
}
.ethical-sidebar,
.ethical-footer {
padding: 0.5em;
margin: 1em 0;
}
.ethical-sidebar img,
.ethical-footer img {
width: 120px;
height: 90px;
display: inline-block;
}
.ethical-sidebar .ethical-callout,
.ethical-footer .ethical-callout {
padding-top: 1em;
clear: both;
}
.ethical-sidebar .ethical-pixel,
.ethical-footer .ethical-pixel,
.ethical-fixedfooter .ethical-pixel {
display: none !important;
}
.ethical-sidebar .ethical-text,
.ethical-footer .ethical-text {
margin-top: 1em;
}
.ethical-sidebar .ethical-image-link,
.ethical-footer .ethical-image-link {
border: 0;
}

.ethical-sidebar,
.ethical-footer {
background-color: #eee;
border: 1px solid #ccc;
border-radius: 5px;
color: #0a0a0a;
font-size: 14px;
line-height: 20px;
}

/* Techstack badging */
.ethical-sidebar ul {
margin: 0 !important;
padding-left: 0;
list-style: none;
}
.ethical-sidebar ul li {
display: inline-block;
background-color: lightskyblue;
color: black;
padding: 0.25em 0.4em;
font-size: 75%;
font-weight: 700;
margin: 0.25em;
border-radius: 0.25rem;
text-align: center;
vertical-align: baseline;
white-space: nowrap;
line-height: 1.41;
}
.ethical-sidebar ul li:not(:last-child) {
margin-right: 0.25rem;
}

.ethical-sidebar a,
.ethical-sidebar a:visited,
.ethical-sidebar a:hover,
.ethical-sidebar a:active,
.ethical-footer a,
.ethical-footer a:visited,
.ethical-footer a:hover,
.ethical-footer a:active {
color: #0a0a0a;
text-decoration: none !important;
border-bottom: 0 !important;
}

.ethical-callout a {
color: #707070 !important;
text-decoration: none !important;
}

/* Sidebar promotions */
.ethical-sidebar {
text-align: center;
max-width: 300px;
margin-left: auto;
margin-right: auto;
}

/* Footer promotions */
.ethical-footer {
text-align: left;

font-size: 14px;
line-height: 20px;
}
.ethical-footer img {
float: right;
margin-left: 25px;
}
.ethical-footer .ethical-callout {
text-align: center;
}
.ethical-footer small {
font-size: 10px;
}

/* Fixed footer promotions */
.ethical-fixedfooter {
box-sizing: border-box;
position: fixed;
bottom: 0;
left: 0;
z-index: 100;
background-color: #eee;
border-top: 1px solid #bfbfbf;
font-size: 12px;
line-height: 1.5;
padding: 0.5em 1.5em;
text-align: center;
color: #404040;
width: 100%; /* Fallback for Opera Mini */
width: 100vw;
}
@media (min-width: 769px) {
/* Improve viewing on non-mobile */
.ethical-fixedfooter {
font-size: 13px;
padding: 1em 1.5em;
}
}
.ethical-fixedfooter .ethical-text:before {
margin-right: 4px;
padding: 2px 6px;
border-radius: 3px;
background-color: #4caf50;
color: #fff;
content: "Sponsored";
}
.ethical-fixedfooter .ethical-callout {
color: #999;
padding-left: 6px;
white-space: nowrap;
}
.ethical-fixedfooter a,
.ethical-fixedfooter a:hover,
.ethical-fixedfooter a:active,
.ethical-fixedfooter a:visited {
color: #404040;
text-decoration: none;
}
.ethical-fixedfooter .ethical-close {
position: absolute;
top: 0;
right: 5px;
font-size: 20px;
line-height: 20px;
}

/* RTD Theme specific customizations */
.wy-nav-side .ethical-rtd {
/* RTD theme doesn't correctly set the sidebar width */
max-width: 300px;
padding: 0 1em;
}
.ethical-rtd .ethical-sidebar {
/* RTD theme doesn't set sidebar text color */
color: #b3b3b3;

font-size: 14px;
line-height: 20px;
}

@media (min-width: 769px) {
/* Make sure the fixed footer ad is under the RTD theme version selector */
.wy-body-for-nav .ethical-fixedfooter {
padding-left: 300px;
}
}

/* Alabaster specific customizations */
.ethical-alabaster a.ethical-image-link {
/* Alabaster adds a border even to image links on hover */
border: 0 !important;
}
.ethical-alabaster hr {
/* Alabaster needs some extra spacing before the footer ad */
margin-top: 2em;
}
.ethical-alabaster::before {
/* Alabaster's search box above the ad is floating */
clear: both;
content: "";
display: table;
margin-top: 3em;
}

/* Dark theme */
.ethical-dark-theme .ethical-sidebar {
background-color: #4e4b4b;
border: 1px solid #a0a0a0;
color: #c2c2c2 !important;
}
.ethical-dark-theme a,
.ethical-dark-theme a:visited {
color: #e6e6e6 !important;
border-bottom: 0 !important;
}
.ethical-dark-theme .ethical-callout a {
color: #b3b3b3 !important;
}

/* Docusaurus */
.ethical-docusaurus {
margin-left: 10% !important;
margin-right: 10% !important;
}
Loading