Merge pull request #4037 from davidfischer/adblock-nag
Ad block nag to urge people to whitelisttheme-version-to-0.4.x
commit
e2c999f824
|
@ -161,3 +161,26 @@ div.ethical-sidebar, div.ethical-footer {
|
|||
display: table;
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
/* Ad block nag */
|
||||
.keep-us-sustainable {
|
||||
padding: .5em;
|
||||
margin: 1em 0;
|
||||
text-align: center;
|
||||
border: 1px dotted #8ECC4C;
|
||||
}
|
||||
.keep-us-sustainable a,
|
||||
.keep-us-sustainable a:hover,
|
||||
.keep-us-sustainable a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
/* Read the Docs theme specific fixes */
|
||||
.wy-body-for-nav .keep-us-sustainable {
|
||||
margin: 1em 2em 1em 1em;
|
||||
color: #b3b3b3;
|
||||
}
|
||||
.wy-body-for-nav .keep-us-sustainable a {
|
||||
color: #efefef;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
|
|
@ -141,11 +141,28 @@ function adblock_admonition() {
|
|||
console.log(' - only show advertisements of interest to developers');
|
||||
console.log('Read more about our approach to advertising here: https://docs.readthedocs.io/en/latest/ethical-advertising.html');
|
||||
console.log('Read more about Ads for Open Source: https://ads-for-open-source.readthedocs.io');
|
||||
console.log('Or go ad-free: https://readthedocs.org/sustainability/');
|
||||
console.log('%cPlease whitelist Read the Docs on your adblocker using the following filter:', 'font-size: 2em');
|
||||
console.log('https://ads-for-open-source.readthedocs.io/en/latest/_static/lists/readthedocs-ads.txt');
|
||||
console.log('--------------------------------------------------------------------------------------');
|
||||
}
|
||||
|
||||
function adblock_nag() {
|
||||
// Place an ad block nag into the sidebar
|
||||
var placement = create_sidebar_placement();
|
||||
var unblock_url = 'https://ads-for-open-source.readthedocs.io/';
|
||||
var ad_free_url = 'https://readthedocs.org/sustainability/';
|
||||
var container = null;
|
||||
|
||||
if (placement && placement.div_id) {
|
||||
container = $('#' + placement.div_id).attr('class', 'keep-us-sustainable');
|
||||
|
||||
$('<p />').text('Support Read the Docs!').appendTo(container);
|
||||
$('<p />').html('Please help keep us sustainable by <a href="' + unblock_url + '">allowing our Ethical Ads in your ad blocker</a> or <a href="' + ad_free_url + '">go ad-free</a> by subscribing.').appendTo(container);
|
||||
$('<p />').text('Thank you! \u2764\ufe0f').appendTo(container);
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
var request_data = {format: "jsonp"};
|
||||
var div_ids = [];
|
||||
|
@ -210,6 +227,7 @@ function init() {
|
|||
|
||||
if (xhr && xhr.status === 404 && rtd.api_host === 'https://readthedocs.org') {
|
||||
adblock_admonition();
|
||||
adblock_nag();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue