Giter Site home page Giter Site logo

/#goog_rewarded about .github HOT 1 CLOSED

google avatar google commented on May 3, 2024
/#goog_rewarded

from .github.

Comments (1)

malipor160 avatar malipor160 commented on May 3, 2024
<iframe frameborder="0" style="overflow:hidden;height:50%;width:100%" height="100%" width="100%" src="https://www.appcreator24.com/intra/app_sec_game_preview.php?idioma=en&idsesion=7criupg8todneq4bkl3v5y09mfw26jsa1zxh&idg=9&ckp=gmzp2f6nbrecy4lkj1qoh37u9d5wtxa">

<!doctype html>

<title>نمونه تبلیغ پاداش</title> <script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> <script> googletag = window.googletag | | {cmd: []}; ``` var rewardedSlot; googletag.cmd.push(function() { rewardedSlot = googletag.defineOutOfPageSlot( '/22904734271/rewarded_web_example', googletag.enums.OutOfPageFormat.REWARDED);
// Slot returns null if the page or device does not support rewarded ads.
if (rewardedSlot) {
  rewardedSlot.addService(googletag.pubads());

  googletag.pubads().addEventListener('rewardedSlotReady', function(event) {
    document.getElementById('watchAdButton').onclick = function() {
      event.makeRewardedVisible();
      displayModal();
    }

    displayModal('reward', 'Watch an ad to receive a special reward?');
  });

  googletag.pubads().addEventListener('rewardedSlotClosed', dismissRewardedAd);

  googletag.pubads().addEventListener('rewardedSlotGranted', function(event) {
    // Automatically close the ad by destroying the slot.
    // Remove this to force the user to close the ad themselves.
    dismissRewardedAd();

    var reward = event.payload;
    displayModal('grant', 'You have been rewarded ' + reward.amount + ' '
                                                    + reward.type + '!');
  });

  googletag.enableServices();
  googletag.display(rewardedSlot);
}

});

function dismissRewardedAd() {
displayModal();
googletag.destroySlots([rewardedSlot]);
}

function displayModal(type, message) {
var modal = document.getElementById('modal');
modal.removeAttribute('data-type');

if (type) {
  document.getElementById('modalMessage').textContent = message;
  modal.setAttribute('data-type', type);
}

}
</script>

<style> .modal { display: none; position: fixed; z-index: 1; padding-top: 300px; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.4); } .modal[data-type] { display: block; } .modalDialog { margin: auto; padding: 25px; background-color: white; text-align: center; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); } .grantButtons, .rewardButtons { display: none; } .modal[data-type='grant'] .grantButtons, .modal[data-type='reward'] .rewardButtons { display: block; } .modal input[type="button"] { padding: .5rem; background: blue; border: none; border-radius: 4px; margin: 4px; color: white; } </style>

<span class="grantButtons">
  <input type="button" onclick="dismissRewardedAd();" value="Close" />
</span>

<span class="rewardButtons">
  <input type="button" id="watchAdButton" value="Yes" />
  <input type="button" onclick="dismissRewardedAd();" value="No" />
</span>

from .github.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.