Skip to content

Commit

Permalink
Justpremium Adapter bugfix (#1716)
Browse files Browse the repository at this point in the history
* Justpremium adapter and unit tests.

* Fix test suit.

* Performance improvements.

* Changes requested in pull request review.

* Register justpremium adapter in adaptermanager

* pass through bid from request

* fix linting errors

* Load polyfills for older browsers

* Load polyfills if older browser

* Remove package-lock.json
  • Loading branch information
mkalafior authored and Matt Kendall committed Oct 20, 2017
1 parent a7a73fd commit be21952
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/justpremiumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const JustpremiumAdapter = function JustpremiumAdapter() {
return null;
}

function isOldBrowser() {
const isPromisse = typeof Promise !== 'undefined' && Promise.toString().indexOf('[native code]') !== -1;
const isWeakMap = typeof WeakMap !== 'undefined' && WeakMap.toString().indexOf('[native code]') !== -1;
return (!Array.prototype.find || !Array.prototype.sort || !Array.prototype.map || !Array.prototype.filter || !Array.prototype.keys || !isPromisse || !isWeakMap);
}

function setupVar() {
d = top.document;
jPAM = top.jPAM = top.jPAM || window.jPAM || {};
Expand All @@ -58,7 +64,7 @@ const JustpremiumAdapter = function JustpremiumAdapter() {
server: null
};
const libVer = readCookie('jpxhbjs') || null;
toLoad = dConfig.toLoad || [d.location.protocol + '//cdn-cf.justpremium.com/js/' + (libVer ? libVer + '/' : '') + 'jpx.js'];
toLoad = dConfig.toLoad || [d.location.protocol + '//cdn-cf.justpremium.com/js/' + (libVer ? libVer + '/' : '') + (isOldBrowser() ? 'jpxp.js' : 'jpx.js')];
server = dConfig.server || d.location.protocol + '//pre.ads.justpremium.com/v/1.4';
}

Expand Down Expand Up @@ -114,7 +120,6 @@ const JustpremiumAdapter = function JustpremiumAdapter() {
return rec.length ? rec.pop() : false;
}
}

return false;
}

Expand Down

0 comments on commit be21952

Please sign in to comment.