Skip to content

Commit 511741c

Browse files
authored
Merge pull request readthedocs#5567 from rtfd/davidfischer/non-mobile-fixed-footer
Non mobile fixed footer ads
2 parents 6cb3cce + 68780c9 commit 511741c

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

media/css/readthedocs-doc-embed.css

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,46 @@ div.ethical-footer {
168168
background-color: #eee;
169169
border-top: 1px solid #bfbfbf;
170170
font-size: 12px;
171-
line-height: 16px;
172-
padding: 0.5em 2.5em;
171+
line-height: 1.5;
172+
padding: 0.5em 1.5em;
173173
text-align: center;
174174
color: #404040;
175175
width: 100%; /* Fallback for Opera Mini */
176176
width: 100vw;
177177
}
178+
@media (min-width: 769px) {
179+
/* Improve viewing on non-mobile */
180+
.ethical-fixedfooter {
181+
font-size: 13px;
182+
padding: 1em 1.5em;
183+
}
184+
}
185+
.ethical-fixedfooter .ethical-text:before {
186+
margin-right: 4px;
187+
padding: 2px 6px;
188+
border-radius: 3px;
189+
background-color: #4caf50;
190+
color: #fff;
191+
content: "Sponsored";
192+
}
193+
.ethical-fixedfooter .ethical-callout {
194+
color: #999;
195+
padding-left: 6px;
196+
white-space: nowrap;
197+
}
178198
.ethical-fixedfooter a,
179199
.ethical-fixedfooter a:hover,
180200
.ethical-fixedfooter a:active,
181201
.ethical-fixedfooter a:visited {
182-
color: #004B6B;
183-
text-decoration: underline;
202+
color: #404040;
203+
text-decoration: none;
184204
}
185205
.ethical-fixedfooter .ethical-close {
186206
position: absolute;
187207
top: 0;
188208
right: 5px;
189-
font-size: 15px;
190-
line-height: 15px;
191-
}
192-
.ethical-fixedfooter .ethical-close a {
193-
color: black;
194-
text-decoration: none;
209+
font-size: 20px;
210+
line-height: 20px;
195211
}
196212

197213
/* RTD Theme specific customizations */
@@ -208,6 +224,13 @@ div.ethical-footer {
208224
line-height: 20px;
209225
}
210226

227+
@media (min-width: 769px) {
228+
/* Make sure the fixed footer ad is under the RTD theme version selector */
229+
.wy-body-for-nav .ethical-fixedfooter {
230+
padding-left: 300px;
231+
}
232+
}
233+
211234
/* Alabaster specific customizations */
212235
.ethical-alabaster a.ethical-image-link {
213236
/* Alabaster adds a border even to image links on hover */

readthedocs/core/static-src/core/js/doc-embed/sponsorship.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ function create_sidebar_placement() {
6767
if (!offset || offset.top > $(window).height()) {
6868
// If this is off screen, lower the priority
6969
priority = constants.LOW_PROMO_PRIORITY;
70-
} else if (bowser && !bowser.mobile) {
71-
// If this isn't mobile, then the ad will be ATF, so raise the priority
72-
priority = constants.MAXIMUM_PROMO_PRIORITY;
7370
}
7471

7572
return {
@@ -131,20 +128,21 @@ function create_footer_placement() {
131128
function create_fixed_footer_placement() {
132129
var element_id = 'rtd-' + (Math.random() + 1).toString(36).substring(4);
133130
var display_type = constants.PROMO_TYPES.FIXED_FOOTER;
131+
var priority = constants.DEFAULT_PROMO_PRIORITY;
134132

135-
// Only propose the fixed footer ad for mobile
136133
if (bowser && bowser.mobile) {
137-
$('<div />').attr('id', element_id).appendTo('body');
138-
return {
139-
'div_id': element_id,
140-
'display_type': display_type,
141-
142-
// Prioritize mobile ads when on mobile
143-
'priority': constants.MAXIMUM_PROMO_PRIORITY,
144-
};
134+
// If this is mobile, then prioritize fixed footer
135+
priority = constants.MAXIMUM_PROMO_PRIORITY;
145136
}
146137

147-
return null;
138+
$('<div />').attr('id', element_id).appendTo('body');
139+
return {
140+
'div_id': element_id,
141+
'display_type': display_type,
142+
143+
// Prioritize mobile ads when on mobile
144+
'priority': priority,
145+
};
148146
}
149147

150148
function Promo(data) {

0 commit comments

Comments
 (0)