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

Use sustainability api for advertising #3747

Merged
merged 8 commits into from Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
163 changes: 48 additions & 115 deletions media/css/readthedocs-doc-embed.css
Expand Up @@ -42,144 +42,77 @@ 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.rst-pro is deprecated in favor of div.rtd-pro here, though we still need
both rules for historical docs.
*/

div.rtd-pro,
div.rst-pro {
display: block;
padding: .5em;
margin: 1em 0em 1em 0em;
text-align: center;
div.ethical-sidebar, div.ethical-footer {
display: block !important;
}
div.rtd-pro.wy-menu,
div.rtd-pro.wy-menu {
width: 300px;
}
div.rtd-pro.alabaster {
width: 100%;
box-sizing: border-box;
}

div.rtd-pro.wy-menu,
div.rst-pro.wy-menu {
bottom: 60px;
background: rgba(0, 0, 0, .06);
}

div.rtd-pro.alabaster {
background: rgba(220, 220, 220, .1);
}

div.rtd-pro > span,
div.rst-pro > span {
display: block;
font-size: 90%;
}

div.rtd-pro.wy-menu > span,
div.rst-pro.wy-menu > span {
color: #b3b3b3;
}

div.rtd-pro.wy-menu a,
div.rtd-pro.wy-menu a:link,
div.rtd-pro.wy-menu a:visited,
div.rst-pro.wy-menu a,
div.rst-pro.wy-menu a:link,
div.rst-pro.wy-menu a:visited,
div.rtd-pro.wy-menu a:hover,
div.rtd-pro.wy-menu a:active,
div.rst-pro.wy-menu a:hover,
div.rst-pro.wy-menu a:active { color: #efefef; }

div.rtd-pro a.rtd-pro-image-wrapper {
display: inline-block;
padding: 6px;
margin: 5px 0px 10px 0px;
border: 1px solid #434343;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}

div.rtd-pro.wy-menu a.rtd-pro-image-wrapper,
div.rst-pro.wy-menu a.rst-pro-image-wrapper {
border-color: #434343;
}

div.rtd-pro.alabaster a.rtd-pro-image-wrapper {
border-color: #d3d3d3;
.ethical-sidebar, .ethical-footer {
padding: .5em;
margin: 1em 0;
}

div.rtd-pro img,
div.rst-pro.wy-menu img {
.ethical-sidebar img, .ethical-footer img {
width: 120px;
height: 90px;
display: inline-block;
}

div.rtd-pro div.rtd-pro-about {
float: right;
text-align: right;
font-size: 90%;
.ethical-sidebar .ethical-callout, .ethical-footer .ethical-callout {
padding-top: 1em;
clear: both;
}
div.rtd-pro.wy-menu div.rtd-pro-about,
div.rst-pro.wy-menu div.rst-pro-about {
color: white;
.ethical-sidebar .ethical-pixel, .ethical-footer .ethical-pixel {
display: none !important;
}

div.rtd-pro.alabaster div.rtd-pro-about a {
border-bottom: 0px;
.ethical-sidebar .ethical-text, .ethical-footer .ethical-text {
margin-top: 1em;
}

div.rtd-pro.alabaster div.rtd-pro-about i.fa-info-circle:before,
div.rtd-pro.rtd-pro-footer div.rtd-pro-about i.fa-info-circle:before {
content: "";
color: #a3a3a3;
.ethical-sidebar .ethical-image-link, .ethical-footer .ethical-image-link {
border: 0;
}

/* Hide the "sponsored" note in the left navigation */
div.rtd-pro-about span {
display: none;
/* Sidebar promotions */
.ethical-sidebar {
text-align: center;
}

/* Footer promos */
div.rtd-pro.rtd-pro-footer div.rtd-pro-about span {
display: inline;
}
div.rtd-pro.rtd-pro-footer div.rtd-pro-about {
float: none;
}
div.rtd-pro.rtd-pro-footer div.rtd-pro-about a {
text-decoration: none;
}
div.rtd-pro.rtd-pro-footer {
/* Footer promotions */
.ethical-footer {
text-align: left;
font-size: 90%;
}
div.rtd-pro.rtd-pro-footer a.rtd-pro-image-wrapper {
.ethical-footer img {
float: right;
margin-left: 25px;
}

div.rtd-pro-wrapper {
clear: both;
.ethical-footer .ethical-callout {
text-align: right;
}

@media (max-width: 768px) {
div.rst-pro.wy-menu {
display: none;
}
/* RTD Theme specific customizations */
.ethical-rtd .ethical-sidebar {
/* RTD theme doesn't set sidebar text color */
color: #b3b3b3;

div.rtd-pro.alabaster {
background: rgba(220, 220, 220, .05);
}
/* RTD theme doesn't correctly set the sidebar width */
width: 300px;

div.rtd-pro.alabaster a.rtd-pro-image-wrapper {
border-color: #656565;
}
font-size: 14px;
line-height: 20px;
}
.ethical-rtd .ethical-sidebar a,
.ethical-rtd .ethical-sidebar a:visited,
.ethical-rtd .ethical-sidebar a:hover,
.ethical-rtd .ethical-sidebar a:active {
/* RTD theme doesn't set sidebar link color */
color: #efefef;
}

div.rtd-pro > p.ethical-callout {
margin-top: 1em;
/* 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;
}
10 changes: 5 additions & 5 deletions readthedocs/core/static-src/core/js/doc-embed/constants.js
Expand Up @@ -3,18 +3,18 @@
var exports = {
THEME_RTD: 'sphinx_rtd_theme',
THEME_ALABASTER: 'alabaster',
THEME_CELERY: 'sphinx_celery'
}
THEME_CELERY: 'sphinx_celery',
};

exports.PROMO_SUPPORTED_THEMES = [
exports.THEME_RTD,
exports.THEME_ALABASTER,
exports.THEME_CELERY
]
exports.THEME_CELERY,
];

exports.PROMO_TYPES = {
LEFTNAV: 'doc', // Left navigation on documentation pages
FOOTER: 'site-footer' // Footer of documentation pages
FOOTER: 'site-footer', // Footer of documentation pages
};

module.exports = exports;
28 changes: 1 addition & 27 deletions readthedocs/core/static-src/core/js/doc-embed/footer.js
@@ -1,6 +1,5 @@
var rtddata = require('./rtd-data'),
versionCompare = require('./version-compare'),
sponsorship = require('../sponsorship');
versionCompare = require('./version-compare');


function init() {
Expand Down Expand Up @@ -28,15 +27,6 @@ function init() {
get_data['subproject'] = true;
}

if (typeof URL !== 'undefined' && typeof URLSearchParams !== 'undefined') {
// Force a specific promo to be displayed
var params = new URL(window.location).searchParams;
var force_promo = params.get('promo');
if (force_promo) {
get_data['promo'] = force_promo;
}
}

// Get footer HTML from API and inject it into the page.
$.ajax({
url: rtd.api_host + "/api/v2/footer_html/",
Expand Down Expand Up @@ -74,22 +64,6 @@ function injectFooter(data) {
} else if (!data['version_supported']) {
//$('.rst-current-version').addClass('rst-active-old-version')
}

// Show promo selectively
if (data.promo && config.show_promo()) {
var promo = new sponsorship.Promo(
data.promo_data.id,
data.promo_data.text,
data.promo_data.link,
data.promo_data.image,
config.theme,
data.promo_data.display_type,
data.promo_data.pixel
)
if (promo) {
promo.display();
}
}
}


Expand Down