Comments (1)
<!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); }
}
<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>
</script>
<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 (12)
- @blakedavide
- Animeworld
- Markétka novakova
- La cultura y el respeto ajeno es la paz ✌👨👩👧👦👩👩👦👦👭👨👧👦👩🏻🤝🧑🏾📝
- > Someone has been causing problems with my computer
- Need help! HOT 2
- G pay HOT 1
- I can't install ooredoo Maldives application HOT 1
- Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). HOT 1
- ฉันกำลังแบ่งปัน 'tp_debug_info.txt' กับคุณจาก WPS Office=
- Google HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from .github.