1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10 11(function() { 12 window.ShareThisEvent = {}; 13 14 ShareThisEvent.listen = function (event_name, callback) { 15 if(document.addEventListener) { 16 document.addEventListener(event_name, callback, false); 17 } else { 18 document.documentElement.attachEvent('onpropertychange', function (e) { 19 if(e.propertyName == event_name) { 20 callback(); 21 } 22 }); 23 } 24 }; 25 26 ShareThisEvent.trigger = function (event_name) { 27 if(document.createEvent) { 28 var event = document.createEvent('Event'); 29 event.initEvent(event_name, true, true); 30 document.dispatchEvent(event); 31 } else { 32 document.documentElement[event_name]++; 33 } 34 }; 35 36})(); 37(function(tag){ 38 var e=document.createElement(tag); 39 var id = 'async-buttons'; 40 if (document.getElementById(id)) {return;}; 41 e.type="text/javascript";e.id=id; 42 e.src="https://ws.sharethis.com/button/async-buttons.js"; 43 var s = document.getElementsByTagName("script")[0]; 44 s.parentNode.insertBefore(e, s);})('script'); 45 46 47var stlib = stlib || { 48 functions: [], 49 functionCount: 0, 50 util: { 51 prop: function(p, obj) { 52 if (obj) { 53 return obj[p]; 54 } 55 return function(o) { return o[p]; }; 56 } 57 }, 58 dynamicOn: true, 59 setPublisher : function(pubKey){ 60 stlib.publisher = pubKey; 61 }, 62 setProduct : function(prod){ 63 stlib.product = prod; 64 }, 65 parseQuery: function( query ) { 66 var Params = new Object (); 67 if ( ! query ) return Params; // return empty object 68 var Pairs = query.split(/[;&]/); 69 for ( var i = 0; i < Pairs.length; i++ ) { 70 var KeyVal = Pairs[i].split('='); 71 if ( ! KeyVal || KeyVal.length != 2 ) continue; 72 var key = unescape( KeyVal[0] ); 73 var val = unescape( KeyVal[1] ); 74 val = val.replace(/\+/g, ' '); 75 Params[key] = val; 76 } 77 return Params; 78 }, 79 getQueryParams : function(){ 80 var buttonScript = document.getElementById('st_insights_js'); 81 if(buttonScript && buttonScript.src){ 82 var queryString = buttonScript.src.replace(/^[^\?]+\??/,''); 83 var params = stlib.parseQuery( queryString ); 84 stlib.setPublisher ( params.publisher); 85 stlib.setProduct( params.product); 86 } 87 } 88}; 89 90stlib.global = { 91 hash: stlib.util.prop('hash', document.location).substr(1) 92}; 93 94// Extract out parameters 95stlib.getQueryParams(); 96stlib.debugOn = false; 97stlib.debug = { 98 count: 0, 99 messages: [], 100 debug: function(message, show) { 101 if (show && (typeof console) != "undefined") { 102 console.log(message); 103 } 104 stlib.debug.messages.push(message); 105 }, 106 show: function(errorOnly) { 107 for (message in stlib.debug.messages) { 108 if ((typeof console) != "undefined") { 109 if (errorOnly) { 110 /ERROR/.test(stlib.debug.messages[message]) ? console.log(stlib.debug.messages[message]) : null; 111 } else { 112 console.log(stlib.debug.messages[message]); 113 } 114 } 115 } 116 }, 117 showError: function() { 118 stlib.debug.show(true); 119 } 120}; 121 122var _$d = function(message) { stlib.debug.debug(message, stlib.debugOn); } 123var _$d0 = function() { _$d(" "); }; 124var _$d_ = function() { _$d("___________________________________________"); }; 125var _$d1 = function(m) { _$d(_$dt() + "| " + m); }; 126var _$d2 = function(m) { _$d(_$dt() + "| * " + m); }; 127var _$de = function(m) { _$d(_$dt() + "ERROR: " + m); }; 128 129var _$dt = function() { 130 var today=new Date(); 131 var h=today.getHours(); 132 var m=today.getMinutes(); 133 var s=today.getSeconds(); 134 return h+":"+m+":"+s+" > "; 135}; 136 137stlib.allServices = { 138 adfty: {title: 'Adfty'}, 139 allvoices: {title:'Allvoices'}, 140 amazon_wishlist: {title:'Amazon Wishlist'}, 141 arto: {title:'Arto'}, 142 att: {title:'AT&T'}, 143 baidu: {title: 'Baidu'}, 144 blinklist : {title : 'Blinklist'}, 145 blip: {title: 'Blip'}, 146 blogmarks : {title : 'Blogmarks'}, 147 blogger : {title : 'Blogger',type : 'post'}, 148 buddymarks: {title: 'BuddyMarks'}, 149 buffer: {title: 'Buffer'}, 150 care2 : {title : 'Care2'}, 151 chiq : {title:'chiq'}, 152 citeulike : {title : 'CiteULike'}, 153 chiq : {title : 'chiq'}, 154 corkboard: {title: 'Corkboard'}, 155 dealsplus : {title : 'Dealspl.us'}, 156 delicious : {title : 'Delicious'}, 157 digg : {title : 'Digg'}, 158 diigo : {title : 'Diigo'}, 159 dzone: {title: 'DZone'}, 160 edmodo : {title : 'Edmodo'}, 161 email : {title : 'Email'}, 162 embed_ly : {title : 'Embed.ly'}, 163 evernote: {title:'Evernote'}, 164 facebook : {title : 'Facebook'}, 165 fark : {title : 'Fark'}, 166 fashiolista: {title:'Fashiolista'}, 167 flipboard: {title:'Flipboard'}, 168 folkd:{title:'folkd.com'},
169 foodlve: {title:'FoodLve'}, 170 fresqui : {title : 'Fresqui'}, 171 friendfeed : {title : 'FriendFeed'}, 172 funp : {title : 'Funp'}, 173 fwisp: {title:'fwisp'}, 174 google: {title: 'Google'}, 175 googleplus: {title: 'Google +'}, 176 google_bmarks : {title : 'Bookmarks'}, 177 google_reader: {title: 'Google Reader'}, 178 google_translate: {title: 'Google Translate'}, 179 hatena: {title:'Hatena'}, 180 instapaper : {title : 'Instapaper'}, 181 jumptags: {title:'Jumptags'}, 182 kaboodle:{title:'Kaboodle'}, 183 kik: {title:'Kik'}, 184 linkagogo:{title:'linkaGoGo'}, 185 linkedin : {title : 'LinkedIn'}, 186 livejournal : {title : 'LiveJournal',type : 'post'}, 187 mail_ru : {title : 'mail.ru'}, 188 meneame : {title : 'Meneame'}, 189 messenger : {title : 'Messenger'}, 190 mister_wong : {title : 'Mr Wong'}, 191 moshare : {title : 'moShare'}, 192 myspace : {title : 'MySpace'}, 193 n4g : {title : 'N4G'}, 194 netlog: {title: 'Netlog'}, 195 netvouz:{title:'Netvouz'}, 196 newsvine : {title : 'Newsvine'}, 197 nujij:{title:'NUjij'}, 198 odnoklassniki : {title : 'Odnoklassniki'}, 199 oknotizie : {title : 'Oknotizie'}, 200 pinterest:{title:'Pinterest'}, 201 pocket:{title:'Pocket'}, 202 print:{title:'Print'}, 203 raise_your_voice : {title : 'Raise Your Voice'}, 204 reddit : {title : 'Reddit'}, 205 segnalo : {title : 'Segnalo'}, 206 sharethis : {title : 'ShareThis'}, 207 sina: {title:'Sina'}, 208 sonico : {title : 'Sonico'}, 209 startaid:{title:'Startaid'}, 210 startlap:{title:'Startlap'}, 211 stumbleupon : {title : 'StumbleUpon'}, 212 stumpedia:{title:'Stumpedia'}, 213 typepad : {title : 'TypePad',type : 'post'}, 214 tumblr : {title : 'Tumblr'}, 215 twitter : {title : 'Twitter'}, 216 viadeo:{title:'Viadeo'}, 217 virb:{title:'Virb'}, 218 vkontakte : {title : 'Vkontakte'}, 219 voxopolis:{title: 'VOXopolis'}, 220 whatsapp : {title: 'WhatsApp'}, 221 weheartit : {title: 'We Heart It'}, 222 wordpress : {title : 'WordPress',type : 'post'}, 223 xerpi:{title:"Xerpi"}, 224 xing: {title:'Xing'}, 225 yammer : {title : 'Yammer'} 226}; 227stlib.allOauthServices = { 228 twitter: {title:'Twitter'}, 229 linkedIn : {title : 'LinkedIn'}, 230 facebook : {title : 'Facebook'} 231}; 232stlib.allNativeServices = { 233 fblike:{title:"Facebook Like"}, 234 fbrec:{title:"Facebook Recommend"}, 235 fbsend:{title:"Facebook Send"}, 236 fbsub:{title:"Facebook Subscribe"}, 237 foursquaresave:{title:"Foursquare Save"}, 238 foursquarefollow:{title:"Foursquare Follow"}, 239 instagram:{title:"Instagram Badge"}, 240 plusone: {title:'Google +1'}, 241 pinterestfollow : {title : 'Pinterest Follow'}, 242 twitterfollow : {title : 'Twitter Follow'}, 243 youtube : {title : 'Youtube Subscribe'} 244}; 245stlib.allDeprecatedServices = { 246 google_bmarks:{title:'Google Bookmarks'}, 247 yahoo_bmarks:{title:'Yahoo Bookmarks'} 248}; 249stlib.allOtherServices = { 250 copy:{title:'Copy Paste'}, 251 sharenow:{title:'ShareNow'}, 252 sharenow_auto:{title:'Frictionless Sharing'}, 253 fbunlike:{title:'Facebook Unlike'} 254}; 255var _all_services = stlib.allServices;/********************START BUTTON INFO CODE***********************/ 256/* 257 * This holds critical data about all st buttons on a page. Requires debug() 258 */ 259stlib.buttonInfo = { 260 buttonList: [], 261 addButton: function(obj) { 262 stlib.buttonInfo.buttonList.push(obj); 263 }, 264 getButton: function(key) { 265 if (!isNaN(key)) { 266 if (key >= stlib.buttonInfo.buttonList.length) 267 return false; 268 else 269 return stlib.buttonInfo.buttonList[key]; 270 } else { 271 for (c=0; c<stlib.buttonInfo.buttonList.length; c++) { 272 if (stlib.buttonInfo.buttonList[c].service==key) 273 debug(stlib.buttonInfo.buttonList[c]); 274 } 275 } 276 }, 277 clickButton: function(key) { 278 if (!isNaN(key)) { 279 if (key >= stlib.buttonInfo.buttonList.length) 280 return false; 281 else { 282 if (stlib.buttonInfo.getButton(key).service=="sharethis" || stlib.buttonInfo.getButton(key).service=="email" || stlib.buttonInfo.getButton(key).service=="wordpress") 283 stlib.buttonInfo.getButton(key).popup(); 284 else 285 stlib.buttonInfo.getButton(key).element.childNodes[0].onclick(); 286 } 287 } else { 288 for (c=0; c<stlib.buttonInfo.buttonList.length; c++) { 289 if (stlib.buttonInfo.buttonList[c].service==key) { 290 if (stlib.buttonInfo.getButton(c).service=="sharethis" || stlib.buttonInfo.getButton(c).service=="email" || stlib.buttonInfo.getButton(c).service=="wordpress") { 291 stlib.buttonInfo.getButton(c).popup(); 292 return true; 293 } 294 else 295 stlib.buttonInfo.getButton(c).element.childNodes[0].onclick(); 296 } 297 } 298 } 299 }, 300 resetButton: function() { 301 stlib.buttonInfo.buttonList = []; 302 }, 303 listButton: function () { 304 for (c=0; c<stlib.buttonInfo.buttonList.length; c++) 305 debug(stlib.buttonInfo.buttonList[c]); 306 } 307}; 308 309stlib.buttonInfo.resetButton(); 310/********************END BUTTON INFO CODE***********************/ 311 312/********************START MESSAGE QUEUE***********************/ 313 314stlib.messageQueue = function () { 315 var that = this; 316 this.pumpInstance = null; 317 this.queue = []; 318 this.dependencies = ["data"];
318 // This holds a sorted array of dependency tags, [0] should be loaded before [1]. 319 this.sending = true; 320 this.setPumpInstance = function(pumpInstance){ 321 this.pumpInstance = pumpInstance; 322 }; 323 this.send = function(message, tag){ 324 // Send debug message 325 if ((typeof(message) == "string") && (typeof(tag) == "string")) { 326 _$d_(); 327 _$d1("Queueing message: " + tag + ": " + message); 328 } 329 // Queue the message 330 (typeof(message) == "string") && (typeof(tag) == "string") ? this.queue.push([tag, message]) : null; 331 332 if (this.sending == false || stlib.browser.ieFallback) { // Don't process the queue if it's currently processing 333 if (this.pumpInstance != null) { // If the pumpInstance is valid 334 if (this.dependencies.length > 0) { // If there are current dependencies 335 for (messageSet in this.queue) { // Look for the dependency and send it. If not found, don't send anything. 336 if (this.queue.hasOwnProperty(messageSet) && this.queue[messageSet][0] == this.dependencies[0]) { 337 if(this.queue.length > 0) { 338 _$d1("Current Queue Length: " + this.queue.length); 339 var m = this.queue.shift(); 340 this.pumpInstance.broadcastSendMessage(m[1]); 341 this.dependencies.shift(); 342 this.sending = true; 343 } 344 } 345 } 346 } else { // If there are no dependencies, just send the first message 347 if (this.queue.length > 0) { 348 _$d1("Current Queue Length: " + this.queue.length); 349 var m = this.queue.shift(); 350 this.pumpInstance.broadcastSendMessage(m[1]); 351 this.sending = true; 352 } 353 } 354 } else { 355 _$d_(); 356 _$d1("Pump is null"); 357 } 358 } 359 if ((stlib.browser.ieFallback) && (this.queue.length > 0)) { 360 var processName = "process" + stlib.functionCount; 361 stlib.functionCount++; 362 stlib.functions[processName] = that.process; 363 setTimeout("stlib.functions['" + processName + "']()", 500); 364 } 365 }; 366 this.process = function() { 367 _$d1("Processing MessageQueue"); 368 that.sending = false; 369 _$d(this.queue); 370 that.send(); 371 }; 372}; 373/********************END MESSAGE QUEUE***********************/ 374/* 375 * This handles direct post sharing 376 */ 377stlib.sharer = { 378 sharerUrl: "https://ws.sharethis.com/api/sharer.php", 379 regAuto : new RegExp(/(.*?)_auto$/), //regexp to detect auto events 380 constructParamString: function() { 381 // Validate the data 382 stlib.data.validate(); 383// if (!stlib.hash.doNotHash) { 384 // stlib.hash.checkURL(); 385// } 386 // Pull all the parameters from the page the widget was on 387 var p = stlib.data.pageInfo; 388 var paramString = "?"; 389 var param; 390 for (param in p) { 391 // the following line creates "param=value&" 392 paramString += param + "=" + encodeURIComponent(p[param]) + "&"; 393 _$d1("constructParamStringPageInfo: " + param + ": " + p[param]); 394 } 395 // Pull all the parameters related to the share 396 p = stlib.data.shareInfo; 397 for (param in p) { 398 399 paramString += param + "=" + encodeURIComponent(p[param]) + "&"; 400 _$d1("constructParamStringShareInfo: " + param + ": " + p[param]); 401 } 402 paramString += "ts=" + new Date().getTime() + "&"; 403 404 return paramString.substring(0, paramString.length-1); 405 }, 406 stPrint : function() { 407 window.print(); 408 }, 409 incrementShare : function() { 410 var currentRefer = document.referrer; 411 var referArray = currentRefer.replace("http://", "").replace("https://", "").split("/"); 412 var refD = referArray.shift(); 413 if ( refD == "www.mangatown.com" || refD == "imobiliariacasa.com.br") { 414 return; 415 } 416 var url = stlib.data.get("url", "shareInfo"); 417 var dest = stlib.data.get("destination", "shareInfo"); 418 var proto = "https://"; 419 var cs_ep = "count-server.sharethis.com/increment_shares?countType=share&output=false"; 420 // remove #sthash 421 url = url.split("#sthash")[0] 422 var params = "&service=" + encodeURIComponent(dest) + "&url=" + encodeURIComponent(url) 423 var put_count_url = proto + cs_ep + params 424 if (dest != "copy") { 425 stlib.scriptLoader.loadJavascript(put_count_url, function(){}); 426 } 427 }, 428 sharePinterest : function() { 429 // stlib.sharer.incrementShare(); 430 if (stlib.data.get("image", "shareInfo") == false || stlib.data.get("image", "shareInfo") == null || stlib.data.get("pinterest_native", "shareInfo") == "true"){ 431 if (typeof(stWidget)!="undefined" && typeof(stWidget.closeWidget) === "function") 432 stWidget.closeWidget(); 433 if (typeof(stcloseWidget) === "function") 434 stcloseWidget(); 435 if (typeof(stToolbar) !="undefined" && typeof(stToolbar.closeWidget) === "function") 436 stToolbar.closeWidget(); 437 var e = document.createElement('script'); 438 e.setAttribute('type', 'text/javascript'); 439 e.setAttribute('charset', 'UTF-8'); 440 e.setAttribute('src', 'https://assets.pinterest.com/js/pinmarklet.js?r='+Math.random() * 99999999); 441 document.body.appendChild(e); 442 } 443 }, 444 share: function(callback, popup) { 445 var paramString = stlib.sharer.constructParamString(); 446 _$d_(); 447 _$d1("Initiating a Share with the following url:"); 448 _$d2(stlib.sharer.sharerUrl + paramString); 449 // stlib.sharer.incrementShare(); 450 451 // Pass sharer.php differently if destination has "_auto" 452 // ("fblike_auto""fbunlike_auto""fbsend_auto""twitter_click_auto""twitter_tweet_auto""twitter_retweet_auto""twitter_favorite_auto""twitter_follow_auto") 453 if ((stlib.data.get("destination", "shareInfo") == "print") || (stlib.data.get("destination", "shareInfo") == "email") || (stlib.data.get("destination", "shareInfo") == "pinterest" && stlib.data.get("source", "shareInfo").match(/share4xmobile/) == null && stlib.data.get("source", "shareInfo").match(/share4xpage/) == null && stlib.data.get("source", "shareInfo").match(/5xpage/) == null && (stlib.data.get("image", "shareInfo") == false || stlib.data.get("image", "shareInfo") == null))|| stlib.data.get("destination", "shareInfo") == "snapsets" || stlib.data.get("destination", "shareInfo") == "copy" || stlib.data.get("destination", "shareInfo") == "plusone" || stlib.data.get("destination", "shareInfo").match(stlib.sharer.regAuto) || (typeof(stlib.nativeButtons) != "undefined" && stlib.nativeButtons.checkNativeButtonSupport(stlib.data.get("destination", "shareInfo")))||(stlib.data.get("pinterest_native", "shareInfo") != false && stlib.data.get("pinterest_native", "shareInfo") != null)){ 454 var mImage = new Image(1,1); 455 mImage.src = stlib.sharer.sharerUrl + paramString; 456 mImage.onload = function(){return;}; 457 } else { 458 if (typeof(popup)!="undefined"&&popup==true) // <-- force popup here 459 window.open(stlib.sharer.sharerUrl + paramString, (new Date()).valueOf(), "scrollbars=1, status=1, height=480, width=640, resizable=1"); 460 else 461 window.open(stlib.sharer.sharerUrl + paramString); 462 } 463 464 callback ? callback() : null; 465 } 466}; 467/********************START SCRIPTLOADER***********************/ 468/* 469 * This handles on demand loading of javascript and CSS files 470 */ 471stlib.scriptLoader = { 472 loadJavascript : function(href,callBack){ 473 var loader = stlib.scriptLoader; 474 loader.head=document.getElementsByTagName('head')[0]; 475 loader.scriptSrc=href; 476 loader.script=document.createElement('script'); 477 loader.script.setAttribute('type', 'text/javascript'); 478 loader.script.setAttribute('src', loader.scriptSrc); 479 loader.script.async = true; 480 481 if(window.attachEvent && document.all) { //IE: 482 loader.script.onreadystatechange=function(){ 483 if(this.readyState=='complete' || this.readyState=='loaded'){ 484 callBack(); 485 } 486 }; 487 } else { //other browsers: 488 loader.script.onload=callBack; 489 } 490 loader.s = document.getElementsByTagName('script')[0]; 491 loader.s.parentNode.insertBefore(loader.script, loader.s); 492 }, 493 loadCSS : function(href,callBack) { 494 _$d_(); 495 _$d1("Loading CSS: " + href); 496 var loader = stlib.scriptLoader; 497 var cssInterval; 498 loader.head=document.getElementsByTagName('head')[0]; 499 loader.cssSrc=href; 500 loader.css=document.createElement('link'); 501 loader.css.setAttribute('rel', 'stylesheet'); 502 loader.css.setAttribute('type', 'text/css'); 503 loader.css.setAttribute('href', href); 504 loader.css.setAttribute('id', href); 505 setTimeout(function(){ 506 callBack(); 507 if(!document.getElementById(href)){ 508 cssInterval=setInterval(function(){ 509 if(document.getElementById(href)){ 510 clearInterval(cssInterval); 511 callBack(); 512 } 513 }, 100); 514 } 515 },100); 516 loader.head.appendChild(loader.css); 517 } 518}; 519/********************END SCRIPTLOADER***********************/ 520/********************START BROWSER CODE***********************/ 521stlib.browser = { 522 iemode: null, 523 firefox: null, 524 firefoxVersion: null, 525 safari: null, 526 chrome: null, 527 opera: null, 528 windows: null, 529 mac: null, 530 ieFallback: (/MSIE [6789]/).test(navigator.userAgent), 531 //ieFallback: true, 532 533 init: function() { 534 var ua = navigator.userAgent.toString().toLowerCase(); 535 536 if (/msie|trident/i.test(ua)) { 537 if (document.documentMode) // IE8 or later 538 stlib.browser.iemode = document.documentMode; 539 else{ // IE 5-7 540 stlib.browser.iemode = 5; // Assume quirks mode unless proven otherwise 541 if (document.compatMode){ 542 if (document.compatMode == "CSS1Compat") 543 stlib.browser.iemode = 7; // standards mode 544 } 545 } 546 //stlib.browser.iemode = getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i); //IE11+ 547 } 548 /*stlib.browser.firefox =(navigator.userAgent.indexOf("Firefox") !=-1) ? true : false;
549 stlib.browser.firefoxVersion =(navigator.userAgent.indexOf("Firefox/5.0") !=-1 || navigator.userAgent.indexOf("Firefox/9.0") !=-1) ? false : true; 550 stlib.browser.safari =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") ==-1) ? true : false; 551 stlib.browser.chrome =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") !=-1) ? true : false; 552 stlib.browser.windows =(navigator.userAgent.indexOf("Windows") !=-1) ? true : false; 553 stlib.browser.mac =(navigator.userAgent.indexOf("Macintosh") !=-1) ? true : false;*/ 554 555 stlib.browser.firefox = ((ua.indexOf("firefox") !=-1) && (typeof InstallTrigger !== 'undefined'))?true:false; 556 stlib.browser.firefoxVersion =(ua.indexOf("firefox/5.0") !=-1 || ua.indexOf("firefox/9.0") !=-1) ? false : true; 557 stlib.browser.safari = (ua.indexOf("safari") !=-1 && ua.indexOf("chrome") ==-1)?true:false; 558 stlib.browser.chrome = (ua.indexOf("safari") !=-1 && ua.indexOf("chrome") !=-1)?true:false; 559 stlib.browser.opera = (window.opera || ua.indexOf(' opr/') >= 0)?true:false; 560 stlib.browser.windows =(ua.indexOf("windows") !=-1) ? true : false; 561 stlib.browser.mac =(ua.indexOf("macintosh") !=-1) ? true : false; 562 }, 563 564 getIEVersion : function() { 565 return stlib.browser.iemode; 566 }, 567 isFirefox : function() { 568 return stlib.browser.firefox; 569 }, 570 firefox8Version : function() { 571 return stlib.browser.firefoxVersion; 572 }, 573 isSafari : function() { 574 return stlib.browser.safari; 575 }, 576 isWindows : function() { 577 return stlib.browser.windows; 578 }, 579 isChrome : function() { 580 return stlib.browser.chrome; 581 }, 582 isOpera : function() { 583 return stlib.browser.opera; 584 }, 585 isMac : function() { 586 return stlib.browser.mac; 587 }, 588 isSafariBrowser: function(vendor, ua) { 589 // check if browser is safari 590 var isSafari = vendor && 591 vendor.indexOf('Apple Computer, Inc.') > -1 && 592 ua && !ua.match('CriOS'); 593 // check if browser is not chrome 594 var notChrome = /^((?!chrome|android).)*safari/i.test(ua); 595 // check if browser is not firefox 596 var notFireFox = /^((?!firefox|linux))/i.test(ua); 597 // check if OS is from Apple 598 var isApple = (ua.indexOf('Mac OS X') > -1) || 599 (/iPad|iPhone|iPod/.test(ua) && !window.MSStream); 600 // check if OS is windows 601 var isWindows = (ua.indexOf('Windows NT') > -1) && notChrome; 602 // browser is safari but not chrome 603 return (isSafari && notChrome && notFireFox && (isApple || isWindows)); 604 } 605}; 606 607stlib.browser.init(); 608/********************END BROWSER CODE***********************/ 609/********************START MOBILE BROWSER CODE***********************/ 610 611stlib.browser.mobile = { 612 mobile:false, 613 uagent: null, 614 android: null, 615 iOs: null, 616 silk: null, 617 windows: null, 618 kindle: null, 619 url: null, 620 sharCreated: false, 621 sharUrl: null, 622 isExcerptImplementation: false, //Flag to check if multiple sharethis buttons (Excerpt) have been implemented 623 iOsVer: 0, // It will hold iOS version if device is iOS else 0 624 625 init: function () { 626 this.uagent = navigator.userAgent.toLowerCase(); 627 if (this.isAndroid()) { 628 this.mobile = true; 629 }else if (this.isIOs()) { 630 this.mobile = true; 631 } else if (this.isSilk()) { 632 this.mobile = true; 633 } else if (this.isWindowsPhone()) { 634 this.mobile = true; 635 }else if (this.isKindle()) { 636 this.mobile = true; 637 } 638 639 640 }, 641 642 isMobile: function isMobile() { 643 return this.mobile; 644 }, 645 646 isAndroid: function() { 647 if (this.android === null) { 648 this.android = this.uagent.indexOf("android") > -1; 649 } 650 return this.android; 651 }, 652 653 isKindle: function() { 654 if (this.kindle === null) { 655 this.kindle = this.uagent.indexOf("kindle") > -1; 656 } 657 return this.kindle; 658 }, 659 660 isIOs: function isIOs() { 661 if (this.iOs === null) { 662 this.iOs = (this.uagent.indexOf("ipad") > -1) || 663 (this.uagent.indexOf("ipod") > -1) || 664 (this.uagent.indexOf("iphone") > -1); 665 } 666 return this.iOs; 667 668 }, 669 670 isSilk: function() { 671 if (this.silk === null) { 672 this.silk = this.uagent.indexOf("silk") > -1; 673 } 674 return this.silk; 675 }, 676 677 /** 678 * This is to get iOS version if iOS device, else return 0 679 */ 680 getIOSVersion: function() { 681 if (this.isIOs()) { 682 this.iOsVer = this.uagent.substr( (this.uagent.indexOf( 'os ' )) + 3, 5 ).replace( /\_/g, '.' ); 683 } 684 return this.iOsVer; 685 }, 686 687 isWindowsPhone: function() { 688 if (this.windows === null) { 689 this.windows = this.uagent.indexOf("windows phone") > -1; 690 } 691 return this.windows; 692 } 693 694}; 695 696stlib.browser.mobile.init(); 697 698/********************END MOBILE BROWSER CODE***********************/ 699 700/********************START MOBILE BROWSER FRIENDLY CODE***********************/ 701stlib = stlib || {}; 702stlib.browser = stlib.browser || {}; 703stlib.browser.mobile = stlib.browser.mobile || {}; 704 705stlib.browser.mobile.handleForMobileFriendly = function(o, options, widgetOpts) { 706 if (!this.isMobile()) { 707 return false;
708 } 709 if (typeof(stLight) === 'undefined') { 710 stLight = {} 711 stLight.publisher = options.publisher; 712 stLight.sessionID = options.sessionID; 713 stLight.fpc = ""; 714 } 715 var title = (typeof(o.title) !== 'undefined') ? o.title: encodeURIComponent(document.title); 716 var url = (typeof(o.url) !== 'undefined') ? o.url: document.URL; 717 //SA-77: introduce new st_short_url parameter 718 var shortUrl = (options.short_url != "" && options.short_url != null) ? options.short_url : ''; 719 720 if (options.service=="sharethis") { 721 var title = (typeof(o.title) !== 'undefined') ? o.title: encodeURIComponent(document.title); 722 var url = (typeof(o.url) !== 'undefined') ? o.url: document.URL; 723 724 725 726 var summary = ''; 727 if(typeof(o.summary)!='undefined' && o.summary!=null){ 728 summary=o.summary; 729 } 730 var form = document.createElement("form"); 731 form.setAttribute("method", "GET"); 732 form.setAttribute("action", "http://edge.sharethis.com/share4x/mobile.html"); 733 form.setAttribute("target", "_blank"); 734 //destination={destination}&url={url}&title={title}&publisher={publisher}&fpc={fpc}&sessionID={sessionID}&source=buttons 735 736 var params={url:url,title:title,summary:summary,destination:options.service,publisher:stLight.publisher,fpc:stLight.fpc,sessionID:stLight.sessionID,short_url:shortUrl}; 737 if(typeof(o.image)!='undefined' && o.image!=null){ 738 params.image=o.image; 739 }if(typeof(o.summary)!='undefined' && o.summary!=null){ 740 params.desc=o.summary; 741 }if(typeof(widgetOpts)!='undefined' && typeof(widgetOpts.exclusive_services)!='undefined' && widgetOpts.exclusive_services!=null){ 742 params.exclusive_services=widgetOpts.exclusive_services; 743 }if(typeof(options.exclusive_services)!='undefined' && options.exclusive_services!=null){ 744 params.exclusive_services=options.exclusive_services; 745 }if(typeof(widgetOpts)!='undefined' && typeof(widgetOpts.services)!='undefined' && widgetOpts.services!=null){ 746 params.services=widgetOpts.services; 747 }if(typeof(options.services)!='undefined' && options.services!=null){ 748 params.services=options.services; 749 } 750 751 // Get any additional options 752 var containsOpts = options; 753 if (typeof(widgetOpts)!='undefined') { 754 containsOpts = widgetOpts; 755 } 756 if(typeof(containsOpts.doNotHash)!='undefined' && containsOpts.doNotHash!=null){ 757 params.doNotHash=containsOpts.doNotHash; 758 } 759 if(typeof(o.via)!='undefined' && o.via!=null){ 760 params.via=o.via; 761 } 762 763 params.service = options.service; 764 params.type = options.type; 765 if (stlib.data) { 766 var toStoreA = stlib.json.encode(stlib.data.pageInfo); 767 var toStoreB = stlib.json.encode(stlib.data.shareInfo); 768 769 if (stlib.browser.isFirefox() && !stlib.browser.firefox8Version()) { 770 toStoreA = encodeURIComponent(encodeURIComponent(toStoreA)); 771 toStoreB = encodeURIComponent(encodeURIComponent(toStoreB)); 772 } 773 else { 774 toStoreA = encodeURIComponent(toStoreA); 775 toStoreB = encodeURIComponent(toStoreB); 776 } 777 778 params.pageInfo = toStoreA; 779 params.shareInfo = toStoreB; 780 } 781 782 for(var key in params) { 783 var hiddenField = document.createElement("input"); 784 hiddenField.setAttribute("type", "hidden"); 785 hiddenField.setAttribute("name", key); 786 hiddenField.setAttribute("value", params[key]); 787 form.appendChild(hiddenField); 788 } 789 document.body.appendChild(form); 790 form.submit(); 791 return true; 792 } 793 if(options.service=='email') { 794 var sharInterval, i=0; 795 stlib.browser.mobile.url = url; 796 if(stlib.browser.mobile.sharUrl == null) { 797 stlib.browser.mobile.createSharOnPage(); 798 } 799 var body = (shortUrl != "") ? shortUrl + "%0A%0a" : "{sharURLValue}" + "%0A%0a"; 800 if( (typeof(o.summary) != 'undefined') && o.summary!=null){ 801 body += o.summary + "%0A%0a"; 802 } 803 body += "Sent using ShareThis"; 804 var mailto = "mailto:?"; 805 mailto += "subject=" + title; 806 mailto += "&body=" +body; 807 808 //WID-709: Shar implementation done 809 sharInterval = setInterval( function(){ 810 if(stlib.browser.mobile.sharUrl != null){ 811 clearInterval(sharInterval); 812 window.location.href=mailto.replace("{sharURLValue}", stlib.browser.mobile.sharUrl); 813 } 814 if(i > 500) { 815 clearInterval(sharInterval); 816 window.location.href=mailto.replace("{sharURLValue}", stlib.browser.mobile.sharUrl); 817 } 818 i++; 819 }, 100); 820 } 821 return true; 822 }; 823 824stlib.browser.mobile.createSharOnPage = function(){ 825 if(stlib.browser.mobile.url!=="" && stlib.browser.mobile.url!==" " && stlib.browser.mobile.url!==null && !stlib.browser.mobile.sharCreated) 826 { 827 var data=["return=json","cb=stlib.browser.mobile.createSharOnPage_onSuccess","service=createSharURL","url="+encodeURIComponent(stlib.browser.mobile.url)]; 828 data=data.join('&'); 829 stlib.scriptLoader.loadJavascript("https://ws.sharethis.com/api/getApi.php?"+data, function(){}); 830 } 831}; 832 833stlib.browser.mobile.createSharOnPage_onSuccess = function(response){ 834 if(response.status=="SUCCESS") { 835 stlib.browser.mobile.sharCreated = true; 836 stlib.browser.mobile.sharUrl = response.data.sharURL; 837 } else { 838 stlib.browser.mobile.sharUrl = stlib.browser.mobile.url; 839 } 840}; 841 842/********************END MOBILE BROWSER FRIENDLY CODE***********************/ 843 844/********************START COOKIE LIBRARY***********************/ 845/* 846 * This handles cookies 847 */ 848var tpcCookiesEnableCheckingDone = false;
849var tpcCookiesEnabledStatus = true; 850 851stlib.cookie = { 852 setCookie : function(name, value, days) { 853 var safari =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") ==-1); 854 var ie =(navigator.userAgent.indexOf("MSIE") !=-1); 855 856 if (safari || ie) { 857 var expiration = (days) ? days*24*60*60 : 0; 858 859 var _div = document.createElement('div'); 860 _div.setAttribute("id", name); 861 _div.setAttribute("type", "hidden"); 862 document.body.appendChild(_div); 863 864 var 865 div = document.getElementById(name), 866 form = document.createElement('form'); 867 868 try { 869 var iframe = document.createElement('<iframe name="'+name+'" ></iframe>'); 870 //try is ie 871 } catch(err) { 872 //catch is ff and safari 873 iframe = document.createElement('iframe'); 874 } 875 876 iframe.name = name; 877 iframe.src = 'javascript:false'; 878 iframe.style.display="none"; 879 div.appendChild(iframe); 880 881 form.action = "https://sharethis.com/account/setCookie.php"; 882 form.method = 'POST'; 883 884 var hiddenField = document.createElement("input"); 885 hiddenField.setAttribute("type", "hidden"); 886 hiddenField.setAttribute("name", "name"); 887 hiddenField.setAttribute("value", name); 888 form.appendChild(hiddenField); 889 890 var hiddenField2 = document.createElement("input"); 891 hiddenField2.setAttribute("type", "hidden"); 892 hiddenField2.setAttribute("name", "value"); 893 hiddenField2.setAttribute("value", value); 894 form.appendChild(hiddenField2); 895 896 var hiddenField3 = document.createElement("input"); 897 hiddenField3.setAttribute("type", "hidden"); 898 hiddenField3.setAttribute("name", "time"); 899 hiddenField3.setAttribute("value", expiration); 900 form.appendChild(hiddenField3); 901 902 form.target = name; 903 div.appendChild(form); 904 905 form.submit(); 906 } 907 else { 908 if (days) { 909 var date = new Date(); 910 date.setTime(date.getTime()+(days*24*60*60*1000)); 911 var expires = "; expires="+date.toGMTString(); 912 } else { 913 var expires = ""; 914 } 915 var cookie_string = name + "=" + escape(value) + expires; 916 cookie_string += "; domain=" + escape (".sharethis.com")+";path=/"; 917 document.cookie = cookie_string; 918 } 919 }, 920 setTempCookie : function(name, value, days) { 921 if (days) { 922 var date = new Date(); 923 date.setTime(date.getTime()+(days*24*60*60*1000)); 924 var expires = "; expires="+date.toGMTString(); 925 } else { 926 var expires = ""; 927 } 928 var cookie_string = name + "=" + escape(value) + expires; 929 cookie_string += "; domain=" + escape (".sharethis.com")+";path=/"; 930 document.cookie = cookie_string; 931 }, 932 getCookie : function(cookie_name) { 933 var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); 934 if (results) { 935 return (unescape(results[2])); 936 } else { 937 return false; 938 } 939 }, 940 deleteCookie : function(name) { 941 942 // For all browsers 943 var path="/"; 944 var domain=".sharethis.com"; 945 document.cookie = name.replace(/^\s+|\s+$/g,"") + "=" +( ( path ) ? ";path=" + path : "") 946 + ( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT"; 947 948 949 // For Safari and IE 950 var safari =(navigator.userAgent.indexOf("Safari") !=-1 && navigator.userAgent.indexOf("Chrome") ==-1); 951 var ie =(navigator.userAgent.indexOf("MSIE") !=-1); 952 953 if (safari || ie) { 954 var _div = document.createElement('div'); 955 _div.setAttribute("id", name); 956 _div.setAttribute("type", "hidden"); 957 document.body.appendChild(_div); 958 959 var 960 div = document.getElementById(name), 961 form = document.createElement('form'); 962 963 try { 964 var iframe = document.createElement('<iframe name="'+name+'" ></iframe>'); 965 //try is ie 966 } catch(err) { 967 //catch is ff and safari 968 iframe = document.createElement('iframe'); 969 } 970 971 iframe.name = name; 972 iframe.src = 'javascript:false'; 973 iframe.style.display="none"; 974 div.appendChild(iframe); 975 976 form.action = "https://sharethis.com/account/deleteCookie.php"; 977 form.method = 'POST'; 978 979 var hiddenField = document.createElement("input"); 980 hiddenField.setAttribute("type", "hidden"); 981 hiddenField.setAttribute("name", "name"); 982 hiddenField.setAttribute("value", name); 983 form.appendChild(hiddenField); 984 985 form.target = name; 986 div.appendChild(form); 987 988 form.submit(); 989 } 990 }, 991 deleteAllSTCookie : function() { 992 var a=document.cookie; 993 a=a.split(';'); 994 for(var i=0;i<a.length;i++){ 995 var b=a[i]; 996 b=b.split('='); 997 998 // do not delete the st_optout cookie 999 if(!/st_optout/.test(b[0])){ 1000 var name=b[0]; 1001 var path="/"; 1002 var domain=".edge.sharethis.com"; 1003 document.cookie = name + "=;
1003path=" + path + ";domain=" + domain +";expires=Thu, 01-Jan-1970 00:00:01 GMT"; 1004 } 1005 } 1006 }, 1007 setFpcCookie : function(name, value) { 1008// var name="__unam"; 1009 var current_date = new Date; 1010 var exp_y = current_date.getFullYear(); 1011 var exp_m = current_date.getMonth() + 9;// set cookie for 9 months into future 1012 var exp_d = current_date.getDate(); 1013 var cookie_string = name + "=" + escape(value); 1014 if (exp_y) { 1015 var expires = new Date (exp_y,exp_m,exp_d); 1016 cookie_string += "; expires=" + expires.toGMTString(); 1017 } 1018 var domain=stlib.cookie.getDomain(); 1019 cookie_string += "; domain=" + escape (domain)+";path=/"; 1020 document.cookie = cookie_string; 1021 }, 1022 getFpcCookie : function(cookie_name) { 1023 var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); 1024 if (results) 1025 return (unescape(results[2])); 1026 else 1027 return false; 1028 }, 1029 getDomain : function() { 1030 var str = document.domain.split(/\./); 1031 var domain=""; 1032 if(str.length>1){ 1033 domain="."+str[str.length-2]+"."+str[str.length-1]; 1034 } 1035 return domain; 1036 }, 1037 checkCookiesEnabled: function() { 1038 if(!tpcCookiesEnableCheckingDone) { 1039 stlib.cookie.setTempCookie("STPC", "yes", 1); 1040 if(stlib.cookie.getCookie("STPC") == "yes") { 1041 tpcCookiesEnabledStatus = true; 1042 }else { 1043 tpcCookiesEnabledStatus = false; 1044 } 1045 tpcCookiesEnableCheckingDone = true; 1046 return tpcCookiesEnabledStatus; 1047 }else{ 1048 return tpcCookiesEnabledStatus; 1049 } 1050 }, 1051 hasLocalStorage: function() { 1052 try { 1053 localStorage.setItem("stStorage", "yes"); 1054 localStorage.removeItem("stStorage"); 1055 return true; 1056 } catch(e) { 1057 return false; 1058 } 1059 } 1060}; 1061/********************END COOKIE LIBRARY***********************/ 1062/* 1063 * Requires cookie.js 1064 */ 1065stlib.fpc = { 1066 cookieName: "__unam", 1067 cookieValue: "", 1068 createFpc: function() { 1069 if(!document.domain || document.domain.search(/\.gov/) > 0){ 1070 return false; 1071 } 1072// var firstPersonCookie = stlib.cookie.getCookie(stlib.fpc.cookieName); 1073 var firstPersonCookie = stlib.cookie.getFpcCookie(stlib.fpc.cookieName); 1074 if(firstPersonCookie==false){ 1075 // Create a new cookie 1076 var bigRan = Math.round(Math.random() * 2147483647); 1077 bigRan = bigRan.toString(16); 1078 1079 var time = (new Date()).getTime(); 1080 time = time.toString(16); 1081 1082 var partialDomain = window.location.hostname.split(/\./)[1]; 1083 if(!partialDomain){ 1084 return false; 1085 } 1086 1087 var cookieValue = ""; 1088 cookieValue = stlib.fpc.determineHash(partialDomain) + "-" + time + "-" + bigRan + "-1"; 1089 1090 firstPersonCookie = cookieValue; 1091 }else{ 1092 // Increment the counter on the cookie by one 1093 var originalCookie = firstPersonCookie; 1094 var originalCookieArray = originalCookie.split(/\-/); 1095 if(originalCookieArray.length == 4){ 1096 var num = Number(originalCookieArray[3]); 1097 num++; 1098 firstPersonCookie = originalCookieArray[0] + "-" + originalCookieArray[1] + "-" + originalCookieArray[2] + "-" + num; 1099 } 1100 } 1101 1102// stlib.cookie.setCookie(stlib.fpc.cookieName, firstPersonCookie, 90); 1103 stlib.cookie.setFpcCookie(stlib.fpc.cookieName, firstPersonCookie); 1104 stlib.fpc.cookieValue = firstPersonCookie; 1105 return firstPersonCookie; 1106 }, 1107 1108 determineHash: function(partialDomain) { 1109 var hash = 0; 1110 var salt = 0; 1111 for (var i = partialDomain.length - 1; i >= 0; i--) { 1112 var charCode = parseInt(partialDomain.charCodeAt(i)); 1113 hash = ((hash << 8) & 268435455) + charCode + (charCode << 12); 1114 if ((salt = hash & 161119850) != 0){ 1115 hash = (hash ^ (salt >> 20)); 1116 } 1117 } 1118 return hash.toString(16); 1119 } 1120}; 1121stlib.validate = { 1122 regexes: { 1123 notEncoded: /(%[^0-7])|(%[0-7][^0-9a-f])|["{}\[\]\<\>\\\^`\|]/gi, 1124 tooEncoded: /%25([0-7][0-9a-f])/gi, 1125 publisher: /^(([a-z]{2}(-|\.))|)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, 1126 url: /^(http|https):\/\/([a-z0-9!'\(\)\*\.\-\+:]*(\.)[a-z0-9!'\(\)\*\.\-\+:]*)((\/[a-z0-9!'\(\)\*\.\-\+:]*)*)/i, 1127 fpc: /^[0-9a-f]{7}-[0-9a-f]{11}-[0-9a-f]{7,8}-[0-9]*$/i, 1128 sessionID: /^[0-9]*\.[0-9a-f]*$/i, 1129 title: /.*/, 1130 description: /.*/, 1131 buttonType: /^(chicklet|vcount|hcount|large|custom|button|)$/, // TODO: verify, also, is blank ok. 1132 comment: /.*/, 1133 destination: /.*/, // TODO: check against all service (construct a regexp?) 1134 source: /.*/, // TODO: Need to define this 1135 image: /(^(http|https):\/\/([a-z0-9!'\(\)\*\.\-\+:]*(\.)[a-z0-9!'\(\)\*\.\-\+:]*)((\/[a-z0-9!'\(\)\*\.\-\+:]*)*))|^$/i, 1136 sourceURL: /^(http|https):\/\/([a-z0-9!'\(\)\*\.\-\+:]*(\.)[a-z0-9!'\(\)\*\.\-\+:]*)((\/[a-z0-9!'\(\)\*\.\-\+:]*)*)/i, 1137 sharURL: /(^(http|https):\/\/([a-z0-9!'\(\)\*\.\-\+:]*(\.)[a-z0-9!'\(\)\*\.\-\+:]*)((\/[a-z0-9!'\(\)\*\.\-\+:]*)*))|^$/i 1138 } 1139}; 1140 1141stlib.html = { 1142 encode : function(value) { 1143 if(stlib.html.startsWith(value, 'http')) {//URL check 1144 return String(value) 1145 .replace(/"/g, '"') 1146 .replace(/'/g, ''') 1147 .replace(/</g, '<') 1148 .replace(/>/g, '>'); 1149 } else { 1150 return String(value) 1151 .replace(/&/g, '&') 1152 .replace(/"/g, '"') 1153 .replace(/'/g, ''') 1154 .replace(/</g, '<') 1155 .replace(/>/g, '>'); 1156 } 1157 }, 1158 1159 startsWith : function(value, str) { 1160 return (value.match("^"+str)==str); 1161 } 1162}; 1163/* 1164 * This holds critical data, requires the cookie object 1165 */ 1166if (typeof(stlib.data) == "undefined") { 1167 stlib.data = { 1168 bInit: false, 1169 publisherKeySet: false, 1170 pageInfo: { 1171 }, 1172 shareInfo: { 1173 }, 1174 resetPageData: function() { 1175 //stlib.data.pageInfo.publisher = "00-00-00"; // The publisher key as given by the publisher 1176 //stlib.data.pageInfo.fpc = "ERROR"; // The cookie set on the publisher's domain to track the user on that domain 1177 stlib.data.pageInfo.sessionID = "ERROR"; // The session on any given pageview with our widget on it 1178 //stlib.data.pageInfo.sourceURL = "ERROR"; // The source domain 1179 stlib.data.pageInfo.hostname = "ERROR"; // The source domain 1180 stlib.data.pageInfo.location = "ERROR"; // The source domain 1181 stlib.data.pageInfo.product = "widget"; 1182 stlib.data.pageInfo.stid = ""; 1183 }, 1184 resetShareData: function() { 1185 stlib.data.shareInfo = {}; 1186 stlib.data.shareInfo.url = "ERROR"; // The url the service is sharing before any modification 1187 stlib.data.shareInfo.sharURL = ""; // The shar url the service is sharing before any modification 1188 stlib.data.shareInfo.buttonType = "ERROR"; // The button type that were clicked (hcount or vcount) 1189 stlib.data.shareInfo.destination = "ERROR"; // The channel that is being shared to (facebook, twitter) 1190 stlib.data.shareInfo.source = "ERROR"; // The widget or code location that is generating the request 1191 //stlib.data.shareInfo.title = ""; // The title of the article as best as can be determined 1192 //stlib.data.shareInfo.image = ""; // The title of the article as best as can be determined 1193 //stlib.data.shareInfo.description = ""; // The description of the article as best as can be determined 1194 //stlib.data.shareInfo.comment = ""; // The description of the article as best as can be determined 1195 }, 1196 resetData: function() { 1197 stlib.data.resetPageData(); 1198 stlib.data.resetShareData(); 1199 }, 1200 validate: function () { 1201 var regexes = stlib.validate.regexes; 1202 1203 function validateHelp(key, value) { 1204 if (value != encodeURIComponent(value)) { 1205 regexes.notEncoded.test(value) ? _$de(key + " not encoded") : null; 1206 regexes.tooEncoded.test(value) ? _$de(key + " has too much encoding") :null; 1207 } 1208 var valueOk = regexes[key] ? regexes[key].test(decodeURIComponent(value)) : true; 1209 if (!valueOk) { 1210 _$de(key + " failed validation"); 1211 } 1212 } 1213 1214 var p = stlib.data.pageInfo; 1215 var param; 1216 for (param in p) { 1217 validateHelp(param, p[param]) 1218 } 1219 p = stlib.data.shareInfo; 1220 for (param in p) { 1221 validateHelp(param, p[param]) 1222 } 1223 1224 }, 1225 init: function() { 1226 if (!stlib.data.bInit) { 1227 stlib.data.bInit = true; 1228 stlib.data.resetData(); 1229 stlib.data.set("fcmp", typeof(window.__cmp) == 'function', "pageInfo"); 1230 stlib.data.set("fcmpv2", typeof(window.__tcfapi) == 'function', "pageInfo"); 1231 1232 if(stlib.publisher){ 1233 stlib.data.setPublisher(stlib.publisher); 1234 } 1235 stlib.data.set("product",stlib.product,"pageInfo"); 1236 var rawUrl = document.location.href, refDomain = '', refQuery = '', referArray = [], currentRefer = '', cleanUrl = '', hashString = "", 1237 baseURL = '', sessionID_time = '', sessionID_rand = ''; 1238 1239 //Fix for WID-343 1240 referArray = stlib.data.getRefDataFromUrl(rawUrl);//get referrer data coming from share.es 1241 if(referArray.length > 0) { 1242 refDomain = (typeof(referArray[0]) != "undefined") ? referArray[0] : ""; 1243 refQuery = (typeof(referArray[1]) != "undefined") ? referArray[1] : ""; 1244 cleanUrl = stlib.data.removeRefDataFromUrl(rawUrl);//Remove referrer data from the URL. 1245 1246 //Displays the modified(without referrer data parameter) or original URL in the address bar 1247 stlib.data.showModifiedUrl(cleanUrl); 1248 stlib.data.set("url", cleanUrl, "shareInfo"); 1249 } else { //For old non-secure shar urls 1250 currentRefer = document.referrer; 1251 referArray = currentRefer.replace("http://", "").replace("https://", "").split("/"); 1252 refDomain = referArray.shift(); 1253 refQuery = referArray.join("/"); 1254 1255 stlib.data.set("url", rawUrl,"shareInfo"); 1256 } 1257 // TODO add option to not use hash tag 1258 1259 stlib.data.set("title", document.title, "shareInfo"); 1260 1261 if (stlib.data.publisherKeySet != true) { 1262 stlib.data.set("publisher","ur.00000000-0000-0000-0000-000000000000","pageInfo"); 1263 } 1264 1265 // no longer using fpc 1266 // stlib.fpc.createFpc(); 1267 // stlib.data.set("fpc",stlib.fpc.cookieValue,"pageInfo"); // Requires that the cookie has been created 1268 1269 sessionID_time = (new Date()).getTime().toString(); 1270 sessionID_rand = Number(Math.random().toPrecision(5).toString().substr(2)).toString(); 1271 stlib.data.set("sessionID",sessionID_time + '.' + sessionID_rand,"pageInfo"); 1272 1273 //stlib.data.set("sourceURL", document.location.href,"pageInfo"); 1274 stlib.data.set("hostname", document.location.hostname,"pageInfo"); 1275 stlib.data.set("location", document.location.pathname,"pageInfo"); 1276 1277 stlib.data.set("refDomain", refDomain ,"pageInfo"); 1278 stlib.data.set("refQuery", refQuery,"pageInfo"); 1279 } 1280 }, 1281 //Fix for WID-343 1282 showModifiedUrl: function(modUrl) { 1283 if (window.history && history.replaceState) 1284 history.replaceState(null, document.title, modUrl); 1285 else if ((/MSIE/).test(navigator.userAgent)) { 1286 var ampInHashIndex = 0, hashString = window.location.hash, patt1 = new RegExp("(\&st_refDomain=?)[^\&|]+"), 1287 patt2 = new RegExp("(\#st_refDomain=?)[^\&|]+"), hRef = document.location.href; 1288 if(patt1.test(hRef)) { 1289 ampInHashIndex = hashString.indexOf('&st_refDomain'); 1290 window.location.hash = hashString.substr(0, ampInHashIndex); 1291 } else if(patt2.test(hRef)) 1292 window.location.replace("#"); 1293 } else { 1294 document.location.replace(modUrl); 1295 } 1296 }, 1297 //Fix for WID-343 1298 getRefDataFromUrl: function(url) { 1299 var patt = new RegExp("st_refDomain="), tempDomain = '', tempQuery = '', result = []; 1300 1301 if(patt.test(url)) { 1302 tempDomain = url.match(/(st_refDomain=?)[^\&|]+/g); 1303 result.push(tempDomain[0].split('=')[1]); 1304 1305 tempQuery = url.match(/(st_refQuery=?)[^\&|]+/g); 1306 result.push(tempQuery[0].replace('st_refQuery=', '')); 1307 } 1308 1309 return result; 1310 }, 1311 //Fix for WID-343 1312 removeRefDataFromUrl: function(url) { 1313 var urlWoRefdomain = '', 1314 obj = '', 1315 patt1 = new RegExp("(\&st_refDomain=?)[^\&|]+"), 1316 patt2 = new RegExp("(\#st_refDomain=?)[^\&|]+"); 1317 1318 if(patt1.test(url)) { 1319 urlWoRefdomain = url.replace(/\&st_refDomain=(.*)/g,''); 1320 } else if(patt2.test(url)) { 1321 urlWoRefdomain = url.replace(/\#st_refDomain=(.*)/g,''); 1322 } else { 1323 urlWoRefdomain = url; 1324 } 1325 1326 return urlWoRefdomain; 1327 }, 1328 setPublisher: function(publisherKey) { 1329 // TODO: Add Validation 1330 stlib.data.set("publisher",publisherKey,"pageInfo"); 1331 stlib.data.publisherKeySet = true; 1332 }, 1333 setSource: function(src, options) { 1334 // TODO: Add Validation 1335 var source = ""; 1336 // Inside widget logging 1337 if (options) { 1338 if (options.toolbar) { 1339 source = "toolbar"+src; 1340 } else if (options.page && options.page != "home" && options.page != "") { 1341 source = "chicklet"+src; 1342 } else { 1343 source = "button"+src; 1344 } 1345 } 1346 // Outside widget logging 1347 else { 1348 // can be share5x, share4x, chicklet, fastshare, mobile 1349 source = src; 1350 } 1351 stlib.data.set("source",source,"shareInfo"); 1352 }, 1353 set: function(key, value, table) { 1354 if (typeof(value) == "number" || typeof(value) == "boolean") { 1355 stlib.data[table][key] = value; 1356 } else if (typeof(value) == "undefined" || value == null) { 1357 } else { 1358// _$d1("Stripping HTML: " + key + ": " + value.replace(/<[^<>]*>/gi, " ")); 1359// _$d1("decodeURI: " + key + ": " + decodeURI(value.replace(/<[^<>]*>/gi, " "))); 1360// _$d1("Escape percent: " + key + ": " + decodeURI(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25")); 1361// _$d1("Decoding: " + key + ": " + decodeURIComponent(decodeURI(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 1362// _$d1("Encoding: " + key + ": " + encodeURIComponent(decodeURIComponent(decodeURI(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25")))); 1363 stlib.data[table][key] = encodeURIComponent(decodeURIComponent(unescape(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 1364 // These might have url encoded data 1365 if (key=="url" /*|| key=="sourceURL"*/ || key=="location" || key=="image") { 1366 try { 1367 stlib.data[table][key] = encodeURIComponent(decodeURIComponent(decodeURI(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 1368 } catch (e) { 1369 stlib.data[table][key] = encodeURIComponent(decodeURIComponent(unescape(value.replace(/<[^<>]*>/gi, " ")).replace(/%/gi, "%25"))); 1370 } 1371 } 1372 } 1373 }, 1374 get: function(key, table) { 1375 try { 1376 if (stlib.data[table] && stlib.data[table][key]) 1377 return decodeURIComponent(stlib.data[table][key]); 1378 else 1379 return false;
1380 }catch(e){ 1381 return false 1382 } 1383 }, 1384 unset: function(key, table) { 1385 if (stlib.data[table] && typeof(stlib.data[table][key])!="undefined") 1386 delete stlib.data[table][key]; 1387 }, 1388 bindEvent: function(element, eventName, eventHandler) { 1389 if (element.addEventListener) { 1390 element.addEventListener(eventName, eventHandler, false); 1391 } else if (element.attachEvent) { 1392 element.attachEvent('on' + eventName, eventHandler); 1393 } 1394 }, 1395 debug: function(endpoint, event) { 1396 stlib.data.init(); 1397 var a = stlib.data.pageInfo; 1398 var c = ""; 1399 var b; 1400 for (b in a) { 1401 c += b + "=" + a[b] + "&" 1402 } 1403 c = c.substring(0, c.length - 1); 1404 1405 var loggerUrl = "https://l.sharethis.com/"; 1406 loggerUrl += endpoint; 1407 loggerUrl += "?event=" + event; 1408 loggerUrl += "&" + c; 1409 1410 var e = new Image(1, 1); 1411 e.src = loggerUrl; 1412 e.onload = function() { 1413 return 1414 }; 1415 }, 1416 hostname: function(url) { 1417 var a; 1418 if (url == null) { 1419 url = st.href; 1420 } 1421 a = document.createElement('a'); 1422 a.setAttribute('href', url); 1423 return a.hostname; 1424 }, 1425 protocol: function(url) { 1426 var a; 1427 if (url == null) { 1428 url = st.href; 1429 } 1430 a = document.createElement('a'); 1431 a.setAttribute('href', url); 1432 return a.protocol; 1433 }, 1434 parseCookie: function (name, cookie) { 1435 var values = cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)'); 1436 return values ? values.pop() : null; 1437 }, 1438 writeCookie: function(name, value, max_age) { 1439 if (!max_age) { 1440 max_age = 33696000 1441 } 1442 var host = (window && window.location && window.location.hostname) || ''; 1443 var parts = host.split('.'); 1444 var domain = ""; 1445 if (parts.length > 1) { 1446 domain = "domain=." + parts.slice(-2).join('.'); 1447 } 1448 var samesite_secure = ""; 1449 try { 1450 document.cookie = "st_samesite=1;SameSite=None;Secure"; 1451 if (stlib.data.parseCookie("st_samesite", document.cookie)) { 1452 samesite_secure = "SameSite=None;Secure" 1453 document.cookie = "st_samesite=1;max-age=0;SameSite=None;Secure"; 1454 } 1455 } catch (e) {} 1456 document.cookie = name + "=" + value + ";" + domain + ";path=/;max-age=" + max_age + ";" + samesite_secure; 1457 }, 1458 setConsent: function(consent) { 1459 for(var consent_key in consent) { 1460 stlib.data.set(consent_key,consent[consent_key],"pageInfo"); 1461 } 1462 }, 1463 getEUConsent: function (c) { 1464 1465 function once(fn, context) { 1466 var result; 1467 return function() { 1468 if(fn) { 1469 result = fn.apply(context || this, arguments); 1470 fn = null; 1471 } 1472 return result; 1473 }; 1474 } 1475 1476 var done = once(c); 1477 1478 // set usprivacy first if we have it 1479 var usprivacy = stlib.data.parseCookie("usprivacy", document.cookie); 1480 if (usprivacy) { 1481 stlib.data.setConsent({ 1482 usprivacy: usprivacy 1483 }); 1484 } 1485 1486 // keep track of how long it takes to get consent 1487 var start = Date.now(); 1488 1489 var useCookie = once(function() { 1490 1491 // check for first party cookies 1492 var euconsent_v2 = stlib.data.parseCookie("euconsent-v2", document.cookie); 1493 if (euconsent_v2 !== null) { 1494 stlib.data.setConsent({ 1495 gdpr_consent: euconsent_v2, 1496 gdpr_domain: document.location.hostname, 1497 gdpr_method: "cookie" 1498 }); 1499 } 1500 done(); 1501 }); 1502 1503 if (typeof window.__tcfapi == "function") { 1504 1505 // fallback to cookie in case the tcf api is too slow or unavailable 1506 var timeout = setTimeout(useCookie, 5000); 1507 1508 // first we try to get the data from the cmp 1509 // wrap in a try catch since we don't control the tcfapi code on page 1510 try { 1511 1512 const tcfapi_callback = (data) => { 1513 if (data && data.tcString) { 1514 var gdpr_domain = (data.isServiceSpecific) 1515 ? document.location.hostname : ".consensu.org"; 1516 stlib.data.setConsent({ 1517 consent_duration: Date.now() - start, 1518 gdpr_consent: data.tcString, 1519 gdpr_domain: gdpr_domain, 1520 gdpr_method: "api" 1521 }); 1522 clearTimeout(timeout); 1523 done(); 1524 __tcfapi('removeEventListener', 2, () => {}, data.listenerId); 1525 } 1526 } 1527 __tcfapi('addEventListener', 2, tcfapi_callback); 1528 1529 } catch (e) { 1530 1531 // fallback to cookie if there is an error 1532 useCookie(); 1533 } 1534 } else { 1535 1536 // fallback to cookie if the tcfapi doesn't exist 1537 useCookie(); 1538 } 1539 } 1540 }; 1541 1542 stlib.data.resetData(); 1543} 1544stlib.comscore = { 1545 load: function() { 1546 var ref=document.referrer; 1547 var lurl = "https://sb.scorecardresearch.com/"; 1548 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"; 1549 var logger = new Image(1,1); 1550 logger.src = lurl; 1551 logger.onload = function(){return;}; 1552 } 1553} 1554stlib.hash = { 1555 doNotHash: false, 1556 hashAddressBar: false, 1557 doNotCopy: false, 1558 prefix:"sthash", 1559 shareHash: "", 1560 incomingHash: "", 1561 validChars: ["1","2","3","4","5","6","7","8","9","0", 1562 "A","B","C","D","E","F","G","H","I","J", 1563 "K","L","M","N","O","P","Q","R","S","T", 1564 "U","V","W","X","Y","Z","a","b","c","d", 1565 "e","f","g","h","i","j","k","l","m","n", 1566 "o","p","q","r","s","t","u","v","w","x", 1567 "y","z"], 1568 servicePreferences: { 1569 linkedin: "param", 1570 stumbleupon: "param", 1571 bebo: "param" 1572 }, 1573 hashDestination: function(destination) { 1574 if (destination == "copy") {return "dpuf";} 1575 var condensedString = destination.substring(0,2) + destination.substring(destination.length-2, destination.length); 1576 var increment = function(string, pos) { 1577 if(string.charCodeAt(pos) == 122) { 1578 return "a"; 1579 } 1580 return String.fromCharCode(string.charCodeAt(pos) + 1); 1581 } 1582 return increment(condensedString, 0) + increment(condensedString, 1) + increment(condensedString, 2) + increment(condensedString, 3); 1583 }, 1584 getHash: function() { 1585 var sthashFound = false;
1586 var sthashValue = ""; 1587 var urlWithoutHash = document.location.href; 1588 urlWithoutHash = urlWithoutHash.split("#").shift(); 1589 var paramArray = urlWithoutHash.split("?"); 1590 if (paramArray.length > 1) { 1591 paramArray = paramArray[1].split("&"); 1592 for (arg in paramArray) { 1593 try { 1594 if (paramArray[arg].substring(0, 6) == "sthash") { 1595 sthashFound = true; 1596 sthashValue = paramArray[arg]; 1597 } 1598 } catch (err) { 1599 1600 } 1601 } 1602 if (sthashFound) { 1603 return sthashValue; 1604 } else { 1605 return document.location.hash.substring(1); 1606 } 1607 } else { 1608 return document.location.hash.substring(1); 1609 } 1610 }, 1611 stripHash: function(url) { 1612 var urlWithoutHash = url; 1613 urlWithoutHash = urlWithoutHash.split("#"); 1614 if (urlWithoutHash.length > 1) 1615 return urlWithoutHash[1]; 1616 else 1617 return ""; 1618 }, 1619 clearHash: function() { 1620 if (stlib.hash.validateHash(document.location.hash)) { 1621 var baseHref = document.location.href.split("#").shift(); 1622 1623 if (window.history && history.replaceState) 1624// history.replaceState(null, "ShareThis", "#"); 1625 history.replaceState(null, document.title, baseHref); 1626 else if ((/MSIE/).test(navigator.userAgent)) 1627 window.location.replace("#"); 1628 else 1629 document.location.hash = ""; 1630 } 1631 }, 1632 init: function() { 1633 var finalHash = ""; 1634 var max = stlib.hash.validChars.length; 1635 for (var i=0;i<8;i++) { 1636 finalHash += stlib.hash.validChars[Math.random()*max|0]; 1637 } 1638 if (stlib.hash.getHash() == "") { 1639 stlib.hash.shareHash = stlib.hash.prefix + "." + finalHash; 1640 } else { 1641 var splitHash = stlib.hash.getHash().split("."); 1642 var key = splitHash.shift(); 1643 if (key == stlib.hash.prefix || key == stlib.hash.prefix) { 1644 stlib.hash.incomingHash = stlib.hash.getHash(); 1645 stlib.hash.shareHash = stlib.hash.prefix + "." + splitHash.shift() + "." + finalHash; 1646 } else { 1647 stlib.hash.shareHash = stlib.hash.prefix + "." + finalHash; 1648 } 1649 } 1650 if (!stlib.hash.doNotHash && stlib.hash.hashAddressBar) { 1651 if (document.location.hash == "" || stlib.hash.validateHash(document.location.hash)) { 1652 if (window.history && history.replaceState) 1653 history.replaceState(null, "ShareThis", "#"+stlib.hash.shareHash + ".dpbs"); 1654 else if ((/MSIE/).test(navigator.userAgent)) 1655 window.location.replace("#"+stlib.hash.shareHash + ".dpbs"); 1656 else 1657 document.location.hash = stlib.hash.shareHash + ".dpbs"; 1658 } 1659 } else { 1660 stlib.hash.clearHash(); 1661 } 1662 if (!stlib.hash.doNotHash && !stlib.hash.doNotCopy) { 1663 stlib.hash.copyPasteInit(); 1664 } 1665 stlib.hash.copyPasteLog(); 1666 }, 1667 checkURL: function() { 1668 var destination = stlib.data.get("destination", "shareInfo"); 1669 var baseURL = stlib.hash.updateParams(destination); 1670 var shortenedDestination = "." + stlib.hash.hashDestination(destination); 1671 stlib.hash.updateDestination(shortenedDestination); 1672 if (!stlib.hash.doNotHash && typeof(stlib.data.pageInfo.shareHash) != "undefined") { 1673 var url = stlib.data.get("url", "shareInfo"); 1674 var hash = stlib.hash.stripHash(url); 1675 if (stlib.hash.validateHash(hash) || hash == "") { 1676 if(typeof(stlib.hash.servicePreferences[destination]) != "undefined") { 1677 if(stlib.hash.servicePreferences[destination] == "param") { 1678 _$d1("Don't use hash, use params"); 1679 _$d2(baseURL); 1680 if (baseURL.split("?").length > 1) { 1681 var parameterArray = baseURL.split("?")[1].split("&") 1682 var sthashExists = false; 1683 //for (arg in parameterArray) { 1684 for (var arg = 0; arg < parameterArray.length; arg++) { 1685 if (parameterArray[arg].split(".")[0] == "sthash") { 1686 sthashExists = true; 1687 } 1688 } 1689 if (sthashExists) { 1690 // Param was fixed by updateParams, dont need to add anything 1691 stlib.data.set("url",baseURL, "shareInfo"); 1692 } else { 1693 // Param wasn't there, need to add it. 1694 stlib.data.set("url",baseURL + "&" + stlib.data.pageInfo.shareHash, "shareInfo"); 1695 } 1696 } else { 1697 // There are no params, need to add the hash param 1698 stlib.data.set("url",baseURL + "?" + stlib.data.pageInfo.shareHash, "shareInfo"); 1699 } 1700 if (destination == "linkedin") { // shar url contains # which is an error in LinkedIn 1701 if (stlib.data.get("sharURL", "shareInfo") != "") { 1702 stlib.data.set("sharURL", stlib.data.get("url", "shareInfo"), "shareInfo"); 1703 } 1704 } 1705 } else { 1706 _$d1("Using Hash"); 1707 stlib.data.set("url",baseURL + "#" + stlib.data.pageInfo.shareHash, "shareInfo"); 1708 } 1709 } else { 1710 _$d1("Not using custom destination hash type"); 1711 stlib.data.set("url",baseURL + "#" + stlib.data.pageInfo.shareHash, "shareInfo"); 1712 } 1713 } 1714 } 1715 }, 1716 updateParams: function(destination) { 1717 var baseURL = stlib.data.get("url", "shareInfo").split("#").shift(); 1718 var regex2a = /(\?)sthash\.[a-zA-z0-9]{8}\.[a-zA-z0-9]{8}/; 1719 var regex2b = /(&)sthash\.[a-zA-z0-9]{8}\.[a-zA-z0-9]{8}/; 1720 var regex1a = /(\?)sthash\.[a-zA-z0-9]{8}/; 1721 var regex1b = /(&)sthash\.[a-zA-z0-9]{8}/; 1722 if (regex2a.test(baseURL)) { 1723 baseURL = baseURL.replace(regex2a, "?" + stlib.data.pageInfo.shareHash); 1724 } else if (regex2b.test(baseURL)) { 1725 baseURL = baseURL.replace(regex2b, "&" + stlib.data.pageInfo.shareHash); 1726 } else if (regex1a.test(baseURL)) { 1727 baseURL = baseURL.replace(regex1a, "?" + stlib.data.pageInfo.shareHash); 1728 } else if (regex1b.test(baseURL)) { 1729 baseURL = baseURL.replace(regex1b, "&" + stlib.data.pageInfo.shareHash); 1730 } 1731 return baseURL; 1732 }, 1733 updateDestination: function(destinationHash) { 1734 var regex2 = /sthash\.[a-zA-z0-9]{8}\.[a-zA-z0-9]{8}\.[a-z]{4}/; 1735 var regex1 = /sthash\.[a-zA-z0-9]{8}\.[a-z]{4}/; 1736 _$d_(); 1737 _$d1("Updating Destination"); 1738 if (regex2.test(stlib.data.pageInfo.shareHash)) { 1739 _$d2(stlib.data.pageInfo.shareHash.substring(0,24)); 1740 stlib.data.pageInfo.shareHash = stlib.data.pageInfo.shareHash.substring(0,24) + destinationHash; 1741 } else if (regex1.test(stlib.data.pageInfo.shareHash)) { 1742 _$d2(stlib.data.pageInfo.shareHash.substring(0,15)); 1743 stlib.data.pageInfo.shareHash = stlib.data.pageInfo.shareHash.substring(0,15) + destinationHash; 1744 } else { 1745 stlib.data.pageInfo.shareHash += destinationHash; 1746 } 1747 }, 1748 validateHash: function(isValidHash) { 1749 var regex3 = /[\?#&]?sthash\.[a-zA-z0-9]{8}\.[a-zA-z0-9]{8}$/; 1750 var regex2 = /[\?#&]?sthash\.[a-zA-z0-9]{8}\.[a-zA-z0-9]{8}\.[a-z]{4}$/; 1751 var regex1 = /[\?#&]?sthash\.[a-zA-z0-9]{8}\.[a-z]{4}$/; 1752 var regex0 = /[\?#&]?sthash\.[a-zA-z0-9]{8}$/; 1753 return regex0.test(isValidHash) || regex1.test(isValidHash) || regex2.test(isValidHash) || regex3.test(isValidHash); 1754 }, 1755 appendHash : function (url) { 1756 var hash = stlib.hash.stripHash(url); 1757 if (stlib.data.pageInfo.shareHash && (stlib.hash.validateHash(hash) || hash == "")) { 1758 url = url.replace("#"+hash,"") + "#" + stlib.data.pageInfo.shareHash; 1759 } else { 1760 } 1761 return url; 1762 }, 1763 copyPasteInit: function() { 1764 var body = document.getElementsByTagName("body")[0]; 1765 var replacement = document.createElement("div"); 1766 replacement.id = "stcpDiv"; 1767 replacement.style.position = "absolute"; 1768 replacement.style.top = "-1999px"; 1769 replacement.style.left = "-1988px"; 1770 body.appendChild(replacement); 1771 replacement.innerHTML = "ShareThis Copy and Paste"; 1772 var baseHref = document.location.href.split("#").shift(); 1773 var hash = "#" + stlib.hash.shareHash; 1774 if (document.addEventListener) { 1775 body["addEventListener"]("copy",function(e){ 1776 //TYNT CONFLICT FIX: do not copy if Tynt object exists 1777 if (typeof(Tynt)!="undefined"){ 1778// console.log("Tynt exists. Don't copy"); 1779 return; 1780 } 1781// console.log("Tynt doesn't exist. Proceed"); 1782 1783 //grab current range and append url to it 1784 var selection = document.getSelection(); 1785 1786 if (selection.isCollapsed) { 1787 return; 1788 } 1789 1790 var markUp = selection.getRangeAt(0).cloneContents(); 1791 replacement.innerHTML = ""; 1792 replacement.appendChild(markUp); 1793 1794 if (replacement.textContent.trim().length==0) { 1795 return; 1796 } 1797 1798 if((selection+"").trim().length==0) { 1799 //No text, don't need to do anything 1800 } else if (replacement.innerHTML == (selection+"") || replacement.textContent == (selection+"")) { 1801 //Fix for CNS FB:12969. Encode html data to avoid js script execution on content copy 1802 replacement.innerHTML = stlib.html.encode(stlib.hash.selectionModify(selection)); 1803 } else { 1804 //Fix for CNS FB:12969. Encode html data to avoid js script execution on content copy 1805 replacement.innerHTML += stlib.html.encode(stlib.hash.selectionModify(selection, true)); 1806 } 1807 var range = document.createRange(); 1808 range.selectNodeContents(replacement); 1809 var oldRange = selection.getRangeAt(0); 1810 },false); 1811 } else if (document.attachEvent) { 1812 /* 1813 body.oncopy = function() { 1814 var oldRange = document.selection.createRange(); 1815 replacement.innerHTML = oldRange.htmlText; 1816 try { 1817 var length = (oldRange.text).trim().length; 1818 } catch (e) { 1819 var length = (oldRange.text).replace(/^\s+|\s+$/g, '').length; 1820 } 1821 if(length==0) { 1822 //No text, don't need to do anything 1823 } else if (oldRange.htmlText == oldRange.text) { 1824 //Just text, treat normally 1825 replacement.innerHTML = stlib.hash.selectionModify(oldRange.text); 1826 } else { 1827 //Text and markup, special case 1828 replacement.innerHTML += stlib.hash.selectionModify(oldRange.text, true); 1829 } 1830 var range = document.body.createTextRange(); 1831 range.moveToElementText(replacement); 1832 range.select(); 1833 setTimeout(function() {oldRange.select();}, 1); 1834 }; 1835 */ 1836 } 1837 }, 1838 copyPasteLog: function() { 1839 var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; 1840 var messageEvent1 = eventMethod == "attachEvent" ? "oncopy" : "copy"; 1841 var body = document.getElementsByTagName("body")[0]; 1842 if(body){ 1843 body[eventMethod](messageEvent1,function(e){ 1844 var pass = true; 1845 stlib.data.resetShareData(); 1846 stlib.data.set("url", document.location.href, "shareInfo"); 1847 stlib.data.setSource("copy"); 1848 stlib.data.set("destination", "copy", "shareInfo"); 1849 stlib.data.set("buttonType", "custom", "shareInfo"); 1850 1851 if (typeof(Tynt)!="undefined"){ 1852 // Log Tynt 1853 stlib.data.set("result", "tynt", "shareInfo"); 1854 pass = false;
1855 } 1856 if (typeof(addthis_config)!="undefined") { 1857 // Log AddThis 1858 stlib.data.set("result", "addThis", "shareInfo"); 1859 if (typeof(addthis_config.data_track_textcopy)=="undefined"||addthis_config.data_track_textcopy) { 1860 stlib.data.set("enabled", "true", "shareInfo"); 1861 pass = false; 1862 } else { 1863 stlib.data.set("enabled", "false", "shareInfo"); 1864 } 1865 } 1866 },false); 1867 } 1868 }, 1869 logCopy: function(url, selection) { 1870 stlib.data.resetShareData(); 1871 stlib.data.set("url", url, "shareInfo"); 1872 stlib.data.setSource("copy"); 1873 stlib.data.set("destination", "copy", "shareInfo"); 1874 stlib.data.set("buttonType", "custom", "shareInfo"); 1875 if (selection) 1876 stlib.data.set("copy_text", selection, "shareInfo"); 1877 stlib.sharer.share(); 1878 }, 1879 selectionModify: function(selection, anchorOnly) { 1880 selection = "" + selection; 1881 _$d_(); 1882 _$d1("Copy Paste"); 1883 var regex = /^((http|https):\/\/([a-z0-9!'\(\)\*\.\-\+:]*(\.)[a-z0-9!'\(\)\*\.\-\+:]*)((\/[a-z0-9!'\(\)\*\.\-\+:]*)*))/i; 1884 var regex2 = /^([a-z0-9!'\(\)\*\.\-\+:]*(\.)[a-z0-9!'\(\)\*\.\-\+:]*)((\/[a-z0-9!'\(\)\*\.\-\+:]*)*)/i; 1885 var regexPhoneNumberUS = /^\+?1?[\.\-\\)_\s]?[\\(]?[0-9]{3}[\.\-\\)_\s]?[0-9]{3}[\.\-_\s]?[0-9]{4}$|^[0-9]{3}[\.\-_\s]?[0-9]{4}$/; 1886 var regexPhoneNumberIndia = /^[0-9]{3}[\.\-_\s]?[0-9]{8}$/; 1887 var regexPhoneNumberBrazil = /^[0-9]{2}[\.\-_\s]?[0-9]{4}[\.\-_\s]?[0-9]{4}$/; 1888 var regexEmail = /[\-_\.a-z0-9]+@[\-_\.a-z0-9]+\.[\-_\.a-z0-9]+/i; 1889 var regex3 = /[\s@]/; 1890 var baseHref = document.location.href.split("#").shift(); 1891 var hash = "#" + stlib.hash.shareHash; 1892 var anchorStr = ""; 1893 var urlStr = ""; 1894 var returnStr = selection; 1895 if (typeof(anchorOnly) == "undefined" && ((regex.test(selection) || regex2.test(selection)) && !regex3.test(selection.trim()))) { // the selection is a url 1896 _$d2("is Url"); 1897 if (selection.match(/#/) == null || stlib.hash.validateHash(selection)) { 1898 urlStr = selection.split("#")[0] + hash + ".dpuf"; 1899 } else { 1900 urlStr = selection; 1901 } 1902 } else { 1903 _$d2("is Not Url"); 1904 if (document.location.hash == "" || (/^#$/).test(document.location.hash) || stlib.hash.validateHash(document.location.hash)) { 1905 urlStr = baseHref + hash + ".dpuf"; 1906 } else { 1907 urlStr = document.location.href; 1908 } 1909 returnStr = selection; 1910 if (selection.length > 50) { 1911 if (!regexPhoneNumberUS.test(selection) && !regexPhoneNumberIndia.test(selection) && !regexPhoneNumberBrazil.test(selection) && !regexEmail.test(selection)) { // don't add if an email or phone number 1912 returnStr += anchorStr; 1913 } 1914 } 1915 } 1916 if (selection.length > 500) { 1917 selection = selection.substring(0, 497) + "..."; 1918 } 1919 stlib.hash.logCopy(urlStr, selection); 1920 return returnStr; 1921 } 1922}; 1923/* Requires browser obj */ 1924stlib.pump = function (destination, source, callback) { 1925 var that = this; 1926 this.isIframeReady = false; 1927 this.isIframeSending = false; 1928 1929 this.getHash = function(url) { 1930 var mArray = url.split("#"); 1931 mArray.shift(); 1932 return mArray.join("#"); 1933 } 1934 1935 this.broadcastInit = function(destination) { 1936 this.destination = destination; 1937 _$d_('---------------------'); 1938 _$d1("Initiating broadcaster:"); 1939 _$d(this.destination); 1940 }; 1941 this.broadcastSendMessage = function(message) { 1942 _$d_('---------------------'); 1943 _$d1("Initiating Send:"); 1944 if (this.destination === window) { // Iframe sends an event to the parent window 1945 if (stlib.browser.ieFallback) { 1946 //window.location.hash = message; 1947 window.location.replace(window.location.href.split("#")[0] + "#" + message); 1948 _$d2("child can't communicate with parent"); 1949 return; 1950 } 1951 _$d2("Iframe to publisher: " + message); 1952 parent.postMessage("#" + message, document.referrer); 1953 } else { // The parent window sends an event to the iframe 1954 _$d2("Publisher to Iframe: " + message); 1955 if (stlib.browser.ieFallback) { 1956 if (this.destination.contentWindow) { 1957 this.destination.contentWindow.location.replace(this.destination.src + "#" + message); 1958 this.isIframeSending = true; 1959 } 1960 return; 1961 } 1962 this.destination.contentWindow.postMessage("#" + message, this.destination.src); 1963 } 1964 }; 1965 this.receiverInit = function(source, callback) { 1966 _$d_('---------------------'); 1967 _$d1("Initiating Receiver:"); 1968 _$d(source); 1969 if (stlib.browser.ieFallback) { 1970 this.callback = callback; 1971 this.source = source; 1972 if (source === window) { // The iframe polls the hash value for any changes 1973 //window.location.hash = ""; 1974 window.location.replace(window.location.href.split("#")[0] + "#"); 1975 this.currentIframe = window.location.hash; 1976 1977 var receiverName = "receiver" + stlib.functionCount; 1978 stlib.functions[receiverName] = function (callback) { 1979 if ("" != window.location.hash && "#" != window.location.hash) { 1980 var hash = window.location.hash; 1981 callback(hash); 1982 //window.location.hash = ""; 1983 window.location.replace(window.location.href.split("#")[0] + "#"); 1984 } 1985 }; 1986 stlib.functionCount++; 1987 var callbackName = "callback" + stlib.functionCount; 1988 stlib.functions[callbackName] = callback; 1989 stlib.functionCount++; 1990 setInterval("stlib.functions['" + receiverName + "'](stlib.functions['" + callbackName + "'])", 200); 1991 1992 } else { // The parent polls the iframe 1993 /* 1994 var receiverName = "receiver" + stlib.functionCount; 1995 that.oldHash = that.getHash(source.src); 1996 stlib.functions[receiverName] = function (callback) { 1997 _$d1("ShareThis Publisher is polling: " + that.oldHash + ": " + (source.src)); 1998 if (that.oldHash != that.getHash(source.src)) { 1999 that.oldHash = that.getHash(source.src); 2000 callback(hash); 2001 } 2002 }; 2003 stlib.functionCount++; 2004 var callbackName = "callback" + stlib.functionCount; 2005 stlib.functions[callbackName] = callback; 2006 stlib.functionCount++; 2007 setInterval("stlib.functions['" + receiverName + "'](stlib.functions['" + callbackName + "'])", 200); 2008 */ 2009 } 2010 var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; 2011 var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; 2012 // Listen to message from child window 2013 window[eventMethod](messageEvent,function(e) { 2014 if (source == window) { 2015 } else { 2016 if (e.origin.indexOf("sharethis.com") != -1) { 2017 if (e.data.match(/#Pinterest Click/)) 2018 stlib.sharer.sharePinterest(); 2019 if (e.data.match(/#Print Click/)) 2020 stlib.sharer.stPrint(); 2021 } 2022 } 2023 },false); 2024 return; 2025 } 2026 var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; 2027 var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; 2028 // Listen to message from child window 2029 window[eventMethod](messageEvent,function(e) { 2030 if (source == window) { 2031 _$d1("arrived in iframe from:"); 2032 _$d(e.origin); 2033 if (e.data.match(/#fragmentPump/) || e.data.match(/#Buttons Ready/) || e.data.match(/#Widget Ready/) || e.data.indexOf("#light")==0 || e.data.indexOf("#widget")==0 || e.data.indexOf("#popup")==0 || e.data.indexOf("#show")==0 || e.data.indexOf("#init")==0 || e.data.indexOf("#test")==0 || e.data.indexOf("#data")==0) // Make sure data is our own 2034 callback(e.data); 2035 } else { 2036 if (e.origin.indexOf("sharethis.com") != -1) { 2037 _$d1("arrived in parent from:"); 2038 _$d(e.origin); 2039 if (e.data.match(/#fragmentPump/) || e.data.match(/#Buttons Ready/) || e.data.match(/#Widget Ready/) || e.data.indexOf("#light")==0 || e.data.indexOf("#widget")==0 || e.data.indexOf("#popup")==0 || e.data.indexOf("#show")==0 || e.data.indexOf("#init")==0 || e.data.indexOf("#test")==0 || e.data.indexOf("#data")==0) // Make sure data is our own 2040 callback(e.data); 2041 else if (e.data.match(/#Pinterest Click/)) 2042 stlib.sharer.sharePinterest(); 2043 else if (e.data.match(/#Print Click/)) 2044 stlib.sharer.stPrint(); 2045 } else { 2046 _$d1("discarded event from:"); 2047 _$d(e.origin); 2048 } 2049 } 2050 },false); 2051 }; 2052 2053 this.broadcastInit(destination); 2054 this.receiverInit(source, callback); 2055}; 2056/***************START JSON ENCODE/DECODE***************/ 2057stlib.json = { 2058 c : {"\b":"b","\t":"t","\n":"n","\f":"f","\r":"r",'"':'"',"\\":"\\","/":"/"}, 2059 d : function(n){return n<10?"0".concat(n):n}, 2060 e : function(c,f,e){e=eval;delete eval;if(typeof eval==="undefined")eval=e;f=eval(""+c);eval=e;return f}, 2061 i : function(e,p,l){return 1*e.substr(p,l)}, 2062 p : ["","000","00","0",""], 2063 rc : null, 2064 rd : /^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/, 2065 rs : /(\x5c|\x2F|\x22|[\x0c-\x0d]|[\x08-\x0a])/g, 2066 rt : /^([0-9]+|[0-9]+[,\.][0-9]{1,3})$/, 2067 ru : /([\x00-\x07]|\x0b|[\x0e-\x1f])/g, 2068 s : function(i,d){return "\\".concat(stlib.json.c[d])}, 2069 u : function(i,d){
2070 var n=d.charCodeAt(0).toString(16); 2071 return "\\u".concat(stlib.json.p[n.length],n) 2072 }, 2073 v : function(k,v){return stlib.json.types[typeof result](result)!==Function&&(v.hasOwnProperty?v.hasOwnProperty(k):v.constructor.prototype[k]!==v[k])}, 2074 types : { 2075 "boolean":function(){return Boolean}, 2076 "function":function(){return Function}, 2077 "number":function(){return Number}, 2078 "object":function(o){return o instanceof o.constructor?o.constructor:null}, 2079 "string":function(){return String}, 2080 "undefined":function(){return null} 2081 }, 2082 $$ : function(m){ 2083 function $(c,t) { 2084 t=c[m]; 2085 delete c[m]; 2086 try { 2087 stlib.json.e(c) 2088 } catch(z){c[m]=t;return 1;} 2089 }; 2090 return $(Array)&&$(Object); 2091 }, 2092 encode : function(){ 2093 var self = arguments.length ? arguments[0] : this, 2094 result, tmp; 2095 if(self === null) 2096 result = "null"; 2097 else if(self !== undefined && (tmp = stlib.json.types[typeof self](self))) { 2098 switch(tmp){ 2099 case Array: 2100 result = []; 2101 for(var i = 0, j = 0, k = self.length; j < k; j++) { 2102 if(self[j] !== undefined && (tmp = stlib.json.encode(self[j]))) 2103 result[i++] = tmp; 2104 }; 2105 result = "[".concat(result.join(","), "]"); 2106 break; 2107 case Boolean: 2108 result = String(self); 2109 break; 2110 case Date: 2111 result = '"'.concat(self.getFullYear(), '-', stlib.json.d(self.getMonth() + 1), '-', stlib.json.d(self.getDate()), 'T', stlib.json.d(self.getHours()), ':', stlib.json.d(self.getMinutes()), ':', stlib.json.d(self.getSeconds()), '"'); 2112 break; 2113 case Function: 2114 break; 2115 case Number: 2116 result = isFinite(self) ? String(self) : "null"; 2117 break; 2118 case String: 2119 result = '"'.concat(self.replace(stlib.json.rs, stlib.json.s).replace(stlib.json.ru, stlib.json.u), '"'); 2120 break; 2121 default: 2122 var i = 0, key; 2123 result = []; 2124 for(key in self) { 2125 if(self[key] !== undefined && (tmp = stlib.json.encode(self[key]))) 2126 result[i++] = '"'.concat(key.replace(stlib.json.rs, stlib.json.s).replace(stlib.json.ru, stlib.json.u), '":', tmp); 2127 }; 2128 result = "{".concat(result.join(","), "}"); 2129 break; 2130 } 2131 }; 2132 return result; 2133 }, 2134 decode : function(input){ 2135 if(typeof(input)=='string') 2136 { 2137 var data=null; 2138 try{if ( /^[\],:{}\s]*$/.test(input.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") 2139 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") 2140 .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { 2141 data=window.JSON && window.JSON.parse ? window.JSON.parse(input) : (new Function("return " + input))(); 2142 return data; 2143 }else{ 2144 return null; 2145 }}catch(err){} 2146 } 2147 } 2148}; 2149try{stlib.json.rc=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')} 2150catch(z){stlib.json.rc=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/} 2151/***************END JSON ENCODE/DECODE***************/ 2152/********************START LOGGING***********************/ 2153/* 2154 * This handles logging 2155 */ 2156stlib.logger = { 2157 loggerUrl: "https://l.sharethis.com/", 2158 l2LoggerUrl: "https://l2.sharethis.com/", 2159 productArray: new Array(), 2160 version: '', 2161 lang: 'en', 2162 isFpEvent: false, 2163 2164 constructParamString: function() { 2165 2166 // Pull all the parameters from the page the widget was on 2167 var p = stlib.data.pageInfo; 2168 var paramString = ""; 2169 var param; 2170 2171 for (param in p) { 2172 2173 // the following line creates "param=value&" 2174 if (p[param] == null || p[param] === "" || p[param] == "ERROR") continue; 2175 paramString += param + "=" + p[param] + "&"; 2176 } 2177 2178 // Pull all the parameters related to the share 2179 p = stlib.data.shareInfo; 2180 for (param in p) { 2181 if (p[param] == null || p[param] === "" || p[param] == "ERROR") continue; 2182 paramString += param + "=" + p[param] + "&"; 2183 } 2184 2185 // add sop parameter 2186 paramString += "sop=false" 2187 2188 // add fpestid if it exists 2189 var fpestid = stlib.data.parseCookie("fpestid", document.cookie); 2190 if (fpestid) { 2191 paramString += "&fpestid=" + fpestid; 2192 } 2193 2194 // add description if it exists 2195 try { 2196 var elements = document.getElementsByTagName("meta"); 2197 for (var i = 0; i < elements.length; i++) { 2198 var attribute = elements[i].getAttribute('property'); 2199 if (attribute == null) { 2200 attribute = elements[i].getAttribute('name'); 2201 } 2202 if (attribute == "twitter:description" || attribute == "og:description" || attribute == "description" || attribute == "Description") { 2203 var description = encodeURIComponent(elements[i].getAttribute('content')); 2204 paramString += "&description=" + description; 2205 break; 2206 } 2207 } 2208 } catch (e) {} 2209 2210 return paramString 2211 }, 2212 ibl: function() { 2213 var blacklist, domain, protocol, hostname, href, i, len; 2214 href = document.referrer; 2215 if (href) { 2216 hostname = stlib.data.hostname(href) || ''; 2217 if (stlib.data.protocol) { 2218 protocol = stlib.data.protocol(href) || ''; 2219 if (protocol == "android-app:") { 2220 return true; 2221 } 2222 } 2223 blacklist = ['aol', 'bing', 'bs.to', 'facebook', 'google', 'yahoo', '
2223yandex', document.location.hostname]; 2224 for (i = 0, len = blacklist.length; i < len; i++) { 2225 domain = blacklist[i]; 2226 if (hostname.indexOf(domain) > -1) { 2227 return true; 2228 } 2229 } 2230 var logUrl = stlib.logger.loggerUrl + "log?event=ibl&url=" + href; 2231 stlib.logger.logByImage("ibl", logUrl, null); 2232 } 2233 return true; 2234 }, 2235 obl: function(e) { 2236 var href, prefix, ref; 2237 if ((e != null ? (ref = e.target) != null ? ref.tagName : void 0 : void 0) === 'A') { 2238 href = e.target.getAttribute('href') || ''; 2239 prefix = href.slice(0, href.indexOf(':')); 2240 if (href.slice(0, 4) === 'http' && e.target.hostname !== document.location.hostname) { 2241 var logUrl = stlib.logger.loggerUrl + "log?event=obl&url=" + href; 2242 stlib.logger.logByImage("obl", logUrl, null); 2243 } 2244 } 2245 return true; 2246 }, 2247 getGDPRQueryString: function() { 2248 var gdpr_consent = stlib.data.get("gdpr_consent", "pageInfo"); 2249 var gdpr_domain = encodeURIComponent(stlib.data.get("gdpr_domain", "pageInfo")); 2250 var gdpr_method = stlib.data.get("gdpr_method", "pageInfo"); 2251 var gdpr_query_str = ""; 2252 if (gdpr_consent) { 2253 gdpr_query_str += "&gdpr_consent=" + gdpr_consent; 2254 } 2255 if (gdpr_domain) { 2256 gdpr_query_str += "&gdpr_domain=" + gdpr_domain; 2257 } 2258 if (gdpr_method) { 2259 gdpr_query_str += "&gdpr_method=" + gdpr_method; 2260 } 2261 return gdpr_query_str; 2262 }, 2263 2264 loadPixelsAsync: function(res) { 2265 if (typeof(stlib.product) !== "undefined") { 2266 if ((stlib.product == "ecommerce") || 2267 (stlib.product == "dos2") || 2268 (stlib.product == "feather") || 2269 (stlib.product == "simple") || 2270 (stlib.product == "simpleshare") || 2271 (stlib.product == "simple-share-pro")) { 2272 return; 2273 } 2274 } 2275 if (typeof(res) !== "undefined") { 2276 if (res.status === "true") { 2277 // set stid 2278 stlib.data.set("stid", res.stid, "pageInfo") 2279 2280 // fire the pixel 2281 var pxcel_url = "https://t.sharethis.com/1/k/t.dhj?rnd=" + 2282 (new Date()).getTime() + 2283 "&cid=c010&dmn="+ 2284 window.location.hostname + 2285 stlib.logger.getGDPRQueryString(); 2286 var $el = document.createElement('script'); 2287 $el.async = 1; 2288 $el.src = pxcel_url; 2289 $el.id = "pxscrpt"; 2290 var first = document.getElementsByTagName('script')[0]; 2291 first.parentNode.insertBefore($el, first); 2292 } 2293 2294 if(res.status === "true" && res.atlas === "true") { 2295 stlib.logger.js("https://platform-api.sharethis.com/atlas-exp.js"); 2296 } 2297 2298 // run dmd script if indicated in response 2299 if (res.dmd === "true") { 2300 var f = function (w, d, s, m, n, t) { 2301 w[m] = w[m] || { 2302 init: function () { (w[m].q = w[m].q || []).push(arguments); }, ready: function (c) { 2303 if ('function' != typeof c) { return; } (w[m].c = w[m].c || []).push(c); c = w[m].c; 2304 n.onload = n.onreadystatechange = function () { 2305 if (!n.readyState || /loaded|complete/.test(n.readyState)) { 2306 n.onload = n.onreadystatechange = null; 2307 if (t.parentNode && n.parentNode) { t.parentNode.removeChild(n); } while (c.length) { (c.shift())(); } 2308 } 2309 }; 2310 } 2311 }, w[m].d = 1 * new Date(); n = d.createElement(s); t = d.getElementsByTagName(s)[0]; 2312 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); 2313 } 2314 f(window, document, 'script', 'AIM'); 2315 2316 AIM.init('194-3051-2EAEFDBB', { 'onload_pageview': false }); 2317 2318 AIM.ready(function () { 2319 var stid = stlib.data.get("stid", "pageInfo"); 2320 var url = window.location.href + '#estid=' + stid; 2321 AIM.pageview(url); 2322 }); 2323 } 2324 2325 try { 2326 2327 // run lotame's panorama id code if indicated by the content rule 2328 if(res.status === "true" && res.lotame === "true") { 2329 !function() { 2330 // Callback that will be triggered after each call to sync() 2331 // and let you have access to the profile and/or panorama ids 2332 var syncCallback = function (profile) { 2333 2334 // sync the panorama id 2335 var panorama_id = profile.getPanoramaId(); 2336 if (panorama_id && res.stid) { 2337 var url = "https://sync.sharethis.com/panorama" 2338 url += "?uid=" + encodeURIComponent(panorama_id) 2339 url += "&stid=" + encodeURIComponent(res.stid) 2340 stlib.logger.send(url) 2341 } 2342 2343 }; 2344 2345 var lotame_client_id = '16621'; 2346 var lotame_tag_input = { 2347 config: { 2348 onProfileReady: syncCallback 2349 } 2350 }; 2351 2352 // Lotame initialization 2353 var lotame_config = lotame_tag_input.config || {}; 2354 var namespace = window['lotame_sync_' + lotame_client_id] = {}; 2355 namespace.config = lotame_config; 2356 namespace.data = {}; 2357 namespace.cmd = namespace.cmd || []; 2358 } (); 2359 2360 window.lotame_sync_16621.cmd.push(function() { 2361 window.lotame_sync_16621.sync(); 2362 }); 2363 2364 stlib.logger.js("https://platform-api.sharethis.com/panorama.js"); 2365 } 2366 } catch (e) { 2367 // do nothing for now 2368 } 2369 2370 } 2371 }, 2372 2373 send: function(url) { 2374 var img = new Image(1, 1); 2375 img.src = url; 2376 img.style.display = "none" 2377 img.onload = function() {}; 2378 img.onerror = function() {}; 2379 }, 2380 2381 js: function(url) { 2382 var el = document.createElement('script'); 2383 el.async = 1; 2384 el.src = url; 2385 var first = document.getElementsByTagName('script')[0]; 2386 first.parentNode.insertBefore(el, first); 2387 }, 2388 2389 logByImage: function(event, logUrl, callback) { 2390 2391 // add consent params if they exist 2392 var gdpr_consent = stlib.data.get("gdpr_consent", "pageInfo"); 2393 var gdpr_domain = stlib.data.get("gdpr_domain", "pageInfo"); 2394 if (gdpr_consent) { 2395 logUrl += "&gdpr_consent=" + gdpr_consent; 2396 } 2397 if (gdpr_domain) { 2398 logUrl += "&gdpr_domain=" + gdpr_domain; 2399 } 2400 var gdpr_method = stlib.data.get("gdpr_method", "pageInfo"); 2401 if (gdpr_method) { 2402 logUrl += "&gdpr_method=" + gdpr_method; 2403 } 2404 var usprivacy = stlib.data.get("usprivacy", "pageInfo"); 2405 if (usprivacy) { 2406 logUrl += "&usprivacy=" + usprivacy; 2407 } 2408 2409 // add fpestid if it exists 2410 var fpestid = stlib.data.parseCookie("fpestid", document.cookie); 2411 if (fpestid) { 2412 logUrl += "&fpestid=" + fpestid; 2413 } 2414 2415 // add description if it exists 2416 try { 2417 var elements = document.getElementsByTagName("meta"); 2418 for (var i = 0; i < elements.length; i++) { 2419 var attribute = elements[i].getAttribute('property'); 2420 if (attribute == null) { 2421 attribute = elements[i].getAttribute('name'); 2422 } 2423 if (attribute == "twitter:description" || attribute == "og:description" || attribute == "description" || attribute == "Description") { 2424 var description = encodeURIComponent(elements[i].getAttribute('content')); 2425 logUrl += "&description=" + description; 2426 break; 2427 } 2428 } 2429 } catch (e) {} 2430 2431 var mImage = new Image(1, 1);
2432 mImage.src = logUrl + "&img_pview=true"; 2433 mImage.onload = function () { 2434 return; 2435 }; 2436 if (event == "pview") { 2437 stlib.logger.loadPixelsAsync(undefined); 2438 } else { 2439 callback? callback() : null; 2440 } 2441 }, 2442 2443 // TODO: (step 1) error checking on data 2444 // TODO: (step 2) convert params into a generic object, normalize or prepare before logging 2445 log : function(event, loggingUrl, callback, newEndpoint) { 2446 2447 if(typeof(stlib.data.get("counter", "shareInfo")) != "undefined") { 2448 var count = 0; 2449 if (stlib.data.get("counter", "shareInfo")) { 2450 count = stlib.data.get("counter", "shareInfo"); 2451 } 2452 stlib.data.set("ts" + new Date().getTime() + "." + count, "", "shareInfo"); 2453 stlib.data.unset("counter", "shareInfo"); 2454 } else { 2455 stlib.data.set("ts" + new Date().getTime(), "", "shareInfo"); 2456 } 2457 2458 if(event == 'widget') { 2459 var shortenedDestination = "." + stlib.hash.hashDestination(stlib.data.shareInfo.destination); 2460 stlib.hash.updateDestination(shortenedDestination); 2461 } 2462 2463 //Fix for SAB-709 2464 if ( !loggingUrl || (loggingUrl != stlib.logger.loggerUrl && loggingUrl != stlib.logger.l2LoggerUrl)) { 2465 loggingUrl = stlib.logger.loggerUrl; 2466 } 2467 2468 // Step 3: log data (iterate through objects) 2469 var logName = null; 2470 if (newEndpoint) { 2471 logName = event; 2472 } else { 2473 logName = (event == "pview") ? event : ((event == "debug") ? "cns" : "log"); 2474 } 2475 stlib.data.getEUConsent(function(consent){ 2476 if(event == "pview") { 2477 var logUrl = loggingUrl + logName + "?event="+event+ "&" + "version="+stlib.logger.version+ "&" + "lang="+stlib.logger.lang + "&" + stlib.logger.constructParamString(); 2478 }else { 2479 var logUrl = loggingUrl + logName + "?event="+event + "&" + stlib.logger.constructParamString(); 2480 } 2481 var pview_had_consent = (stlib.data.get("gdpr_consent", "pageInfo")) ? true : false; 2482 stlib.data.set("pview_had_consent", pview_had_consent, "pageInfo"); 2483 2484 var user_agent_data = {} 2485 var ua_fields = {} 2486 stlib.data.ua_fields = ua_fields 2487 2488 try { 2489 if (navigator.userAgentData) { 2490 user_agent_data = navigator.userAgentData; 2491 } 2492 2493 if (Array.isArray(user_agent_data.brands)) { 2494 var ua = "" 2495 user_agent_data.brands.forEach((brand) => { 2496 if (ua) { 2497 ua += ", " 2498 } 2499 ua += `"${brand.brand}";v="${brand.version}"` 2500 }); 2501 ua_fields.ua = ua 2502 2503 logUrl += "&ua=" + encodeURIComponent(ua); 2504 } 2505 2506 if (user_agent_data.mobile !== undefined) { 2507 var ua_mobile = (user_agent_data.mobile) ? "true" : "false"; 2508 ua_fields.ua_mobile = ua_mobile 2509 logUrl += "&ua_mobile=" + encodeURIComponent(ua_mobile); 2510 } 2511 2512 if (user_agent_data.platform) { 2513 var ua_platform = user_agent_data.platform 2514 ua_fields.ua_platform = ua_platform 2515 logUrl += "&ua_platform=" + encodeURIComponent(ua_platform); 2516 } 2517 2518 } catch (e) { 2519 // do nothing for now if it fails 2520 } 2521 2522 // if there is no getHighEntropyValues function create a shell function 2523 // in order to keep the workflow unified 2524 if (!user_agent_data.getHighEntropyValues) { 2525 user_agent_data.getHighEntropyValues = () => { 2526 return new Promise((resolve) => { 2527 resolve({}); 2528 }); 2529 } 2530 } 2531 2532 function once(fn, context) { 2533 var result; 2534 return function() { 2535 if(fn) { 2536 result = fn.apply(context || this, arguments); 2537 fn = null; 2538 } 2539 return result; 2540 }; 2541 } 2542 2543 var sendPageView = once(function() { 2544 2545 try { 2546 var client = new XMLHttpRequest(); 2547 var res; 2548 try { 2549 if (crypto && crypto.randomUUID) { 2550 logUrl += "&uuid=" + crypto.randomUUID() 2551 } 2552 stlib.data.pageInfo.pview_url = logUrl 2553 } catch (e) {} 2554 client.open("GET", logUrl, true); 2555 client.withCredentials = true; 2556 client.timeout = 10000; 2557 client.onreadystatechange = function () { 2558 if (this.readyState == this.DONE) { 2559 try { 2560 res = JSON.parse(client.responseText); 2561 if (res.fpestid) { 2562 stlib.data.writeCookie("fpestid", res.fpestid, res.fpestid_maxage); 2563 } 2564 if (event == "pview") { 2565 /* 2566 // stop firing comscore beacon 2567 if (typeof (stlib.comscore) != "undefined") { 2568 stlib.comscore.load(); 2569 } 2570 */ 2571 stlib.logger.loadPixelsAsync(res); 2572 } else { 2573 callback ? callback(): null; 2574 } 2575 } catch (e) { 2576 // responseText is empty for request timeout 2577 stlib.logger.logByImage(event, logUrl, callback); 2578 } 2579 } 2580 }; 2581 client.send(); 2582 } catch (err) { // some browsers don't support XMLHttpRequest 2583 stlib.logger.logByImage(event, logUrl, callback); 2584 } 2585 }) 2586 2587 var getOverride = function() { 2588 var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 2589 if (is_safari) { 2590 var req = new XMLHttpRequest(); 2591 req.open("GET", "https://data.stbuttons.click/data", true); 2592 req.onreadystatechange = function() { 2593 try { 2594 if (this.readyState == this.DONE) { 2595 var res = JSON.parse(req.responseText) 2596 if (res.data) { 2597 var override = res.data 2598 logUrl += "&override=" + encodeURIComponent(override); 2599 stlib.data.override = override 2600 } 2601 sendPageView() 2602 } 2603 } catch(e) { 2604 sendPageView() 2605 } 2606 } 2607 req.send() 2608 2609 // send page view if request doesn't complete in 2 seconds 2610 setTimeout(sendPageView, 2000) 2611 } else { 2612 sendPageView() 2613 } 2614 } 2615 2616 var high_entropy_fields = [ 2617 "model", 2618 "platformVersion", 2619 "fullVersionList" 2620 ] 2621 2622 user_agent_data.getHighEntropyValues(high_entropy_fields).then((high_entropy_values) => { 2623 2624 try { 2625 2626 if (Array.isArray(high_entropy_values.fullVersionList)) { 2627 var ua_full_version_list = "" 2628 high_entropy_values.fullVersionList.forEach((brand) => { 2629 if (ua_full_version_list) { 2630 ua_full_version_list += ", " 2631 } 2632 ua_full_version_list += `"${brand.brand}";v="${brand.version}"` 2633 }); 2634 ua_fields.ua_full_version_list = ua_full_version_list 2635 logUrl += "&ua_full_version_list=" + encodeURIComponent(ua_full_version_list); 2636 } 2637 2638 if (high_entropy_values.model) { 2639 var ua_model = high_entropy_values.model 2640 ua_fields.ua_model = ua_model 2641 logUrl += "&ua_model=" + encodeURIComponent(ua_model); 2642 } 2643 2644 if (high_entropy_values.platformVersion) { 2645 var ua_platform_version = high_entropy_values.platformVersion 2646 ua_fields.ua_platform_version = ua_platform_version 2647 logUrl += "&ua_platform_version=" + encodeURIComponent(ua_platform_version); 2648 } 2649 2650 } catch (e) { 2651 // do nothing for now 2652 } 2653 2654 getOverride() 2655 2656 }); 2657 2658 }); 2659 }, 2660 tcfapi_listener: function() { 2661 var start = Date.now(); 2662 var interval = setInterval(function() { 2663 if (window.__tcfapi) { 2664 try { 2665 window.__tcfapi("addEventListener", 2, function(data) { 2666 if (data && data.eventStatus == "useractioncomplete") { 2667 stlib.data.set("gdpr_consent", data.tcString, "pageInfo"); 2668 var gdpr_domain = (data.isServiceSpecific) 2669 ? document.location.hostname : ".consensu.org"; 2670 stlib.data.set("gdpr_domain", gdpr_domain, "pageInfo"); 2671 stlib.data.set("gdpr_method", "api", "pageInfo"); 2672 var url = stlib.logger.loggerUrl; 2673 url += "log?event=updated_consent"; 2674 url += "&pview_had_consent=" + stlib.data.get("pview_had_consent", "pageInfo"); 2675 stlib.logger.logByImage("updated_consent", url, null); 2676 } 2677 }); 2678 } catch (e) { 2679 clearInterval(interval); 2680 } 2681 } 2682 if (Date.now() - start > 10000) { 2683 clearInterval(interval); 2684 } 2685 }, 1000); 2686 }() 2687}; 2688 2689/********************END LOGGING***********************/ 2690/* 2691 * This handles ajax requests 2692 */ 2693if(typeof(stlib.ajax)=="undefined") { 2694 stlib.ajax = { 2695 post: function(url, params, callback, async) { 2696 var xmlHttp = new XMLHttpRequest(); 2697 if (callback) { 2698 async ? (xmlHttp.onreadystatechange = callback) : null; 2699 } 2700 xmlHttp.open("POST", url, async); 2701 xmlHttp.send(params); 2702 if (callback) { 2703 !async ? callback() : null; 2704 } 2705 }, 2706 get: function(url, callback) { 2707 try { 2708 var client = new XMLHttpRequest(); 2709 client.open("GET", url, true); 2710 client.withCredentials = true; 2711 client.onreadystatechange = function () { 2712 if (this.readyState == this.HEADERS_RECEIVED) { 2713 callback ? callback() : null; 2714 } 2715 }; 2716 client.send(); 2717 } catch (err) { // some browsers don't support XMLHttpRequest 2718 var mImage = new Image(1, 1); 2719 mImage.src = url; 2720 mImage.onload = function () { 2721 return; 2722 }; 2723 callback ? callback() : null; 2724 } 2725 } 2726 } 2727} 2728/* end of ajax */ 2729stlib.logger.version = 'buttons.js' 2730var customProduct = 'widget' 2731 2732if(typeof(stLight)=="undefined" && typeof(SHARETHIS)=="undefined"){ //make sure it isnt called over and over again 2733 var stWidgetVersion = false;
2734 2735 if(typeof(switchTo5x)=="undefined") { 2736 stWidgetVersion = "4x"; // For Migration Phase 2 - by deafult widget will be 5xa 2737 }else{ 2738 if(switchTo5x == false){ 2739 stWidgetVersion = "4x"; 2740 } 2741 if(switchTo5x == true){ 2742 stWidgetVersion = "5xa"; 2743 } 2744 } 2745 2746 stLight=new function(){ 2747 this.version=false; 2748 this.publisher=null; 2749 this.sessionID_time = (new Date()).getTime().toString(); 2750 this.sessionID_rand = Number(Math.random().toPrecision(5).toString().substr(2)).toString(); 2751 this.sessionID = this.sessionID_time + '.' + this.sessionID_rand; 2752 this.fpc=null; 2753 this.counter=0; 2754 this.readyRun=false; 2755 this.meta={ 2756 hostname: document.location.host, 2757 location: document.location.pathname 2758 }; 2759 this.loadedFromBar=false; 2760 this.clickCallBack=false; 2761 }; 2762 2763 stLight.loadDefault = function() { 2764 if (typeof(customProduct) == "undefined") { 2765 this.product = "DOS2"; 2766 } else{ 2767 this.product = customProduct; 2768 } 2769 this.source = "DOS2"; 2770 this.version = "st_insights.js"; 2771 }; 2772 2773 stLight.options=function(options){ 2774 this.loadDefault(); 2775 // set custom publisher 2776 if(options && options.publisher){ 2777 stLight.setPublisher(options.publisher); 2778 } 2779 2780 // set custom ref domain 2781 if(options && options.refDomain){ 2782 stLight.setRefDomain(options.refDomain); 2783 } 2784 2785 // set custom product 2786 // calls setProduct but doesn't update stLight.product 2787 // deprecated: productArray 2788 stlib.logger.productArray = [] 2789 if(options && options.product){ 2790 stLight.setProduct(options.product); 2791 } 2792 else { 2793 stLight.setProduct(stLight.product); 2794 } 2795 2796 // set copy and share options 2797 if(options && typeof(options.hashAddressBar) != "undefined") { 2798 stlib.hash.hashAddressBar = options.hashAddressBar; 2799 } 2800 stlib.hash.doNotHash = stlib.hash.doNotCopy = false; 2801 if(options) { 2802 options.doNotCopy = options.doNotHash = false; 2803 } 2804 2805 stlib.stLightOptionsObj = options; 2806 }; 2807 2808 stLight.onReady=function(){ 2809 if(stLight.readyRun==true){ 2810 return false; 2811 } 2812 2813 stLight.loadFromScript(); 2814 stLight.readyRun=true; 2815 stlib.data.init(); 2816 stLight.fpc=stlib.data.get("fpc", "pageInfo"); 2817 if(stLight.publisher==null){ 2818 if(typeof(window.console)!=="undefined"){ 2819 try{ 2820 // console.debug("Please specify a ShareThis Publisher Key \nFor help, contact [email protected]"); 2821 }catch(err){} 2822 } 2823 } 2824 stLight.setProduct(stLight.product); 2825 2826 //TODO: set this from the ref? 2827 stlib.logger.lang = 'en'; 2828 2829 }; 2830 2831 2832 2833 2834 //Used only to generate widget and pview events logs. 2835 stLight.log=function(event){ 2836 stlib.data.resetShareData(); 2837 stlib.data.setSource(stLight.getSource()); 2838 stlib.data.set("url", document.location.href, "shareInfo"); 2839 stlib.data.set("title", document.title, "shareInfo"); 2840 stlib.data.set("counter", stLight.counter++, "shareInfo"); 2841 stlib.logger.log(event); 2842 }; 2843 2844 2845 if(window.document.readyState=="completed"){ 2846 stLight.onReady(); 2847 }else{ 2848 if (typeof(window.addEventListener) != 'undefined') { 2849 window.addEventListener("load", stLight.onReady, false); 2850 } else if (typeof(document.addEventListener) != 'undefined') { 2851 document.addEventListener("load", stLight.onReady, false); 2852 } else if (typeof window.attachEvent != 'undefined') { 2853 window.attachEvent("onload", stLight.onReady); 2854 } 2855 } 2856 2857 2858 stLight.setPublisher = function(publisher) { 2859 stlib.data.setPublisher(publisher); 2860 stLight.publisher=publisher; 2861 }; 2862 2863 stLight.setRefDomain = function(refDomain) { 2864 stlib.data.setRefDomain(refDomain); 2865 }; 2866 2867 stLight.setProduct = function(product) { 2868 this.product = product; 2869 stlib.data.set("product", product, "pageInfo"); 2870 }; 2871 2872 stLight.getProduct = function() { 2873 return this.product; 2874 }; 2875 2876 stLight.getSource=function(){ 2877 var source = 'share4x'; 2878 if(stWidgetVersion == "5xa"){ 2879 source = 'share5x'; 2880 } 2881 //TODO: Get share bar version before buttons load 2882 return source; 2883 }; 2884 2885} 2886 2887stLight.getUrlSearchParam = function() { 2888 var list = window.location.search.substring(1); 2889 return list.split("&"); 2890} 2891 2892stLight.getUrlQueryParams = function(url) { 2893 var params = {}; 2894 var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, 2895 function(m,key,value) { 2896 params[key] = value; 2897 }); 2898 return params; 2899} 2900 2901stLight.getScriptSrcParams = function(scriptId){ 2902 var s = document.getElementById(scriptId); 2903 if (s) { 2904 return stLight.getUrlQueryParams(s.src) 2905 } 2906} 2907 2908stLight.setParams = function(params) { 2909 if (params) { 2910 if (params.refdomain) { 2911 stLight.setRefDomain(params.refdomain); 2912 } 2913 if (params.publisher) { 2914 stLight.setPublisher(params.publisher); 2915 } 2916 if (params.product) { 2917 stLight.setProduct(params.product); 2918 } 2919 } 2920} 2921 2922stLight.loadFromScript = function() { 2923 // Load the url params from script "st_insights_js" src 2924 var params = stLight.getScriptSrcParams('st_insights_js'); 2925 stLight.setParams(params) 2926} 2927 2928stLight.loadFromWindowLocation = function() { 2929 var params = stLight.getUrlSearchParam(); 2930 stLight.setParams(params) 2931} 2932 2933//END OF light.js 2934 2935stLight.onDomContentLoaded=function(){ 2936 stLight.onReady(); 2937; 2938}; 2939 2940 2941stLight.domReady=function(){ 2942 stLight.onReady(); 2943}; 2944 2945 2946st_showing=false; 2947 2948stLight.clickSubscribers=[]; 2949stLight.nonClickSubscribers=[]; 2950 2951 2952if(window.document.readyState=="completed"){ 2953 stLight.domReady();//domReady 2954}else{ 2955 if (typeof(window.addEventListener) != 'undefined') { 2956 window.addEventListener("load", stLight.domReady, false); 2957 } else if (typeof(document.addEventListener) != 'undefined') { 2958 document.addEventListener("load", stLight.domReady, false); 2959 } else if (typeof window.attachEvent != 'undefined') { 2960 window.attachEvent("onload", stLight.domReady); 2961 } 2962} 2963 2964 2965 2966//DOMContentLoaded 2967if(typeof(__st_loadLate)=="undefined"){ 2968 if (typeof(window.addEventListener) != 'undefined') { 2969 window.addEventListener("DOMContentLoaded", stLight.onDomContentLoaded, false); 2970 } else if (typeof(document.addEventListener) != 'undefined') { 2971 document.addEventListener("DOMContentLoaded", stLight.onDomContentLoaded, false); 2972 } 2973} else { 2974 if (typeof(window.addEventListener) != 'undefined') { 2975 window.addEventListener("DOMContentLoaded", stLight.onDomContentLoadedLazy, false); 2976 } else if (typeof(document.addEventListener) != 'undefined') { 2977 document.addEventListener("DOMContentLoaded", stLight.onDomContentLoadedLazy, false); 2978 } 2979} 2980 2981 2982if(document.readyState == "complete" && stLight.readyRun==false){ //Keep at the end of the file 2983 //This is called after body is loaded so the domeready call would never get called, so call it here 2984 stLight.domReady(); 2985} 2986 2987 2988 2989 2990//deprecated (only used in special cases: i.e. Forbes) This will always get from ShareThis count service 2991var stButtons = stButtons || {}; 2992 2993stButtons.getCount=function(url,service,element){ 2994 var flag=false; 2995 2996 if(element && element!==null){ 2997 while (element.childNodes.length >= 1 ) 2998 {
2999 try{element.removeChild(element.firstChild );}catch(err){} //empty out old ones... 3000 } 3001 } 3002 // delay execution of these, so that async-buttons.js will show up 3003 ShareThisEvent.listen('on_async_buttons_load',function(){ 3004 stButtons = async_buttons.stButtons; 3005 stButtons.cbQueue.push({"url":url,"service":service,"element":element}); 3006 stButtons.getCountsFromService(url,service,element); 3007 },false); 3008}; 3009 3010stButtons.locateElements=function(clearChildren){ 3011 ShareThisEvent.listen('on_async_buttons_load', function(){ 3012 async_buttons.stButtons.locateElements(clearChildren); 3013 }, false); 3014}; 3015 3016var stWidget = stWidget || {}; 3017if(typeof(stWidget.readyRun) == 'undefined'){ 3018 stWidget.addEntry=function(options){ 3019 ShareThisEvent.listen('on_async_buttons_load',function(){ 3020 stWidget = async_buttons.stWidget; 3021 stWidget.addEntry(options); 3022 },false); 3023 }; 3024}; 3025 3026stLight.subscribe=function(evnt,fun){ 3027 ShareThisEvent.listen('on_async_buttons_load',function(){ 3028 stButtonsLib.subscribe(evnt,fun); 3029 },false); 3030}; 3031 3032// set product and property for new buttons 3033if (window.__sharethis__) { 3034 stlib.setProduct(window.__sharethis__.product); 3035 stlib.setPublisher(window.__sharethis__.property); 3036} 3037var sop_pview_logged = typeof __stdos__ !== 'undefined' && __stdos__ !== null && __stdos__.onscriptload; 3038if (!sop_pview_logged && !stlib.onscriptload && document.URL.indexOf("edge.sharethis.com") == -1) { 3039 stlib.data.init(); 3040 stlib.onscriptload = true; 3041 stlib.logger.log("pview", null); 3042} 3043stlib.logger.ibl(); 3044stlib.data.bindEvent(document, "click", stlib.logger.obl); 3045 3046/********************START SCRIPTLOADER***********************/ 3047/* 3048 * This handles on demand loading of javascript and CSS files 3049 */ 3050stlib.scriptLoader = { 3051 loadJavascript : function(href,callBack){ 3052 var loader = stlib.scriptLoader; 3053 loader.head=document.getElementsByTagName('head')[0]; 3054 loader.scriptSrc=href; 3055 loader.script=document.createElement('script'); 3056 loader.script.setAttribute('type', 'text/javascript'); 3057 loader.script.setAttribute('src', loader.scriptSrc); 3058 loader.script.async = true; 3059 3060 if(window.attachEvent && document.all) { //IE: 3061 loader.script.onreadystatechange=function(){ 3062 if(this.readyState=='complete' || this.readyState=='loaded'){ 3063 callBack(); 3064 } 3065 }; 3066 } else { //other browsers: 3067 loader.script.onload=callBack; 3068 } 3069 loader.s = document.getElementsByTagName('script')[0]; 3070 loader.s.parentNode.insertBefore(loader.script, loader.s); 3071 }, 3072 loadCSS : function(href,callBack) { 3073 _$d_(); 3074 _$d1("Loading CSS: " + href); 3075 var loader = stlib.scriptLoader; 3076 var cssInterval; 3077 loader.head=document.getElementsByTagName('head')[0]; 3078 loader.cssSrc=href; 3079 loader.css=document.createElement('link'); 3080 loader.css.setAttribute('rel', 'stylesheet'); 3081 loader.css.setAttribute('type', 'text/css'); 3082 loader.css.setAttribute('href', href); 3083 loader.css.setAttribute('id', href); 3084 setTimeout(function(){ 3085 callBack(); 3086 if(!document.getElementById(href)){ 3087 cssInterval=setInterval(function(){ 3088 if(document.getElementById(href)){ 3089 clearInterval(cssInterval); 3090 callBack(); 3091 } 3092 }, 100); 3093 } 3094 },100); 3095 loader.head.appendChild(loader.css); 3096 } 3097}; 3098/********************END SCRIPTLOADER***********************/ 3099 3100}
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.