1var stlib = stlib || { 2 functions: [], 3 functionCount: 0, 4 util: { 5 prop: function(p, obj) { 6 if (obj) { 7 return obj[p]; 8 } 9 return function(o) { return o[p]; }; 10 } 11 }, 12 dynamicOn: true, 13 setPublisher : function(pubKey){ 14 stlib.publisher = pubKey; 15 }, 16 setProduct : function(prod){ 17 stlib.product = prod; 18 }, 19 parseQuery: function( query ) { 20 var Params = new Object (); 21 if ( ! query ) return Params; // return empty object 22 var Pairs = query.split(/[;&]/); 23 for ( var i = 0; i < Pairs.length; i++ ) { 24 var KeyVal = Pairs[i].split('='); 25 if ( ! KeyVal || KeyVal.length != 2 ) continue; 26 var key = unescape( KeyVal[0] ); 27 var val = unescape( KeyVal[1] ); 28 val = val.replace(/\+/g, ' '); 29 Params[key] = val; 30 } 31 return Params; 32 }, 33 getQueryParams : function(){ 34 var buttonScript = document.getElementById('st_insights_js'); 35 if(buttonScript && buttonScript.src){ 36 var queryString = buttonScript.src.replace(/^[^\?]+\??/,''); 37 var params = stlib.parseQuery( queryString ); 38 stlib.setPublisher ( params.publisher); 39 stlib.setProduct( params.product); 40 } 41 } 42}; 43 44stlib.global = { 45 hash: stlib.util.prop('hash', document.location).substr(1) 46}; 47 48// Extract out parameters 49stlib.getQueryParams(); 50/********************START BROWSER CODE***********************/ 51stlib.browser = { 52 iemode: null, 53 firefox: null, 54 firefoxVersion: null, 55 safari: null, 56 chrome: null, 57 opera: null, 58 windows: null, 59 mac: null, 60 ieFallback: (/MSIE [6789]/).test(navigator.userAgent), 61 //ieFallback: true, 62 63 init: function() { 64 var ua = navigator.userAgent.toString().toLowerCase(); 65 66 if (/msie|trident/i.test(ua)) { 67 if (document.documentMode) // IE8 or later 68 stlib.browser.iemode = document.documentMode; 69 else{ // IE 5-7 70 stlib.browser.iemode = 5; // Assume quirks mode unless proven otherwise 71 if (document.compatMode){ 72 if (document.compatMode == "CSS1Compat") 73 stlib.browser.iemode = 7; // standards mode 74 } 75 } 76 //stlib.browser.iemode = getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i); //IE11+ 77 } 78 /*stlib.browser.firefox =(navigator.userAgent.indexOf("Firefox") !=-1) ? true : false; 79 stlib.browser.firefoxVersion =(navigator.userAgent.indexOf("Firefox/5.0") !=-1 || navigator.userAgent.indexOf("Firefox/9.0") !=-1) ? false : true; 80 stlib.browser.safari =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") ==-1) ? true : false; 81 stlib.browser.chrome =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") !=-1) ? true : false; 82 stlib.browser.windows =(navigator.userAgent.indexOf("Windows") !=-1) ? true : false; 83 stlib.browser.mac =(navigator.userAgent.indexOf("Macintosh") !=-1) ? true : false;*/ 84 85 stlib.browser.firefox = ((ua.indexOf("firefox") !=-1) && (typeof InstallTrigger !== 'undefined'))?true:false; 86 stlib.browser.firefoxVersion =(ua.indexOf("firefox/5.0") !=-1 || ua.indexOf("firefox/9.0") !=-1) ? false : true; 87 stlib.browser.safari = (ua.indexOf("safari") !=-1 && ua.indexOf("chrome") ==-1)?true:false; 88 stlib.browser.chrome = (ua.indexOf("safari") !=-1 && ua.indexOf("chrome") !=-1)?true:false; 89 stlib.browser.opera = (window.opera || ua.indexOf(' opr/') >= 0)?true:false; 90 stlib.browser.windows =(ua.indexOf("windows") !=-1) ? true : false; 91 stlib.browser.mac =(ua.indexOf("macintosh") !=-1) ? true : false; 92 }, 93 94 getIEVersion : function() { 95 return stlib.browser.iemode; 96 }, 97 isFirefox : function() { 98 return stlib.browser.firefox; 99 }, 100 firefox8Version : function() { 101 return stlib.browser.firefoxVersion; 102 }, 103 isSafari : function() { 104 return stlib.browser.safari; 105 }, 106 isWindows : function() { 107 return stlib.browser.windows; 108 }, 109 isChrome : function() { 110 return stlib.browser.chrome; 111 }, 112 isOpera : function() { 113 return stlib.browser.opera; 114 }, 115 isMac : function() { 116 return stlib.browser.mac; 117 }, 118 isSafariBrowser: function(vendor, ua) { 119 // check if browser is safari
120 var isSafari = vendor && 121 vendor.indexOf('Apple Computer, Inc.') > -1 && 122 ua && !ua.match('CriOS'); 123 // check if browser is not chrome 124 var notChrome = /^((?!chrome|android).)*safari/i.test(ua); 125 // check if browser is not firefox 126 var notFireFox = /^((?!firefox|linux))/i.test(ua); 127 // check if OS is from Apple 128 var isApple = (ua.indexOf('Mac OS X') > -1) || 129 (/iPad|iPhone|iPod/.test(ua) && !window.MSStream); 130 // check if OS is windows 131 var isWindows = (ua.indexOf('Windows NT') > -1) && notChrome; 132 // browser is safari but not chrome 133 return (isSafari && notChrome && notFireFox && (isApple || isWindows)); 134 } 135}; 136 137stlib.browser.init(); 138/********************END BROWSER CODE***********************/ 139/********************START SCRIPTLOADER***********************/ 140/* 141 * This handles on demand loading of javascript and CSS files 142 */ 143stlib.scriptLoader = { 144 loadJavascript : function(href,callBack){ 145 var loader = stlib.scriptLoader; 146 loader.head=document.getElementsByTagName('head')[0]; 147 loader.scriptSrc=href; 148 loader.script=document.createElement('script'); 149 loader.script.setAttribute('type', 'text/javascript'); 150 loader.script.setAttribute('src', loader.scriptSrc); 151 loader.script.async = true; 152 153 if(window.attachEvent && document.all) { //IE: 154 loader.script.onreadystatechange=function(){ 155 if(this.readyState=='complete' || this.readyState=='loaded'){ 156 callBack(); 157 } 158 }; 159 } else { //other browsers: 160 loader.script.onload=callBack; 161 } 162 loader.s = document.getElementsByTagName('script')[0]; 163 loader.s.parentNode.insertBefore(loader.script, loader.s); 164 }, 165 loadCSS : function(href,callBack) { 166 _$d_(); 167 _$d1("Loading CSS: " + href); 168 var loader = stlib.scriptLoader; 169 var cssInterval; 170 loader.head=document.getElementsByTagName('head')[0]; 171 loader.cssSrc=href; 172 loader.css=document.createElement('link'); 173 loader.css.setAttribute('rel', 'stylesheet'); 174 loader.css.setAttribute('type', 'text/css'); 175 loader.css.setAttribute('href', href); 176 loader.css.setAttribute('id', href); 177 setTimeout(function(){ 178 callBack(); 179 if(!document.getElementById(href)){ 180 cssInterval=setInterval(function(){ 181 if(document.getElementById(href)){ 182 clearInterval(cssInterval); 183 callBack(); 184 } 185 }, 100); 186 } 187 },100); 188 loader.head.appendChild(loader.css); 189 } 190}; 191/********************END SCRIPTLOADER***********************/ 192/********************START MOBILE BROWSER CODE***********************/ 193 194stlib.browser.mobile = { 195 mobile:false, 196 uagent: null, 197 android: null, 198 iOs: null, 199 silk: null, 200 windows: null, 201 kindle: null, 202 url: null, 203 sharCreated: false, 204 sharUrl: null, 205 isExcerptImplementation: false, //Flag to check if multiple sharethis buttons (Excerpt) have been implemented 206 iOsVer: 0, // It will hold iOS version if device is iOS else 0 207 208 init: function () { 209 this.uagent = navigator.userAgent.toLowerCase(); 210 if (this.isAndroid()) { 211 this.mobile = true; 212 }else if (this.isIOs()) { 213 this.mobile = true; 214 } else if (this.isSilk()) { 215 this.mobile = true; 216 } else if (this.isWindowsPhone()) { 217 this.mobile = true; 218 }else if (this.isKindle()) { 219 this.mobile = true; 220 } 221 222 223 }, 224 225 isMobile: function isMobile() { 226 return this.mobile; 227 }, 228 229 isAndroid: function() { 230 if (this.android === null) { 231 this.android = this.uagent.indexOf("android") > -1; 232 } 233 return this.android; 234 }, 235 236 isKindle: function() { 237 if (this.kindle === null) { 238 this.kindle = this.uagent.indexOf("kindle") > -1; 239 } 240 return this.kindle; 241 }, 242 243 isIOs: function isIOs() { 244 if (this.iOs === null) { 245 this.iOs = (this.uagent.indexOf("ipad") > -1) || 246 (this.uagent.indexOf("ipod") > -1) || 247 (this.uagent.indexOf("iphone") > -1); 248 } 249 return this.iOs; 250 251 }, 252 253 isSilk: function() { 254 if (this.silk === null) { 255 this.silk = this.uagent.indexOf("silk") > -1; 256 } 257 return this.silk; 258 }, 259 260 /** 261 * This is to get iOS version if iOS device, else return 0 262 */ 263 getIOSVersion: function() { 264 if (this.isIOs()) { 265 this.iOsVer = this.uagent.substr( (this.uagent.indexOf( 'os ' )) + 3, 5 ).replace( /\_/g, '.' ); 266 } 267 return this.iOsVer; 268 }, 269 270 isWindowsPhone: function() { 271 if (this.windows === null) { 272 this.windows = this.uagent.indexOf("windows phone") > -1; 273 } 274 return this.windows; 275 } 276 277}; 278 279stlib.browser.mobile.init(); 280 281/********************END MOBILE BROWSER CODE***********************/ 282 283/********************START COOKIE LIBRARY***********************/ 284/* 285 * This handles cookies 286 */ 287var tpcCookiesEnableCheckingDone = false;
288var tpcCookiesEnabledStatus = true; 289 290stlib.cookie = { 291 setCookie : function(name, value, days) { 292 var safari =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") ==-1); 293 var ie =(navigator.userAgent.indexOf("MSIE") !=-1); 294 295 if (safari || ie) { 296 var expiration = (days) ? days*24*60*60 : 0; 297 298 var _div = document.createElement('div'); 299 _div.setAttribute("id", name); 300 _div.setAttribute("type", "hidden"); 301 document.body.appendChild(_div); 302 303 var 304 div = document.getElementById(name), 305 form = document.createElement('form'); 306 307 try { 308 var iframe = document.createElement('<iframe name="'+name+'" ></iframe>'); 309 //try is ie 310 } catch(err) { 311 //catch is ff and safari 312 iframe = document.createElement('iframe'); 313 } 314 315 iframe.name = name; 316 iframe.src = 'javascript:false'; 317 iframe.style.display="none"; 318 div.appendChild(iframe); 319 320 form.action = "https://sharethis.com/account/setCookie.php"; 321 form.method = 'POST'; 322 323 var hiddenField = document.createElement("input"); 324 hiddenField.setAttribute("type", "hidden"); 325 hiddenField.setAttribute("name", "name"); 326 hiddenField.setAttribute("value", name); 327 form.appendChild(hiddenField); 328 329 var hiddenField2 = document.createElement("input"); 330 hiddenField2.setAttribute("type", "hidden"); 331 hiddenField2.setAttribute("name", "value"); 332 hiddenField2.setAttribute("value", value); 333 form.appendChild(hiddenField2); 334 335 var hiddenField3 = document.createElement("input"); 336 hiddenField3.setAttribute("type", "hidden"); 337 hiddenField3.setAttribute("name", "time"); 338 hiddenField3.setAttribute("value", expiration); 339 form.appendChild(hiddenField3); 340 341 form.target = name; 342 div.appendChild(form); 343 344 form.submit(); 345 } 346 else { 347 if (days) { 348 var date = new Date(); 349 date.setTime(date.getTime()+(days*24*60*60*1000)); 350 var expires = "; expires="+date.toGMTString(); 351 } else { 352 var expires = ""; 353 } 354 var cookie_string = name + "=" + escape(value) + expires; 355 cookie_string += "; domain=" + escape (".sharethis.com")+";path=/"; 356 document.cookie = cookie_string; 357 } 358 }, 359 setTempCookie : function(name, value, days) { 360 if (days) { 361 var date = new Date(); 362 date.setTime(date.getTime()+(days*24*60*60*1000)); 363 var expires = "; expires="+date.toGMTString(); 364 } else { 365 var expires = ""; 366 } 367 var cookie_string = name + "=" + escape(value) + expires; 368 cookie_string += "; domain=" + escape (".sharethis.com")+";path=/"; 369 document.cookie = cookie_string; 370 }, 371 getCookie : function(cookie_name) { 372 var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); 373 if (results) { 374 return (unescape(results[2])); 375 } else { 376 return false; 377 } 378 }, 379 deleteCookie : function(name) { 380 381 // For all browsers 382 var path="/"; 383 var domain=".sharethis.com"; 384 document.cookie = name.replace(/^\s+|\s+$/g,"") + "=" +( ( path ) ? ";path=" + path : "") 385 + ( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT"; 386 387 388 // For Safari and IE 389 var safari =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") ==-1); 390 var ie =(navigator.userAgent.indexOf("MSIE") !=-1); 391 392 if (safari || ie) { 393 var _div = document.createElement('div'); 394 _div.setAttribute("id", name); 395 _div.setAttribute("type", "hidden"); 396 document.body.appendChild(_div); 397 398 var 399 div = document.getElementById(name), 400 form = document.createElement('form'); 401 402 try { 403 var iframe = document.createElement('<iframe name="'+name+'" ></iframe>'); 404 //try is ie 405 } catch(err) { 406 //catch is ff and safari 407 iframe = document.createElement('iframe'); 408 } 409 410 iframe.name = name; 411 iframe.src = 'javascript:false'; 412 iframe.style.display="none"; 413 div.appendChild(iframe); 414 415 form.action = "https://sharethis.com/account/deleteCookie.php"; 416 form.method = 'POST'; 417 418 var hiddenField = document.createElement("input"); 419 hiddenField.setAttribute("type", "hidden"); 420 hiddenField.setAttribute("name", "name"); 421 hiddenField.setAttribute("value", name); 422 form.appendChild(hiddenField); 423 424 form.target = name; 425 div.appendChild(form); 426 427 form.submit(); 428 } 429 }, 430 deleteAllSTCookie : function() { 431 var a=document.cookie; 432 a=a.split(';'); 433 for(var i=0;i<a.length;i++){ 434 var b=a[i]; 435 b=b.split('='); 436 437 // do not delete the st_optout cookie 438 if(!/st_optout/.test(b[0])){ 439 var name=b[0]; 440 var path="/"; 441 var domain=".edge.sharethis.com"; 442 document.cookie = name + "=;
442path=" + path + ";domain=" + domain +";expires=Thu, 01-Jan-1970 00:00:01 GMT"; 443 } 444 } 445 }, 446 setFpcCookie : function(name, value) { 447// var name="__unam"; 448 var current_date = new Date; 449 var exp_y = current_date.getFullYear(); 450 var exp_m = current_date.getMonth() + 9;// set cookie for 9 months into future 451 var exp_d = current_date.getDate(); 452 var cookie_string = name + "=" + escape(value); 453 if (exp_y) { 454 var expires = new Date (exp_y,exp_m,exp_d); 455 cookie_string += "; expires=" + expires.toGMTString(); 456 } 457 var domain=stlib.cookie.getDomain(); 458 cookie_string += "; domain=" + escape (domain)+";path=/"; 459 document.cookie = cookie_string; 460 }, 461 getFpcCookie : function(cookie_name) { 462 var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); 463 if (results) 464 return (unescape(results[2])); 465 else 466 return false; 467 }, 468 getDomain : function() { 469 var str = document.domain.split(/\./); 470 var domain=""; 471 if(str.length>1){ 472 domain="."+str[str.length-2]+"."+str[str.length-1]; 473 } 474 return domain; 475 }, 476 checkCookiesEnabled: function() { 477 if(!tpcCookiesEnableCheckingDone) { 478 stlib.cookie.setTempCookie("STPC", "yes", 1); 479 if(stlib.cookie.getCookie("STPC") == "yes") { 480 tpcCookiesEnabledStatus = true; 481 }else { 482 tpcCookiesEnabledStatus = false; 483 } 484 tpcCookiesEnableCheckingDone = true; 485 return tpcCookiesEnabledStatus; 486 }else{ 487 return tpcCookiesEnabledStatus; 488 } 489 }, 490 hasLocalStorage: function() { 491 try { 492 localStorage.setItem("stStorage", "yes"); 493 localStorage.removeItem("stStorage"); 494 return true; 495 } catch(e) { 496 return false; 497 } 498 } 499}; 500/********************END COOKIE LIBRARY***********************/ 501/* 502 * Requires cookie.js 503 */ 504stlib.fpc = { 505 cookieName: "__unam", 506 cookieValue: "", 507 createFpc: function() { 508 if(!document.domain || document.domain.search(/\.gov/) > 0){ 509 return false; 510 } 511// var firstPersonCookie = stlib.cookie.getCookie(stlib.fpc.cookieName); 512 var firstPersonCookie = stlib.cookie.getFpcCookie(stlib.fpc.cookieName); 513 if(firstPersonCookie==false){ 514 // Create a new cookie 515 var bigRan = Math.round(Math.random() * 2147483647); 516 bigRan = bigRan.toString(16); 517 518 var time = (new Date()).getTime(); 519 time = time.toString(16); 520 521 var partialDomain = window.location.hostname.split(/\./)[1]; 522 if(!partialDomain){ 523 return false; 524 } 525 526 var cookieValue = ""; 527 cookieValue = stlib.fpc.determineHash(partialDomain) + "-" + time + "-" + bigRan + "-1"; 528 529 firstPersonCookie = cookieValue; 530 }else{ 531 // Increment the counter on the cookie by one 532 var originalCookie = firstPersonCookie; 533 var originalCookieArray = originalCookie.split(/\-/); 534 if(originalCookieArray.length == 4){ 535 var num = Number(originalCookieArray[3]); 536 num++; 537 firstPersonCookie = originalCookieArray[0] + "-" + originalCookieArray[1] + "-" + originalCookieArray[2] + "-" + num; 538 } 539 } 540 541// stlib.cookie.setCookie(stlib.fpc.cookieName, firstPersonCookie, 90); 542 stlib.cookie.setFpcCookie(stlib.fpc.cookieName, firstPersonCookie); 543 stlib.fpc.cookieValue = firstPersonCookie; 544 return firstPersonCookie; 545 }, 546 547 determineHash: function(partialDomain) { 548 var hash = 0; 549 var salt = 0; 550 for (var i = partialDomain.length - 1; i >= 0; i--) { 551 var charCode = parseInt(partialDomain.charCodeAt(i)); 552 hash = ((hash << 8) & 268435455) + charCode + (charCode << 12); 553 if ((salt = hash & 161119850) != 0){ 554 hash = (hash ^ (salt >> 20)); 555 } 556 } 557 return hash.toString(16); 558 } 559}; 560/* 561 * This holds critical data, requires the cookie object 562 */ 563if (typeof(stlib.data) == "undefined") { 564 stlib.data = { 565 bInit: false, 566 publisherKeySet: false, 567 pageInfo: { 568 }, 569 shareInfo: { 570 }, 571 resetPageData: function() { 572 //stlib.data.pageInfo.publisher = "00-00-00"; // The publisher key as given by the publisher 573 // stlib.data.pageInfo.fpc = "ERROR"; // The cookie set on the publisher's domain to track the user on that domain 574 stlib.data.pageInfo.sessionID = "ERROR"; // The session on any given pageview with our widget on it 575 //stlib.data.pageInfo.sourceURL = "ERROR"; // The source domain 576 stlib.data.pageInfo.hostname = "ERROR"; // The source domain 577 stlib.data.pageInfo.location = "ERROR"; // The source domain 578 stlib.data.pageInfo.product = "DOS2"; // the product 579 }, 580 resetShareData: function() { 581 stlib.data.shareInfo = {}; 582 stlib.data.shareInfo.url = "ERROR"; // The url the service is sharing before any modification 583 stlib.data.shareInfo.sharURL = ""; // The shar url the service is sharing before any modification 584 stlib.data.shareInfo.buttonType = "ERROR"; // The button type that were clicked (hcount or vcount) 585 stlib.data.shareInfo.destination = "ERROR"; // The channel that is being shared to (facebook, twitter) 586 stlib.data.shareInfo.source = "ERROR"; // The widget or code location that is generating the request 587 }, 588 resetData: function() { 589 stlib.data.resetPageData(); 590 stlib.data.resetShareData(); 591 }, 592 593 init: function() { 594 if (!stlib.data.bInit) { 595 stlib.data.bInit = true; 596 stlib.data.resetData(); 597 stlib.data.set("fcmp", typeof(window.__cmp) == 'function', "pageInfo"); 598 stlib.data.set("fcmpv2", typeof(window.__tcfapi) == 'function', "pageInfo"); 599 600 if (stlib.publisher){ 601 stlib.data.setPublisher(stlib.publisher); 602 } 603 stlib.data.set("product",stlib.product,"pageInfo"); 604 var rawUrl = document.location.href; 605 var sessionID_time = '', sessionID_rand = ''; 606 stlib.data.set("url", rawUrl,"shareInfo"); 607 608 // no longer using fpc 609 // stlib.fpc.createFpc(); 610 // stlib.data.set("fpc",stlib.fpc.cookieValue,"pageInfo"); // Requires that the cookie has been created 611 612 stlib.data.set("title", document.title, "shareInfo"); 613 614 sessionID_time = (new Date()).getTime().toString(); 615 sessionID_rand = Number(Math.random().toPrecision(5).toString().substr(2)).toString(); 616 stlib.data.set("sessionID",sessionID_time + '.' + sessionID_rand,"pageInfo"); 617 stlib.data.validateRefDomain(); 618 //stlib.data.set("sourceURL", document.location.href,"pageInfo"); 619 stlib.data.set("hostname", document.location.hostname,"pageInfo"); 620 stlib.data.set("location", document.location.pathname,"pageInfo"); 621 } 622 }, 623 624 validateRefDomain: function() { 625 var refDomain = stlib.data.get("refDomain", "pageInfo"); 626 if (!refDomain) { 627 this.setRefDomain(stlib.util.prop('referrer', window.document)); 628 } 629 }, 630 631 setRefDomain: function (refDomain) { 632 if (refDomain.length == 0) { 633 return; 634 } 635 var referArray = refDomain.replace("http://", "").replace("https://", "").split("/"); 636 if(referArray.length > 0) { 637 refDomain = (typeof(referArray[0]) != "undefined") ? referArray[0] : refDomain; 638 refQuery = (typeof(referArray[1]) != "undefined") ? referArray[1] : ""; 639 stlib.data.set("refQuery", refQuery,"pageInfo"); 640 stlib.data.set("refDomain", refDomain ,"pageInfo"); 641 } 642; 643 }, 644 setPublisher: function(publisherKey) { 645 // TODO: Add Validation 646 stlib.data.set("publisher",publisherKey,"pageInfo"); 647 }, 648 setSource: function(src, options) { 649 // TODO: Add Validation 650 var source = ""; 651 // Inside widget logging 652 if (options) { 653 if (options.toolbar) { 654 source = "toolbar"+src; 655 } else if (options.page && options.page != "home" && options.page != "") { 656 source = "chicklet"+src; 657 } else { 658 source = "button"+src; 659 } 660 } 661 // Outside widget logging 662 else { 663 // can be share5x, share4x, chicklet, fastshare, mobile 664 source = src; 665 } 666 stlib.data.set("source",source,"shareInfo"); 667 }, 668 set: function(key, value, table) { 669 if (typeof(value) == "number" || typeof(value) == "boolean") { 670 stlib.data[table][key] = value; 671 } else if (typeof(value) == "undefined" || value == null) { 672 } else { 673 stlib.data[table][key] = encodeURIComponent(decodeURIComponent(unescape(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 674 // These might have url encoded data 675 if (key=="url" /*|| key=="sourceURL"*/ || key=="location" || key=="image") { 676 try { 677 stlib.data[table][key] = encodeURIComponent(decodeURIComponent(decodeURI(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 678 } catch (e) { 679 stlib.data[table][key] = encodeURIComponent(decodeURIComponent(unescape(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 680 } 681 } 682 } 683 }, 684 get: function(key, table) { 685 try{ 686 if (stlib.data[table] && stlib.data[table][key]) 687 return decodeURIComponent(stlib.data[table][key]); 688 else 689 return false;
690 }catch(e){ 691 return false 692 } 693 }, 694 unset: function(key, table) { 695 if (stlib.data[table] && typeof(stlib.data[table][key])!="undefined") 696 delete stlib.data[table][key]; 697 }, 698 bindEvent: function(element, eventName, eventHandler) { 699 if (element.addEventListener) { 700 element.addEventListener(eventName, eventHandler, false); 701 } else if (element.attachEvent) { 702 element.attachEvent('on' + eventName, eventHandler); 703 } 704 }, 705 debug: function(endpoint, event) { 706 stlib.data.init(); 707 var a = stlib.data.pageInfo; 708 var c = ""; 709 var b; 710 for (b in a) { 711 c += b + "=" + a[b] + "&" 712 } 713 c = c.substring(0, c.length - 1); 714 715 var loggerUrl = "https://l.sharethis.com/"; 716 loggerUrl += endpoint; 717 loggerUrl += "?event=" + event; 718 loggerUrl += "&" + c; 719 720 var e = new Image(1, 1); 721 e.src = loggerUrl; 722 e.onload = function() { 723 return 724 }; 725 }, 726 hostname: function(url) { 727 var a; 728 if (url == null) { 729 url = st.href; 730 } 731 a = document.createElement('a'); 732 a.setAttribute('href', url); 733 return a.hostname; 734 }, 735 parseCookie: function (name, cookie) { 736 var values = cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)'); 737 return values ? values.pop() : null; 738 }, 739 writeCookie: function(name, value, max_age) { 740 if (!max_age) { 741 max_age = 33696000 742 } 743 var host = (window && window.location && window.location.hostname) || ''; 744 var parts = host.split('.'); 745 var domain = ""; 746 if (parts.length > 1) { 747 domain = "domain=." + parts.slice(-2).join('.'); 748 } 749 var samesite_secure = ""; 750 try { 751 document.cookie = "st_samesite=1;SameSite=None;Secure"; 752 if (stlib.data.parseCookie("st_samesite", document.cookie)) { 753 samesite_secure = "SameSite=None;Secure" 754 document.cookie = "st_samesite=1;max-age=0;SameSite=None;Secure"; 755 } 756 } catch (e) {} 757 document.cookie = name + "=" + value + ";" + domain + ";path=/;max-age=" + max_age + ";" + samesite_secure; 758 }, 759 setConsent: function(consent) { 760 for(var consent_key in consent) { 761 stlib.data.set(consent_key,consent[consent_key],"pageInfo"); 762 } 763 }, 764 getEUConsent: function (c) { 765 766 function once(fn, context) { 767 var result; 768 return function() { 769 if(fn) { 770 result = fn.apply(context || this, arguments); 771 fn = null; 772 } 773 return result; 774 }; 775 } 776 777 var done = once(c); 778 779 // set usprivacy first if we have it 780 var usprivacy = stlib.data.parseCookie("usprivacy", document.cookie); 781 if (usprivacy) { 782 stlib.data.setConsent({ 783 usprivacy: usprivacy 784 }); 785 } 786 787 // keep track of how long it takes to get consent 788 var start = Date.now(); 789 790 var useCookie = once(function() { 791 792 // check for first party cookies 793 var euconsent_v2 = stlib.data.parseCookie("euconsent-v2", document.cookie); 794 if (euconsent_v2 !== null) { 795 796 // use the first party cookie if it exists 797 stlib.data.setConsent({ 798 gdpr_consent: euconsent_v2, 799 gdpr_domain: document.location.hostname, 800 gdpr_method: "cookie" 801 }); 802 } 803 done(); 804 }); 805 806 if (typeof window.__tcfapi == "function") { 807 808 // fallback to cookie in case the tcf api is too slow or unavailable 809 var timeout = setTimeout(useCookie, 5000); 810 811 // first we try to get the data from the cmp 812 // wrap in a try catch since we don't control the tcfapi code on page 813 try { 814 815 const tcfapi_callback = (data) => { 816 if (data && data.tcString) { 817 var gdpr_domain = (data.isServiceSpecific) 818 ? document.location.hostname : ".consensu.org"; 819 stlib.data.setConsent({ 820 consent_duration: Date.now() - start, 821 gdpr_consent: data.tcString, 822 gdpr_domain: gdpr_domain, 823 gdpr_method: "api" 824 }); 825 clearTimeout(timeout); 826 done(); 827 __tcfapi('removeEventListener', 2, () => {}, data.listenerId); 828 } 829 } 830 __tcfapi('addEventListener', 2, tcfapi_callback); 831 832 } catch (e) { 833 834 // fallback to cookie if there is an error 835 useCookie(); 836 } 837 } else { 838 839 // fallback to cookie if the tcfapi doesn't exist 840 useCookie(); 841 } 842 } 843 }; 844 845 stlib.data.resetData(); 846} 847stlib.comscore = { 848 load: function() { 849 var ref=document.referrer; 850 var lurl = "https://sb.scorecardresearch.com/"; 851 lurl+="b?c1=7&c2=8097938&rn=" +Math.round(Math.random() * 2147483647 )+ "&c7=" + encodeURIComponent(document.location.href)+ "&c3=8097938"+ "&c8="+encodeURIComponent(document.title)+ ( (ref)? "&c9="+encodeURIComponent(document.referrer) : "" )+ "&cv=2.2"+ "&cs=js"; 852 var logger = new Image(1,1); 853 logger.src = lurl; 854 logger.onload = function(){return;}; 855 } 856} 857/********************START LOGGING***********************/ 858/* 859 * This handles logging 860 */ 861stlib.logger = { 862 loggerUrl: "https://l.sharethis.com/", 863 l2LoggerUrl: "https://l2.sharethis.com/", 864 productArray: new Array(), 865 version: '', 866 lang: 'en', 867 isFpEvent: false, 868 869 constructParamString: function() { 870 871 // Pull all the parameters from the page the widget was on 872 var p = stlib.data.pageInfo; 873 var paramString = ""; 874 var param; 875 876 for (param in p) { 877 878 // the following line creates "param=value&" 879 if (p[param] == null || p[param] === "" || p[param] == "ERROR") continue; 880 paramString += param + "=" + p[param] + "&"; 881 } 882 883 // Pull all the parameters related to the share 884 p = stlib.data.shareInfo; 885 for (param in p) { 886 if (p[param] == null || p[param] === "" || p[param] == "ERROR") continue; 887 paramString += param + "=" + p[param] + "&"; 888 } 889 890 // add sop parameter 891 paramString += "sop=false" 892 893 // add fpestid if it exists 894 var fpestid = stlib.data.parseCookie("fpestid", document.cookie); 895 if (fpestid) { 896 paramString += "&fpestid=" + fpestid; 897 } 898 899 // add description if it exists 900 try { 901 var elements = document.getElementsByTagName("meta"); 902 for (var i = 0; i < elements.length; i++) { 903 var attribute = elements[i].getAttribute('property'); 904 if (attribute == null) { 905 attribute = elements[i].getAttribute('name'); 906 } 907 if (attribute == "twitter:description" || attribute == "og:description" || attribute == "description" || attribute == "Description") { 908 var description = encodeURIComponent(elements[i].getAttribute('content')); 909 paramString += "&description=" + description; 910 break; 911 } 912 } 913 } catch (e) {} 914 915 return paramString 916 }, 917 ibl: function() { 918 var blacklist, domain, protocol, hostname, href, i, len; 919 href = document.referrer; 920 if (href) { 921 hostname = stlib.data.hostname(href) || ''; 922 if (stlib.data.protocol) { 923 protocol = stlib.data.protocol(href) || ''; 924 if (protocol == "android-app:") { 925 return true; 926 } 927 } 928 blacklist = ['aol', 'bing', 'bs.to', 'facebook', 'google', 'yahoo', '
928yandex', document.location.hostname]; 929 for (i = 0, len = blacklist.length; i < len; i++) { 930 domain = blacklist[i]; 931 if (hostname.indexOf(domain) > -1) { 932 return true; 933 } 934 } 935 var logUrl = stlib.logger.loggerUrl + "log?event=ibl&url=" + href; 936 stlib.logger.logByImage("ibl", logUrl, null); 937 } 938 return true; 939 }, 940 obl: function(e) { 941 var href, prefix, ref; 942 if ((e != null ? (ref = e.target) != null ? ref.tagName : void 0 : void 0) === 'A') { 943 href = e.target.getAttribute('href') || ''; 944 prefix = href.slice(0, href.indexOf(':')); 945 if (href.slice(0, 4) === 'http' && e.target.hostname !== document.location.hostname) { 946 var logUrl = stlib.logger.loggerUrl + "log?event=obl&url=" + href; 947 stlib.logger.logByImage("obl", logUrl, null); 948 } 949 } 950 return true; 951 }, 952 getGDPRQueryString: function() { 953 var gdpr_consent = stlib.data.get("gdpr_consent", "pageInfo"); 954 var gdpr_domain = encodeURIComponent(stlib.data.get("gdpr_domain", "pageInfo")); 955 var gdpr_method = stlib.data.get("gdpr_method", "pageInfo"); 956 var gdpr_query_str = ""; 957 if (gdpr_consent) { 958 gdpr_query_str += "&gdpr_consent=" + gdpr_consent; 959 } 960 if (gdpr_domain) { 961 gdpr_query_str += "&gdpr_domain=" + gdpr_domain; 962 } 963 if (gdpr_method) { 964 gdpr_query_str += "&gdpr_method=" + gdpr_method; 965 } 966 return gdpr_query_str; 967 }, 968 969 loadPixelsAsync: function(res) { 970 if (typeof(stlib.product) !== "undefined") { 971 if ((stlib.product == "ecommerce") || 972 (stlib.product == "dos2") || 973 (stlib.product == "feather") || 974 (stlib.product == "simple") || 975 (stlib.product == "simpleshare") || 976 (stlib.product == "simple-share-pro")) { 977 return; 978 } 979 } 980 if (typeof(res) !== "undefined") { 981 if (res.status === "true") { 982 // set stid 983 stlib.data.set("stid", res.stid, "pageInfo") 984 985 // fire the pixel 986 var pxcel_url = "https://t.sharethis.com/1/k/t.dhj?rnd=" + 987 (new Date()).getTime() + 988 "&cid=c010&dmn="+ 989 window.location.hostname + 990 stlib.logger.getGDPRQueryString(); 991 var $el = document.createElement('script'); 992 $el.async = 1; 993 $el.src = pxcel_url; 994 $el.id = "pxscrpt"; 995 var first = document.getElementsByTagName('script')[0]; 996 first.parentNode.insertBefore($el, first); 997 } 998 999 if(res.status === "true" && res.atlas === "true") { 1000 stlib.logger.js("https://platform-api.sharethis.com/atlas-exp.js"); 1001 } 1002 1003 // run dmd script if indicated in response 1004 if (res.dmd === "true") { 1005 var f = function (w, d, s, m, n, t) { 1006 w[m] = w[m] || { 1007 init: function () { (w[m].q = w[m].q || []).push(arguments); }, ready: function (c) { 1008 if ('function' != typeof c) { return; } (w[m].c = w[m].c || []).push(c); c = w[m].c; 1009 n.onload = n.onreadystatechange = function () { 1010 if (!n.readyState || /loaded|complete/.test(n.readyState)) { 1011 n.onload = n.onreadystatechange = null; 1012 if (t.parentNode && n.parentNode) { t.parentNode.removeChild(n); } while (c.length) { (c.shift())(); } 1013 } 1014 }; 1015 } 1016 }, w[m].d = 1 * new Date(); n = d.createElement(s); t = d.getElementsByTagName(s)[0]; 1017 n.async=1;n.src='https://www.medtargetsystem.com/javascript/beacon.js?'+(Date.now().toString()).substring(0,4);n.setAttribute("data-aim",m);t.parentNode.insertBefore(n,t); 1018 } 1019 f(window, document, 'script', 'AIM'); 1020 1021 AIM.init('194-3051-2EAEFDBB', { 'onload_pageview': false }); 1022 1023 AIM.ready(function () { 1024 var stid = stlib.data.get("stid", "pageInfo"); 1025 var url = window.location.href + '#estid=' + stid; 1026 AIM.pageview(url); 1027 }); 1028 } 1029 1030 try { 1031 1032 // run lotame's panorama id code if indicated by the content rule 1033 if(res.status === "true" && res.lotame === "true") { 1034 !function() { 1035 // Callback that will be triggered after each call to sync() 1036 // and let you have access to the profile and/or panorama ids 1037 var syncCallback = function (profile) { 1038 1039 // sync the panorama id 1040 var panorama_id = profile.getPanoramaId(); 1041 if (panorama_id && res.stid) { 1042 var url = "https://sync.sharethis.com/panorama" 1043 url += "?uid=" + encodeURIComponent(panorama_id) 1044 url += "&stid=" + encodeURIComponent(res.stid) 1045 stlib.logger.send(url) 1046 } 1047 1048 }; 1049 1050 var lotame_client_id = '16621'; 1051 var lotame_tag_input = { 1052 config: { 1053 onProfileReady: syncCallback 1054 } 1055 }; 1056 1057 // Lotame initialization 1058 var lotame_config = lotame_tag_input.config || {}; 1059 var namespace = window['lotame_sync_' + lotame_client_id] = {}; 1060 namespace.config = lotame_config; 1061 namespace.data = {}; 1062 namespace.cmd = namespace.cmd || []; 1063 } (); 1064 1065 window.lotame_sync_16621.cmd.push(function() { 1066 window.lotame_sync_16621.sync(); 1067 }); 1068 1069 stlib.logger.js("https://platform-api.sharethis.com/panorama.js"); 1070 } 1071 } catch (e) { 1072 // do nothing for now 1073 } 1074 1075 } 1076 }, 1077 1078 send: function(url) { 1079 var img = new Image(1, 1); 1080 img.src = url; 1081 img.style.display = "none" 1082 img.onload = function() {}; 1083 img.onerror = function() {}; 1084 }, 1085 1086 js: function(url) { 1087 var el = document.createElement('script'); 1088 el.async = 1; 1089 el.src = url; 1090 var first = document.getElementsByTagName('script')[0]; 1091 first.parentNode.insertBefore(el, first); 1092 }, 1093 1094 logByImage: function(event, logUrl, callback) { 1095 1096 // add consent params if they exist 1097 var gdpr_consent = stlib.data.get("gdpr_consent", "pageInfo"); 1098 var gdpr_domain = stlib.data.get("gdpr_domain", "pageInfo"); 1099 if (gdpr_consent) { 1100 logUrl += "&gdpr_consent=" + gdpr_consent; 1101 } 1102 if (gdpr_domain) { 1103 logUrl += "&gdpr_domain=" + gdpr_domain; 1104 } 1105 var gdpr_method = stlib.data.get("gdpr_method", "pageInfo"); 1106 if (gdpr_method) { 1107 logUrl += "&gdpr_method=" + gdpr_method; 1108 } 1109 var usprivacy = stlib.data.get("usprivacy", "pageInfo"); 1110 if (usprivacy) { 1111 logUrl += "&usprivacy=" + usprivacy; 1112 } 1113 1114 // add fpestid if it exists 1115 var fpestid = stlib.data.parseCookie("fpestid", document.cookie); 1116 if (fpestid) { 1117 logUrl += "&fpestid=" + fpestid; 1118 } 1119 1120 // add description if it exists 1121 try { 1122 var elements = document.getElementsByTagName("meta"); 1123 for (var i = 0; i < elements.length; i++) { 1124 var attribute = elements[i].getAttribute('property'); 1125 if (attribute == null) { 1126 attribute = elements[i].getAttribute('name'); 1127 } 1128 if (attribute == "twitter:description" || attribute == "og:description" || attribute == "description" || attribute == "Description") { 1129 var description = encodeURIComponent(elements[i].getAttribute('content')); 1130 logUrl += "&description=" + description; 1131 break; 1132 } 1133 } 1134 } catch (e) {} 1135 1136 var mImage = new Image(1, 1);
1137 mImage.src = logUrl + "&img_pview=true"; 1138 mImage.onload = function () { 1139 return; 1140 }; 1141 if (event == "pview") { 1142 stlib.logger.loadPixelsAsync(undefined); 1143 } else { 1144 callback? callback() : null; 1145 } 1146 }, 1147 1148 // TODO: (step 1) error checking on data 1149 // TODO: (step 2) convert params into a generic object, normalize or prepare before logging 1150 log : function(event, loggingUrl, callback, newEndpoint) { 1151 1152 if(typeof(stlib.data.get("counter", "shareInfo")) != "undefined") { 1153 var count = 0; 1154 if (stlib.data.get("counter", "shareInfo")) { 1155 count = stlib.data.get("counter", "shareInfo"); 1156 } 1157 stlib.data.set("ts" + new Date().getTime() + "." + count, "", "shareInfo"); 1158 stlib.data.unset("counter", "shareInfo"); 1159 } else { 1160 stlib.data.set("ts" + new Date().getTime(), "", "shareInfo"); 1161 } 1162 1163 if(event == 'widget') { 1164 var shortenedDestination = "." + stlib.hash.hashDestination(stlib.data.shareInfo.destination); 1165 stlib.hash.updateDestination(shortenedDestination); 1166 } 1167 1168 //Fix for SAB-709 1169 if ( !loggingUrl || (loggingUrl != stlib.logger.loggerUrl && loggingUrl != stlib.logger.l2LoggerUrl)) { 1170 loggingUrl = stlib.logger.loggerUrl; 1171 } 1172 1173 // Step 3: log data (iterate through objects) 1174 var logName = null; 1175 if (newEndpoint) { 1176 logName = event; 1177 } else { 1178 logName = (event == "pview") ? event : ((event == "debug") ? "cns" : "log"); 1179 } 1180 stlib.data.getEUConsent(function(consent){ 1181 if(event == "pview") { 1182 var logUrl = loggingUrl + logName + "?event="+event+ "&" + "version="+stlib.logger.version+ "&" + "lang="+stlib.logger.lang + "&" + stlib.logger.constructParamString(); 1183 }else { 1184 var logUrl = loggingUrl + logName + "?event="+event + "&" + stlib.logger.constructParamString(); 1185 } 1186 var pview_had_consent = (stlib.data.get("gdpr_consent", "pageInfo")) ? true : false; 1187 stlib.data.set("pview_had_consent", pview_had_consent, "pageInfo"); 1188 1189 var user_agent_data = {} 1190 var ua_fields = {} 1191 stlib.data.ua_fields = ua_fields 1192 1193 try { 1194 if (navigator.userAgentData) { 1195 user_agent_data = navigator.userAgentData; 1196 } 1197 1198 if (Array.isArray(user_agent_data.brands)) { 1199 var ua = "" 1200 user_agent_data.brands.forEach((brand) => { 1201 if (ua) { 1202 ua += ", " 1203 } 1204 ua += `"${brand.brand}";v="${brand.version}"` 1205 }); 1206 ua_fields.ua = ua 1207 1208 logUrl += "&ua=" + encodeURIComponent(ua); 1209 } 1210 1211 if (user_agent_data.mobile !== undefined) { 1212 var ua_mobile = (user_agent_data.mobile) ? "true" : "false"; 1213 ua_fields.ua_mobile = ua_mobile 1214 logUrl += "&ua_mobile=" + encodeURIComponent(ua_mobile); 1215 } 1216 1217 if (user_agent_data.platform) { 1218 var ua_platform = user_agent_data.platform 1219 ua_fields.ua_platform = ua_platform 1220 logUrl += "&ua_platform=" + encodeURIComponent(ua_platform); 1221 } 1222 1223 } catch (e) { 1224 // do nothing for now if it fails 1225 } 1226 1227 // if there is no getHighEntropyValues function create a shell function 1228 // in order to keep the workflow unified 1229 if (!user_agent_data.getHighEntropyValues) { 1230 user_agent_data.getHighEntropyValues = () => { 1231 return new Promise((resolve) => { 1232 resolve({}); 1233 }); 1234 } 1235 } 1236 1237 function once(fn, context) { 1238 var result; 1239 return function() { 1240 if(fn) { 1241 result = fn.apply(context || this, arguments); 1242 fn = null; 1243 } 1244 return result; 1245 }; 1246 } 1247 1248 var sendPageView = once(function() { 1249 1250 try { 1251 var client = new XMLHttpRequest(); 1252 var res; 1253 try { 1254 if (crypto && crypto.randomUUID) { 1255 logUrl += "&uuid=" + crypto.randomUUID() 1256 } 1257 stlib.data.pageInfo.pview_url = logUrl 1258 } catch (e) {} 1259 client.open("GET", logUrl, true); 1260 client.withCredentials = true; 1261 client.timeout = 10000; 1262 client.onreadystatechange = function () { 1263 if (this.readyState == this.DONE) { 1264 try { 1265 res = JSON.parse(client.responseText); 1266 if (res.fpestid) { 1267 stlib.data.writeCookie("fpestid", res.fpestid, res.fpestid_maxage); 1268 } 1269 if (event == "pview") { 1270 /* 1271 // stop firing comscore beacon 1272 if (typeof (stlib.comscore) != "undefined") { 1273 stlib.comscore.load(); 1274 } 1275 */ 1276 stlib.logger.loadPixelsAsync(res); 1277 } else { 1278 callback ? callback(): null; 1279 } 1280 } catch (e) { 1281 // responseText is empty for request timeout 1282 stlib.logger.logByImage(event, logUrl, callback); 1283 } 1284 } 1285 }; 1286 client.send(); 1287 } catch (err) { // some browsers don't support XMLHttpRequest 1288 stlib.logger.logByImage(event, logUrl, callback); 1289 } 1290 }) 1291 1292 var getOverride = function() { 1293 var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 1294 if (is_safari) { 1295 var req = new XMLHttpRequest(); 1296 req.open("GET", "https://data.stbuttons.click/data", true); 1297 req.onreadystatechange = function() { 1298 try { 1299 if (this.readyState == this.DONE) { 1300 var res = JSON.parse(req.responseText) 1301 if (res.data) { 1302 var override = res.data 1303 logUrl += "&override=" + encodeURIComponent(override); 1304 stlib.data.override = override 1305 } 1306 sendPageView() 1307 } 1308 } catch(e) { 1309 sendPageView() 1310 } 1311 } 1312 req.send() 1313 1314 // send page view if request doesn't complete in 2 seconds 1315 setTimeout(sendPageView, 2000) 1316 } else { 1317 sendPageView() 1318 } 1319 } 1320 1321 var high_entropy_fields = [ 1322 "model", 1323 "platformVersion", 1324 "fullVersionList" 1325 ] 1326 1327 user_agent_data.getHighEntropyValues(high_entropy_fields).then((high_entropy_values) => { 1328 1329 try { 1330 1331 if (Array.isArray(high_entropy_values.fullVersionList)) { 1332 var ua_full_version_list = "" 1333 high_entropy_values.fullVersionList.forEach((brand) => { 1334 if (ua_full_version_list) { 1335 ua_full_version_list += ", " 1336 } 1337 ua_full_version_list += `"${brand.brand}";v="${brand.version}"` 1338 }); 1339 ua_fields.ua_full_version_list = ua_full_version_list 1340 logUrl += "&ua_full_version_list=" + encodeURIComponent(ua_full_version_list); 1341 } 1342 1343 if (high_entropy_values.model) { 1344 var ua_model = high_entropy_values.model 1345 ua_fields.ua_model = ua_model 1346 logUrl += "&ua_model=" + encodeURIComponent(ua_model); 1347 } 1348 1349 if (high_entropy_values.platformVersion) { 1350 var ua_platform_version = high_entropy_values.platformVersion 1351 ua_fields.ua_platform_version = ua_platform_version 1352 logUrl += "&ua_platform_version=" + encodeURIComponent(ua_platform_version); 1353 } 1354 1355 } catch (e) { 1356 // do nothing for now 1357 } 1358 1359 getOverride() 1360 1361 }); 1362 1363 }); 1364 }, 1365 tcfapi_listener: function() { 1366 var start = Date.now(); 1367 var interval = setInterval(function() { 1368 if (window.__tcfapi) { 1369 try { 1370 window.__tcfapi("addEventListener", 2, function(data) { 1371 if (data && data.eventStatus == "useractioncomplete") { 1372 stlib.data.set("gdpr_consent", data.tcString, "pageInfo"); 1373 var gdpr_domain = (data.isServiceSpecific) 1374 ? document.location.hostname : ".consensu.org"; 1375 stlib.data.set("gdpr_domain", gdpr_domain, "pageInfo"); 1376 stlib.data.set("gdpr_method", "api", "pageInfo"); 1377 var url = stlib.logger.loggerUrl; 1378 url += "log?event=updated_consent"; 1379 url += "&pview_had_consent=" + stlib.data.get("pview_had_consent", "pageInfo"); 1380 stlib.logger.logByImage("updated_consent", url, null); 1381 } 1382 }); 1383 } catch (e) { 1384 clearInterval(interval); 1385 } 1386 } 1387 if (Date.now() - start > 10000) { 1388 clearInterval(interval); 1389 } 1390 }, 1000); 1391 }() 1392}; 1393 1394/********************END LOGGING***********************/ 1395stlib.logger.version = 'st_insights.js' 1396// set product and property for new buttons 1397if (window.__sharethis__) { 1398 stlib.setProduct(window.__sharethis__.product); 1399 stlib.setPublisher(window.__sharethis__.property); 1400} 1401var sop_pview_logged = typeof __stdos__ !== 'undefined' && __stdos__ !== null && __stdos__.onscriptload; 1402if (!sop_pview_logged && !stlib.onscriptload && document.URL.indexOf("edge.sharethis.com") == -1) { 1403 stlib.data.init(); 1404 stlib.onscriptload = true; 1405 stlib.logger.log("pview", null); 1406} 1407stlib.logger.ibl(); 1408stlib.data.bindEvent(document, "click", stlib.logger.obl); 1409 1410 1411if(typeof(stLight)=="undefined" && typeof(SHARETHIS)=="undefined"){ //make sure it isnt called over and over again 1412 var stWidgetVersion = false;
1413 1414 if(typeof(switchTo5x)=="undefined") { 1415 stWidgetVersion = "4x"; // For Migration Phase 2 - by deafult widget will be 5xa 1416 }else{ 1417 if(switchTo5x == false){ 1418 stWidgetVersion = "4x"; 1419 } 1420 if(switchTo5x == true){ 1421 stWidgetVersion = "5xa"; 1422 } 1423 } 1424 1425 stLight=new function(){ 1426 this.version=false; 1427 this.publisher=null; 1428 this.sessionID_time = (new Date()).getTime().toString(); 1429 this.sessionID_rand = Number(Math.random().toPrecision(5).toString().substr(2)).toString(); 1430 this.sessionID = this.sessionID_time + '.' + this.sessionID_rand; 1431 this.fpc=null; 1432 this.counter=0; 1433 this.readyRun=false; 1434 this.meta={ 1435 hostname: document.location.host, 1436 location: document.location.pathname 1437 }; 1438 this.loadedFromBar=false; 1439 this.clickCallBack=false; 1440 }; 1441 1442 stLight.loadDefault = function() { 1443 if (typeof(customProduct) == "undefined") { 1444 this.product = "DOS2"; 1445 } else{ 1446 this.product = customProduct; 1447 } 1448 this.source = "DOS2"; 1449 this.version = "st_insights.js"; 1450 }; 1451 1452 stLight.options=function(options){ 1453 this.loadDefault(); 1454 // set custom publisher 1455 if(options && options.publisher){ 1456 stLight.setPublisher(options.publisher); 1457 } 1458 1459 // set custom ref domain 1460 if(options && options.refDomain){ 1461 stLight.setRefDomain(options.refDomain); 1462 } 1463 1464 // set custom product 1465 // calls setProduct but doesn't update stLight.product 1466 // deprecated: productArray 1467 stlib.logger.productArray = [] 1468 if(options && options.product){ 1469 stLight.setProduct(options.product); 1470 } 1471 else { 1472 stLight.setProduct(stLight.product); 1473 } 1474 1475 // set copy and share options 1476 if(options && typeof(options.hashAddressBar) != "undefined") { 1477 stlib.hash.hashAddressBar = options.hashAddressBar; 1478 } 1479 stlib.hash.doNotHash = stlib.hash.doNotCopy = false; 1480 if(options) { 1481 options.doNotCopy = options.doNotHash = false; 1482 } 1483 1484 stlib.stLightOptionsObj = options; 1485 }; 1486 1487 stLight.onReady=function(){ 1488 if(stLight.readyRun==true){ 1489 return false; 1490 } 1491 1492 stLight.loadFromScript(); 1493 stLight.readyRun=true; 1494 stlib.data.init(); 1495 stLight.fpc=stlib.data.get("fpc", "pageInfo"); 1496 if(stLight.publisher==null){ 1497 if(typeof(window.console)!=="undefined"){ 1498 try{ 1499 // console.debug("Please specify a ShareThis Publisher Key \nFor help, contact [email protected]"); 1500 }catch(err){} 1501 } 1502 } 1503 stLight.setProduct(stLight.product); 1504 1505 //TODO: set this from the ref? 1506 stlib.logger.lang = 'en'; 1507 1508 }; 1509 1510 1511 1512 1513 //Used only to generate widget and pview events logs. 1514 stLight.log=function(event){ 1515 stlib.data.resetShareData(); 1516 stlib.data.setSource(stLight.getSource()); 1517 stlib.data.set("url", document.location.href, "shareInfo"); 1518 stlib.data.set("title", document.title, "shareInfo"); 1519 stlib.data.set("counter", stLight.counter++, "shareInfo"); 1520 stlib.logger.log(event); 1521 }; 1522 1523 1524 if(window.document.readyState=="completed"){ 1525 stLight.onReady(); 1526 }else{ 1527 if (typeof(window.addEventListener) != 'undefined') { 1528 window.addEventListener("load", stLight.onReady, false); 1529 } else if (typeof(document.addEventListener) != 'undefined') { 1530 document.addEventListener("load", stLight.onReady, false); 1531 } else if (typeof window.attachEvent != 'undefined') { 1532 window.attachEvent("onload", stLight.onReady); 1533 } 1534 } 1535 1536 1537 stLight.setPublisher = function(publisher) { 1538 stlib.data.setPublisher(publisher); 1539 stLight.publisher=publisher; 1540 }; 1541 1542 stLight.setRefDomain = function(refDomain) { 1543 stlib.data.setRefDomain(refDomain); 1544 }; 1545 1546 stLight.setProduct = function(product) { 1547 this.product = product; 1548 stlib.data.set("product", product, "pageInfo"); 1549 }; 1550 1551 stLight.getProduct = function() { 1552 return this.product; 1553 }; 1554 1555 stLight.getSource=function(){ 1556 var source = 'share4x'; 1557 if(stWidgetVersion == "5xa"){ 1558 source = 'share5x'; 1559 } 1560 //TODO: Get share bar version before buttons load 1561 return source; 1562 }; 1563 1564} 1565 1566stLight.getUrlSearchParam = function() { 1567 var list = window.location.search.substring(1); 1568 return list.split("&"); 1569} 1570 1571stLight.getUrlQueryParams = function(url) { 1572 var params = {}; 1573 var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, 1574 function(m,key,value) { 1575 params[key] = value; 1576 }); 1577 return params; 1578} 1579 1580stLight.getScriptSrcParams = function(scriptId){ 1581 var s = document.getElementById(scriptId); 1582 if (s) { 1583 return stLight.getUrlQueryParams(s.src) 1584 } 1585} 1586 1587stLight.setParams = function(params) { 1588 if (params) { 1589 if (params.refdomain) { 1590 stLight.setRefDomain(params.refdomain); 1591 } 1592 if (params.publisher) { 1593 stLight.setPublisher(params.publisher); 1594 } 1595 if (params.product) { 1596 stLight.setProduct(params.product); 1597 } 1598 } 1599} 1600 1601stLight.loadFromScript = function() { 1602 // Load the url params from script "st_insights_js" src 1603 var params = stLight.getScriptSrcParams('st_insights_js'); 1604 stLight.setParams(params) 1605} 1606 1607stLight.loadFromWindowLocation = function() { 1608 var params = stLight.getUrlSearchParam(); 1609 stLight.setParams(params) 1610} 1611 1612//END OF light.js 1613 1614stLight.onDomContentLoaded=function(){ 1615 stLight.onReady(); 1616; 1617}; 1618 1619 1620stLight.domReady=function(){ 1621 stLight.onReady(); 1622}; 1623 1624 1625st_showing=false; 1626 1627stLight.clickSubscribers=[]; 1628stLight.nonClickSubscribers=[]; 1629 1630 1631if(window.document.readyState=="completed"){ 1632 stLight.domReady();//domReady 1633}else{ 1634 if (typeof(window.addEventListener) != 'undefined') { 1635 window.addEventListener("load", stLight.domReady, false); 1636 } else if (typeof(document.addEventListener) != 'undefined') { 1637 document.addEventListener("load", stLight.domReady, false); 1638 } else if (typeof window.attachEvent != 'undefined') { 1639 window.attachEvent("onload", stLight.domReady); 1640 } 1641} 1642 1643 1644 1645//DOMContentLoaded 1646if(typeof(__st_loadLate)=="undefined"){ 1647 if (typeof(window.addEventListener) != 'undefined') { 1648 window.addEventListener("DOMContentLoaded", stLight.onDomContentLoaded, false); 1649 } else if (typeof(document.addEventListener) != 'undefined') { 1650 document.addEventListener("DOMContentLoaded", stLight.onDomContentLoaded, false); 1651 } 1652} else { 1653 if (typeof(window.addEventListener) != 'undefined') { 1654 window.addEventListener("DOMContentLoaded", stLight.onDomContentLoadedLazy, false); 1655 } else if (typeof(document.addEventListener) != 'undefined') { 1656 document.addEventListener("DOMContentLoaded", stLight.onDomContentLoadedLazy, false); 1657 } 1658} 1659 1660 1661if(document.readyState == "complete" && stLight.readyRun==false){ //Keep at the end of the file 1662 //This is called after body is loaded so the domeready call would never get called, so call it here 1663 stLight.domReady(); 1664}
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.