chocolateplatform-plugin-cordova
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "chocolateplatform-plugin-cordova", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A plugin to enable chocolateplatform ads to be displayed in cordova apps.", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -20,28 +20,58 @@ | ||
//////////////SET TARGETING PARAMETERS////////////// | ||
setAdRequestUserParams : function(age, birthDate, gender, maritalStatus, | ||
ethnicity, dmaCode, postal, curPostal, latitude, longitude) { | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'setUserParameters', | ||
[{ | ||
"AGE":age, | ||
"BIRTHDATE":birthDate, | ||
"GENDER":gender, | ||
"MARITALSTATUS":maritalStatus, | ||
"ETHNICITY":ethnicity, | ||
"DMACODE":dmaCode, | ||
"POSTAL":postal, | ||
"CURPOSTAL":curPostal, | ||
"LATITUDE":latitude, | ||
"LONGITUDE":longitude | ||
}] | ||
); | ||
}, | ||
setAdRequestAppParams : function(appName, pubName, appDomain, pubDomain, storeUrl, iabCategory) { | ||
setDemographics: function(age, birthDate, gender, maritalStatus, | ||
ethnicity){ | ||
cordova.exec(function(result) {},function(result) {}, | ||
"vdopiaPlugin", | ||
'setDemographics', | ||
[{ | ||
"AGE":age, | ||
"BIRTHDATE":birthDate, | ||
"GENDER":gender, | ||
"MARITALSTATUS":maritalStatus, | ||
"ETHNICITY":ethnicity | ||
}] | ||
); | ||
}, | ||
setLocation: function(dmaCode, postal, curPostal, latitude, longitude) { | ||
cordova.exec(function(result) {},function(result) {}, | ||
"vdopiaPlugin", | ||
'setLocation', | ||
[{ | ||
"DMACODE":dmaCode, | ||
"POSTAL":postal, | ||
"CURPOSTAL":curPostal, | ||
"LATITUDE":latitude, | ||
"LONGITUDE":longitude | ||
}] | ||
); | ||
}, | ||
// setAdRequestUserParams : function(age, birthDate, gender, maritalStatus, | ||
// ethnicity, dmaCode, postal, curPostal, latitude, longitude) { | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'setUserParameters', | ||
// [{ | ||
// "AGE":age, | ||
// "BIRTHDATE":birthDate, | ||
// "GENDER":gender, | ||
// "MARITALSTATUS":maritalStatus, | ||
// "ETHNICITY":ethnicity, | ||
// "DMACODE":dmaCode, | ||
// "POSTAL":postal, | ||
// "CURPOSTAL":curPostal, | ||
// "LATITUDE":latitude, | ||
// "LONGITUDE":longitude | ||
// }] | ||
// ); | ||
// }, | ||
setAppInfo : function(appName, pubName, appDomain, pubDomain, storeUrl, iabCategory) { | ||
cordova.exec( | ||
@@ -53,3 +83,3 @@ function(result) { | ||
"vdopiaPlugin", | ||
'setAppParameters', | ||
'setAppInfo', | ||
[{ | ||
@@ -75,2 +105,15 @@ "APPNAME":appName, | ||
}, | ||
setPrivacySettings: function(gdprApplies,gdprConsentString) { | ||
cordova.exec( | ||
function(result){}, | ||
function(result){}, | ||
"vdopiaPlugin", | ||
'setPrivacySettings', | ||
[{ | ||
"GDPR_APPLIES":gdprApplies, | ||
"GDPR_CONSENT_STRING":gdprConsentString, | ||
}] | ||
); | ||
} | ||
@@ -102,88 +145,88 @@ showAlert : function(message,title,cancleButtonText,confirmButtonText) | ||
//////////////SHOW NATIVE AD////////////// | ||
showInviewAdFromSDK : function(apikey, inviewDiv) { | ||
// //////////////SHOW NATIVE AD////////////// | ||
// showInviewAdFromSDK : function(apikey, inviewDiv) { | ||
// | ||
// _inviewAdContainer = inviewDiv; | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'loadNativeAd', | ||
// [{"apikey":apikey}] | ||
// ); | ||
// }, | ||
// | ||
// registerInviewAdEvents : function() { | ||
// | ||
// document.addEventListener('onBannerAdClicked', function() { | ||
// inViewAdEvent('onBannerAdClicked') | ||
// }); | ||
// | ||
// document.addEventListener('onBannerAdFailed', function() { | ||
// inViewAdEvent('onBannerAdFailed') | ||
// }); | ||
// | ||
// document.addEventListener('onBannerAdLoaded', function() { | ||
// inViewAdEvent('onBannerAdLoaded') | ||
// }); | ||
// | ||
// document.addEventListener('VdoAdEvent', function(e) { | ||
// if (e.eventStatus === "click") { | ||
// | ||
// var e = new CustomEvent('onBannerAdClicked', { detail: "Ad Clicked" }); | ||
// document.dispatchEvent(e); | ||
// | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'fireTracker', | ||
// [{"tracker":"click"}] | ||
// ); | ||
// } else if (e.eventStatus === "ad_unavailable") { | ||
// var e = new CustomEvent('onBannerAdFailed', { detail: "Ad Unavailable" }); | ||
// document.dispatchEvent(e); | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'fireTracker', | ||
// [{"tracker":"ui"}] | ||
// ); | ||
// } else if (e.eventStatus === "impression") { | ||
// | ||
// var e = new CustomEvent('onBannerAdLoaded', { detail: "Ad Available" }); | ||
// document.dispatchEvent(e); | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'fireTracker', | ||
// [{"tracker":"impression"}] | ||
// ); | ||
// } | ||
// }, false); | ||
// }, | ||
// | ||
// loadInviewAdInDiv : function(url) { | ||
// | ||
// url = url + "&" + _inviewDivId + "=" + _inviewAdContainer; | ||
// | ||
// $.getScript(url) | ||
// .done(function(script, textStatus) { | ||
// }) | ||
// .fail(function(jqxhr, settings, exception) { | ||
// }); | ||
// }, | ||
_inviewAdContainer = inviewDiv; | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'loadNativeAd', | ||
[{"apikey":apikey}] | ||
); | ||
}, | ||
registerInviewAdEvents : function() { | ||
document.addEventListener('onBannerAdClicked', function() { | ||
inViewAdEvent('onBannerAdClicked') | ||
}); | ||
document.addEventListener('onBannerAdFailed', function() { | ||
inViewAdEvent('onBannerAdFailed') | ||
}); | ||
document.addEventListener('onBannerAdLoaded', function() { | ||
inViewAdEvent('onBannerAdLoaded') | ||
}); | ||
document.addEventListener('VdoAdEvent', function(e) { | ||
if (e.eventStatus === "click") { | ||
var e = new CustomEvent('onBannerAdClicked', { detail: "Ad Clicked" }); | ||
document.dispatchEvent(e); | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'fireTracker', | ||
[{"tracker":"click"}] | ||
); | ||
} else if (e.eventStatus === "ad_unavailable") { | ||
var e = new CustomEvent('onBannerAdFailed', { detail: "Ad Unavailable" }); | ||
document.dispatchEvent(e); | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'fireTracker', | ||
[{"tracker":"ui"}] | ||
); | ||
} else if (e.eventStatus === "impression") { | ||
var e = new CustomEvent('onBannerAdLoaded', { detail: "Ad Available" }); | ||
document.dispatchEvent(e); | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'fireTracker', | ||
[{"tracker":"impression"}] | ||
); | ||
} | ||
}, false); | ||
}, | ||
loadInviewAdInDiv : function(url) { | ||
url = url + "&" + _inviewDivId + "=" + _inviewAdContainer; | ||
$.getScript(url) | ||
.done(function(script, textStatus) { | ||
}) | ||
.fail(function(jqxhr, settings, exception) { | ||
}); | ||
}, | ||
//////////////SHOW INTERSTITIAL AD////////////// | ||
loadInterstitialAdFromSDK : function(apikey) { | ||
loadInterstitialAd : function(apikey) { | ||
@@ -197,3 +240,3 @@ _interstitialAdLoaded = false; | ||
"vdopiaPlugin", | ||
'loadIntestitialAd', | ||
'loadInterstitialAd', | ||
[{"apikey":apikey}] | ||
@@ -203,3 +246,3 @@ ); | ||
showInterstitialAdFromSDK : function() { | ||
showInterstitialAd : function() { | ||
@@ -212,3 +255,3 @@ cordova.exec( | ||
"vdopiaPlugin", | ||
'showIntestitialAd', | ||
'showInterstitialAd', | ||
[{"apikey":"showIntestitialAd"}] | ||
@@ -243,3 +286,3 @@ ); | ||
loadRewardAdFromSDK : function(apikey, showAuto) { | ||
loadRewardAd : function(apikey, showAuto) { | ||
@@ -259,3 +302,3 @@ _rewardAdLoaded = false; | ||
showRewardAdFunctionCallFromHtml : function(rewardAmount,RewardName,rewardUserID,rewardSecretKey) { | ||
showRewardAd : function(rewardAmount,RewardName,rewardUserID,rewardSecretKey) { | ||
cordova.exec( | ||
@@ -295,139 +338,139 @@ function(result) { | ||
}); | ||
}, | ||
}//, | ||
//////////////SHOW PREROLL AD////////////// | ||
showPrerollAdFromSDK : function(apikey, width, height, adDiv, videoElement) { | ||
_prerollAdWidth = width; | ||
_prerollAdHeight = height; | ||
_prerollAdContainer = adDiv; | ||
_prerollAdVideoElement = videoElement; | ||
// //////////////SHOW PREROLL AD////////////// | ||
// showPrerollAdFromSDK : function(apikey, width, height, adDiv, videoElement) { | ||
// _prerollAdWidth = width; | ||
// _prerollAdHeight = height; | ||
// _prerollAdContainer = adDiv; | ||
// _prerollAdVideoElement = videoElement; | ||
// | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'loadPrerollad', | ||
// [{"apikey":apikey, "width":_prerollAdWidth, "height":_prerollAdHeight}] | ||
// ); | ||
// }, | ||
// | ||
// prerollAdFailedFromSDK : function(error) { | ||
// _prerollAdVideoElement.play(); | ||
// }, | ||
// | ||
// loadPrerollAdInDiv : function(urls) { | ||
// urls = JSON.parse(urls); | ||
// _partnerCount = urls.length; | ||
// _totalFailedPartner = 0; | ||
// | ||
// for(var url in urls) { | ||
// | ||
// if (urls[url].indexOf("caller=vdosdk") != -1) { | ||
// | ||
// new sdk_chocolate( | ||
// "chocolate", | ||
// urls[url], | ||
// _prerollAdContainer, _prerollAdVideoElement, | ||
// _prerollAdWidth, _prerollAdHeight, | ||
// onAdEventVdopia); | ||
// } else { | ||
// setupIMA( | ||
// "google", | ||
// urls[url], | ||
// _prerollAdContainer, _prerollAdVideoElement, | ||
// _prerollAdWidth, _prerollAdWidth); | ||
// } | ||
// } | ||
// }, | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'loadPrerollad', | ||
[{"apikey":apikey, "width":_prerollAdWidth, "height":_prerollAdHeight}] | ||
); | ||
}, | ||
// vdopiaEvent : null, //This variable is required to save the function which start the Ad after mediation | ||
// onAdEventVdopia : function(event) { | ||
// console.log("Preroll Event Fired : " + event.type); | ||
// if (event.type == "AdLoaded") { | ||
// vdopiaEvent = event.startAd;//Save function to start the AD in above created variable | ||
// prerollAdEventFromJSPlayer("chocolate","AdLoaded") | ||
// } else if (event.type == "AdError") { | ||
// prerollAdEventFromJSPlayer("chocolate","AdError") | ||
// } else if (event.type == "AdEnded") { | ||
// prerollAdEventFromJSPlayer("chocolate","AdEnded") | ||
// } else if (event.type == "AdClicked") { | ||
// prerollAdEventFromJSPlayer("chocolate","AdClicked") | ||
// } | ||
// }, | ||
// | ||
// prerollAdEventFromJSPlayer : function(partner, event) { | ||
// | ||
// if (event === "AdLoaded") | ||
// { | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'prerolAdLoad', | ||
// [{"partner":partner}] | ||
// ); | ||
// } | ||
// else if (event === "AdError") | ||
// { | ||
// _totalFailedPartner++; | ||
// | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'prerolAdFail', | ||
// [{"partner":partner}] | ||
// ); | ||
// | ||
// if (_totalFailedPartner == _partnerCount) { | ||
// prerollAdEvent("onPrerollAdFailed"); | ||
// playMainContent(); | ||
// } | ||
// | ||
// } else if (event === "AdClicked") { | ||
// | ||
// prerollAdEvent("onPrerollAdClicked"); | ||
// | ||
// cordova.exec( | ||
// function(result) { | ||
// }, | ||
// function(result) { | ||
// }, | ||
// "vdopiaPlugin", | ||
// 'prerollAdClickedEvent', | ||
// [{"partner":partner}] | ||
// ); | ||
// | ||
// } else if (event === "AdEnded") { | ||
// prerollAdEvent("onPrerollAdEnded"); | ||
// playMainContent(); | ||
// } | ||
// }, | ||
// | ||
// | ||
// showPrerollAdInDiv : function(partner) { | ||
// | ||
// prerollAdEvent("onPrerollAdLoaded"); | ||
// | ||
// if (partner.toLowerCase() === "google") { | ||
// playAds(); | ||
// } else { | ||
// if (vdopiaEvent) { | ||
// vdopiaEvent(); | ||
// } | ||
// } | ||
// }, | ||
// | ||
// playMainContent : function() { | ||
// _prerollAdContainer.style.display = "none"; | ||
// _prerollAdVideoElement.load(); | ||
// _prerollAdVideoElement.play(); | ||
// } | ||
prerollAdFailedFromSDK : function(error) { | ||
_prerollAdVideoElement.play(); | ||
}, | ||
loadPrerollAdInDiv : function(urls) { | ||
urls = JSON.parse(urls); | ||
_partnerCount = urls.length; | ||
_totalFailedPartner = 0; | ||
for(var url in urls) { | ||
if (urls[url].indexOf("caller=mpsdk") != -1) { | ||
new sdk_chocolate( | ||
"chocolate", | ||
urls[url], | ||
_prerollAdContainer, _prerollAdVideoElement, | ||
_prerollAdWidth, _prerollAdHeight, | ||
onAdEventVdopia); | ||
} else { | ||
setupIMA( | ||
"google", | ||
urls[url], | ||
_prerollAdContainer, _prerollAdVideoElement, | ||
_prerollAdWidth, _prerollAdWidth); | ||
} | ||
} | ||
}, | ||
vdopiaEvent : null, //This variable is required to save the function which start the Ad after mediation | ||
onAdEventVdopia : function(event) { | ||
console.log("Preroll Event Fired : " + event.type); | ||
if (event.type == "AdLoaded") { | ||
vdopiaEvent = event.startAd;//Save function to start the AD in above created variable | ||
prerollAdEventFromJSPlayer("chocolate","AdLoaded") | ||
} else if (event.type == "AdError") { | ||
prerollAdEventFromJSPlayer("chocolate","AdError") | ||
} else if (event.type == "AdEnded") { | ||
prerollAdEventFromJSPlayer("chocolate","AdEnded") | ||
} else if (event.type == "AdClicked") { | ||
prerollAdEventFromJSPlayer("chocolate","AdClicked") | ||
} | ||
}, | ||
prerollAdEventFromJSPlayer : function(partner, event) { | ||
if (event === "AdLoaded") | ||
{ | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'prerolAdLoad', | ||
[{"partner":partner}] | ||
); | ||
} | ||
else if (event === "AdError") | ||
{ | ||
_totalFailedPartner++; | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'prerolAdFail', | ||
[{"partner":partner}] | ||
); | ||
if (_totalFailedPartner == _partnerCount) { | ||
prerollAdEvent("onPrerollAdFailed"); | ||
playMainContent(); | ||
} | ||
} else if (event === "AdClicked") { | ||
prerollAdEvent("onPrerollAdClicked"); | ||
cordova.exec( | ||
function(result) { | ||
}, | ||
function(result) { | ||
}, | ||
"vdopiaPlugin", | ||
'prerollAdClickedEvent', | ||
[{"partner":partner}] | ||
); | ||
} else if (event === "AdEnded") { | ||
prerollAdEvent("onPrerollAdEnded"); | ||
playMainContent(); | ||
} | ||
}, | ||
showPrerollAdInDiv : function(partner) { | ||
prerollAdEvent("onPrerollAdLoaded"); | ||
if (partner.toLowerCase() === "google") { | ||
playAds(); | ||
} else { | ||
if (vdopiaEvent) { | ||
vdopiaEvent(); | ||
} | ||
} | ||
}, | ||
playMainContent : function() { | ||
_prerollAdContainer.style.display = "none"; | ||
_prerollAdVideoElement.load(); | ||
_prerollAdVideoElement.play(); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
167051
1100