1var CBS_PROD_NETWORK = "8264"; 2var CBS_DEV_NETWORK = "7336"; 3var CBS_SURROUND_COOKIE_NAME = "tsurround"; 4var CBS_SESSION_ID_VALUES = "abcdef".split(""); 5var CBS_SUBSESSION_ID_VALUES = "1234".split(""); 6var UnitTargetting = (function () { 7 function UnitTargetting(input) { 8 ObjectAssign(this, input); 9 } 10 UnitTargetting.prototype.applyTo = function (pubAdsInstance) { 11 for (var key in this.kvp) { 12 pubAdsInstance.setTargeting(key, this.kvp[key]); 13 } 14 }; 15 UnitTargetting.prototype.serialize = function (obj) { 16 return Object.keys(obj) 17 .map(function (key) { 18 return key + "=" + encodeURIComponent(obj[key]); 19 }) 20 .join("&"); 21 }; 22 UnitTargetting.prototype.toSimpleUrlTag = function (correlator) { 23 var combined = ObjectAssign({}, this.pageKvp, this.kvp); 24 var serializedKvps = this.serialize(combined); 25 var serializedParams = this.serialize({ 26 iu: this.fullIu, 27 sz: "1x1", 28 ists: "1", 29 t: serializedKvps, 30 c: correlator 31 }); 32 return "https://pubads.g.doubleclick.net/gampad/adx?" + serializedParams; 33 }; 34 return UnitTargetting; 35}()); 36var PageTargetting = (function () { 37 function PageTargetting(input) { 38 this.assignedPositionsByWidthAndPos = {}; 39 ObjectAssign(this, input); 40 } 41 PageTargetting.prototype.forUnit = function (subUnitName, requestedPosValue, width) { 42 var actualPos = this.assignPosFromRequestedAndWidth(requestedPosValue, width); 43 return new UnitTargetting({ 44 fullIu: this.iuBase, 45 kvp: { 46 pos: actualPos 47 }, 48 pageKvp: this.kvp 49 }); 50 }; 51 PageTargetting.prototype.applyTo = function (pubAdsInstance) { 52 pubAdsInstance.enableSingleRequest(); 53 for (var key in this.kvp) { 54 pubAdsInstance.setTargeting(key, this.kvp[key]); 55 } 56 }; 57 PageTargetting.prototype.assignPosFromRequestedAndWidth = function (requestedPosValue, width) { 58 var widthPos = width + "-" + requestedPosValue; 59 var map = this.assignedPositionsByWidthAndPos; 60 if (map[widthPos] == null) { 61 map[widthPos] = 1; 62 return requestedPosValue; 63 } 64 switch (requestedPosValue) { 65 case "top": 66 return this.assignPosFromRequestedAndWidth("middle", width); 67 case "middle": 68 case "bottom": 69 case "sticky": 70 case "outofpage": 71 ++map[widthPos]; 72 return requestedPosValue + map[widthPos]; 73 } 74 }; 75 PageTargetting.getPageLevel = function () { 76 return new PageTargetting({ 77 iuBase: PageTargetting.getAdUnitBase(), 78 kvp: { 79 cid: PageTargetting.getPageContentId(), 80 env: PageTargetting.getStage(), 81 firstpg: PageTargetting.getUserIsFirstPageOfDay() ? "1" : "0", 82 ptype: PageTargetting.getPageType(), 83 session: PageTargetting.getUserSessionId(), 84 subses: PageTargetting.getUserSubsessionId(), 85 sport: PageTargetting.getPageSport(), 86 vguid: PageTargetting.getPageviewGuid() 87 } 88 }); 89 }; 90 PageTargetting.getAdUnitBase = function () { 91 var network = PageTargetting.getStage() === "prod" ? CBS_PROD_NETWORK : CBS_DEV_NETWORK; 92 var plat = PageTargetting.getPlatform() === "mobile" ? "maw" : "aw"; 93 var arena = PageTargetting.getArena(); 94 var site = PageTargetting.getSiteCode(); 95 return "/" + network + "/" + plat + "-" + arena + "/" + site; 96 }; 97 PageTargetting.getStage = function () { 98 return location.href.indexOf(".sidearmsports.com") > -1 ? "dev" : "prod"; 99 }; 100 PageTargetting.getPlatform = function () { 101 return window.document.documentElement.clientWidth > 600 102 ? "desktop" 103 : "mobile"; 104 }; 105 PageTargetting.getArena = function () { 106 return "collegesports"; 107 }; 108 PageTargetting.getUserIsFirstPageOfDay = function () { 109 var date = new Date(); 110 var todayValue = [ 111 date.getFullYear(), 112 PageTargetting.padStart(date.getMonth() + 1, 2, "0"), 113 PageTargetting.padStart(date.getDate(), 2, "0") 114 ].join("-"); 115 return PageTargetting.withCookieSync("local", function (value) { 116 var lastVisitWasToday = value.lastVisit === todayValue; 117 value.lastVisit = todayValue; 118 return !lastVisitWasToday; 119 }); 120 }; 121 PageTargetting.getUserSessionId = function () { 122 return PageTargetting.withCookieSync("session", function (value) { 123 var sessionId = value.sessionId; 124 if (sessionId == null) { 125 sessionId = value.sessionId = 126 CBS_SESSION_ID_VALUES[Math.floor(Math.random() * CBS_SESSION_ID_VALUES.length)];
127 } 128 return sessionId; 129 }); 130 }; 131 PageTargetting.getUserSubsessionId = function () { 132 return PageTargetting.withCookieSync("session", function (value) { 133 var subsessionId = value.subsessionId; 134 if (subsessionId == null) { 135 subsessionId = value.subsessionId = 136 CBS_SUBSESSION_ID_VALUES[Math.floor(Math.random() * CBS_SUBSESSION_ID_VALUES.length)]; 137 } 138 return subsessionId; 139 }); 140 }; 141 PageTargetting.getPageviewGuid = function () { 142 if (window.vguid == null) { 143 window.vguid = PageTargetting.v4(); 144 } 145 return window.vguid; 146 }; 147 PageTargetting.getSiteCode = function () { 148 return PageTargetting.getWindow().targetting_criteria.cbs_site_code; 149 }; 150 PageTargetting.getPageContentId = function () { 151 return PageTargetting.getWindow().targetting_criteria.content_id; 152 }; 153 PageTargetting.getPageType = function () { 154 return PageTargetting.getWindow().targetting_criteria.page_template; 155 }; 156 PageTargetting.getPageSport = function () { 157 return PageTargetting.getWindow().targetting_criteria.sport_name; 158 }; 159 PageTargetting.withCookieSync = function (type, callback) { 160 var value = PageTargetting.getCookie(type); 161 var returnValue = callback.call(this, value); 162 PageTargetting.writeCookie(type, value); 163 return returnValue; 164 }; 165 PageTargetting.getStorageForType = function (type) { 166 return type === "local" ? window.localStorage : window.sessionStorage; 167 }; 168 PageTargetting.getCookie = function (type) { 169 var stringValue = PageTargetting.getStorageForType(type)[CBS_SURROUND_COOKIE_NAME]; 170 if (stringValue == null) 171 return {}; 172 try { 173 return JSON.parse(stringValue) || {}; 174 } 175 catch (err) { 176 return {}; 177 } 178 }; 179 PageTargetting.writeCookie = function (type, value) { 180 if (Object.prototype.toString.call(value) !== "[object Object]") { 181 throw new Error("Can only write objects"); 182 } 183 PageTargetting.getStorageForType(type)[CBS_SURROUND_COOKIE_NAME] = JSON.stringify(value); 184 }; 185 PageTargetting.padStart = function (value, charCount, padChar) { 186 var valueString = "" + value; 187 while (valueString.length < charCount) { 188 valueString = padChar + valueString; 189 } 190 return valueString; 191 }; 192 PageTargetting.v4 = function () { 193 var d = Date.now(); 194 var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { 195 var r = (d + Math.random() * 16) % 16 | 0; 196 d = Math.floor(d / 16); 197 return (c === "x" ? r : (r & 0x3) | 0x8).toString(16); 198 }); 199 return uuid; 200 }; 201 PageTargetting.getWindow = function () { 202 return window; 203 }; 204 return PageTargetting; 205}()); 206function ObjectAssign(target) { 207 var args = []; 208 for (var _i = 1; _i < arguments.length; _i++) { 209 args[_i - 1] = arguments[_i]; 210 } 211 for (var i = 0; i < args.length; i++) { 212 var source = args[i]; 213 for (var key in source) { 214 if (source.hasOwnProperty(key)) { 215 target[key] = source[key]; 216 } 217 } 218 } 219 return target; 220} 221//# sourceMappingURL=cbs-surround.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.