INN/app-template
forked from nprapps/app-template
Permalink
Please sign in to comment.
Browse files
setting up app_config.py for INN, removing some of NPR's ad-code
- Loading branch information...
Showing
with
10 additions
and 142 deletions.
- +10 −25 app_config.py
- +0 −41 less/adhesion.less
- +0 −1 less/app.less
- +0 −1 templates/_base.html
- +0 −74 www/js/ads.js
35
app_config.py
41
less/adhesion.less
| @@ -1,41 +0,0 @@ | ||
| -#adhesion { | ||
| - position: fixed; | ||
| - bottom: 0; | ||
| - left: 0; /* Added for testing - DD. Guess: it's cuz of bootstrap */ | ||
| - width: 100%; | ||
| - -webkit-transition: all .3s ease-in-out; | ||
| - z-index: 1000; | ||
| - | ||
| - .adhesionWrapper { | ||
| - width: 100%; | ||
| - position: fixed; | ||
| - bottom: 0; | ||
| - } | ||
| - img { | ||
| - width: 100%; | ||
| - -webkit-transition: all .3s ease-in-out; | ||
| - } | ||
| - | ||
| - #adhesionClose { | ||
| - float: right; | ||
| - | ||
| - img { | ||
| - width: 33px; | ||
| - float: right; | ||
| - } | ||
| - } | ||
| - | ||
| - .expand { | ||
| - background: black; | ||
| - -webkit-transition: all .3s ease-in-out; | ||
| - | ||
| - img { | ||
| - bottom: 50%; | ||
| - -webkit-transition: all .3s ease-in-out; | ||
| - } | ||
| - } | ||
| -} | ||
| - | ||
| -@media only screen and (min-width: 1025px) { | ||
| - #adhesion { display: none; } | ||
| -} |
1
less/app.less
1
templates/_base.html
74
www/js/ads.js
| @@ -1,74 +0,0 @@ | ||
| -var ADS = {}; | ||
| -var googletag = { cmd: [] }; | ||
| - | ||
| -/* | ||
| - * Configure our ad slots and targeting. | ||
| - */ | ||
| -ADS.setup_ads = function() { | ||
| - // Desktop ad slot | ||
| - if (!Modernizr.touch && Modernizr.mq('(min-width: 1025px)')) { | ||
| - googletag.defineSlot('/6735/n6735.' + APP_CONFIG.NPR_DFP.ENVIRONMENT + '/' + APP_CONFIG.NPR_DFP.TARGET, [300,250], 'ad-desktop').addService(googletag.pubads()); | ||
| - } | ||
| - | ||
| - // Story targeting | ||
| - googletag.pubads().setTargeting('storyId', APP_CONFIG.NPR_DFP.STORY_ID); | ||
| - googletag.pubads().setTargeting('testserver', APP_CONFIG.NPR_DFP.TESTSERVER); | ||
| - | ||
| - // Device | ||
| - var ua = navigator.userAgent.toLowerCase(); | ||
| - | ||
| - if (ua.indexOf('android') > -1) { | ||
| - googletag.pubads().setTargeting('device', 'android'); | ||
| - } else if (ua.match(/(iPad|iPhone|iPod)/i)) { | ||
| - googletag.pubads().setTargeting('device', 'ios'); | ||
| - } | ||
| - | ||
| - // Orientation | ||
| - var orient = ''; | ||
| - | ||
| - if (Modernizr.touch && Modernizr.mq('(max-width: 1024px)')) { | ||
| - if (Modernizr.mq('(orientation: portrait)')) { | ||
| - orient = 'portrait'; | ||
| - } else if (Modernizr.mq('(orientation: landscape)')) { | ||
| - orient = 'landscape'; | ||
| - } | ||
| - } | ||
| - | ||
| - googletag.pubads().setTargeting('orient', orient); | ||
| - | ||
| - googletag.pubads().enableSingleRequest(); | ||
| - googletag.pubads().collapseEmptyDivs(); | ||
| - googletag.enableServices(); | ||
| -}; | ||
| - | ||
| -/* | ||
| - * Load Google JS. | ||
| - */ | ||
| -ADS.setup_googletag = function() { | ||
| - var gads = document.createElement('script'); | ||
| - gads.async = true; | ||
| - gads.type = 'text/javascript'; | ||
| - var useSSL = 'https:' == document.location.protocol; | ||
| - gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; | ||
| - var node = document.getElementsByTagName('script')[0]; | ||
| - node.parentNode.insertBefore(gads, node); | ||
| -}; | ||
| - | ||
| -// Configure when ready | ||
| -googletag.cmd.push(function() { | ||
| - try { | ||
| - ADS.setup_ads(); | ||
| - } catch(e) { | ||
| - NPR.messaging.exception(e, 'Define Google Publisher Tags', NPR.messaging.constants.SPONSORSHIP_ERROR); | ||
| - } | ||
| -}); | ||
| - | ||
| -// Render desktop ad if needed | ||
| -if (!Modernizr.touch && Modernizr.mq('(min-width: 1025px)')) { | ||
| - googletag.cmd.push(function() { | ||
| - googletag.display('ad-desktop'); | ||
| - }); | ||
| -} | ||
| - | ||
| -// Load Google | ||
| -ADS.setup_googletag(); |
0 comments on commit
7284ae5