Skip to content

Commit

Permalink
Add gamepad api permission workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
aglitchman committed Jan 30, 2024
1 parent 2c6df5c commit 95dbc2e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions playable_ad/manifests/web/engine_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,15 @@
<script id="engine-loader" src="dmloader.js" embed="compress"></script>
<script data-src="{{exe-name}}_archive.js" embed></script>
<script id="engine-setup" type="text/javascript">
// TEMPORARY WORKAROUND FOR THE DEFOLD ISSUE 8479
navigator.getGamepads = null;
navigator.webkitGetGamepads = null;
//

// The playable ad verification system of ad platforms requires the target URL to be exposed directly in the JS code.
// So we have to place `mraid.open()` and `FbPlayableAd.onCTAClick()` in this function.
function doClick() {
if (window.FbPlayableAd) {
if (typeof FbPlayableAd !== "undefined") {
// If the advert is running on Facebook, we have to call this function on click:
FbPlayableAd.onCTAClick();
} else if (window.mraid) {
Expand Down Expand Up @@ -299,7 +304,7 @@
startGame();
}

if (typeof DefMraid !== 'undefined') {
if (typeof DefMraid !== "undefined") {
DefMraid.onViewableChange(viewable);
}
}
Expand Down

0 comments on commit 95dbc2e

Please sign in to comment.