Skip to content

Commit

Permalink
code attribute should be removed from the xml template, code can hand…
Browse files Browse the repository at this point in the history
…le current and new situtation and checks if id is a number
  • Loading branch information
Ben committed Sep 2, 2015
1 parent 2e4c02b commit 40fcd34
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions vast/adhese-vast.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ AdheseVastWrapper.prototype.parseInLine = function(ad) {
// insert the AdheseVastAd object in the schedule array using the ad's id as index to allow the palyer to retrieve it by id (as requested)
// id is replaced by code in the advar template so a change has to be made here too
// console.log(ads2);
var code = ad.attributes.getNamedItem("code") ? ad.attributes.getNamedItem("code").value : "preroll";
var code = '';//ad.attributes.getNamedItem("code") ? ad.attributes.getNamedItem("code").nodeValue : "preroll";
if (ad.attributes.getNamedItem("id") && isNaN(ad.attributes.getNamedItem("id").nodeValue)) {
code = ad.attributes.getNamedItem("id").nodeValue;
}else if (ad.attributes.getNamedItem("code")) {
code = ad.attributes.getNamedItem("code").nodeValue;
} else {
code = 'preroll';
}
if (this.debug) console.log(code);
var durationTag = ad.getElementsByTagName("Duration")[0].firstChild,
duration;
Expand Down Expand Up @@ -134,8 +141,17 @@ AdheseVastWrapper.prototype.parseVastJson = function(inJson) {
this.fireAdsLoaded();
}
else { // Wrapper ads, need to be executed to get the xml
var code = ads[i].attributes.getNamedItem("code").nodeValue;
var impressionNodes = ads[i].getElementsByTagName("Impression");
var code = '';//ads[i].attributes.getNamedItem("code").nodeValue;
var ad = ads[i];
if (ad.attributes.getNamedItem("id") && isNaN(ad.attributes.getNamedItem("id").nodeValue)) {
code = ad.attributes.getNamedItem("id").nodeValue;
}else if (ad.attributes.getNamedItem("code")) {
code = ad.attributes.getNamedItem("code").nodeValue;
} else {
code = 'preroll';
}

var impressionNodes = ad.getElementsByTagName("Impression");

AdheseAjax.request({
url: ads[i].getElementsByTagName("VASTAdTagURI")[0].firstChild.nodeValue,
Expand Down

0 comments on commit 40fcd34

Please sign in to comment.