Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function chooseAdslotDef( adslot, origReq ) {
  2.   let w = origReq.innerWidth;     // current window inner width
  3.   let h = origReq.innerHeight;    // current window inner height
  4.   let defs = adslot.dfpDefs || [];
  5.   for ( let i=0; i<defs.length; i++ ) {
  6.     let conds = defs[i].conds || [];
  7.     let minHeight = conds.minHeight || -1;
  8.     let maxHeight = conds.maxHeight || Infinity;
  9.     let minWidth  = conds.minWidth || -1;
  10.     let maxWidth  = conds.maxWidth || Infinity;
  11.     if ( w >= minWidth && w <= maxWidth && h>=minHeight && h<=maxHeight ) {
  12.       return {
  13.         adUnitPath: defs[i].path,
  14.         sizes: defs[i].sizes,
  15.         divId: adslot.elemId
  16.       };
  17.     }
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement