Vous êtes sur la page 1sur 3

clear(this.auto_scroll_interval),this.auto_scroll_interval=TRC.Interval.set(this.

au
to_scroll,parseInt(b)))}),a.appendChild(this.element),this.element.style.display="n
one",this.trc.getProperty(this.mode_name,"has-expand-animation")===!0&&new
TRC.ExpandAnimationManager(this)},TRCRBox.prototype.generateVisibleParts=function()
{if(null==this.listContainer){this.header=this.generateHeader(),"object"==typeof
this.header&&this.element.appendChild(this.header);var
a=document.createElement("div");a.id=this.id.replace("trc_","outer_"),a.className="
trc_rbox_outer",a.style.overflow="hidden",this.listContainer=this.generateRDiv(),a.
appendChild(this.listContainer),this.element.appendChild(a),this.element.style.disp
lay="block",this.trc.global["disclosure-enabled"]===!0?
this.addTaboolaLogo():this.addTaboolaLogoNoDisclosure()}},TRCRBox.prototype.getRetr
yUrl=function(a){var
b=protocol+"//cdn.taboola.com/libtrc/"+TRC.publisherId+"/";return"preview"==a?
b+"trc-"+a+".js":b+"trc-"+this.getListId()
+"-"+a+".js"},TRCRBox.prototype.check_preview_size_error=function(a,b){var
c=b.trc["video-list"].video;return c instanceof Array||(c=[c]),a!
=this.getRetryUrl("preview")&&c.length<10?(this.src=this.getRetryUrl("preview"),!
0):!1},TRCRBox.prototype.setTargetItemsList=function(a,b,c){for(var
d=0,e=b.length;e>d;d++)a[b[d]["item-id"]]={tii:b[d]["item-
id"],tipt:this.getProviderType(b[d]),tit:b[d].type,tids:c}},TRCRBox.prototype.getJs
onTargetItemsList=function(a){var b,c=[];for(b in
a)a.hasOwnProperty(b)&&c.push(a[b]);return{fil:__trcJSONify(c)}},TRCRBox.prototype.
getProviderType=function(a){return a["is-syndicated"]?"SP":a["is-in-
network"]?"NT":a["is-
native"]?"NAV":"RC"},TRCRBox.prototype.isReadMoreDevice=function(a){for(var
b=a.split("|"),c={smart_phone:TRC.dom.isSmartPhone(),tablet:TRC.dom.isTablet(),desk
top:TRC.dom.isDesktop()},d=0;d<b.length;d++){if("all"===b[d])return!
0;if(c[b[d]])return!0}return!1},TRCRBox.prototype.loadScriptCallback=function(a)
{var
b,c,d,e,f="TRCRBox.loadScriptCallback(retry="+this.retryCount+")",g=a.trc,h=this.re
sponse&&this.response.trc.DNT&&"TRUE"===this.response.trc.DNT.toUpperCase(),i=this.
trc.global["has-
userx"],j=TRC.Device.isTouchDevice,k=null;this.sendModeDebugData&&(k=this.getModeDe
bugData("object")),__trcDebug("Enter
"+f),this.abortRequest(),this.utm=this.requestTime&&[this.requestTime,(new
Date).getTime()-TRC.utm.start];var l=win.trc_testmode?!0:!1;if(g.vl&&g.vl.length)
{var m=g.vl.shift();a.trc=g=__trcCopyProps({req:m.ri,"session-
id":a.trc.si,"session-data":a.trc.sd,"user-id":a.trc.ui,"watched-
item":a.trc.wi,"country-code":a.trc.cc,"test-
variant":a.trc.t,cpb:a.trc.cpb,ppb:m.ppb,"video-list":{video:m.v}},a.trc)}if(!g||!
g["video-list"]||!g["video-list"].video)return __trcError("Exit "+f+": pv2 format
error"),this.use_cdn||l?
(this.src=this.getRetryUrl(l?"preview":"error"),this.getData()):this.abortRendering
(),void this.sendEvent("available",this.createUtmParam(),k,!
0);if(l&&this.check_preview_size_error(this.src,a))return __trcDebug("Exit "+f+":
preview with not enough items"),this.getData(),void
this.sendEvent("available",this.createUtmParam(),k,!
0);if(TRC.pageManager.storePublisherValue(TRC.publisherId,"session-
data",g["session-data"]),a.trc.DNT&&"TRUE"===a.trc.DNT.toUpperCase()?
TRC.pageManager.removeKey("user-id"):TRC.pageManager.storeValue("user-id",g["user-
id"]),"rbox-tracking"!=this.getListId()&&"undefined"==typeof
this.trc.modes[this.mode_name])return __trcError("TRCRBox.loadScriptCallback: Mode
name '"+this.mode_name+"' doesn't exist in configuration file "),void
this.sendEvent("available",this.createUtmParam(),k,!0);if(this.drawList)return
__trcWarn("Exit "+f+": got another response after already drawing"),void
this.sendEvent("available",this.createUtmParam(),k,!
0);if(this.response=a,this.setTargetItemsList(this.fullEventItemsHash,g["video-
list"].video,"a"),this.sendEvent("available",this.createUtmParam(),this.util.merge(
this.getJsonTargetItemsList(this.fullEventItemsHash),k),!0),g["video-
list"].video.length<1)return __trcDebug("Exit "+f+": no items in response"),void
this.abortRendering();if(this.recommendationList=g["video-
list"].video,this.itemsTypes=this.getItemsTypesList(this.recommendationList),this.h
asSyndicatedContent=this.hasSyndicated(this.itemsTypes),this.orig_name=this.mode_na
me,this.orig_placement=this.placement,"object"==typeof g&&"undefined"!=typeof
g["test-variant"]&&(b="ab_"+this.mode_name+"_"+g["test-
variant"],TRC.pConsole(this.mode_name,"info","test variant = "+g["test-
variant"],b),"undefined"!=typeof this.trc.modes[b]?
(this.trc.cssReset&&this.switchCSSResetDivIds(this.mode_name,b),this.mode_name=b,th
is.element.className="trc_rbox "+this.mode_name):this.trc.global["send-variant-
warning"]&&__trcWarn("variant - "+g["test-variant"]+" : has no configuration.
using fallback - "+this.mode_name)),c=this.trc.getProperty(this.mode_name,"auto-
size"),d="none"!=this.trc.getProperty(this.mode_name,"thumbnail-
position"),e=this.trc.getProperty(this.mode_name,"mode-has-
userx"),this.useNativeLineClamp=TRC.Browser.compatibility.lineClamp&&!
this.trc.getProperty(this.mode_name,"details-inline-with-
title")&&this.trc.getProperty(this.mode_name,"use-browser-line-
clamp"),this.isWCTextLinks="autowidget-template-text-
links"==this.trc.getProperty(this.mode_name,"widget-creator-
layout"),this.isResponsive=this.trc.getProperty(this.mode_name,"mode-is-
responsive"),TRC.pConsole(this.mode_name,"info","has user X =
"+e,""),__trcDebug("Exit "+f+": success"),this.drawList=!
0,this.hasReadMore=this.trc.global["enable-read-more"]===!1?!
1:this.trc.getProperty(this.mode_name,"enable-read-
more"),this.isReadMoreDebug=this.trc.global["read-more-debug"]||this.trc["read-
more-debug"],this.readMorePageConfig=this.read_more||
{},this.readMoreConfig=this.trc.getProperty(this.mode_name,"read-more-config")||
{},this.hasReadMore&&this.isReadMoreDevice(this.trc["read-more-
devices"])&&TRC.setReadMore(this),this.isResponsive&&!this.isWCTextLinks?
(this.generateResponsiveOuters(this.element),this.drawResponsiveList(g)):
(c&&this.container&&0==this.container.clientWidth&&(this.container.style.width="100
%"),this.generateVisibleParts(),this.drawListBody(g)),"1"!=this.response.trc.sl||
TRC.Device.isTouchDevice){if(e&&i&&d&&!h&&!TRC.Browser.ieUpto(8)&&!j&&(!
this.trc.preloadRequest||!this.placement||!
this.trc.preloadRequest[this.placement]||!
this.trc.preloadRequest[this.placement].spotlight)){if(!
TRC.userX.isInitialized)try{TRC.userX.init(this.trc.language)}catch(n)
{__trcDebug("failed to init Taboola
Choice")}try{TRC.userX.initForMode(this)}catch(n){__trcDebug("failed to init
Taboola Choice for mode "+this.mode_name)}}}else{var
o=document.trcGetParentByClassName(this.getContainer(),"trc_related_container");__t
rcDebug("Detected Spotlight
Administrator("+this.response.trc.pi+")"),o.setAttribute("data-spotlight-publisher-
id",this.response.trc.pi),TRC.backstageDomainPrefix=this.response.trc.bdp,this.trc.
loadSpotlight()}(this.slider===!0||
this.trc.getProperty(this.mode_name,"slider")===!0)&&new
TRC.SliderManager(this)},TRCRBox.prototype.switchCSSResetDivIds=function(a,b){var
c=TRC.modesCache[a]?TRC.modesCache[a].cssDivsArr:[],d=TRC.modesCache[b]?
TRC.modesCache[b].cssDivsArr:[],e=c.length;try{for(var f=0;e>f;f+
+)doc.getElementById(c[f]).id=d[f]}catch(g)
{__trcError("TRCRBox.prototype.switchCSSResetDivs :
",g.message)}},TRCRBox.prototype.loadFailureHandler=function()
{TRC.pConsole(this.mode_name,"debug","handleing TRC request failure","");var
a="TRCRBox.loadFailureHandler(retry="+this.retryCount+")";if(__trcDebug("Enter
"+a),!this.request)return void __trcDebug("Exit "+a+": request was
aborted");if("object"==typeof window.trc_json_response)return __trcWarn("Exit
"+a+": old style response"),this.loadScriptCallback(window.trc_json_response),void
delete window.trc_json_response;if(this.abortRequest(),this.response)return void
__trcDebug("Exit "+a+": response already
received");if(win.trc_testmode)this.src=this.getRetryUrl("preview"),__trcDebug("Exi
t "+a+": preview");else{if(!this.use_cdn)return __trcError("Aborting on error due
to use-cdn=false",null),void
this.abortRendering();this.src=this.getRetryUrl("error"),__trcWarn("Exit "+a+":
retrying with "+this.src.split("/")[2].split(".")
[0].toUpperCase())}this.getData()},TRCRBox.prototype.abortRequest=function()
{this.timeoutId&&(TRC.Timeout.clear(this.timeoutId),this.timeoutId=null),this.reque
st&&(this.request.parentNode.removeChild(this.request),this.request=null)},TRCRBox.
prototype.sendRequest=function(){var
a="TRCRBox.sendRequest(retry="+this.retryCount+")";if(__trcDebug("Enter
"+a),this.response)return __trcDebug("Exit "+a+": already have response"),void
this.loadScriptCallback(this.response);if(this.loadRBoxRequestFailed){if(!
this.use_cdn)return __trcError("loadRBox failed and not using CDN, aborting."),void
this.abortRendering();this.retryCount++,this.src=this.getRetryUrl("error")}var
b=this.trc.getProperty(this.mode_name,"timeout")||
8e3;this.timeoutId=TRC.Timeout.set(function(){return
this.timeoutHappened=this.timeoutHappened+1||1,this.use_cdn?
(this.abortRequest(),this.src=this.getRetryUrl("timeout"),__trcWarn("Called
TRCRBox.sendRequest.timeout("+this.timeoutHappened+"): retrying with
"+this.src.split("/")[2].split(".")[0].toUpperCase()),void this.getData()):void
__trcError("Timedout waiting for server but not
aborting")}.trcBind(this),b),this.response=null;try{this.requestTime=(new
Date).getTime()-
TRC.utm.start,this.request=this.trc.loadExternal(this.src,"js",this.loadFailureHand
ler.trcBind(this),!0)}catch(c){return void __trcError("Exit "+a+": error in
loadExternal",c)}__trcDebug("Exit "+a+":
success")},TRCRBox.prototype.abortRendering=function(){var
a="TRCRBox.abortRendering(retry="+this.retryCount+")";switch(__trcDebug("Called
"+a),this.drawList=!0,typeof this.errorHandler){case"string":return void(null!
=this.listContainer&&this.listContainer.appendChild(document.createTextNode("Error
getting recommendations:
"+this.errorHandler)));case"function":return void
this.errorHandler()}},TRCRBox.prototype.getData=function(){this.loaded=!
0,this.retryCount++;var a="TRCRBox.getData(retry="+this.retryCount+")";return
__trcDebug("Enter "+a),this.cdnEventHandler||
(this.cdnEventHandler=TRC.listen("staticRecommendationsReceived",function(a)
{this.response||
this.loadScriptCallback(a.response)}.trcBind(this))),this.retryCount>this.trc.MAX_R
ETRY?(__trcError("Exit "+a+": max retry - last call was to "+this.src.split("/")
[2].split(".")[0].toUpperCase()),void this.abortRendering()):
(TRC.dom.onReady(this.sendRequest.trcBind(this),TRC.Browser.ie?!1:!0),void
__trcDebug("Exit "+a+": success"))},TRCRBox.prototype.getContainer=function()
{return this.element.parentNode},TRCRBox.prototype.sendEvent=function(a,b,c,d,e,f)
{var g=!1,h={ri:this.response?
this.response.trc.req:null,sd:TRC.pageManager.getPublisherValue(TRC.publisherId,"se
ssion-data"),ui:TRC.pageManager.getValue("user-
id"),pi:this.trc.getItemId(),wi:this.response?this.response.trc["watched-
item"]:null,pt:this.getItemType(),vi:TRC.pageManager.getPageData(),li:this.getListI
d()},i=function(){g||(g=!0,e&&e())};(this.trc.global["tmp-use-pb-
params"]&&this.trc.configForPostEvent[a]||"click"===a&&this.sendClickPiggyBack)&&(t
his.response.trc&&this.response.trc.ppb&&(b.ppb=this.response.trc.ppb),this.re

Vous aimerez peut-être aussi