-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add prebid-ads redirect #190 AG-12558
Merge in ADGUARD-FILTERS/scriptlets from fix/AG-12558 to release/v1.6 Squashed commit of the following: commit b89b88b Merge: 68813a6 7f8bebf Author: Stanislav A <s.atroschenko@adguard.com> Date: Fri Feb 18 16:36:56 2022 +0300 Merge branch 'release/v1.6' into fix/AG-12558 commit 68813a6 Author: Stanislav A <s.atroschenko@adguard.com> Date: Fri Feb 18 13:43:28 2022 +0300 update compatibility-table commit 13cc688 Author: Stanislav A <s.atroschenko@adguard.com> Date: Fri Feb 18 13:15:15 2022 +0300 description fix commit 9e7e637 Author: Stanislav A <s.atroschenko@adguard.com> Date: Fri Feb 18 12:59:57 2022 +0300 rename redirect commit 6181870 Author: Stanislav A <s.atroschenko@adguard.com> Date: Thu Feb 17 17:13:39 2022 +0300 add constant-detection-stubs redirect
- Loading branch information
1 parent
7f8bebf
commit c55dfb2
Showing
6 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* eslint-disable func-names */ | ||
import { hit } from '../helpers'; | ||
|
||
/** | ||
* @redirect prebid-ads | ||
* | ||
* @description | ||
* Sets predefined constants on a page: | ||
* - `canRunAds`: `true` | ||
* - `isAdBlockActive`: `false` | ||
* | ||
* **Example** | ||
* ``` | ||
* ||playerdrive.me/assets/js/prebid-ads.js$script,redirect=prebid-ads | ||
* ``` | ||
*/ | ||
export function prebidAds(source) { | ||
window.canRunAds = true; | ||
window.isAdBlockActive = false; | ||
|
||
hit(source); | ||
} | ||
|
||
prebidAds.names = [ | ||
'prebid-ads', | ||
'ubo-prebid-ads.js', | ||
'prebid-ads.js', | ||
]; | ||
|
||
prebidAds.injections = [hit]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* eslint-disable no-underscore-dangle */ | ||
import { runRedirect, clearGlobalProps } from '../helpers'; | ||
|
||
const { test, module } = QUnit; | ||
const name = 'prebid-ads'; | ||
|
||
const changingProps = ['hit', '__debug']; | ||
|
||
const beforeEach = () => { | ||
window.__debug = () => { | ||
window.hit = 'FIRED'; | ||
}; | ||
}; | ||
|
||
const afterEach = () => { | ||
clearGlobalProps(...changingProps); | ||
}; | ||
|
||
module(name, { beforeEach, afterEach }); | ||
|
||
test('constants are set', (assert) => { | ||
runRedirect(name); | ||
|
||
assert.true(window.canRunAds, 'window.canRunAds created'); | ||
assert.false(window.isAdBlockActive, 'Piwik.isAdBlockActive created'); | ||
|
||
assert.strictEqual(window.hit, 'FIRED', 'hit function was executed'); | ||
}); |