From d6e5abe8d15e8074e2c6d35753959a133eb421b9 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Thu, 4 Aug 2022 10:53:02 -0400 Subject: [PATCH] Various files: clean up unneeded code (#8778) * Update example2.js * Update example.js * Update config.js * Update freewheel-sspBidAdapter.js * Update browsiRtdProvider.js * Update consentManagementUsp.js * Update synacormediaBidAdapter.js * Update trustpidSystem.js * Update tappxBidAdapter.js * Update nobidBidAdapter.js * Update visxBidAdapter.js * Update remote.html * Update prebidServer_example.html * Update openxBidAdapter.js * Update fintezaAnalyticsAdapter.js * Update postbid-config.js * Update postbid-config.js * Update fintezaAnalyticsAdapter.js * Update 1plusXRtdProviderExample.html * Update prebidServer_example.html * Update blueconicRtdProvider_example.html * Update hadronRtdProvider_example.html * Update airgridRtdProvider_example.html * Update userId_example.html * Update inskin_example.html * Update serverbidServer_example.html * Update postbid-config.js --- integrationExamples/gpt/1plusXRtdProviderExample.html | 6 ++---- .../gpt/airgridRtdProvider_example.html | 5 +---- integrationExamples/gpt/amp/remote.html | 2 +- .../gpt/blueconicRtdProvider_example.html | 6 ++---- integrationExamples/gpt/hadronRtdProvider_example.html | 4 +--- integrationExamples/gpt/inskin_example.html | 4 +--- integrationExamples/gpt/prebidServer_example.html | 4 +--- integrationExamples/gpt/serverbidServer_example.html | 4 +--- integrationExamples/gpt/userId_example.html | 4 +--- integrationExamples/postbid/oas/postbid-config.js | 10 +++++----- .../analyticsAdapter/examples/libraries/example.js | 4 ++-- .../analyticsAdapter/examples/libraries/example2.js | 4 ++-- modules/browsiRtdProvider.js | 4 ++-- modules/consentManagementUsp.js | 2 +- modules/fintezaAnalyticsAdapter.js | 2 +- modules/freewheel-sspBidAdapter.js | 2 +- modules/nobidBidAdapter.js | 2 +- modules/openxBidAdapter.js | 2 -- modules/synacormediaBidAdapter.js | 2 +- modules/tappxBidAdapter.js | 4 ++-- modules/trustpidSystem.js | 2 +- modules/visxBidAdapter.js | 2 +- src/config.js | 2 +- 23 files changed, 32 insertions(+), 51 deletions(-) diff --git a/integrationExamples/gpt/1plusXRtdProviderExample.html b/integrationExamples/gpt/1plusXRtdProviderExample.html index 2eb75063df1..b2c7a0037ff 100644 --- a/integrationExamples/gpt/1plusXRtdProviderExample.html +++ b/integrationExamples/gpt/1plusXRtdProviderExample.html @@ -82,9 +82,7 @@ var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; - var useSSL = 'https:' == document.location.protocol; - gads.src = (useSSL ? 'https:' : 'http:') + - '//securepubads.g.doubleclick.net/tag/js/gpt.js'; + gads.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })(); @@ -109,4 +107,4 @@

1plusX RTD Module for Prebid

- \ No newline at end of file + diff --git a/integrationExamples/gpt/airgridRtdProvider_example.html b/integrationExamples/gpt/airgridRtdProvider_example.html index a8fd989f682..657eae8f481 100644 --- a/integrationExamples/gpt/airgridRtdProvider_example.html +++ b/integrationExamples/gpt/airgridRtdProvider_example.html @@ -108,10 +108,7 @@ var gads = document.createElement("script"); gads.async = true; gads.type = "text/javascript"; - var useSSL = "https:" == document.location.protocol; - gads.src = - (useSSL ? "https:" : "http:") + - "//www.googletagservices.com/tag/js/gpt.js"; + gads.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js'; var node = document.getElementsByTagName("script")[0]; node.parentNode.insertBefore(gads, node); })(); diff --git a/integrationExamples/gpt/amp/remote.html b/integrationExamples/gpt/amp/remote.html index 785d854766f..4ee2cdcb2f6 100644 --- a/integrationExamples/gpt/amp/remote.html +++ b/integrationExamples/gpt/amp/remote.html @@ -33,7 +33,7 @@ // load Prebid.js (function () { - var d = document, pbs = d.createElement("script"), pro = d.location.protocal; + var d = document, pbs = d.createElement("script"); pbs.type = "text/javascript"; pbs.src = prebidSrc; var target = document.getElementsByTagName("head")[0]; diff --git a/integrationExamples/gpt/blueconicRtdProvider_example.html b/integrationExamples/gpt/blueconicRtdProvider_example.html index e51a54b3be6..598a7569d8e 100644 --- a/integrationExamples/gpt/blueconicRtdProvider_example.html +++ b/integrationExamples/gpt/blueconicRtdProvider_example.html @@ -30,7 +30,7 @@ var pbjs = pbjs || {}; pbjs.que = pbjs.que || []; - + - \ No newline at end of file + diff --git a/libraries/analyticsAdapter/examples/libraries/example.js b/libraries/analyticsAdapter/examples/libraries/example.js index 0d758fd5513..f2bfd612193 100644 --- a/libraries/analyticsAdapter/examples/libraries/example.js +++ b/libraries/analyticsAdapter/examples/libraries/example.js @@ -31,8 +31,8 @@ events.init(); // overwrite example object and handle 'on' callbacks window[window.ExampleAnalyticsGlobalObject] = example = utils.errorless(function() { if (arguments[0] && arguments[0] === 'on') { - var eventName = arguments[1] && arguments[1]; - var args = arguments[2] && arguments[2]; + var eventName = arguments[1]; + var args = arguments[2]; if (eventName && args) { if (eventName === 'bidAdjustment') { pbjsHandlers.onBidAdjustment.apply(this, [args]); diff --git a/libraries/analyticsAdapter/examples/libraries/example2.js b/libraries/analyticsAdapter/examples/libraries/example2.js index 68e814b1417..9a7106a48e0 100644 --- a/libraries/analyticsAdapter/examples/libraries/example2.js +++ b/libraries/analyticsAdapter/examples/libraries/example2.js @@ -31,8 +31,8 @@ events.init(); // overwrite example object and handle 'on' callbacks window[window.ExampleAnalyticsGlobalObject2] = example = utils.errorless(function() { if (arguments[0] && arguments[0] === 'on') { - var eventName = arguments[1] && arguments[1]; - var args = arguments[2] && arguments[2]; + var eventName = arguments[1]; + var args = arguments[2]; if (eventName && args) { if (eventName === 'bidAdjustment') { pbjsHandlers.onBidAdjustment.apply(this, [args]); diff --git a/modules/browsiRtdProvider.js b/modules/browsiRtdProvider.js index 15f2d58010d..ffc946cbb33 100644 --- a/modules/browsiRtdProvider.js +++ b/modules/browsiRtdProvider.js @@ -93,7 +93,7 @@ export function collectData() { function waitForData(callback) { if (_browsiData) { _dataReadyCallback = null; - callback(_browsiData); + callback(); } else { _dataReadyCallback = callback; } @@ -102,7 +102,7 @@ function waitForData(callback) { export function setData(data) { _browsiData = data; if (isFn(_dataReadyCallback)) { - _dataReadyCallback(_browsiData); + _dataReadyCallback(); _dataReadyCallback = null; } } diff --git a/modules/consentManagementUsp.js b/modules/consentManagementUsp.js index 0224d6ef2c0..cde32a2f1c0 100644 --- a/modules/consentManagementUsp.js +++ b/modules/consentManagementUsp.js @@ -44,7 +44,7 @@ function lookupUspConsent({onSuccess, onError}) { let uspapiFrame; let uspapiFunction; - while (!uspapiFrame) { + while (true) { try { if (typeof f.__uspapi === 'function') { uspapiFunction = f.__uspapi; diff --git a/modules/fintezaAnalyticsAdapter.js b/modules/fintezaAnalyticsAdapter.js index 7b1b2f69364..88c5f85f15d 100644 --- a/modules/fintezaAnalyticsAdapter.js +++ b/modules/fintezaAnalyticsAdapter.js @@ -181,7 +181,7 @@ function initSession() { !checkSessionByExpires() || !checkSessionByReferer() || !checkSessionByDay()) { - sessionId = '' + timestamp + getRandAsStr(SESSION_RAND_PART); + sessionId = '' + timestamp + getRandAsStr(SESSION_RAND_PART); // lgtm [js/insecure-randomness] begin = timestamp; isNew = true; diff --git a/modules/freewheel-sspBidAdapter.js b/modules/freewheel-sspBidAdapter.js index 91453fdcf5d..38973f915b6 100644 --- a/modules/freewheel-sspBidAdapter.js +++ b/modules/freewheel-sspBidAdapter.js @@ -189,7 +189,7 @@ function formatAdHTML(bid, size) { var libUrl = ''; if (integrationType && integrationType !== 'inbanner') { libUrl = PRIMETIME_URL + getComponentId(bid.params.format) + '.min.js'; - script = getOutstreamScript(bid, size); + script = getOutstreamScript(bid); } else { libUrl = MUSTANG_URL; script = getInBannerScript(bid, size); diff --git a/modules/nobidBidAdapter.js b/modules/nobidBidAdapter.js index cfe18301b32..877afb08293 100644 --- a/modules/nobidBidAdapter.js +++ b/modules/nobidBidAdapter.js @@ -30,7 +30,7 @@ function nobidBuildRequests(bids, bidderRequest) { var serializeState = function(divIds, siteId, adunits) { var filterAdUnitsByIds = function(divIds, adUnits) { var filtered = []; - if (!divIds || !divIds.length) { + if (!divIds.length) { filtered = adUnits; } else if (adUnits) { var a = []; diff --git a/modules/openxBidAdapter.js b/modules/openxBidAdapter.js index 7bea38a2de3..251e6fb50e3 100644 --- a/modules/openxBidAdapter.js +++ b/modules/openxBidAdapter.js @@ -213,13 +213,11 @@ function getViewportDimensions(isIfr) { } catch (e) { return; } - docEl = tDoc.documentElement; body = tDoc.body; width = tWin.innerWidth || docEl.clientWidth || body.clientWidth; height = tWin.innerHeight || docEl.clientHeight || body.clientHeight; } else { - docEl = tDoc.documentElement; width = tWin.innerWidth || docEl.clientWidth; height = tWin.innerHeight || docEl.clientHeight; } diff --git a/modules/synacormediaBidAdapter.js b/modules/synacormediaBidAdapter.js index a48c1aaf55b..845d6b4b5fb 100644 --- a/modules/synacormediaBidAdapter.js +++ b/modules/synacormediaBidAdapter.js @@ -101,7 +101,7 @@ export const spec = { }); // CCPA - if (bidderRequest && bidderRequest.uspConsent) { + if (bidderRequest.uspConsent) { deepSetValue(openRtbBidRequest, 'regs.ext.us_privacy', bidderRequest.uspConsent); } diff --git a/modules/tappxBidAdapter.js b/modules/tappxBidAdapter.js index fd038f3104e..b8f7a5559f8 100644 --- a/modules/tappxBidAdapter.js +++ b/modules/tappxBidAdapter.js @@ -406,9 +406,9 @@ function buildOneRequest(validBidRequests, bidderRequest) { (typeof uuid !== 'undefined' && uuid !== null) && (typeof uuid.source == 'string' && uuid.source !== null) && (typeof uuid.uids[0].id == 'string' && uuid.uids[0].id !== null) - ) + ); - if (typeof user !== 'undefined') { user.ext.eids = eidsArr } + user.ext.eids = eidsArr; }; let regs = {}; diff --git a/modules/trustpidSystem.js b/modules/trustpidSystem.js index 27ca4bf6340..fc2bab19913 100644 --- a/modules/trustpidSystem.js +++ b/modules/trustpidSystem.js @@ -84,7 +84,7 @@ function getTrustpidFromStorage() { logInfo(`${LOG_PREFIX}: Domain acronym found: ${acronym}`); // Domain is correct in both local storage and idGraph, but no acronym is existing for the domain - if (domain && !acronym) { + if (!acronym) { return { trustpid: null, acr: null diff --git a/modules/visxBidAdapter.js b/modules/visxBidAdapter.js index cec48a83c35..ee4d9708f15 100644 --- a/modules/visxBidAdapter.js +++ b/modules/visxBidAdapter.js @@ -375,7 +375,7 @@ function _isAdSlotExists(adUnitCode) { } const gptAdSlot = getGptSlotInfoForAdUnitCode(adUnitCode); - if (gptAdSlot && gptAdSlot.divId && document.getElementById(gptAdSlot.divId)) { + if (gptAdSlot.divId && document.getElementById(gptAdSlot.divId)) { return true; } diff --git a/src/config.js b/src/config.js index a50edc09221..30ab8f35e2c 100644 --- a/src/config.js +++ b/src/config.js @@ -526,7 +526,7 @@ export function newConfig() { } const mergedConfig = Object.keys(obj).reduce((accum, key) => { - const prevConf = _getConfig(key)[key] || {}; + const prevConf = _getConfig()[key] || {}; accum[key] = mergeDeep(prevConf, obj[key]); return accum; }, {});