Surat Perjanjian
Surat Perjanjian
Surat Perjanjian
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
if (window.pokktOMIDBridge === undefined ||
window.pokktOMIDBridge.videoEvents === undefined) {
log.i('bridge or video-events not available');
return;
}
window.pokktOMIDBridge.videoEvents.midpoint();
});
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
for (var index = 0; index < events.length; index++) {
log.i('registering listner for ' + events[index]);
this.player.ima.addEventListener(events[index],
this.onAdEvent.bind(this));
}
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
<!-- Pokkt Specific -->
<script type="text/javascript">
//alert('hi!');
window.name = "pokkt_video_window";
log.i('window name: ' + window.name);
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
/**
* mraid functionalities
**/
(function() {
if (console.oldLog === undefined) {
console.oldLog = console.log;
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getScreenSize = function() {
log.i("mraid.getScreenSize: " + screenSize.width + " x " +
screenSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireLocationChangeEvent = function(lat, lon, type, accuracy, lastfix,
ipservice) {
log.i("mraid.fireLocationChangeEvent, lat: " + lat + " lon: " + lon + "
type: " + type +
" accuracy: " + accuracy + " lastfix: " + lastfix +
" ipservice: " + ipservice);
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
/**
* mraid functionalities
**/
(function() {
if (console.oldLog === undefined) {
console.oldLog = console.log;
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
bridge.setCurrentAppOrientation = function(orientation, locked) {
currentAppOrientation.orientation = orientation;
currentAppOrientation.locked = locked;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getScreenSize = function() {
log.i("mraid.getScreenSize: " + screenSize.width + " x " +
screenSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
1560493059918 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1560493059919 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1560493062676 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1560493062676 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1560493066103 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1560493066103 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1560493069597 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1560493069614 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1560493069615 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1560493070444 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1560493070445 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1560493070447 com.zapak.littlekrishnarunner Impressions: {} [com.pokkt.a.g@11b21c6,
com.pokkt.a.g@1fbe587]
1560493070920 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1560493070921 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1561377277963 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1561377277997 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 01 : Problem connecting to the
internet. Please Check your Internet connection.
at com.pokkt.sdk.utils.l.a(Unknown Source:48)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1564196387837 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196387838 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
1564196403417 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196403417 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
1564196412226 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196412228 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196412781 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196412783 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
1564196416412 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196416412 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196417126 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196417127 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
/**
* mraid functionalities
**/
(function() {
if (console.oldLog === undefined) {
console.oldLog = console.log;
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
var properties = {};
properties.allowOrientationChange =
orientationProperties.allowOrientationChange;
properties.forceOrientation = orientationProperties.forceOrientation;
return properties;
};
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getScreenSize = function() {
log.i("mraid.getScreenSize: " + screenSize.width + " x " +
screenSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
mraid.removeEventListener = function(event, listener) {
log.i("mraid.removeEventListener for event: " + event);
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
/**
* mraid functionalities
**/
(function() {
if (console.oldLog === undefined) {
console.oldLog = console.log;
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
//\\//\\//\\//\\//\\//\\//\\// BRIDGE \\//\\//\\//\\//\\//\\//\\//\\
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
resizeUtil.isRectContained = function(containingRect, containedRect) {
log.d("isRectContained");
resizeUtil.printRect("containingRect", containingRect);
resizeUtil.printRect("containedRect", containedRect);
return (containedRect.x >= containingRect.x &&
(containedRect.x + containedRect.width) <= (containingRect.x +
containingRect.width) &&
containedRect.y >= containingRect.y &&
(containedRect.y + containedRect.height) <= (containingRect.y +
containingRect.height));
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
var allValidators = mraidUtils.allValidators = {
"setExpandProperties": {
"width" : function(width) {
return !isNaN(width);
},
"height" : function(height) {
return !isNaN(height);
},
"useCustomClose" : function(useCustomClose) {
if (VERSION === "3.0")
return true; // ignoring in case of MRAID 3
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getScreenSize = function() {
log.i("mraid.getScreenSize: " + screenSize.width + " x " +
screenSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
// ensure service or provider used to determine geolocation from IP address
(i.e., type = 2)
if (locationData.type == 2 && !ipservice) {
log.e("invalid location data!");
broadcastEvent(EVENTS.ERROR, "invalid location data!", "getLocation");
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
var resizeRect = {};
resizeRect.x = defaultPosition.x + properties.offsetX;
resizeRect.y = defaultPosition.y + properties.offsetY;
resizeRect.width = properties.width;
resizeRect.height = properties.height;
resizeUtil.printRect("resizeRect", resizeRect);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
if (eventListeners[event] && eventListeners[event].count === 0) {
eventListeners[event] = null;
delete eventListeners[event];
}
};
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
1564196424685 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196424685 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
/**
* mraid functionalities
**/
(function() {
if (console.oldLog === undefined) {
console.oldLog = console.log;
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
var SUPPORTED_FEATURES = mraid.SUPPORTED_FEATURES = {
"SMS" : "sms",
"TEL" : "tel",
"CALENDAR" : "calendar",
"STOREPICTURE" : "storePicture",
"INLINEVIDEO" : "inlineVideo",
"VPAID" : "vpaid",
"LOCATION" : "location"
};
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
if (width !== previousSize.width || height !== previousSize.height) {
mraid.fireSizeChangeEvent(width, height);
}
};
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getScreenSize = function() {
log.i("mraid.getScreenSize: " + screenSize.width + " x " +
screenSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
log.i("mraid object is ready!");
} ());
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
1564196437918 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196437919 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196441065 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196441066 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196441118 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196441119 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196444215 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196444216 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196447237 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196447238 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196450325 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196450327 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196450367 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196450368 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196450687 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1564196456119 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196456120 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196462302 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196462303 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196462307 com.zapak.littlekrishnarunner executing d...
1564196462321 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196462323 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196463243 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564196463245 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
1564196463873 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1564205246099 com.zapak.littlekrishnarunner
Address[addressLines=[0:"Indonesia"],feature=Indonesia,admin=null,sub-
admin=null,locality=null,thoroughfare=null,postalCode=null,countryCode=ID,countryNa
me=Indonesia,hasLatitude=true,latitude=-
0.789275,hasLongitude=true,longitude=113.92132699999999,phone=null,url=null,extras=
null]
1564205246100 com.zapak.littlekrishnarunner
{"country":"Indonesia","countryCode":"ID"}
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
if (window.pokktOMIDBridge === undefined ||
window.pokktOMIDBridge.videoEvents === undefined) {
log.i('bridge or video-events not available');
return;
}
window.pokktOMIDBridge.videoEvents.complete();
});
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
ficationScripts);b=this.b;var c=a.impressionOwner;a=a.videoEventsOwner;bb(b)?
C('Impression event has occcured before the event owners have been registered.'):
(b.a.b!==c&&'none'===b.a.b&&
(b.a.b=c),b.a.a!==a&&'none'===b.a.a&&(b.a.a=a),gb(b,a))}};
h.P=function(a,b,c){var d;if(d=V(b))
{if(d=W(b.environment,pa)&&W(b.adSessionType,ma))d=b.omidNativeInfo,d=V(d)?
U(d.partnerName)&&U(d.partnerVersion):!1;d&&(d=b.app,d=V(d)?
U(d.libraryVersion)&&U(d.appId):!1)}d&&(this.a.adSessionId=a,a=b,b=this.a.c||
{},a.omidJsInfo=Object.assign({},b.omidJsInfo||{},a.omidJsInfo||
{}),b=a=Object.assign({},b,a),this.a.m||(this.a.g?
(b.videoElement=this.a.g,b.accessMode='full'):this.a.f&&(b.slotElement=this.a.f,b.a
ccessMode='full')),this.a.c=a,cb(this.b,c),this.c&&T(this.c))};
h.G=function(){db(this.b)};h.N=function(a)
{V(a)&&zb(a.x)&&zb(a.y)&&zb(a.width)&&zb(a.height)&&(this.a.v=a,jb(this.f,'containe
r'))};h.O=function(a){W(a,oa)&&(this.a.j=a,'backgrounded'===a?
jb(this.f,'container','backgrounded'):jb(this.f,'container'))};h.L=function(a)
{'impression'===a&&(this.D(),this.c&&T(this.c))};h.D=function()
{hb(this.b,'native')&&eb(this.b,'native')};h.error=function(a,b)
{W(a,la)&&Q(this.b,a,b)};
h.I=function(a,b){ib(this.b,'native')&&W(a,t)&&(void 0===b||
V(b))&&fb(this.b,a,'native',b)};h.M=function(a){if('none'!
==this.b.a.a&&'number'===typeof a&&!isNaN(a)){this.a.l=a;a=this.g;var b=a.a.B;null!
=b&&fb(a.b,'volumeChange','native',
{videoPlayerVolume:b,deviceVolume:a.a.l})}};X.prototype.startSession=X.prototype.P;
X.prototype.error=X.prototype.error;X.prototype.finishSession=X.prototype.G;X.proto
type.publishAdEvent=X.prototype.L;X.prototype.publishImpressionEvent=X.prototype.D;
X.prototype.publishVideoEvent=X.prototype.I;X.prototype.setNativeViewHierarchy=X.pr
ototype.N;X.prototype.setState=X.prototype.O;X.prototype.setDeviceVolume=X.prototyp
e.M;X.prototype.init=X.prototype.H;function Ab(a,b,c){var d=this;c=c?
c:v;this.b=a;this.a=b;this.i=c;this.h=new z;c.omid=c.omid||
{};c.omid.v1_SessionServiceCommunication=this.h;this.f=null;c&&c.addEventListener&&
c.postMessage&&(this.f=new
E(c));this.h.a=this.J.bind(this);this.f&&(this.f.a=this.K.bind(this));this.c=[];thi
s.g=!1;Bb(this,function(a){return Cb(d,a)})}function Bb(a,b){$a(a.b,b)}function
Db(a,b){P().f=b;a.a&&mb(a.a)}function Eb(a,b){P().g=b;a.a&&mb(a.a)}function Fb(a,b)
{P().i=b;a.a&&mb(a.a);a.a&&nb(a.a)}h=Ab.prototype;
h.error=function(a,b){Q(this.b,a,b)};function Gb(a)
{hb(a.b,'javascript')&&(eb(a.b,'javascript'),a.a&&T(a.a))}h.loaded=function(a){var
b={skippable:a.isSkippable,autoPlay:a.isAutoPlay,position:a.position};a.isSkippable
&&(b.skipOffset=a.skipOffset);fb(this.b,'loaded','javascript',b);this.a&&T(this.a)}
;h.start=function(a,b){Y(this,'start',
{duration:a,videoPlayerVolume:b});this.a&&T(this.a)};
function Hb(a){if(a.g&&a.c.length){var b=a.c;if(a.i&&'undefined'!==typeof
a.i.document)for(var c=P().m,d=0;d<b.length;d++){var
e=b[d],f=d,l=e.resourceUrl,g=a.i.document,m=g.createElement('iframe');c&&(m.sandbox
='allow-scripts');m.id='omid-verification-script-
frame-'+f;m.style.display='none';m.srcdoc='<html><head>'+('<script
type="text/javascript" src="'+l+'">\x3c/script>')
+'</head><body></body></html>';g.body.appendChild(m);f=e.vendorKey;e=e.verification
Parameters;f=void 0===f?'':f;e=void 0===e?'':
e;f&&'string'===typeof f&&''!==f&&e&&'string'===typeof e&&''!==e&&(a.b.f[f]=e)}else
C('OMID Session Client is not running within a window');a.c=[]}}function Ib(a){var
b=P().c.omidJsInfo;a(b.serviceVersion)}function Cb(a,b)
{'sessionStart'===b.type&&(a.g=!0,Hb(a));'sessionFinish'===b.type&&(a.g=!
1,Bb(a,function(b){return Cb(a,b)}))}function Jb(a,b,c){var d=P().c||
{};d.omidJsInfo=Object.assign({},d.omidJsInfo,
{sessionClientVersion:a,partnerName:b,partnerVersion:c});P().c=d}
function Y(a,b,c){'javascript'===P().a&&fb(a.b,b,'javascript',c)}h.K=function(a,b)
{Kb(this,a,b,this.f)};h.J=function(a,b){Kb(this,a,b,this.h)};
function Kb(a,b,c,d){function e(a){for(var b=[],e=0;e<arguments.length;++e)b[e-
0]=arguments[e];b=new u(f,'response',g,ia(g)&&ja(g)?
b:JSON.stringify(b));d.sendMessage(b,c)}var
f=b.b,l=b.method,g=b.version;b=ka(g,b.a);try{switch(l){case
'SessionService.registerAdEvents':hb(a.b,'javascript');break;case
'SessionService.registerVideoEvents':ib(a.b,'javascript');break;case
'SessionService.registerSessionObserver':Bb(a,e);break;case
'SessionService.setSlotElement':var m=p(b).next().value;Db(a,m);break;case
'SessionService.setVideoElement':var N=
p(b).next().value;Eb(a,N);break;case 'SessionService.setElementBounds':var
x=p(b).next().value;Fb(a,x);break;case
'SessionService.impressionOccurred':Gb(a);break;case 'SessionService.loaded':var
A=p(b).next().value;a.loaded(A);break;case 'SessionService.start':var
G=p(b),H=G.next().value,B=G.next().value;a.start(H,B);break;case
'SessionService.firstQuartile':Y(a,'firstQuartile');break;case
'SessionService.midpoint':Y(a,'midpoint');break;case
'SessionService.thirdQuartile':Y(a,'thirdQuartile');break;
case 'SessionService.complete':Y(a,'complete');break;case
'SessionService.pause':Y(a,'pause');break;case
'SessionService.resume':Y(a,'resume');break;case
'SessionService.bufferStart':Y(a,'bufferStart');break;case
'SessionService.bufferFinish':Y(a,'bufferFinish');break;case
'SessionService.skipped':Y(a,'skipped');break;case
'SessionService.volumeChange':var w=p(b).next().value;Y(a,'volumeChange',
{videoPlayerVolume:w});break;case 'SessionService.playerStateChange':var
va=p(b).next().value;Y(a,'playerStateChange',
{state:va});break;case 'SessionService.adUserInteraction':var
wa=p(b).next().value;Y(a,'adUserInteraction',{interactionType:wa});break;case
'SessionService.setClientInfo':var
R=p(b),xa=R.next().value,ya=R.next().value,y=R.next().value;Jb(xa,ya,y);Ib(e);break
;case 'SessionService.injectVerificationScriptResources':var
Rb=p(b).next().value;a.c.push.apply(a.c,[].concat(r(Rb)));Hb(a);break;case
'SessionService.sessionError':var
kb=p(b),Sb=kb.next().value,Tb=kb.next().value;a.error(Sb,Tb)}}catch(D)
{d.sendMessage(new u(f,
'error',g,'\n name: '+D.name+'\n message: '+D.message+'\n
filename: '+D.filename+'\n lineNumber: '+D.lineNumber+'\n
columnNumber: '+D.columnNumber+'\n stack: '+D.stack+'\n
toString(): '+D.toString()+'\n '),c)}};function Lb(a,b,c){c=c?
c:v;this.g=a;this.a=b;this.h={};this.f={};this.c=new z;c.omid=c.omid||
{};c.omid.v1_VerificationServiceCommunication=this.c;this.b=null;c&&c.addEventListe
ner&&c.postMessage&&(this.b=new
E(c));this.c.a=this.i.bind(this);this.b&&(this.b.a=this.j.bind(this))}function
Mb(a,b,c,d){ub(a.a,b,c,d)}function Nb(a,b,c,d){tb(a.a,'downloadJavaScriptResource')
(b,c,d)}Lb.prototype.j=function(a,b)
{this.b&&Ob(this,a,b,this.b)};Lb.prototype.i=function(a,b){Ob(this,a,b,this.c)};
function Ob(a,b,c,d){function e(a){for(var b=[],e=0;e<arguments.length;++e)b[e-
0]=arguments[e];b=new u(f,'response',g,ia(g)&&ja(g)?
b:JSON.stringify(b));d.sendMessage(b,c)}var
f=b.b,l=b.method,g=b.version;b=ka(g,b.a);try{switch(l){case
'VerificationService.addEventListener':var
m=p(b).next().value;Ya(a.g,m,e);break;case
'VerificationService.addSessionListener':var N=p(b).next().value;
$a(a.g,e,N);break;case 'VerificationService.sendUrl':var
x=p(b).next().value;Mb(a,x,function(){return e(!0)},function(){return e(!1)});
break;case 'VerificationService.setTimeout':var
A=p(b),G=A.next().value,H=A.next().value;a.h[G]=qb(a.a,'setTimeout')
(e,H);break;case 'VerificationService.clearTimeout':var
B=p(b).next().value;sb(a.a,a.h[B]);break;case 'VerificationService.setInterval':var
w=p(b),va=w.next().value,wa=w.next().value;a.f[va]=pb(a.a,e,wa);break;case
'VerificationService.clearInterval':var
R=p(b).next().value;rb(a.a,a.f[R]);break;case
'VerificationService.injectJavaScriptResource':var
xa=p(b).next().value;Nb(a,xa,function(a){return e(!0,
a)},function(){return e(!1)});break;case
'VerificationService.getVersion':p(b).next();var
ya=P().c.omidJsInfo;e(ya.serviceVersion)}}catch(y){d.sendMessage(new
u(f,'error',g,'\n name: '+y.name+'\n message:
'+y.message+'\n filename: '+y.filename+'\n lineNumber:
'+y.lineNumber+'\n columnNumber: '+y.columnNumber+'\n
stack: '+y.stack+'\n toString(): '+y.toString()+'\n
'),c)}};var Z=new Ta,Pb=new function(){var a;this.a=a=void 0===a?omidGlobal:a};new
Lb(Z,Pb);var Qb=new function(){var a=new Na;this.c=Z;this.b=a;this.a=P()},Ub=v?
v.IntersectionObserver?new xb(v,Qb,Z):new vb(v,Qb,Pb,Z):null;new
Ab(Z,Ub);v.omidBridge=new X(Z,Qb,new function(){var a=P();this.b=Z;this.a=a},new
function(){},Ub);if(v.frames&&v.document&&!('omid_v1_present'in v.frames)){var
Vb;if(Vb=!v.document.body)Vb='MutationObserver'in v;Vb?za():v.document.body?
ua(v):v.document.write('<iframe style="display:none" id="omid_v1_present"
name="omid_v1_present"></iframe>')};
}).call(this, this);
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
if (window.pokktOMIDBridge === undefined ||
window.pokktOMIDBridge.videoEvents === undefined) {
log.i('bridge or video-events not available');
return;
}
window.pokktOMIDBridge.videoEvents.complete();
});
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
1564205253137 com.zapak.littlekrishnarunner
{"pin":"94973","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bungku Tengah","locality":"Bente","area":"Kabupaten Morowali"}
1564205253143 com.zapak.littlekrishnarunner hashKey id b4aeba42-c5cc-4c06-9e1a-
084193c4563815642052531420547cf5a09036891b7a40525fcfdcacc
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getScreenSize = function() {
log.i("mraid.getScreenSize: " + screenSize.width + " x " +
screenSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
1564206268287 com.zapak.littlekrishnarunner
{"pin":"94973","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bungku Tengah","locality":"Bente","area":"Kabupaten Morowali"}
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
PokktIMAWrapper.prototype.initWithAdTag = function(adTag, isAdTagAUrl) {
log.i('initializing ima...');
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
1564206269853 com.zapak.littlekrishnarunner
{"pin":"94973","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bungku Tengah","locality":"Bente","area":"Kabupaten Morowali"}
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
var resizeRect = {};
resizeRect.x = defaultPosition.x + properties.offsetX;
resizeRect.y = defaultPosition.y + properties.offsetY;
resizeRect.width = properties.width;
resizeRect.height = properties.height;
resizeUtil.printRect("resizeRect", resizeRect);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
if (eventListeners[event] && eventListeners[event].count === 0) {
eventListeners[event] = null;
delete eventListeners[event];
}
};
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
// function injectScript() {
// var Android = {};
// function closeInterstitial() {
// setTimeout(function() {
// window.location = 'pokkt://closeInterstitial';
// }, 1000);
// };
// function gratifyInterstitial() {
// window.location = 'pokkt://gratifyInterstitial';
// };
// Android.closeInterstitial = closeInterstitial;
// Android.gratifyInterstitial = gratifyInterstitial;
// window.Android = Android;
// }
// injectScript();
</script>
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
'controls':false,
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('vpaid.AdVideoStart', function(e) {
log.i('window.pokktOMIDBridge start');
player.on('vpaid.AdVideoFirstQuartile', function(e) {
log.i('window.pokktOMIDBridge first quartile');
player.on('vpaid.AdVideoMidpoint', function(e) {
log.i('window.pokktOMIDBridge midpoint');
player.on('vpaid.AdVideoThirdQuartile', function(e) {
log.i('window.pokktOMIDBridge third quartile');
player.on('vpaid.AdVideoComplete', function(e) {
log.i('window.pokktOMIDBridge complete');
player.on('vpaid.AdSkipped', function(e) {
log.i('window.pokktOMIDBridge skipped');
player.on('vpaid.AdPaused', function(e) {
log.i('window.pokktOMIDBridge paused');
player.on('vpaid.AdPlaying', function(e) {
log.i('window.pokktOMIDBridge resumed');
player.on('vpaid.AdVolumeChange', function(e) {
log.i('window.pokktOMIDBridge volume changed');
window.pokktOMIDBridge.videoEvents.volumeChange(videoPlayerVolume);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
// setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
1564206274779 com.zapak.littlekrishnarunner Successfully downloaded VPAID HTML
1571638078982 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
this.player.ima.initializeAdDisplayContainer();
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
log.i('notifying omid wrapper ready...');
pokktNativeBridge.notifyNative('omWrapperReady');
};
} ());
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
<style>
.vjs-default-skin.vjs-paused .vjs-big-play-button
{
display: none;
}
.video-js .vjs-control-bar
{
background-color: rgba(43, 51, 63, 0);
}
/* .video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-
horizontal
{
display: none;
} */
/* .vjs-default-skin.vjs-paused .vjs-control-bar
{
display: block;
} */
</style>
</head>
<body>
<div class="pokkt-video-container" id="pokkt-video-container"
style="opacity:100">
<video id="pokkt-video-ad" class="video-js vjs-default-skin vjs-16-9"
controls webkit-playsinline playsinline preload="auto"
poster="https://pokktjs.pokkt.com/vjs/logo.png" data-
setup='{}'>
<source src="https://vdo.pokkt.com/video-js-4.12/loading.mp4"
type='video/mp4'>
</video>
</div>
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
//'controls':false,
controlBar: {
fullscreenToggle: false,
playToggle: false,
progressControl: false,
},
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function trackStart(player) {
var duration = isNaN(player.duration()) ? player.duration() : -1;
var muted = player.muted() ? 0 : 1;
trackOMEvent('start', duration, muted);
}
function trackVolume(player) {
var videoPlayerVolume = player.muted() ? 0 : player.volume();
log.i('device volume is: ' + videoPlayerVolume);
trackOMEvent('volumeChange', videoPlayerVolume);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('play', function(e) {
console.log('play started!');
});
player.on('vast.start', function(e) {
trackStart(player);
});
player.on('vpaid.AdVideoStart', function(e) {
trackStart(player);
});
player.on('vast.firstQuartile', function(e) {
trackOMEvent('firstQuartile');
});
player.on('vpaid.AdVideoFirstQuartile', function(e) {
trackOMEvent('firstQuartile');
});
player.on('vast.midpoint', function(e) {
trackOMEvent('midpoint');
});
player.on('vpaid.AdVideoMidpoint', function(e) {
trackOMEvent('midpoint');
});
player.on('vast.thirdQuartile', function(e) {
trackOMEvent('thirdQuartile');
});
player.on('vpaid.AdVideoThirdQuartile', function(e) {
trackOMEvent('thirdQuartile');
});
player.on('vast.complete', function(e) {
trackOMEvent('complete');
});
player.on('vpaid.AdVideoComplete', function(e) {
trackOMEvent('complete');
});
player.on('vast.adSkip', function(e) {
trackOMEvent('skipped');
});
player.on('vpaid.AdSkipped', function(e) {
trackOMEvent('skipped');
});
player.on('vast.pause', function(e) {
trackOMEvent('pause');
});
player.on('vpaid.AdPaused', function(e) {
trackOMEvent('pause');
});
player.on('vast.resume', function(e) {
trackOMEvent('resume');
});
player.on('vpaid.AdPlaying', function(e) {
trackOMEvent('resume');
});
player.on('vast.mute', function(e) {
trackVolume(player);
});
player.on('vast.unmute', function(e) {
trackVolume(player);
});
player.on('vpaid.AdVolumeChange', function(e) {
trackVolume(player);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
//setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
<script src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/video.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ads.min.js"></script>
<script src="https://s3-ap-southeast-
1.amazonaws.com/sdkplugin/imasupport/videojs.ima.js"></script>
<script type="text/javascript">
/**
* console logger
**/
(function() {
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* bridge
**/
(function() {
window.pokktNativeBridge = {};
window.pokktNativeBridge.notifyNative = function(operation, params) {
log.i('notifying native of: ' + operation + ' , with params: ' + params);
/**
* POKKT-IMA Wrapper
**/
var PokktIMAWrapper = function(debugEnabled) {
log.i('preparing ima wrapper for pokkt...');
this.player = videojs('pokkt-video-ad');
this.player.fluid(true);
// Remove controls from the player on iPad to stop native controls from
stealing our click
if (navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)){
var contentPlayer = document.getElementById('content_video_html5_api');
if (contentPlayer != null && contentPlayer.hasAttribute('controls')) {
contentPlayer.removeAttribute('controls');
}
this.player.controls(false);
}
var options = {
debug: debugEnabled,
id: 'pokkt-video-ad',
autoPlayAdBreaks: false,
showControlsForJSAds: false,
vpaidMode: 'INSECURE',
disableCustomPlaybackForIOS10Plus: true,
adsManagerLoadedCallback: this.adsManagerLoadedCallback.bind(this)
};
this.player.ima(options);
this.player.ima.setAdBreakReadyListener(function(){
log.i('ad-break ready, attempting ad playback...');
this.player.ima.playAdBreak();
});
pokktNativeBridge.notifyNative('wrapperPrepared');
};
if (isAdTagAUrl) {
this.player.ima.setContentWithAdTag(null, adTag, false);
} else {
this.player.ima.setContentWithAdsResponse(null, adTag, false);
}
this.player.ima.requestAds();
};
PokktIMAWrapper.prototype.adsManagerLoadedCallback = function(event) {
log.i('ads-manager loaded, registering remaining listners...');
var events = [
google.ima.AdEvent.Type.AD_BREAK_READY,
google.ima.AdEvent.Type.AD_CAN_PLAY,
google.ima.AdEvent.Type.AD_METADATA,
google.ima.AdEvent.Type.ALL_ADS_COMPLETED,
google.ima.AdEvent.Type.CLICK,
google.ima.AdEvent.Type.COMPLETE,
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,
google.ima.AdEvent.Type.DURATION_CHANGE,
google.ima.AdEvent.Type.EXPANDED_CHANGED,
google.ima.AdEvent.Type.FIRST_QUARTILE,
google.ima.AdEvent.Type.IMPRESSION,
google.ima.AdEvent.Type.INTERACTION,
google.ima.AdEvent.Type.LINEAR_CHANGED,
google.ima.AdEvent.Type.LOADED,
google.ima.AdEvent.Type.LOG,
google.ima.AdEvent.Type.MIDPOINT,
google.ima.AdEvent.Type.PAUSED,
google.ima.AdEvent.Type.RESUMED,
google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,
google.ima.AdEvent.Type.SKIPPED,
google.ima.AdEvent.Type.STARTED,
google.ima.AdEvent.Type.THIRD_QUARTILE,
google.ima.AdEvent.Type.USER_CLOSE,
google.ima.AdEvent.Type.VIEWABLE_IMPRESSION,
google.ima.AdEvent.Type.VOLUME_CHANGED,
google.ima.AdEvent.Type.VOLUME_MUTED,
google.ima.AdErrorEvent.Type.AD_ERROR
];
window.addEventListener('resize', this.onWindowResize.bind(this));
};
PokktIMAWrapper.prototype.onAdEvent = function(event) {
var message = 'Ad event: ' + event.type;
log.i(message);
// notify this event to native
window.pokktNativeBridge.notifyNative('adEvent', event.type);
};
PokktIMAWrapper.prototype.playAd = function() {
this.player.ima.playAdBreak();
};
PokktIMAWrapper.prototype.pauseAd = function() {
this.player.pause();
};
PokktIMAWrapper.prototype.onWindowResize = function() {
var adContainer = document.getElementById('pokkt-ima-adcontainer');
var videoElement = document.getElementById('pokkt-video-ad');
var adContainerWidth = adContainer.offsetWidth;
var videoHeight = videoElement.offsetHeight;
function prepareIMA(debugEnabled) {
window.imaAds = new PokktIMAWrapper(debugEnabled);
}
function playAd() {
window.imaAds.playAd();
}
function pauseAd() {
window.imaAds.pauseAd();
}
</script>
</body>
</html>
1571638080705 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
</script>
function is_pokkt_sdk() {
return true;
}
function pokkt_on_close() {
pauseAd();
if (typeof(Android) != "undefined" && Android.closeInterstitial) {
Android.closeInterstitial();
} else {
if (window.external && window.external.notify) {
window.external.notify("closeInterstitial");
}
}
}
function pokktOnComplete() {
if (typeof(Android) != "undefined" && Android.gratifyInterstitial)
{
Android.gratifyInterstitial();
} else {
if(window && window.external && window.external.notify) {
window.external.notify("gratifyInterstitial");
}
}
}
</script>
pokktOMIDBridge.createOMIDSession = function(omidSDKVersion,
vendors, partnerName, partnerVersion) {
log.i('creating omid session...');
var sessionClient;
try {
sessionClient = OmidSessionClient[omidSDKVersion];
} catch (e) {
log.i('error creating sessionClient!');
}
if (!sessionClient) {
log.i('sessionClient not available!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
const AdSession = sessionClient.AdSession;
const Partner = sessionClient.Partner;
const Context = sessionClient.Context;
const VerificationScriptResource =
sessionClient.VerificationScriptResource;
const AdEvents = sessionClient.AdEvents;
const VideoEvents = sessionClient.VideoEvents;
if (!resources.length) {
log.i('no verification resources found!');
pokktNativeBridge.notifyNative('omWrapperFailed');
return;
}
adSession.registerSessionObserver(function (event) {
log.i('omid session event: ' + event.type)
if (event.type === "sessionStart") {
videoEvents.loaded({ isSkippable: true, isAutoPlay:
true, position: 'standalone' });
adEvents.impressionOccurred();
} else if (event.type === "sessionError") {
log.i('session error occured! ' + event);
} else if (event.type === "sessionFinish") {
log.i('session finished!');
}
});
function initOMIDSession(pokktOMConfig) {
log.i('initializing omid session...');
if (pokktOMConfig === undefined) {
log.i('using dummy verification data');
// TEST DATA
pokktOMConfig = {
"omid_sdk_version" : "1.1.3-iab493",
"partner_name" : "Pokkt",
"partner_version" : "7.3.0",
"vendors" : [
{
"vendorKey": "iabtechlab.com-omid",
"javascriptResourceUrl": " https://s3-us-west-
2.amazonaws.com/omsdk-files/compliance-js/omid-validation-verification-script-
v1.js",
"verificationParameters": "iabtechlab-pokkt"
}
]
};
}
<style>
.vjs-default-skin.vjs-paused .vjs-big-play-button
{
display: none;
}
.video-js .vjs-control-bar
{
background-color: rgba(43, 51, 63, 0);
}
/* .vjs-default-skin.vjs-paused .vjs-control-bar
{
display: block;
} */
</style>
</head>
<body>
<div class="pokkt-video-container" id="pokkt-video-container"
style="opacity:100">
<video id="pokkt-video-ad" class="video-js vjs-default-skin vjs-16-9"
controls webkit-playsinline playsinline preload="auto"
poster="https://pokktjs.pokkt.com/vjs/logo.png" data-
setup='{}'>
<source src="https://vdo.pokkt.com/video-js-4.12/loading.mp4"
type='video/mp4'>
</video>
</div>
<script type="text/javascript">
window.vjsPlayer = videojs('pokkt-video-ad', {
//'controls':false,
controlBar: {
fullscreenToggle: false,
playToggle: false,
progressControl: false,
},
'forceSSL':true
}, function () {
log.i('videojs is ready!');
setupEventListeners(this);
window.pokktNativeBridge.notifyNative('vjsPlayerReady');
//this.play();
});
if (isTagAnURL) {
vastClientSettings.adTagUrl = vastTag;
} else {
vastResponseXML = vastTag;
vastClientSettings.adTagXML = 'requestVASTXML';
}
window.vjsPlayer.vastClient(vastClientSettings);
}
function trackStart(player) {
var duration = isNaN(player.duration()) ? player.duration() : -1;
var muted = player.muted() ? 0 : 1;
trackOMEvent('start', duration, muted);
}
function trackVolume(player) {
var videoPlayerVolume = player.muted() ? 0 : player.volume();
log.i('device volume is: ' + videoPlayerVolume);
trackOMEvent('volumeChange', videoPlayerVolume);
}
function setupEventListeners(player) {
log.i('setting up listeners on player: ' + player);
player.on('play', function(e) {
console.log('play started!');
});
player.on('vast.start', function(e) {
trackStart(player);
});
player.on('vpaid.AdVideoStart', function(e) {
trackStart(player);
});
player.on('vast.firstQuartile', function(e) {
trackOMEvent('firstQuartile');
});
player.on('vpaid.AdVideoFirstQuartile', function(e) {
trackOMEvent('firstQuartile');
});
player.on('vast.midpoint', function(e) {
trackOMEvent('midpoint');
});
player.on('vpaid.AdVideoMidpoint', function(e) {
trackOMEvent('midpoint');
});
player.on('vast.thirdQuartile', function(e) {
trackOMEvent('thirdQuartile');
});
player.on('vpaid.AdVideoThirdQuartile', function(e) {
trackOMEvent('thirdQuartile');
});
player.on('vast.complete', function(e) {
trackOMEvent('complete');
});
player.on('vpaid.AdVideoComplete', function(e) {
trackOMEvent('complete');
});
player.on('vast.adSkip', function(e) {
trackOMEvent('skipped');
});
player.on('vpaid.AdSkipped', function(e) {
trackOMEvent('skipped');
});
player.on('vast.pause', function(e) {
trackOMEvent('pause');
});
player.on('vpaid.AdPaused', function(e) {
trackOMEvent('pause');
});
player.on('vast.resume', function(e) {
trackOMEvent('resume');
});
player.on('vpaid.AdPlaying', function(e) {
trackOMEvent('resume');
});
player.on('vast.mute', function(e) {
trackVolume(player);
});
player.on('vast.unmute', function(e) {
trackVolume(player);
});
player.on('vpaid.AdVolumeChange', function(e) {
trackVolume(player);
});
}
function playAd() {
window.vjsPlayer.play();
}
function pauseAd() {
window.vjsPlayer.pause();
}
</script>
<script type="text/javascript">
// replace macros and call the following
//setupVJS(isTagAnURL, vastTag, moatData, moatPartnerCode);
setupVJS({{IS_TAG_A_URL}}, '{{VAST_TAG}}', {{MOAT_DATA}},
'{{MOAT_PARTNER_CODE}}');
</script>
</body>
</html>
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
var LOG_LEVEL = {
"DEBUG" : 0,
"INFO" : 1,
"WARNING" : 2,
"ERROR" : 3
};
log.d = function(msg) {
if (logLevel <= LOG_LEVEL.DEBUG) {
console.log("[DEBUG] " + msg);
}
};
log.i = function(msg) {
if (logLevel <= LOG_LEVEL.INFO) {
console.log("[INFO] " + msg);
}
};
log.w = function(msg) {
if (logLevel <= LOG_LEVEL.WARN) {
console.log("[WARN] " + msg);
}
};
log.e = function(msg) {
console.log("[ERROR] " + msg);
};
} ());
/**
* console logger
**/
(function() {
log.i("init mraid...");
/**
* globals
**/
var mraid = window.mraid = {};
/**
* constants
**/
var VERSION = "3.0";
/**
* states
**/
var supportedFeatures = {};
var orientationProperties = {
"allowOrientationChange" : true,
"forceOrientation" : DEVICE_ORIENTATIONS.NONE
};
var currentAppOrientation = {
"orientation" : DEVICE_ORIENTATIONS.NONE,
"locked" : false
};
var currentPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var defaultPosition = {
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0
};
var expandProperties = {
"width" : 0,
"height" : 0,
"useCustomClose" : false,
"isModal" : true
};
var maxSize = {
"width" : 0,
"height" : 0
};
var screenSize = {
"width" : 0,
"height" : 0
};
var resizeProperties = {
"width" : 0,
"height" : 0,
"offsetX" : 0,
"offsetY" : 0,
"customClosePosition" : CUSTOM_CLOSE_POSITION.TOP_RIGHT,
"allowOffscreen" : true
};
var locationData = {
"lat" : 0.0,
"lon" : 0.0,
"type" : LOCATION_PROVIDER_TYPES.GPS,
"accuracy" : 0.0,
"lastfix" : 0,
"ipservice" : ""
};
var exposureProperties = {
"exposedPercentage" : 0,
"visibleRectangle" : {},
"occlusionRectangles" : null // not used in this version
};
bridge.setPlacementType = function(pt) {
placementType = pt;
};
currentPosition.x = x;
currentPosition.y = y;
currentPosition.width = width;
currentPosition.height = height;
var customClosePosition =
properties.hasOwnProperty("customClosePosition") ?
properties.customClosePosition : resizeProperties.customClosePosition;
log.d("customClosePosition " + customClosePosition);
resizeUtil.fitResizeViewOnScreen = function(properties) {
log.d("fitResizeViewOnScreen");
log.d("defaultPosition " + defaultPosition.x + " " + defaultPosition.y);
log.d("offset " + properties.offsetX + " " + properties.offsetY);
if (resizeUtil.isRectContained(maxRect, resizeRect)) {
log.d("no adjustment necessary");
return adjustments;
}
return adjustments;
};
this.add = function(func) {
var id = String(func);
if (!listeners[id]) {
listeners[id] = func;
this.count++;
}
};
this.remove = function(func) {
var id = String(func);
if (listeners[id]) {
listeners[id] = null;
delete listeners[id];
this.count--;
return true;
} else {
return false;
}
};
this.removeAll = function() {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
this.remove(listeners[id]);
}
}
};
this.broadcast = function(args) {
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
listeners[id].apply(mraid, args);
}
}
};
this.toString = function() {
var out = [event, ':'];
for (var id in listeners) {
if (listeners.hasOwnProperty(id)) {
out.push('|', id, '|');
}
}
return out.join('');
};
};
/**
* validators
*
* The action parameter is a string which is the name of the setter function
which called this function
* (in other words, setExpandPropeties, setOrientationProperties, or
setResizeProperties).
* It serves both as the key to get the the appropriate set of validating
functions from the allValidators object
* as well as the action parameter of any error event that may be thrown.
*
* added location-data validation
**/
/**
* mraid properties
**/
mraid.supports = function(feature) {
log.i("mraid.supports: " + feature + " " + supportedFeatures[feature]);
var retval = supportedFeatures[feature];
if (typeof retval === "undefined") {
retval = false;
}
return retval;
};
mraid.getPlacementType = function() {
log.i("mraid.getPlacementType");
return placementType;
};
mraid.getOrientationProperties = function() {
log.i("mraid.getOrientationProperties");
mraid.setOrientationProperties = function(properties) {
log.i("mraid.setOrientationProperties...");
if (!validate(properties, "setOrientationProperties")) {
log.e("validation failed!");
return;
}
orientationProperties.allowOrientationChange =
newOrientationProperties.allowOrientationChange;
orientationProperties.forceOrientation =
newOrientationProperties.forceOrientation;
notifyNative("setOrientationProperties",
JSON.stringify(orientationProperties));
};
mraid.getCurrentAppOrientation = function() {
log.i("mraid.getCurrentAppOrientation");
mraid.getCurrentPosition = function() {
log.i("mraid.getCurrentPosition");
var position = {
"x": currentPosition.x,
"y": currentPosition.y,
"width": currentPosition.width,
"height": currentPosition.height
};
return position;
};
mraid.getDefaultPosition = function() {
log.i("mraid.getDefaultPosition");
var position = {
"x": defaultPosition.x,
"y": defaultPosition.y,
"width": defaultPosition.width,
"height": defaultPosition.height
};
return position;
};
mraid.getState = function() {
log.i("mraid.getState: " + state);
return state;
};
mraid.getExpandProperties = function() {
log.i("mraid.getExpandProperties");
var properties = {
"width" : expandProperties.width,
"height" : expandProperties.height,
"useCustomClose" : expandProperties.useCustomClose,
"isModal" : expandProperties.isModal
};
return properties;
};
mraid.setExpandProperties = function(properties) {
log.i("mraid.setExpandProperties");
if (!validate(properties, "setExpandProperties")) {
log.e("validation failed!");
return;
}
// In MRAID v2.0, all expanded ads by definition cover the entire screen,
// so the only property that the native side has to know about is
useCustomClose.
// (That is, the width and height properties are not needed by the native
code.)
if (expandProperties.useCustomClose !== oldUseCustomClose) {
mraid.useCustomClose(properties.useCustomClose);
}
};
mraid.getMaxSize = function() {
log.i("mraid.getMaxSize: " + maxSize.width + " x " + maxSize.height);
mraid.getResizeProperties = function() {
log.i("mraid.getResizeProperties");
var properties = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX,
"offsetY" : resizeProperties.offsetY,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
return properties;
};
mraid.setResizeProperties = function(properties) {
log.i("mraid.setResizeProperties");
isResizeReady = false;
// The properties object passed into this function must contain width,
height, offsetX, offsetY.
// The remaining two properties are optional.
var rwProps = [ "width", "height", "offsetX", "offsetY" ];
for (var i = 0; i < rwProps.length; i++) {
var propname = rwProps[i];
if (!properties.hasOwnProperty(propname)) {
var message = "required property " + propname + " is missing";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
}
if (!validate(properties, "setResizeProperties")) {
log.e("validation failed!");
return;
}
if (!allowOffscreen) {
if (properties.width > maxSize.width || properties.height >
maxSize.height) {
var message = "Resize width or height is greater than the maxSize
width or height!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
adjustments = resizeUtil.fitResizeViewOnScreen(properties);
} else if (!resizeUtil.isCloseRegionOnScreen(properties)) {
var message = "Close event region will not appear entirely onscreen!";
log.e(message);
broadcastEvent(EVENTS.ERROR, message, "setResizeProperties");
return;
}
var params = {
"width" : resizeProperties.width,
"height" : resizeProperties.height,
"offsetX" : resizeProperties.offsetX + adjustments.x,
"offsetY" : resizeProperties.offsetY + adjustments.y,
"customClosePosition" : resizeProperties.customClosePosition,
"allowOffscreen" : resizeProperties.allowOffscreen
};
notifyNative("setResizeProperties", JSON.stringify(params));
isResizeReady = true;
};
mraid.getLocation = function() {
if (!validate(locationData, "locationData")) {
log.e("invalid location data!");
return -1;
}
var data = {
"lat" : locationData.lat,
"lon" : locationData.lon,
"type" : locationData.type,
"accuracy" : locationData.accuracy,
"lastfix" : locationData.lastfix,
"ipservice" : locationData.ipservice
};
return data;
};
/**
* mraid methods
**/
mraid.getVersion = function() {
log.i("mraid.getVersion: " + VERSION);
return VERSION;
};
if (!event || !listener) {
broadcastEvent(EVENTS.ERROR, "Both event and listener are required.",
"addEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"addEventListener");
return;
}
if (!eventListeners[event]) {
eventListeners[event] = new EventListeners(event);
}
eventListeners[event].add(listener);
};
if (!event) {
broadcastEvent(EVENTS.ERROR, "Event is required.",
"removeEventListener");
return;
}
if (!contains(event, EVENTS)) {
broadcastEvent(EVENTS.ERROR, "Unknown MRAID event: " + event,
"removeEventListener");
return;
}
if (eventListeners[event]) {
if (!listener) {
eventListeners[event].removeAll();
} else if (!eventListeners[event].remove(listener)) {
broadcastEvent(EVENTS.ERROR, "Listener not currently registered for
event.", "removeEventListener");
}
}
if (eventListeners[event] && eventListeners[event].count === 0) {
eventListeners[event] = null;
delete eventListeners[event];
}
};
mraid.open = function(url) {
log.i("mraid.open: " + url);
if (!url) {
broadcastEvent(EVENTS.ERROR, "Invalid URL: " + url, "open");
return;
}
notifyNative("open", url);
};
mraid.close = function() {
log.i("mraid.close");
notifyNative("close");
};
mraid.unload = function() {
log.i("mraid.unload");
notifyNative("unload");
};
mraid.useCustomClose = function(shouldUseCustomClose) {
log.i("mraid.useCustomClose: " + shouldUseCustomClose);
expandProperties.useCustomClose = shouldUseCustomClose;
notifyNative("useCustomClose", shouldUseCustomClose);
};
mraid.expand = function(url) {
log.i("mraid.expand: " + (url === undefined) ? "(1-part)" : url);
mraid.isViewable = function() {
log.i("mraid.isViewable");
return isViewable;
};
mraid.playVideo = function(uri) {
log.i("mraid.playVideo: " + uri);
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "playVideo");
return;
}
notifyNative("playVideo", uri);
};
mraid.resize = function() {
log.i("mraid.resize");
notifyNative("resize", JSON.stringify(resizeProperties));
};
mraid.storePicture = function(uri) {
log.i("mraid.storePicture: " + uri);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.STOREPICTURE)) {
broadcastEvent(EVENTS.ERROR, "storePicture is not supported",
"storePicture");
return;
}
if (!uri) {
broadcastEvent(EVENTS.ERROR, "Invalid URI: " + uri, "storePicture");
return;
}
notifyNative("storePicture", uri);
};
mraid.createCalendarEvent = function(parameters) {
log.i("mraid.createCalendarEvent");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CALENDAR)) {
broadcastEvent(EVENTS.ERROR, "createCalendarEvent is not supported",
"createCalendarEvent");
return;
}
notifyNative("createCalendarEvent", JSON.stringify(parameters));
};
/**
* event dispatchers
**/
mraid.fireErrorEvent = function(message, action) {
broadcastEvent(EVENTS.ERROR, message, action);
};
mraid.fireReadyEvent = function() {
broadcastEvent(EVENTS.READY);
};
mraid.fireStateChangeEvent = function(newState) {
if (state !== newState) {
state = newState;
broadcastEvent(EVENTS.STATECHANGE, state);
}
};
mraid.fireViewableChangeEvent = function(newIsViewable) {
if (isViewable !== newIsViewable) {
isViewable = newIsViewable;
broadcastEvent(EVENTS.VIEWABLECHANGE, isViewable);
}
};
mraid.fireAudioVolumeChangeEvent = function(percentage) {
if (volumePercentage !== percentage) {
volumePercentage = volumePercentage;
broadcastEvent(EVENTS.AUDIOVOLUMECHANGE, percentage);
}
};
// TODO: VPAID
/**
* pokkt extended featuers
**/
(function() {
log.i("setting up: mraid-extensions...");
/**
* pokkt specific constants
**/
var NETWORK = mraid.NETWORK = {
OFFLINE :'offline',
WIFI :'wifi',
CELL :'cell',
UNKNOWN :'unknown'
};
mraid.SUPPORTED_FEATURES.AUDIO = "audio";
mraid.SUPPORTED_FEATURES.CAMERA = "camera";
mraid.SUPPORTED_FEATURES.NETWORK = "network";
mraid.SUPPORTED_FEATURES.SHAKE = "shake";
mraid.SUPPORTED_FEATURES.TILT = "tilt";
mraid.SUPPORTED_FEATURES.HEADING = "heading";
mraid.SUPPORTED_FEATURES.ORIENTATION = "orientation";
mraid.SUPPORTED_FEATURES.MAP = "map";
mraid.EVENTS.SHAKE = "shake";
mraid.EVENTS.TILTCHANGE = "tiltChange";
mraid.EVENTS.HEADINGCHANGE = "headingChange";
mraid.EVENTS.LOCATIONCHANGE = "locationChange";
mraid.EVENTS.NETWORKCHANGE = "networkChange";
mraid.EVENTS.KEYBOARDSTATECHANGE = "keyboardStateChange";
/**
* pokkt specific states
**/
var shakeProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltProperties = {
"interval" : 0,
"intensity" : 0
};
var headingProperties = {
"interval" : 0,
"intensity" : 0
};
var tiltValues = {
"x" : 0,
"y" : 0,
"z" : 0
};
var headingValue = 0;
var currentNetwork = "";
var currentKeyboardState = 0;
/**
* pokkt specific validators
**/
mraidUtils.allValidators.setShakeProperties =
mraidUtils.allValidators.setTiltProperties =
mraidUtils.allValidators.setHeadingProperties = {
"intensity":function(value) { return !isNaN(value); },
"interval":function(value) { return !isNaN(value); }
};
mraidUtils.allValidators.setTilt = {
"x":function(value) { return !isNaN(value); },
"y":function(value) { return !isNaN(value); },
"z":function(value) { return !isNaN(value); }
};
/**
* pokkt's extended properties
**/
mraid.setShakeProperties = function(properties) {
log.i("mraid.setShakeProperties: " + properties);
if (!mraidUtils.validate(properties, "setShakeProperties")) {
log.e("validation failed!");
return;
}
shakeProperties = properties;
mraidBridge.notifyNative("setShakeProperties", JSON.stringify(properties));
};
mraid.getShakeProperties = function() {
log.i("mraid.getShakeProperties");
mraid.setTiltProperties = function(properties) {
log.i("mraid.setTiltProperties: " + properties);
if (!mraidUtils.validate(properties, "setTiltProperties")) {
log.e("validation failed!");
return;
}
tiltProperties = properties;
mraidBridge.notifyNative("setTiltProperties", JSON.stringify(properties));
};
mraid.getTiltProperties = function() {
log.i("mraid.getTiltProperties");
mraid.setHeadingProperties = function(properties) {
log.i("mraid.setHeadingProperties: " + properties);
if (!mraidUtils.validate(properties, "setHeadingProperties")) {
log.e("validation failed!");
return;
}
headingProperties = properties;
mraidBridge.notifyNative("setHeadingProperties",
JSON.stringify(properties));
};
mraid.getHeadingProperties = function() {
log.i("mraid.getHeadingProperties");
mraid.getTilt = function () {
log.i("mraid.getTilt");
tiltValues = newValue;
};
mraid.getNetwork = function () {
log.i("mraid.getNetwork");
return currentNetwork;
};
mraid.getHeading = function () {
log.i("mraid.getHeading");
return headingValue;
};
mraid.getKeyboardState = function () {
log.i("mraid.getKeyboardState");
return currentKeyboardState;
}
/**
* extended methods
**/
mraid.playAudio = function(url) {
log.i("mraid.playAudio " + url);
if (!mraid.supports(mraid.SUPPORTED_FEATURES.AUDIO)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "playAudio is not
supported", "playAudio");
return;
}
mraidBridge.notifyNative("playAudio", url);
};
mraid.openCamera = function () {
log.i("mraid.openCamera");
if (!mraid.supports(mraid.SUPPORTED_FEATURES.CAMERA)) {
mraidUtils.broadcastEvent(mraid.EVENTS.ERROR, "openCamera is not
supported", "openCamera");
return;
}
mraidBridge.notifyNative("openCamera");
}
/**
* event dispatchers
**/
mraid.fireShakeEvent = function() {
log.i("mraid.fireShakeEvent");
mraidUtils.broadcastEvent(mraid.EVENTS.SHAKE);
}
mraid.fireTiltChangeEvent = function(x, y, z) {
log.i("mraid.fireTiltChangeEvent, x: " + x + " y: " + y + " z: " + z);
tiltValues.x = x;
tiltValues.y = y;
tiltValues.z = z;
mraidUtils.broadcastEvent(mraid.EVENTS.TILTCHANGE, x, y, z);
}
mraid.fireHeadingChangeEvent = function(val) {
log.i("mraid.fireHeadingChangeEvent, val: " + val);
if (headingValue != val) {
headingValue = val;
mraidUtils.broadcastEvent(mraid.EVENTS.HEADINGCHANGE, val);
}
}
mraid.fireNetworkChangeEvent = function(network) {
log.d("mraid.fireNetworkChangeEvent: " + network);
if (currentNetwork != network) {
currentNetwork = network;
mraidUtils.broadcastEvent(mraid.EVENTS.NETWORKCHANGE, network);
}
}
mraid.fireKeyboardStateChangeEvent = function(state) {
log.d("mraid.fireKeyboardStateChangeEvent: " + state);
if (currentKeyboardState !== state) {
currentKeyboardState = state;
mraidUtils.broadcastEvent(mraid.EVENTS.KEYBOARDSTATECHANGE, state);
}
}
1571638090623 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638284368 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638311610 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638314678 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638314741 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638314824 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638314938 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638315148 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638315213 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638385333 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638393154 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638431883 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638431920 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638431974 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638432324 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638432327 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638432343 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638448704 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638450911 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638458780 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638552487 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638555505 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638555534 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638555609 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1571638564110 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638564114 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638564130 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: No Offers found!
at com.pokkt.sdk.e.a.a(Unknown Source:1378)
at com.pokkt.sdk.models.adcampaign.a.a(Unknown Source:12)
at com.pokkt.sdk.net.d.a(Unknown Source:11)
at com.pokkt.sdk.net.d.c(Unknown Source:0)
at com.pokkt.sdk.net.a.a(Unknown Source:131)
at com.pokkt.sdk.net.a.doInBackground(Unknown Source:2)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.pokkt.sdk.net.j$1.run(Unknown Source:2)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
1571638564131 com.zapak.littlekrishnarunner
{"pin":"94976","country":"Indonesia","countryCode":"ID","state":"Sulawesi
Tengah","city":"Bumi Raya","locality":"Bahonsuai","area":"Kabupaten Morowali"}
1576568754306 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568754326 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568754346 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568834850 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568834873 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568834892 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568834912 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568834929 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568890530 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568929723 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568929990 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 01 : Problem connecting to the
internet. Please Check your Internet connection.
at com.pokkt.sdk.utils.l.a(Unknown Source:48)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568995627 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568995658 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 01 : Problem connecting to the
internet. Please Check your Internet connection.
at com.pokkt.sdk.utils.l.a(Unknown Source:48)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576568995700 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 01 : Problem connecting to the
internet. Please Check your Internet connection.
at com.pokkt.sdk.utils.l.a(Unknown Source:48)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)
1576569075298 com.zapak.littlekrishnarunner
com.pokkt.sdk.exceptions.PokktException: Error Code 11 : Could Not Connect To
Server.
at com.pokkt.sdk.utils.l.a(Unknown Source:335)
at com.pokkt.sdk.utils.l.a(Unknown Source:21)
at com.pokkt.sdk.notification.NotificationService.onHandleIntent(Unknown
Source:330)
at
android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.os.HandlerThread.run(HandlerThread.java:65)