Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function chooseAdslotDef( adslot, origReq ) {
- let w = origReq.innerWidth; // current window inner width
- let h = origReq.innerHeight; // current window inner height
- let defs = adslot.dfpDefs || [];
- for ( let i=0; i<defs.length; i++ ) {
- let conds = defs[i].conds || [];
- let minHeight = conds.minHeight || -1;
- let maxHeight = conds.maxHeight || Infinity;
- let minWidth = conds.minWidth || -1;
- let maxWidth = conds.maxWidth || Infinity;
- if ( w >= minWidth && w <= maxWidth && h>=minHeight && h<=maxHeight ) {
- return {
- adUnitPath: defs[i].path,
- sizes: defs[i].sizes,
- divId: adslot.elemId
- };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement