Professional Documents
Culture Documents
1547518760639 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru"}
1547518760943 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru"}
/**
* 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
};
var logLevel = LOG_LEVEL.DEBUG;
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('');
};
};
/**
* 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 appOrientation = {};
appOrientation.orientation = currentAppOrientation.orientation;
appOrientation.locked = currentAppOrientation.locked;
return appOrientation;
};
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;
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;
}
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");
// The only time it is valid to call resize is when the ad is
// a banner currently in either default or resized state.
// Trigger an error if the current state is expanded.
if (placementType === PLACEMENT_TYPE.INTERSTITIAL || state ===
STATES.LOADING || state === STATES.HIDDEN) {
// do nothing
return;
}
if (state === STATES.EXPANDED) {
broadcastEvent(EVENTS.ERROR, "Ad cannot be resized when in expanded
state.", "resize");
return;
}
if (!isResizeReady) {
broadcastEvent(EVENTS.ERROR, "Ad is not ready for resizing.",
"resize");
return;
}
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.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);
}
}
1547560639065 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Kaikondrahalli","area":"Bangalore Urban"}
1547560640078 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
/**
* 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);
}
}
1547564962663 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1547564963209 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
/**
* 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");
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);
var size = {};
size.width = maxSize.width;
size.height = maxSize.height;
return size;
};
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;
}
/**
* 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");
var properties = {};
properties.interval = headingProperties.interval;
properties.intensity = headingProperties.intensity;
return properties;
};
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);
}
}
1547566221113 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1547566495532 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1547566760793 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1547567052177 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1547958631809 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli"}
1547958632111 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli"}
/**
* 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;
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;
}
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
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);
}
}
1547971186851 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1547971187130 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
/**
* 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");
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;
}
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;
}
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...");
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");
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);
}
}
1547974176525 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1548174131264 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli"}
1548174131591 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli"}
/**
* 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);
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('');
};
};
var broadcastEvent = mraidUtils.broadcastEvent = function() {
var args = new Array(arguments.length);
var l = arguments.length;
for (var i = 0; i < l; i++) {
args[i] = arguments[i];
}
var event = args.shift();
if (eventListeners[event]) {
eventListeners[event].broadcast(args);
}
};
/**
* 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.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;
};
mraid.addEventListener = function(event, listener) {
log.i("mraid.addEventListener for event: " + event);
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;
}
// a cheap hack to ensure whether the url is encoded or not,
// if its not encoded, make sure to "double encode" as the sdk does a
double decode
if (url.includes("&")) {
//url = url.replace("&", "%26")
url = encodeURIComponent(url);
}
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);
// TODO: consider exposure change event too
if (!mraid.isViewable()) {
broadcastEvent(EVENTS.ERROR, "playVideo cannot be called until the ad
is viewable", "playVideo");
return;
}
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");
var properties = {};
properties.interval = shakeProperties.interval;
properties.intensity = shakeProperties.intensity;
return properties;
};
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);
}
}
1548175436303 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli"}
1548175437707 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli"}
1548175437709 com.moonglabs.epiccricket hashKey id 977f546a-5b32-4d3d-ab76-
d1e2471a196b154817543770989752958dba04b7aa737f83586f5e994
/**
* mraid functionalities
**/
(function() {
if (console.oldLog === undefined) {
console.oldLog = console.log;
console.log = function(log) {
if (console.oldLog !== undefined) {
console.oldLog(log);
}
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 placementType = PLACEMENT_TYPE.UNKNOWN;
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;
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.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;
}
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 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.setNetwork = function (newValue) {
log.i("mraid.setNetwork: " + newValue);
currentNetwork = newValue;
};
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);
}
}
1548175900212 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru"}
1548179913557 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru"}
1548179914012 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru"}
/**
* 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");
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);
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;
}
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;
}
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);
}
}
1551472192735 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
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>
<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>
(c){a:{c=e.g[a];for(d=0;d<e.f.length;d++)if(e.f[d].u(c)){c=!0;break a}c=!1}c=!
c}c&&(M(e,'obstructed'),e.f.push(e.g[a]))}Ma(e)}else M(e,'notFound');return e}
function Pa(a,b,c,d){var e=b.isCreative?!0:b.adSessionId===d;if(e){c.b=b;var
f=J(c.b);a=Ka(c.c,f);La(a,f)&&M(c,'clipped');c.a=new F(a,!1)}else if(f=!0,b.a&&(f=-
1!==b.isFriendlyObstructionFor.indexOf(d)?!1:!1===b.clipsToBounds),f)for(var
l=b.childViews,g=0;g<l.length;g++)f=!!c.b,Pa(a,new F(l[g],f),c,d);!e&&c.b&&(b.a?-1!
==b.isFriendlyObstructionFor.indexOf(d)||c.g.push(b):
(e=J(b),d=J(c.a),I(c.a),a=c.a,0!==a.width&&0!
==a.height&&b.clipsToBounds&&(b=Ka(d,e),La(b,d)&&(M(c,'clipped'),c.a=new F(b,!
1)))))}
;function Qa(){return{apiVersion:'1.0',accessMode:'limited',omidJsInfo:
{omidImplementer:'omsdk',serviceVersion:'1.1.3-iab493'}}}function Ra()
{this.adSessionId=null;this.c=Qa();this.j='foregrounded';this.b=this.a='none';this.
i=this.g=this.f=this.A=this.B=this.l=null;this.m=!0}var O;function P(){O||(O=new
Ra);return O};function Sa(a,b)
{this.b=a;this.c=b}k.Object.defineProperties(Sa.prototype,{a:{configurable:!
0,enumerable:!0,get:function(){return this.b}},origin:{configurable:!0,enumerable:!
0,get:function(){return this.c}}});function Ta()
{this.b=[];this.c=[];this.g=[];this.h=[];this.f={};this.a=P()}function Ua(a)
{a.b=[];a.c=[];a.g=[];a.h=[];a.f={};O.adSessionId=null;O.c=Qa();O.v=void 0;O.w=void
0;O.h=null;O.s=null;O.C=null;O.j='foregrounded';O.a='none';O.b='none';O.l=null;O.B=
null;O.A=null;O.f=null;O.g=null;O.i=null;O.m=!0}function Va(a,b){!1!
==Wa(b)&&a.g.filter(function(a){return a.type===b.a.type}).forEach(function(c)
{return a.i(c.o,b.a)})}
function Xa(a,b,c){a.b.filter(function(a){return
a.a.type===b&&Wa(a)}).map(function(a){return a.a}).forEach(c)}function Wa(a){var
b=a.a.type,c=-1!==Object.values(t).indexOf(b)&&'volumeChange'!
==b;return'impression'===b?a.origin===P().b:c?a.origin===P().a:!0}function
Ya(a,b,c){'video'===b?Za(a,c):(a.g.push({type:b,o:c}),Xa(a,b,c))}function Za(a,b)
{Object.keys(t).forEach(function(c){c=t[c];a.g.push({type:c,o:b});Xa(a,c,b)})}
function $a(a,b,c){a.h.push({R:c,o:b});a.c.forEach(function(d){var
e=ab(d);'sessionStart'===d.a.type&&(e.data.verificationParameters=c&&a.f[c]);a.i(b,
e)})}function bb(a){return a.b.some(function(a){return'impression'===a.a.type})||
a.c.some(function(a){return'impression'===a.a.type})}function Q(a,b,c){var
d=S(a,'sessionError','native',
{errorType:b,message:c});a.c.push(d);a.h.forEach(function(b){a.i(b.o,d.a)})}
function cb(a,b){a.f=Object.assign(a.f,b);if(b=a.a.c){var
c=S(a,'sessionStart','native',{context:b});a.c.push(c);a.h.forEach(function(b){var
d=b.o,f=ab(c);b=b.R;f.data.verificationParameters=b&&a.f[b];a.i(d,f)},a)}}function
db(a){var
b=a.h,c=S(a,'sessionFinish','native');a.c.push(c);Ua(a);b.forEach(function(b)
{return a.i(b.o,c.a)})}Ta.prototype.i=function(a,b){for(var
c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];try{a.apply(null,
[].concat(r(c)))}catch(e){Ba(e)}};
function eb(a,b){var c=a.a.A;var d=(d=P().h)?L(d).viewport:void 0;var e=(e=P().h)?
L(e).adView:void 0;b=S(a,'impression',b,
{mediaType:c,viewport:d,adView:e});a.b.push(b);Va(a,b)}function fb(a,b,c,d)
{'start'!==b&&'volumeChange'!==b||null!=(d&&d.deviceVolume)||
(d.deviceVolume=a.a.l);'start'!==b&&'volumeChange'!==b||
null==(d&&d.videoPlayerVolume)||
(a.a.B=d.videoPlayerVolume);b=S(a,b,c,d);a.b.push(b);Va(a,b)}
function gb(a,b){var c=a.g.filter(function(a)
{return'loaded'===a.type}).map(function(a){return a.o}),d=a.b.filter(function(a)
{return'loaded'===a.a.type&&a.origin===b}).map(function(a){return
a.a});c.forEach(function(a){d.forEach(a)})}function hb(a,b){return'none'!
==a.a.b&&a.a.b!==b?(C('Impression event is owned by '+(a.a.b+', not '+b+'.')),!1):!
0}function ib(a,b){return'none'!==a.a.a&&a.a.a!==b?(C('Video events are owned by '+
(a.a.a+', not '+b+'.')),!1):!0}
function S(a,b,c,d){return new Sa({adSessionId:a.a.adSessionId||'',timestamp:(new
Date).getTime(),type:b,data:d},c)}function ab(a)
{a=a.a;return{adSessionId:a.adSessionId,timestamp:a.timestamp,type:a.type,data:a.da
ta}};function jb(a,b,c){'container'===b&&void 0!==a.a.v&&a.a&&null!
=a.a.adSessionId&&(a.a.h=Oa(a.b,a.a.v,a.a.j,a.a.adSessionId));'creative'===b&&a.a.w
&&(a.a.s=Oa(a.b,a.a.w,a.a.j,a.a.adSessionId));if(a.a.h)if(a.a.s){b=new Ia(0);var
d=a.a.h,e=a.a.s,f=d.i,l=d.b,g=d.a,m=e.b;e=e.a;f&&l&&g&&m&&e&&(Ja(b,f),b.j=new F(l,!
1),b.l=new F(g,!
1),b.g=Object.assign([],d.g),b.f=Object.assign([],d.f),b.h=Object.assign([],d.h),d=
b.j.x,f=b.j.y,m=new F(m,!1),e=new F(e,!1),Fa(m,d,f),Fa(e,d,f),b.b=m,b.a=Ka(e,g),-
1===b.h.indexOf('backgrounded')&&
Ma(b))}else b=a.a.h;else b=null;g=a.a.C;if(b&&!b.u(g)||
c)g=L(b),c&&(g.adView.reasons=g.adView.reasons||
[c]),c=a.c,g=S(c,'geometryChange','native',
{viewport:g.viewport,adView:g.adView}),c.b.push(g),Va(c,g),a.a.C=b};function
lb(a,b,c){this.i=a;this.v=b;this.j=c;this.c=P();this.b=null;this.a=this.g=void
0;this.m=!0;T(this)}function T(a){if(!a.b){var b;a:
{if((b=a.i.document)&&b.getElementsByClassName&&(b=b.getElementsByClassName('omid-
element'))){if(1==b.length){b=b[0];break a}1<b.length&&a.m&&(Q(a.j,'generic',"More
than one element with 'omid-element' class name."),a.m=!
1)}b=null}b&&(b.tagName&&'video'===b.tagName.toLowerCase()?a.c.g=b:a.c.f=b,mb(a))}}
function mb(a){a.c.g?
(a.b=a.c.g,a.h()):a.c.f&&(a.b=a.c.f,'iframe'===a.b.tagName.toLowerCase()?
a.c.i&&a.h():a.h())}function nb(a)
{if(a.a&&a.g)if(a.b.tagName&&'iframe'===a.b.tagName.toLowerCase()){if(a.c.i)
{a:if(a.c.i){var b=new F(a.c.i,!1);Fa(b,a.a.x,a.a.y);b.clipsToBounds=!
0;b.isCreative=!0;for(var c=0;c<a.a.childViews.length;c+
+)if(a.a.childViews[c].isCreative){a.a.childViews[c]=b;break
a}a.a.childViews.push(b)}ob(a)}}else a.a.isCreative=!0,ob(a)}function ob(a)
{a.c.w=a.g;jb(a.v,'creative')};function pb(a,b,c){return qb(a,'setInterval')
(b,c)}function rb(a,b){qb(a,'clearInterval')(b)}function sb(a,b)
{qb(a,'clearTimeout')(b)}function qb(a,b){return a.a&&a.a[b]?a.a[b]:tb(a,b)}
function ub(a,b,c,d){if(a.a.document&&a.a.document.body){var
e=a.a.document.createElement('img');e.width=1;e.height=1;e.style.display='none';e.s
rc=b;c&&e.addEventListener('load',function(){return
c()});d&&e.addEventListener('error',function(){return
d()});a.a.document.body.appendChild(e)}else tb(a,'sendUrl')(b,c,d)}function tb(a,b)
{if(a.a&&a.a.omidNative&&a.a.omidNative[b])return
a.a.omidNative[b].bind(a.a.omidNative);throw Error('Native interface method "'+b+'"
not found.');};function vb(a,b,c,d){lb.call(this,a,b,d);this.f=void
0;this.l=c}q(vb,lb);vb.prototype.s=function(){void 0!
==this.f&&(rb(this.l,this.f),this.f=void 0)};vb.prototype.h=function(){var
a=this;this.b?void 0===this.f&&(this.f=pb(this.l,function(){return
wb(a)},200),wb(this)):this.f=void 0};
function wb(a){if(void 0!==a.f){var b=new F(new
Da(a.i.innerWidth,a.i.innerHeight),!1),c=a.b.getBoundingClientRect();if(null==c.x||
isNaN(c.x))c.x=c.left;if(null==c.y||isNaN(c.y))c.y=c.top;c=new F(c,!
1);b.u(a.g)&&c.u(a.a)||(a.a=c,a.a.clipsToBounds=!
0,a.g=b,a.g.childViews.push(a.a),nb(a))}};function xb(a,b,c)
{lb.call(this,a,b,c);this.f=void 0}q(xb,lb);xb.prototype.s=function()
{this.f&&this.b&&this.f.unobserve(this.b)};xb.prototype.h=function(){this.b&&!
this.f&&(this.f=yb(this),this.f.observe(this.b))};
function yb(a){return new a.i.IntersectionObserver(function(b){try{if(b.length)
{for(var c=b[0],d=1;d<b.length;d++)b[d].time>c.time&&(c=b[d]);b=c;a.g=new
F(b.rootBounds,!1);a.a=new F(b.boundingClientRect,!1);a.a.clipsToBounds=!
0;a.g.childViews.push(a.a);nb(a)}}catch(e){a.s(),Q(a.j,'generic','Problem handling
IntersectionObserver callback: '+e.message)}},
{root:null,rootMargin:'0px',threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]})};function
U(a){return'string'===typeof a}function V(a){return'object'===typeof a}function
zb(a){return'number'===typeof a&&!isNaN(a)&&0<=a}function W(a,b){return U(a)&&-1!
==Object.values(b).indexOf(a)};function X(a,b,c,d,e)
{this.b=a;this.f=b;this.g=c;this.c=e;this.a=P()}h=X.prototype;
h.H=function(a){if(a&&V(a)&&W(a.impressionOwner,na)&&(!('videoEventsOwner'in
a&&null!=a.videoEventsOwner)||W(a.videoEventsOwner,na))){var
b=a.videoEventsOwner;this.a.A=null==b||'none'===b?'display':'video';a&&null!
=a.isolateVerificationScripts&&'boolean'===typeof
a.isolateVerificationScripts&&(this.a.m=a.isolateVerificationScripts);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>
1551472194209 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1551472194214 com.moonglabs.epiccricket 360 POKKT SDK not found
/**
* 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");
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 adjustments = { "x": 0, "y": 0 };
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;
}
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);
// The only time it is valid to call expand is when the ad is
// a banner currently in either default or resized state.
if (placementType !== PLACEMENT_TYPE.INLINE ||
(state !== STATES.DEFAULT && state !== STAES.RESIZED)) {
broadcastEvent(EVENTS.ERROR, "Ad can only be expanded from the default
or resized state.", "expand");
return;
}
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;
}
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);
}
}
1551472303935 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1551472437301 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}
1551472686605 com.moonglabs.epiccricket
{"pin":"560035","country":"India","countryCode":"IN","state":"Karnataka","city":"Be
ngaluru","locality":"Halanayakanahalli","area":"Bangalore Urban"}