@@ -14,17 +14,16 @@ var TripleLiftAdapter = function TripleLiftAdapter() {
14
14
var tlReq = params . bids ;
15
15
var bidsCount = tlReq . length ;
16
16
17
- //set expected bids count for callback execution
18
- //bidmanager.setExpectedBidsCount('triplelift',bidsCount);
17
+ // set expected bids count for callback execution
18
+ // bidmanager.setExpectedBidsCount('triplelift',bidsCount);
19
19
20
20
for ( var i = 0 ; i < bidsCount ; i ++ ) {
21
21
var bidRequest = tlReq [ i ] ;
22
22
var callbackId = bidRequest . bidId ;
23
23
adloader . loadScript ( buildTLCall ( bidRequest , callbackId ) ) ;
24
- //store a reference to the bidRequest from the callback id
25
- //bidmanager.pbCallbackMap[callbackId] = bidRequest;
24
+ // store a reference to the bidRequest from the callback id
25
+ // bidmanager.pbCallbackMap[callbackId] = bidRequest;
26
26
}
27
-
28
27
}
29
28
30
29
@@ -33,8 +32,7 @@ var TripleLiftAdapter = function TripleLiftAdapter() {
33
32
var inventoryCode = utils . getBidIdParameter ( 'inventoryCode' , bid . params ) ;
34
33
var floor = utils . getBidIdParameter ( 'floor' , bid . params ) ;
35
34
36
-
37
- //build our base tag, based on if we are http or https
35
+ // build our base tag, based on if we are http or https
38
36
var tlURI = '//tlx.3lift.com/header/auction?' ;
39
37
var tlCall = document . location . protocol + tlURI ;
40
38
@@ -45,17 +43,20 @@ var TripleLiftAdapter = function TripleLiftAdapter() {
45
43
tlCall = utils . tryAppendQueryString ( tlCall , 'inv_code' , inventoryCode ) ;
46
44
tlCall = utils . tryAppendQueryString ( tlCall , 'floor' , floor ) ;
47
45
48
- //sizes takes a bit more logic
46
+ // indicate whether flash support exists
47
+ tlCall = utils . tryAppendQueryString ( tlCall , 'fe' , isFlashEnabled ( ) ) ;
48
+
49
+ // sizes takes a bit more logic
49
50
var sizeQueryString = utils . parseSizesInput ( bid . sizes ) ;
50
51
if ( sizeQueryString ) {
51
52
tlCall += 'size=' + sizeQueryString + '&' ;
52
53
}
53
54
54
- //append referrer
55
+ // append referrer
55
56
var referrer = utils . getTopWindowUrl ( ) ;
56
57
tlCall = utils . tryAppendQueryString ( tlCall , 'referrer' , referrer ) ;
57
58
58
- //remove the trailing "&"
59
+ // remove the trailing "&"
59
60
if ( tlCall . lastIndexOf ( '&' ) === tlCall . length - 1 ) {
60
61
tlCall = tlCall . substring ( 0 , tlCall . length - 1 ) ;
61
62
}
@@ -64,22 +65,36 @@ var TripleLiftAdapter = function TripleLiftAdapter() {
64
65
utils . logMessage ( 'tlCall request built: ' + tlCall ) ;
65
66
// @endif
66
67
67
- //append a timer here to track latency
68
+ // append a timer here to track latency
68
69
bid . startTime = new Date ( ) . getTime ( ) ;
69
70
70
71
return tlCall ;
71
-
72
72
}
73
73
74
+ function isFlashEnabled ( ) {
75
+ var hasFlash = 0 ;
76
+ try {
77
+ // check for Flash support in IE
78
+ var fo = new window . ActiveXObject ( 'ShockwaveFlash.ShockwaveFlash' ) ;
79
+ if ( fo ) { hasFlash = 1 ; }
80
+ } catch ( e ) {
81
+ if ( navigator . mimeTypes &&
82
+ navigator . mimeTypes [ 'application/x-shockwave-flash' ] !== undefined &&
83
+ navigator . mimeTypes [ 'application/x-shockwave-flash' ] . enabledPlugin ) {
84
+ hasFlash = 1 ;
85
+ }
86
+ }
87
+ return hasFlash ;
88
+ }
74
89
75
- //expose the callback to the global object:
90
+ // expose the callback to the global object:
76
91
$$PREBID_GLOBAL$$ . TLCB = function ( tlResponseObj ) {
77
92
if ( tlResponseObj && tlResponseObj . callback_id ) {
78
93
var bidObj = utils . getBidRequest ( tlResponseObj . callback_id ) ;
79
94
var placementCode = bidObj && bidObj . placementCode ;
80
95
81
96
// @if NODE_ENV='debug'
82
- if ( bidObj ) { utils . logMessage ( 'JSONP callback function called for inventory code: ' + bidObj . params . inventoryCode ) ; }
97
+ if ( bidObj ) { utils . logMessage ( 'JSONP callback function called for inventory code: ' + bidObj . params . inventoryCode ) ; }
83
98
// @endif
84
99
85
100
var bid = [ ] ;
@@ -95,7 +110,7 @@ var TripleLiftAdapter = function TripleLiftAdapter() {
95
110
bidmanager . addBidResponse ( placementCode , bid ) ;
96
111
97
112
} else {
98
- //no response data
113
+ // no response data
99
114
// @if NODE_ENV='debug'
100
115
if ( bidObj ) { utils . logMessage ( 'No prebid response from TripleLift for inventory code: ' + bidObj . params . inventoryCode ) ; }
101
116
// @endif
@@ -105,7 +120,7 @@ var TripleLiftAdapter = function TripleLiftAdapter() {
105
120
}
106
121
107
122
} else {
108
- //no response data
123
+ // no response data
109
124
// @if NODE_ENV='debug'
110
125
utils . logMessage ( 'No prebid response for placement %%PLACEMENT%%' ) ;
111
126
// @endif
0 commit comments