mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
Merge pull request #1252 from bitcoin-dot-org/add-ad-infrastructure
Add ad infrastructure
This commit is contained in:
commit
17fc45acd0
3 changed files with 69 additions and 0 deletions
|
@ -6,6 +6,15 @@ http://opensource.org/licenses/MIT.
|
|||
<script type="text/javascript">
|
||||
fallbackSVG();
|
||||
addAnchorLinks();
|
||||
|
||||
/* var ads = [
|
||||
{website: "https://bitcoin.org", text: "Slot 1 text goes here."},
|
||||
{website: "https://bitcoin.org", text: "Slot 2 text goes here."},
|
||||
{website: "https://bitcoin.org", text: "Slot 3 text goes here."}
|
||||
];
|
||||
showAds(ads);
|
||||
|
||||
*/
|
||||
</script>
|
||||
|
||||
{% comment %}
|
||||
|
|
|
@ -146,6 +146,34 @@ table td,table th{
|
|||
font-style:italic;
|
||||
}
|
||||
|
||||
.ad-slot{
|
||||
background-color: #EFEFEF;
|
||||
border-bottom: 1px solid #D6D6D6;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ad-slot-inner-container{
|
||||
display: inline-block;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
||||
.ad-slot-inner-container a{
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.ad-slot-disclaimer {
|
||||
color: #FFF;
|
||||
line-height: 14px;
|
||||
padding: 0px 2px;
|
||||
font-size: 12px;
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
background-color: #E05950;
|
||||
}
|
||||
|
||||
.banner-message,
|
||||
.banner-message a,
|
||||
.banner-message a:link,
|
||||
|
|
32
js/main.js
32
js/main.js
|
@ -547,6 +547,38 @@ function makeEditable(e) {
|
|||
}
|
||||
}
|
||||
|
||||
function showAds(ads) {
|
||||
if(!isMobile()){
|
||||
|
||||
var ad = ads[Math.floor(Math.random()*ads.length)];
|
||||
|
||||
var ad_slot = document.createElement("div");
|
||||
ad_slot.className = "ad-slot";
|
||||
|
||||
var ad_slot_inner_container = document.createElement("div");
|
||||
ad_slot_inner_container.className = "ad-slot-inner-container";
|
||||
|
||||
|
||||
var ad_slot_link = document.createElement("a");
|
||||
ad_slot_link.href = ad.website;
|
||||
ad_slot_link.target = "_blank";
|
||||
ad_slot_link.appendChild(document.createTextNode(ad.text));
|
||||
|
||||
var ad_slot_disclaimer = document.createElement("span");
|
||||
ad_slot_disclaimer.className = "ad-slot-disclaimer";
|
||||
ad_slot_disclaimer.appendChild(document.createTextNode("Ad"));
|
||||
|
||||
ad_slot_inner_container.appendChild(ad_slot_disclaimer);
|
||||
ad_slot_inner_container.appendChild(ad_slot_link);
|
||||
|
||||
ad_slot.appendChild(ad_slot_inner_container);
|
||||
|
||||
var body = document.body;
|
||||
body.insertBefore(ad_slot, body.firstChild);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Add makeEditable event listener
|
||||
var xint = setInterval(function() {
|
||||
if (!document.body) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue