Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
Ads - Setting viewport margin for specific pagetype/screensizes
Browse files Browse the repository at this point in the history
 🐿 v2.5.16
  • Loading branch information
andrewgeorgiou1981 committed Sep 26, 2017
1 parent 9c9945a commit 747e5f6
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions components/n-ui/ads/js/oAdsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,21 @@ module.exports = function (flags, appName, adOptions) {
return zone.join('/');
}

function setViewportMarginBy (variant) {

if (appName.toLowerCase().substr(0, 3) === fro && res=small) return '15%';
// (pagetype === fro && res=med) return '5%';
// (pagetype === str && res=small) return '5%';
// (pagetype) === str && res=med) return '15%';
switch (variant) {
case '5':
return'5%';
break;
case '10':
return '10%';
break;
case '15':
return '15%';
break;
default:
return '0%';
function setViewportMarginBy () {
let pt = appName;
pt = pt.toLowerCase().substr(0, 3);
let scrnSize = utils.getScreenSize();
if (pt === 'fro') {
if (scrnSize < 760) {return '15%';}
else {
if (pt === 'fro' && scrnSize < 980) {return '5%';}
}
}
if (pt === 'str'){
if (scrnSize < 760) {return '5%';}
else if (scrnSize < 980) {return '15%';}
}
return '0%';
}

function isTargetSize () {
Expand All @@ -83,8 +79,7 @@ module.exports = function (flags, appName, adOptions) {
function getViewportMargin () {
let viewportMargin = '0%';
if (flags.get('adOptimizeLazyLoad') && isTargetSize() ) {
const variant = flags.get('adOptimizeLazyLoad');
viewportMargin = setViewportMarginBy(variant);
viewportMargin = setViewportMarginBy();
}
return viewportMargin;
}
Expand All @@ -100,7 +95,7 @@ module.exports = function (flags, appName, adOptions) {
sizes: 'fluid'
}
},
ponsive: {
responsive: {
extra: [1025, 0], //Reasonable width to show a Billboard (desktop)
large: [980, 0], //reasonable width to show SuperLeaderboard (tablet landscape)
medium: [760, 0], //reasonable width to show a leaderboard (tablet portrait)
Expand Down

0 comments on commit 747e5f6

Please sign in to comment.