Skip to content

Commit

Permalink
client side code and css added
Browse files Browse the repository at this point in the history
  • Loading branch information
joemccann committed Mar 14, 2017
1 parent 0f31354 commit 99b3173
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 86 deletions.
2 changes: 1 addition & 1 deletion public/css/app.css

Large diffs are not rendered by default.

118 changes: 60 additions & 58 deletions public/js/bundle.js

Large diffs are not rendered by default.

81 changes: 73 additions & 8 deletions public/scss/components/_sponsored.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Template (Haml)
// -------------------------------------
//
// .ad-container
// #_default
//
// *************************************

Expand All @@ -25,12 +25,80 @@ $break-mid-4: 460px;
width: 250px;
}

.ad-container a::before{
#_default_ a::before{
color: $c-ad;
content: "Ad: ";
}

.ad-container {
#_default_ img{
display: none;
}


#_default_ #_default_ {
display: block;
float: left;
max-width: 38%;
word-wrap: break-word;
}

#_default_ .default-ad {
display: none;
}

#_default_ ._default_ {
display: block;
font-size: .75rem;
height: 51px;
letter-spacing: 1px;
line-height: 1rem;
padding: 18px 24px;
}

#_default_ ._default_ > * {
vertical-align: middle;
}

#_default_ a {
color: #35d7bb;
text-decoration: none;
}

#_default_ a:hover {
color: lighten(#35d7bb, 20%);
}

#_default_ .default-image {
display: none;
}

#_default_ .default-title:after {
content: " — ";
}

#_default_ .default-title,
#_default_ .default-description {
display: inline;
}

#_default_ .default-title {
position: relative;
font-weight: 600;
display: none;
}

#_default_ a:before {
position: relative;
top: 1px;
padding: 5px;
color: #a0aabf;
content: "Ad";
text-transform: uppercase;
font-size: 8px;
font-family: Verdana, sans-serif;
}


#_default_ {
display: block;
float: left;
max-width: 38%;
Expand Down Expand Up @@ -68,7 +136,7 @@ $break-mid-4: 460px;

// same as .dropdown-toggle

.ad-container a{
#_default_ a{
display: block;
font-size: .75rem;
height: 51px;
Expand Down Expand Up @@ -121,6 +189,3 @@ $break-mid-4: 460px;

}

.ad-container img{
display: none;
}
32 changes: 16 additions & 16 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,27 @@ exports.index = function(req, res) {
}

// If Sponsored ads is enabled get the ad HTML
if(Sponsored.isConfigEnabled){
let forwardedIp = req.headers['X-Forwarded-For'] || req.connection.remoteAddress
// if(Sponsored.isConfigEnabled){
// let forwardedIp = req.headers['X-Forwarded-For'] || req.connection.remoteAddress

console.log('X-Forwarded-For: \t' + req.headers['X-Forwarded-For'])
// console.log('X-Forwarded-For: \t' + req.headers['X-Forwarded-For'])

console.log(req.ip)
console.dir(req.ips)
// console.log(req.ip)
// console.dir(req.ips)

// WARNING: this will break when we switch to IPv6
if (forwardedIp.substr(0, 7) == "::ffff:") {
forwardedIp = forwardedIp.substr(7)
}
// // WARNING: this will break when we switch to IPv6
// if (forwardedIp.substr(0, 7) == "::ffff:") {
// forwardedIp = forwardedIp.substr(7)
// }

Sponsored.fetchAd(forwardedIp, function createAdCb(json){
indexConfig.adHTML = Sponsored.generateAdHTML(json)
return res.render('index', indexConfig)
})
}
else{
// Sponsored.fetchAd(forwardedIp, function createAdCb(json){
// indexConfig.adHTML = Sponsored.generateAdHTML(json)
// return res.render('index', indexConfig)
// })
// }
// else{
return res.render('index', indexConfig)
}
// }

}

Expand Down
13 changes: 13 additions & 0 deletions views/clientside-sponsored.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script src="https://m.servedby-buysellads.com/monetization.js" type="text/javascript"></script>
<!-- <div class="bsa-cpc"></div> -->
<script>
(function(){
if(typeof _bsa !== 'undefined' && _bsa) {
_bsa.init('default', 'CVADP53W', 'placement:dillingerio', {
target: '.ad-container',
align: 'horizontal',
disable_css: 'true'
});
}
})();
</script>
2 changes: 2 additions & 0 deletions views/footer.ejs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<% if(env === 'production') { %>
<%- include clientside-sponsored %>
<script src="/js/bundle.js" type="text/javascript" async></script>
<% if (isGoogleAnalyticsConfigured) { %>
<script type="text/javascript">
<%- GATrackingHTML %>
</script>
<% } %>
<% } else { %>
<%- include clientside-sponsored %>
<script src="/js/bundle.js"></script>
<% }%>
3 changes: 0 additions & 3 deletions views/navbar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
<a class="brand" href="/"><%- include icons/branding %></a>
</h1>

<% if (isSponsoredConfigured) { %>
<div class="ad-container">
<%- adHTML %>
</div>
<% } %>

<nav class="nav nav-right">
<ul class="menu menu-utilities">
Expand Down

0 comments on commit 99b3173

Please sign in to comment.