From 52e1dc83ffb0ccd8ac809dd1ac1d7d32749fc022 Mon Sep 17 00:00:00 2001 From: hdjvieira Date: Fri, 28 Jul 2017 11:54:44 +0100 Subject: [PATCH] Export getParameterByName method On Utils.js make getParameterByName method public --- modules/polluxBidAdapter.js | 14 ++------------ src/utils.js | 1 + 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/polluxBidAdapter.js b/modules/polluxBidAdapter.js index 2972bd597dd..bbc70122693 100644 --- a/modules/polluxBidAdapter.js +++ b/modules/polluxBidAdapter.js @@ -5,16 +5,6 @@ import adloader from 'src/adloader'; import adaptermanager from 'src/adaptermanager'; import { STATUS } from 'src/constants'; -// get parameters -var getParameterByName = function (name) { - var regexS = '[\\?&]' + name + '=([^&#]*)'; - var regex = new RegExp(regexS); - var results = regex.exec(window.location.search); - if (results === null) { - return ''; - } - return decodeURIComponent(results[1].replace(/\+/g, ' ')); -}; // Prebid adapter for Pollux header bidding client function polluxBidAdapter() { function _callBids(params) { @@ -25,8 +15,8 @@ function polluxBidAdapter() { var bid = bids[i]; // check params if (bid.params.zone) { - var domain = getParameterByName('domain'); - var tracker2 = getParameterByName('tracker2'); + var domain = utils.getParameterByName('domain'); + var tracker2 = utils.getParameterByName('tracker2'); if (domain) { request_obj.domain = domain; } else { diff --git a/src/utils.js b/src/utils.js index 14f9c58f3dd..8ed3115cd06 100644 --- a/src/utils.js +++ b/src/utils.js @@ -266,6 +266,7 @@ var getParameterByName = function (name) { return decodeURIComponent(results[1].replace(/\+/g, ' ')); }; +exports.getParameterByName = getParameterByName; /** * This function validates paramaters.