1/** 2 * Easy Social Share Buttons for WordPress Core Javascript 3 * 4 * @package EasySocialShareButtons 5 * @author appscreo 6 * @since 5.0 7 */ 8 9/** 10 * jQuery function extension package for Easy Social Share Buttons 11 */ 12jQuery(document).ready(function($){ 13 "use strict"; 14 15 jQuery.fn.essb_toggle_more = function(){ 16 return this.each(function(){ 17 $(this).removeClass('essb_after_more'); 18 $(this).addClass('essb_before_less'); 19 }); 20 }; 21 22 jQuery.fn.essb_toggle_less = function(){ 23 return this.each(function(){ 24 $(this).addClass('essb_after_more'); 25 $(this).removeClass('essb_before_less'); 26 }); 27 }; 28 29 jQuery.fn.extend({ 30 center: function () { 31 return this.each(function() { 32 var top = (jQuery(window).height() - jQuery(this).outerHeight()) / 2; 33 var left = (jQuery(window).width() - jQuery(this).outerWidth()) / 2; 34 jQuery(this).css({position:'fixed', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'}); 35 }); 36 } 37 }); 38 39}); 40 41(function ($) { 42 $.fn.countTo = function (options) { 43 options = options || {}; 44 45 return $(this).each(function () { 46 // set options for current element 47 var settings = $.extend({}, $.fn.countTo.defaults, { 48 from: $(this).data('from'), 49 to: $(this).data('to'), 50 speed: $(this).data('speed'), 51 refreshInterval: $(this).data('refresh-interval'), 52 decimals: $(this).data('decimals') 53 }, options); 54 55 // how many times to update the value, and how much to increment the value on each update 56 var loops = Math.ceil(settings.speed / settings.refreshInterval), 57 increment = (settings.to - settings.from) / loops; 58 59 // references & variables that will change with each update 60 var self = this, 61 $self = $(this), 62 loopCount = 0, 63 value = settings.from, 64 data = $self.data('countTo') || {}; 65 66 $self.data('countTo', data); 67 68 // if an existing interval can be found, clear it first 69 if (data.interval) { 70 clearInterval(data.interval); 71 } 72 data.interval = setInterval(updateTimer, settings.refreshInterval); 73 74 // initialize the element with the starting value 75 render(value); 76 77 function updateTimer() { 78 value += increment; 79 loopCount++; 80 81 render(value); 82 83 if (typeof (settings.onUpdate) == 'function') { 84 settings.onUpdate.call(self, value); 85 } 86 87 if (loopCount >= loops) { 88 // remove the interval 89 $self.removeData('countTo'); 90 clearInterval(data.interval); 91 value = settings.to; 92 93 if (typeof (settings.onComplete) == 'function') { 94 settings.onComplete.call(self, value); 95 } 96 } 97 } 98 99 function render(value) { 100 var formattedValue = settings.formatter.call(self, value, settings); 101 $self.text(formattedValue); 102 } 103 }); 104 }; 105 106 $.fn.countTo.defaults = { 107 from: 0, // the number the element should start at 108 to: 0, // the number the element should end at 109 speed: 1000, // how long it should take to count between the target numbers 110 refreshInterval: 100, // how often the element should be updated 111 decimals: 0, // the number of decimal places to show 112 formatter: formatter, // handler for formatting the value before rendering 113 onUpdate: null, // callback method for every time the element is updated 114 onComplete: null // callback method for when the element finishes updating 115 }; 116 117 function formatter(value, settings) { 118 return value.toFixed(settings.decimals); 119 } 120 121 122 123}(jQuery)); 124 125( function( $ ) { 126 "use strict"; 127 128 /** 129 * Easy Social Share Buttons for WordPress 130 * 131 * @package EasySocialShareButtons 132 * @since 5.0 133 * @author appscreo 134 */ 135 var essb = window.essb = {}; 136 137 var debounce = function( func, wait ) { 138 var timeout, args, context, timestamp; 139 return function() { 140 context = this; 141 args = [].slice.call( arguments, 0 ); 142 timestamp = new Date(); 143 var later = function() { 144 var last = ( new Date() ) - timestamp; 145 if ( last < wait ) { 146 timeout = setTimeout( later, wait - last ); 147 } else { 148 timeout = null; 149 func.apply( context, args ); 150 } 151 }; 152 if ( ! timeout ) { 153 timeout = setTimeout( later, wait ); 154 } 155 }; 156 }; 157 158 var isElementInViewport = function (el) { 159 160 //special bonus for those using jQuery 161 if (typeof jQuery === "function" && el instanceof jQuery) { 162 el = el[0]; 163 } 164 165 var rect = el.getBoundingClientRect(); 166 167 return ( 168 rect.top >= 0 && 169 rect.left >= 0 && 170 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ 171 rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ 172 ); 173 }; 174 175 var isVisibleSelector = function(selector) { 176 var top_of_element = $(selector).offset().top; 177 var bottom_of_element = $(selector).offset().top + $(selector).outerHeight(); 178 var bottom_of_screen = $(window).scrollTop() + $(window).innerHeight(); 179 var top_of_screen = $(window).scrollTop(); 180 181 if ((bottom_of_screen > top_of_element) && (top_of_screen < bottom_of_element)){ 182 return true; 183 } else { 184 return false; 185 } 186 }; 187 188 essb.add_event = function(eventID, user_function) { 189 if (!essb.events) essb.events = {}; 190 essb.events[eventID] = user_function; 191 }; 192 193 essb.trigger = function(eventID, options) { 194 if (!essb.events) return; 195 if (essb.events[eventID]) essb.events[eventID](options); 196 }; 197 198 essb.window = function (url, service, instance, trackingOnly) { 199 var element = $('.essb_'+instance),
200 instance_post_id = $(element).attr('data-essb-postid') || '', 201 instance_position = $(element).attr('data-essb-position') || '', 202 wnd, 203 isMobile = $(window).width() <= 1024 ? true : false, 204 keyWin = 'essb_share_window' + (isMobile) + '-' + (Date.now()).toString(); 205 206 var w = (service == 'twitter') ? '500' : '800', 207 h = (service == 'twitter') ? '300' : '500', 208 left = (screen.width/2)-(Number(w)/2), 209 top = (screen.height/2)-(Number(h)/2); 210 211 if (typeof essbShareWindowURLFilter != 'undefined') 212 url = essbShareWindowURLFilter(service, url, instance_post_id, instance_position); 213 214 if (!trackingOnly) 215 wnd = window.open( url, keyWin, "height="+(service == 'twitter' ? '500' : '500')+",width="+(service == 'twitter' ? '500' : '800')+",resizable=1,scrollbars=yes,top="+top+",left="+left ); 216 217 218 if (typeof(essb_settings) != "undefined") { 219 if (essb_settings.essb3_stats) { 220 essb.handleInternalStats(service, instance_post_id, instance); 221 } 222 223 if (essb_settings.essb3_ga) 224 essb_ga_tracking(service, url, instance_position); 225 226 if (essb_settings.essb3_ga_ntg && typeof(gtag) != 'undefined') { 227 gtag('event', 'social share', { 228 'event_category': 'NTG social', 229 'event_label': service, 230 'non_interaction' : false 231 }); 232 } 233 234 } 235 236 if (typeof(essb_settings) != 'undefined') { 237 if (typeof(essb_settings.stop_postcount) == 'undefined') essb_self_postcount(service, instance_post_id); 238 } 239 240 if (typeof(essb_abtesting_logger) != "undefined") 241 essb_abtesting_logger(service, instance_post_id, instance); 242 243 if (typeof(essb_conversion_tracking) != 'undefined') 244 essb_conversion_tracking(service, instance_post_id, instance); 245 246 if (!trackingOnly) 247 var pollTimer = window.setInterval(function() { 248 if (wnd.closed !== false) { 249 window.clearInterval(pollTimer); 250 essb_smart_onclose_events(service, instance_post_id); 251 252 if (instance_position == 'booster' && typeof(essb_booster_close_from_action) != 'undefined') 253 essb_booster_close_from_action(); 254 } 255 }, 200); 256 257 }; 258 259 essb.share_window = function(url, custom_position, service) { 260 var w = '800', h = '500', left = (screen.width/2)-(Number(w)/2), top = (screen.height/2)-(Number(h)/2); 261 wnd = window.open( url, "essb_share_window", "height="+'500'+",width="+'800'+",resizable=1,scrollbars=yes,top="+top+",left="+left ); 262 263 if (typeof(essb_settings) != "undefined") { 264 if (essb_settings.essb3_stats) { 265 essb.handleLogInternalStats(service, essb_settings["post_id"] || '', custom_position); 266 } 267 268 if (essb_settings.essb3_ga) 269 essb_ga_tracking(service, url, custom_position); 270 271 if (essb_settings.essb3_ga_ntg && gtag) { 272 gtag('event', 'social share', { 273 'event_category': 'NTG social', 274 'event_label': service, 275 'non_interaction' : false 276 }); 277 } 278 } 279 }; 280 281 essb.fbmessenger = function(app_id, url, saltKey) { 282 var isMobile = $(window).width() <= 1024 ? true : false, 283 cmd = ''; 284 285 if (isMobile) cmd = 'fb-messenger://share/?link=' + url; 286 else cmd = 'https://www.facebook.com/dialog/send?app_id='+app_id+'&link='+url+'&redirect_uri=https://facebook.com'; 287 if (isMobile) { 288 window.open(cmd, "_self"); 289 essb.tracking_only('', 'messenger', saltKey, true); 290 } 291 else { 292 essb.window(cmd, 'messenger', saltKey); 293 } 294 295 return false; 296 }; 297 298 essb.whatsapp = function(url, saltKey) { 299 var isMobile = $(window).width() <= 1024 ? true : false, 300 cmd = ''; 301 302 if (isMobile) cmd = 'whatsapp://send?text=' + url; 303 else cmd = 'https://web.whatsapp.com/send?text=' + url; 304 if (isMobile) { 305 window.open(cmd, "_self"); 306 essb.tracking_only('', 'whatsapp', saltKey, true); 307 } 308 else { 309 essb.window(cmd, 'whatsapp', saltKey); 310 } 311 312 return false; 313 }; 314 315 essb.sms = function(url, saltKey) { 316 var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, 317 cmd = 'sms:' + (iOS ? '&' : '?') + 'body=' + url; 318 window.open(cmd, "_self"); 319 essb.tracking_only('', 'sms', saltKey, true); 320 321 return false; 322 }; 323 324 essb.tracking_only = function(url, service, instance, afterShare) { 325 if (url == '') 326 url = document.URL; 327 328 essb.window(url, service, instance, true); 329 330 var element = $('.essb_'+instance),
331 instance_position = $(element).attr('data-essb-position') || ''; 332 333 if (afterShare) { 334 setTimeout(function() { 335 var instance_post_id = $('.essb_'+instance).attr('data-essb-postid') || ''; 336 essb_smart_onclose_events(service, instance_post_id); 337 338 if (instance_position == 'booster' && typeof(essb_booster_close_from_action) != 'undefined') 339 essb_booster_close_from_action(); 340 }, 1500); 341 } 342 }; 343 344 essb.pinterest_picker = function(instance) { 345 essb.tracking_only('', 'pinterest', instance); 346 var e=document.createElement('script'); 347 e.setAttribute('type','text/javascript'); 348 e.setAttribute('charset','UTF-8'); 349 e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999); 350 document.body.appendChild(e); 351 }; 352 353 essb.print = function (instance) { 354 essb.tracking_only('', 'print', instance); 355 window.print(); 356 }; 357 358 essb.setCookie = function(cname, cvalue, exdays) { 359 var d = new Date(); 360 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 361 var expires = "expires="+d.toGMTString(); 362 document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/"; 363 }; 364 365 essb.getCookie = function(cname) { 366 var name = cname + "="; 367 var ca = document.cookie.split(';'); 368 for(var i=0; i<ca.length; i++) { 369 var c = ca[i].trim(); 370 if (c.indexOf(name) == 0) return c.substring(name.length,c.length); 371 } 372 return ""; 373 }; 374 375 essb.loveThis = function (instance) { 376 console.log(window.essb_love_you_message_thanks); 377 378 if (typeof(essb_love_you_message_loved) == 'undefined') var essb_love_you_message_loved = ''; 379 if (typeof(essb_love_you_message_thanks) == 'undefined') var essb_love_you_message_thanks = ''; 380 381 if (typeof (window.essb_love_you_message_thanks) != 'undefined') essb_love_you_message_thanks = window.essb_love_you_message_thanks; 382 if (typeof (window.essb_love_you_message_loved) != 'undefined') essb_love_you_message_loved = window.essb_love_you_message_loved; 383 384 if (essb.clickedLoveThis) { 385 if (!essb.loveDisableLoved) alert(essb_love_you_message_loved ? essb_love_you_message_loved : 'You already love this today'); 386 return; 387 } 388 389 var element = $('.essb_'+instance); 390 if (!element.length) return; 391 392 var instance_post_id = $(element).attr("data-essb-postid") || ""; 393 394 var cookie_set = essb.getCookie("essb_love_"+instance_post_id); 395 if (cookie_set) { 396 if (!essb.loveDisableLoved) alert(essb_love_you_message_loved ? essb_love_you_message_loved : 'You already love this today'); 397 return; 398 } 399 400 if (typeof(essb_settings) != "undefined") { 401 $.post(essb_settings.ajax_url, { 402 'action': 'essb_love_action', 403 'post_id': instance_post_id, 404 'service': 'love', 405 'nonce': essb_settings.essb3_nonce 406 }, function (data) { if (data) { 407 if (!essb.loveDisableThanks) alert(essb_love_you_message_thanks ? essb_love_you_message_thanks : 'Thank you for loving this'); 408 }},'json'); 409 } 410 411 essb.tracking_only('', 'love', instance, true); 412 }; 413 414 essb.toggle_more = function(unique_id) { 415 if (essb['is_morebutton_clicked']) { 416 essb.toggle_less(unique_id); 417 return; 418 } 419 $('.essb_'+unique_id+' .essb_after_more').essb_toggle_more(); 420 421 var moreButton = $('.essb_'+unique_id).find('.essb_link_more'); 422 if (typeof(moreButton) != "undefined") { 423 moreButton.hide(); 424 moreButton.addClass('essb_hide_more_sidebar'); 425 } 426 427 moreButton = $('.essb_'+unique_id).find('.essb_link_more_dots'); 428 if (typeof(moreButton) != "undefined") { 429 moreButton.hide(); 430 moreButton.addClass('essb_hide_more_sidebar'); 431 } 432 433 essb['is_morebutton_clicked'] = true; 434 }; 435 436 essb.toggle_less = function(unique_id) { 437 essb['is_morebutton_clicked'] = false; 438 $('.essb_'+unique_id+' .essb_before_less').essb_toggle_less(); 439 440 var moreButton = $('.essb_'+unique_id).find('.essb_link_more'); 441 if (typeof(moreButton) != "undefined") { 442 moreButton.show(); 443 moreButton.removeClass('essb_hide_more_sidebar'); 444 } 445 446 moreButton = $('.essb_'+unique_id).find('.essb_link_more_dots'); 447 if (typeof(moreButton) != "undefined") { 448 moreButton.show(); 449 moreButton.removeClass('essb_hide_more_sidebar'); 450 } 451 }; 452 453 essb.toggle_more_popup = function(unique_id) { 454 if (essb['essb_morepopup_opened']) { 455 essb.toggle_less_popup(unique_id); 456 return; 457 } 458 if ($(".essb_morepopup_"+unique_id).hasClass("essb_morepopup_inline")) { 459 essb.toggle_more_inline(unique_id); 460 return; 461 } 462 463 var is_from_mobilebutton = false, height_of_mobile_bar = 0, parentDraw = $(".essb_morepopup_"+unique_id); 464 if ($(parentDraw).hasClass('essb_morepopup_sharebottom')) { 465 is_from_mobilebutton = true; 466 height_of_mobile_bar = $(".essb-mobile-sharebottom").outerHeight(); 467 } 468 469 var win_width = $( window ).width(), win_height = $(window).height(), 470 base_width = !is_from_mobilebutton ? 660 : 550, 471 height_correction = is_from_mobilebutton ? 10 : 80; 472 473 if (win_width < base_width) base_width = win_width - 30; 474 475 var element_class = ".essb_morepopup_"+unique_id, 476 element_class_shadow = ".essb_morepopup_shadow_"+unique_id, 477 alignToBottom = $(element_class).hasClass("essb_morepopup_sharebottom") ? true : false; 478 479 if ($(element_class).hasClass("essb_morepopup_modern") && !is_from_mobilebutton) height_correction = 100; 480 481 $(element_class).css( { width: base_width+'px'}); 482
483 var element_content_class = ".essb_morepopup_content_"+unique_id; 484 var popup_height = $(element_class).outerHeight(); 485 if (popup_height > (win_height - 30)) { 486 var additional_correction = 0; 487 if (is_from_mobilebutton) { 488 $(element_class).css( { top: '5px'}); 489 additional_correction += 5; 490 } 491 $(element_class).css( { height: (win_height - height_of_mobile_bar - height_correction - additional_correction)+'px'}); 492 $(element_content_class).css( { height: (win_height - height_of_mobile_bar - additional_correction - (height_correction+50))+'px', "overflowY" :"auto"}); 493 } 494 if (is_from_mobilebutton) 495 $(element_class_shadow).css( { height: (win_height - (is_from_mobilebutton ? height_of_mobile_bar : 0))+'px'}); 496 497 if (!alignToBottom) 498 $(element_class).center(); 499 else { 500 var left = ($(window).width() - $(element_class).outerWidth()) / 2; 501 $(element_class).css( { left: left+"px", position:'fixed', margin:0, bottom: (height_of_mobile_bar + height_correction) + "px" }); 502 } 503 $(element_class).fadeIn(400); 504 $(element_class_shadow).fadeIn(200); 505 essb['essb_morepopup_opened'] = true; 506 }; 507 508 essb.toggle_less_popup = function(unique_id) { 509 $(".essb_morepopup_"+unique_id).fadeOut(200); 510 $(".essb_morepopup_shadow_"+unique_id).fadeOut(200); 511 essb['essb_morepopup_opened'] = false; 512 }; 513 514 essb.toggle_more_inline = function(unique_id) { 515 var buttons_element = $(".essb_"+unique_id); 516 if (!buttons_element.length) return; 517 var element_class = ".essb_morepopup_"+unique_id; 518 519 var appear_y = $(buttons_element).position().top + $(buttons_element).outerHeight(true); 520 var appear_x = $(buttons_element).position().left; 521 var appear_position = "absolute"; 522 523 var appear_at_bottom = false; 524 525 if ($(buttons_element).css("position") === "fixed") 526 appear_position = "fixed"; 527 528 if ($(buttons_element).hasClass("essb_displayed_bottombar")) 529 appear_at_bottom = true; 530 531 if (appear_at_bottom) { 532 appear_y = $(buttons_element).position().top - $(element_class).outerHeight(true); 533 var pointer_element = $(element_class).find(".modal-pointer"); 534 if ($(pointer_element).hasClass("modal-pointer-up-left")) { 535 $(pointer_element).removeClass("modal-pointer-up-left"); 536 $(pointer_element).addClass("modal-pointer-down-left"); 537 } 538 } 539 540 var more_button = $(buttons_element).find(".essb_link_more"); 541 if (!$(more_button).length) 542 more_button = $(buttons_element).find(".essb_link_more_dots"); 543 if ($(more_button).length) 544 appear_x = (appear_position != "fixed") ? $(more_button).position().left - 5 : (appear_x + $(more_button).position().left - 5); 545 546 var share_button = $(buttons_element).find(".essb_link_share"); 547 if ($(share_button).length) 548 appear_x = (appear_position != "fixed") ? $(share_button).position().left - 5 : (appear_x + $(share_button).position().left - 5); 549 550 551 552 $(element_class).css( { left: appear_x+"px", position: appear_position, margin:0, top: appear_y + "px" }); 553 554 $(element_class).fadeIn(200); 555 essb['essb_morepopup_opened'] = true; 556 557 }; 558 559 essb.subscribe_popup_close = function(key) { 560 $('.essb-subscribe-form-' + key).fadeOut(400); 561 $('.essb-subscribe-form-overlay-' + key).fadeOut(400); 562 }; 563 564 essb.sharebutton = function(key) { 565 if ($('.essb-windowcs-'+key).length) { 566 567 /** 568 * @since 8.3 Custom pop-up size 569 */ 570 var win_width = $( window ).width(), win_height = $(window).height(), 571 popup_width = $('.essb-windowcs-'+key).data('width'), popup_height = $('.essb-windowcs-'+key).data('height'), 572 customPosition = false; 573 574 if (Number(popup_width || 0) > 0 || Number(popup_height || 0) > 0) { 575 if (Number(popup_width) > Number(win_width)) popup_width = win_width; 576 if (Number(popup_height) > Number(win_height)) popup_height = win_height; 577 578 if (Number(popup_width) > 0) $('.essb-windowcs-'+key).css({ 'width': popup_width + 'px'}); 579 if (Number(popup_height) > 0) $('.essb-windowcs-'+key).css({ 'height': popup_height + 'px'}); 580 581 $('.essb-windowcs-'+key).center(); 582 customPosition = true; 583 } 584 585 586 $('.essb-windowcs-'+key).fadeIn(200); 587 if (!customPosition) $('.essb-windowcs-'+key+' .inner-content').center(); 588 else { 589 $('.essb-windowcs-'+key+' .inner-content').css( {'position': 'absolute', 'left': '50%', 'top': '50%', 'transform': 'translate(-50%,-50%)', 'width': '90%' });
590 } 591 } 592 }; 593 594 essb.sharebutton_close = function(key) { 595 if ($('.essb-windowcs-'+key).length) { 596 $('.essb-windowcs-'+key).fadeOut(200); 597 } 598 }; 599 600 essb.toggle_subscribe = function(key) { 601 // subsribe container do not exist 602 if (!$('.essb-subscribe-form-' + key).length) return; 603 604 if (!essb['essb_subscribe_opened']) 605 essb['essb_subscribe_opened'] = {}; 606 607 var asPopup = $('.essb-subscribe-form-' + key).attr("data-popup") || ""; 608 609 // it is not popup (in content methods is asPopup == "") 610 if (asPopup != '1') { 611 if ($('.essb-subscribe-form-' + key).hasClass("essb-subscribe-opened")) { 612 $('.essb-subscribe-form-' + key).slideUp('fast'); 613 $('.essb-subscribe-form-' + key).removeClass("essb-subscribe-opened"); 614 } 615 else { 616 $('.essb-subscribe-form-' + key).slideDown('fast'); 617 $('.essb-subscribe-form-' + key).addClass("essb-subscribe-opened"); 618 619 if (!essb['essb_subscribe_opened'][key]) { 620 essb['essb_subscribe_opened'][key] = key; 621 essb.tracking_only('', 'subscribe', key, true); 622 } 623 } 624 } 625 else { 626 var win_width = $( window ).width(); 627 var doc_height = $('document').height(); 628 629 var base_width = 600; 630 631 if (win_width < base_width) { base_width = win_width - 40; } 632 633 634 $('.essb-subscribe-form-' + key).css( { width: base_width+'px'}); 635 $('.essb-subscribe-form-' + key).center(); 636 637 $('.essb-subscribe-form-' + key).fadeIn(400); 638 $('.essb-subscribe-form-overlay-' + key).fadeIn(200); 639 640 } 641 642 }; 643 644 essb.is_after_comment = function() { 645 var addr = window.location.href; 646 647 return addr.indexOf('#comment') > -1 ? true : false; 648 }; 649 650 essb.flyin_close = function () { 651 $(".essb-flyin").fadeOut(200); 652 }; 653 654 essb.popup_close = function() { 655 656 $(".essb-popup").fadeOut(200); 657 $(".essb-popup-shadow").fadeOut(400); 658 }; 659 660 essb.copy_link_direct = function(currentLocation) { 661 662 if (!$('#essb_copy_link_field').length) { 663 var output = []; 664 output.push('<div style="display: none;"><input type="text" id="essb_copy_link_field" style="width: 100%;padding: 5px 10px;font-size: 15px;background: #f5f6f7;border: 1px solid #ccc;font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;" /></div>'); 665 output.push('<div id="essb_copy_link_message" style="background: rgba(0,0,0,0.7); color: #fff; z-index: 1100; position: fixed; padding: 15px 25px; font-size: 13px; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;">'); 666 output.push(essb_settings.translate_copy_message2 ? essb_settings.translate_copy_message2 : 'Copied to clipboard.'); 667 output.push('</div>'); 668 $('body').append(output.join('')); 669 } 670 671 $('#essb_copy_link_field').val(currentLocation); 672 $('#essb_copy_link_field').focus(); 673 $('#essb_copy_link_field').select(); 674 675 setTimeout(function() { 676 var copyText = document.querySelector("#essb_copy_link_field"); 677 try { 678 copyText.value = currentLocation; 679 copyText.focus(); 680 copyText.select(); 681 copyText.setSelectionRange(0, 99999); /*For mobile devices*/ 682 document.execCommand("copy"); 683 navigator.clipboard.writeText(copyText.value); 684 $('#essb_copy_link_message').center(); 685 $('#essb_copy_link_message').fadeIn(300); 686 setTimeout(function() { 687 $('#essb_copy_link_message').fadeOut(); 688 }, 2000); 689 } 690 catch (e) { 691 console.log('Error link copy to clipboard!'); 692 } 693 }, 100); 694 }; 695 696 essb.copy_link = function(instance_id, user_href) { 697 var currentLocation = window.location.href, win_width = $( window ).width(); 698 699 if (instance_id && $('.essb_' + instance_id).length) { 700 var instance_url = $('.essb_' + instance_id).data('essb-url') || ''; 701 if (instance_url != '') currentLocation = instance_url; 702 } 703 704 if (user_href && user_href != '') currentLocation = user_href; 705 706 if (essb_settings && essb_settings.copybutton_direct) { 707 essb.copy_link_direct(currentLocation); 708 return; 709 } 710 711 if (!$('.essb-copylink-window').length) { 712 var output = []; 713 output.push('<div class="essb_morepopup essb-copylink-window" style="z-index: 1301;">'); 714 output.push('<div class="essb_morepopup_header"> <span> </span> <a href="#" class="essb_morepopup_close"><svg style="width: 24px; height: 24px; padding: 5px;" height="32" viewBox="0 0 32 32" width="32" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M32,25.7c0,0.7-0.3,1.3-0.8,1.8l-3.7,3.7c-0.5,0.5-1.1,0.8-1.9,0.8c-0.7,0-1.3-0.3-1.8-0.8L16,23.3l-7.9,7.9C7.6,31.7,7,32,6.3,32c-0.8,0-1.4-0.3-1.9-0.8l-3.7-3.7C0.3,27.1,0,26.4,0,25.7c0-0.8,0.3-1.3,0.8-1.9L8.7,16L0.8,8C0.3,7.6,0,6.9,0,6.3c0-0.8,0.3-1.3,0.8-1.9l3.7-3.6C4.9,0.2,5.6,0,6.3,0C7,0,7.6,0.2,8.1,0.8L16,8.7l7.9-7.9C24.4,0.2,25,0,25.7,0c0.8,0,1.4,0.2,1.9,0.8l3.7,3.6C31.7,4.9,32,5.5,32,6.3c0,0.7-0.3,1.3-0.8,1.8L23.3,16l7.9,7.9C31.7,24.4,32,25,32,25.7z"/></svg></a> </div>'); 715 output.push('<div class="essb_morepopup_content">'); 716 output.push('<div class="essb_copy_internal" style="display: flex; align-items: center;">'); 717 output.push('<div style="width: calc(100% - 50px); padding: 5px;"><input type="text" id="essb_copy_link_field" style="width: 100%;padding: 5px 10px;font-size: 15px;background: #f5f6f7;border: 1px solid #ccc;font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;" /></div>'); 718 output.push('<div style="width:50px;text-align: center;"><a href="#" class="essb-copy-link" title="'+ (essb_settings.translate_copy_message1 ? essb_settings.translate_copy_message1 : 'Press to copy the link')+'" style="color:#5867dd;background:#fff;padding:10px;text-decoration: none;"><svg style="width: 24px; height: 24px; fill: currentColor;" class="essb-svg-icon" aria-hidden="true" role="img" focusable="false" width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M25.313 28v-18.688h-14.625v18.688h14.625zM25.313 6.688c1.438 0 2.688 1.188 2.688 2.625v18.688c0 1.438-1.25 2.688-2.688 2.688h-14.625c-1.438 0-2.688-1.25-2.688-2.688v-18.688c0-1.438 1.25-2.625 2.688-2.625h14.625zM21.313 1.313v2.688h-16v18.688h-2.625v-18.688c0-1.438 1.188-2.688 2.625-2.688h16z"></path></svg></a></div>'); 719 output.push('</div>'); 720 output.push('<div class="essb-copy-message" style="font-size: 13px; font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;"></div>'); 721 output.push('</div>'); 722 output.push('</div>'); 723 724 output.push('<div class="essb_morepopup_shadow essb-copylink-shadow" style="z-index: 1300;"></div>'); 725 $('body').append(output.join(''));
726 727 $('.essb-copylink-window .essb_morepopup_close').on('click', function(e) { 728 e.preventDefault(); 729 730 $('.essb-copylink-window').fadeOut(300); 731 $('.essb-copylink-shadow').fadeOut(200); 732 }); 733 734 $('.essb-copylink-window .essb-copy-link').on('click', function(e) { 735 e.preventDefault(); 736 var copyText = document.querySelector("#essb_copy_link_field"); 737 try { 738 copyText.select(); 739 copyText.setSelectionRange(0, 99999); /*For mobile devices*/ 740 document.execCommand("copy"); 741 navigator.clipboard.writeText(copyText.value); 742 $('.essb-copylink-window .essb_morepopup_header span').html(essb_settings.translate_copy_message2 ? essb_settings.translate_copy_message2 : 'Copied to clipboard.'); 743 setTimeout(function() { 744 $('.essb-copylink-window .essb_morepopup_header span').html(' '); 745 }, 2000); 746 } 747 catch (e) { 748 $('.essb-copylink-window .essb_morepopup_header span').html(essb_settings.translate_copy_message3 ? essb_settings.translate_copy_message3 : 'Please use Ctrl/Cmd+C to copy the URL.'); 749 setTimeout(function() { 750 $('.essb-copylink-window .essb_morepopup_header span').html(' '); 751 }, 2000); 752 } 753 }); 754 } 755 756 $('.essb-copy-message').html(''); 757 $('.essb-copylink-window').css({'width': (win_width > 600 ? 600 : win_width - 50) + 'px'}); 758 $('.essb-copylink-window').center(); 759 $('.essb-copylink-window').fadeIn(300); 760 $('.essb-copylink-shadow').fadeIn(200); 761 762 $('#essb_copy_link_field').val(currentLocation); 763 $('#essb_copy_link_field').focus(); 764 $('#essb_copy_link_field').select(); 765 }; 766 767 /** 768 * Mobile Display Code 769 */ 770 771 essb.mobile_sharebar_open = function() { 772 var element = $('.essb-mobile-sharebar-window'); 773 if (!element.length) return; 774 775 var sharebar_element = $('.essb-mobile-sharebar'); 776 if (!sharebar_element.length) 777 sharebar_element = $('.essb-mobile-sharepoint'); 778 779 if (!sharebar_element.length) 780 return; 781 782 783 if (essb['is_displayed_sharebar']) { 784 essb.mobile_sharebar_close(); 785 return; 786 } 787 788 var current_height_of_bar = $(sharebar_element).outerHeight(); 789 var win_height = $(window).height(); 790 var win_width = $(window).width(); 791 win_height -= current_height_of_bar; 792 793 if ($('#wpadminbar').length) 794 $("#wpadminbar").hide(); 795 796 797 var element_inner = $('.essb-mobile-sharebar-window-content'); 798 if (element_inner.length) { 799 element_inner.css({ 800 height : (win_height - 60) + 'px' 801 }); 802 } 803 804 $(element).css({ 805 width : win_width + 'px', 806 height : win_height + 'px' 807 }); 808 $(element).fadeIn(400); 809 essb['is_displayed_sharebar'] = true; 810 }; 811 812 essb.mobile_sharebar_close = function() { 813 var element = $('.essb-mobile-sharebar-window'); 814 if (!element.length) 815 return; 816 817 818 $(element).fadeOut(400); 819 essb['is_displayed_sharebar'] = false; 820 }; 821 822 essb.responsiveEventsCanRun = function(element) { 823 var hideOnMobile = $(element).hasClass('essb_mobile_hidden'), 824 hideOnDesktop = $(element).hasClass('essb_desktop_hidden'), 825 hideOnTablet = $(element).hasClass('essb_tablet_hidden'), 826 windowWidth = $(window).width(), 827 canRun = true; 828 829 if (windowWidth <= 768 && hideOnMobile) canRun = false; 830 if (windowWidth > 768 && windowWidth <= 1100 && hideOnTablet) canRun = false; 831 if (windowWidth > 1100 && hideOnDesktop) canRun = false; 832 833 if (!$(element).length) canRun = false; 834 835 return canRun; 836 }; 837 838 essb.handleInternalStats = function(service, postID, instance) { 839 let element = document.querySelector('.essb_' + instance); 840 if (element) { 841 let instance_postion = element.getAttribute('data-essb-position') || '', 842 instance_template = element.getAttribute('data-essb-template') || '', 843 instance_button = element.getAttribute('data-essb-button-style') || '', 844 instance_counters = element.classList.contains('essb_counters'), 845 instance_nostats = element.classList.contains('essb_nostats'); 846 847 if (instance_nostats) return; 848 849 essb.logInternalStats(service, postID, instance_postion, instance_template, instance_button, instance_counters); 850 } 851 } 852 853 essb.handleLogInternalStats = function(service, postId, position) { 854 essb.logInternalStats(service, postId, position, position, position, false); 855 } 856 857 essb.logInternalStats = function(service, postId, position, template, senderButton, usingCounters) { 858 let instanceIsMobile = false; 859 860 if( (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i).test(navigator.userAgent) ) 861 instanceIsMobile = true; 862 863 if (typeof(essb_settings) != "undefined") { 864 fetch(essb_settings.ajax_url, { 865 method: 'POST', 866 headers: { 867 'Content-Type': 'application/x-www-form-urlencoded', 868 'Accept': '*/*' 869 }, 870 body: new URLSearchParams({ 871 'action': 'essb_stat_log', 872 'post_id': postId, 873 'service': service, 874 'template': template, 875 'mobile': instanceIsMobile, 876 'position': position, 877 'button': senderButton, 878 'counter': usingCounters, 879 'nonce': essb_settings.essb3_nonce 880 }) 881 }).then(response => response.text()) 882 .then(data => console.log(data)); 883 } 884 else { 885 console.log('[error] essb.logInternalStats: Missing configuration data') 886 } 887 }; 888 889 window.essb = essb; 890 891 /** 892 * Incore Specific Functions & Events 893 */ 894 895 var essb_int_value = function(value) { 896 value = parseInt(value); 897 898 if (isNaN(value) || !isFinite(value)) value = 0; 899 return value; 900 } 901 902 var essb_self_postcount = function (service, countID) { 903 if (typeof(essb_settings) != "undefined") { 904 countID = String(countID); 905 906 $.post(essb_settings.ajax_url, { 907 'action': 'essb_self_postcount', 908 'post_id': countID, 909 'service': service, 910 'nonce': essb_settings.essb3_nonce 911 }, function (data) { },'json'); 912 } 913 }; 914 915 var essb_smart_onclose_events = function (service, postID) { 916 // 7.0 - trigger only on selected networks (when such are present) 917 if (essb_settings && essb_settings['aftershare_networks']) { 918 var workingNetworks = essb_settings['aftershare_networks'] != '' ? essb_settings['aftershare_networks'].split(',') : []; 919 if (workingNetworks.indexOf(service) == -1) return; 920 } 921 else { 922 // 6.0.3 - adding email & mail as also ignoring options 923 if (service == "subscribe" || service == "comments" || service == 'email' || service == 'mail') return; 924 } 925 926 if (service == "subscribe" || service == "comments" || service == 'email' || service == 'mail') return; 927 928 if (typeof (essbasc_popup_show) == 'function') 929 essbasc_popup_show(); 930 931 if (typeof essb_acs_code == 'function') 932 essb_acs_code(service, postID); 933 934 if ($('.essb-aftershare-subscribe-form').length) { 935 var key = $('.essb-aftershare-subscribe-form').data('salt') || ''; 936 if (key != '') essb.toggle_subscribe(key); 937 } 938 }; 939 940 941 var essb_ga_tracking = function(service, url, position) { 942 var essb_ga_type = essb_settings.essb3_ga_mode; 943 944 if ( 'ga' in window && window.ga !== undefined && typeof window.ga === 'function' ) { 945 if (essb_ga_type == "extended") 946 ga('send', 'event', 'social', service + ' ' + position, url); 947 948 else 949 ga('send', 'event', 'social', service, url); 950 951 } 952 953 if (essb_ga_type == "layers" && typeof(dataLayer) != "undefined") { 954 dataLayer.push({ 955 'service': service, 956 'position': position, 957 'url': url, 958 'event': 'social' 959 }); 960 } 961 }; 962 963 var essb_open_mailform = window.essb_open_mailform = function(unique_id) { 964 if (essb['essb_mailform_opened']) { 965 essb_close_mailform(unique_id); 966 return; 967 } 968 969 var sender_element = $(".essb_"+unique_id); 970 if (!sender_element.length) return; 971
972 var sender_post_id = $(sender_element).attr("data-essb-postid") || ""; 973 974 $("#essb_mail_instance").val(unique_id); 975 $("#essb_mail_post").val(sender_post_id); 976 977 var win_width = $( window ).width(), 978 win_height = $(window).height(), 979 base_width = 400; 980 981 if (win_width < base_width) base_width = win_width - 30; 982 983 var height_correction = 20, 984 element_class = ".essb_mailform", 985 element_class_shadow = ".essb_mailform_shadow"; 986 987 $(element_class).css( { width: base_width+'px'}); 988 989 var popup_height = $(element_class).outerHeight(); 990 if (popup_height > (win_height - 30)) { 991 $(element_class).css( { height: (win_height - height_correction)+'px'}); 992 } 993 994 $("#essb_mailform_from").val(""); 995 $("#essb_mailform_to").val(""); 996 $('#essb_mailform_from_name').val(''); 997 if ($("#essb_mailform_c").length) 998 $("#essb_mailform_c").val(""); 999 1000 // Maybe load reCAPTCHA. 1001 if ( typeof(essb_recaptcha) != 'undefined' && essb_recaptcha && essb_recaptcha.recaptchaSitekey ) { 1002 grecaptcha.render( 'essb-modal-recaptcha', { 1003 sitekey: essb_recaptcha.recaptchaSitekey 1004 } ); 1005 } 1006 1007 $(element_class).center(); 1008 $(element_class).slideDown(200); 1009 $(element_class_shadow).fadeIn(200); 1010 $('#essb_mailform_status_message').html(''); 1011 essb['essb_mailform_opened'] = true; 1012 essb.tracking_only("", "mail", unique_id); 1013 }; 1014 1015 var essb_close_mailform = window.essb_close_mailform = function() { 1016 $(".essb_mailform").fadeOut(200); 1017 $(".essb_mailform_shadow").fadeOut(200); 1018 $('#essb_mailform_status_message').html(''); 1019 essb['essb_mailform_opened'] = false; 1020 }; 1021 1022 var essb_mailform_send = window.essb_mailform_send = function() { 1023 var highlight = function(id) { 1024 $(id).css('background-color', '#ffd8d8'); 1025 setTimeout(function() { 1026 $(id).css('background-color', '#fff'); 1027 }, 5000); 1028 }; 1029 1030 $('#essb_mailform_status_message').html(''); 1031 $('.essb_mailform_content_buttons').css('visibility', 'visible'); 1032 1033 var sender_email = $("#essb_mailform_from").val(), 1034 sender_name = $('#essb_mailform_from_name').val(), 1035 recepient_email = $("#essb_mailform_to").val(), 1036 captcha_validate = $("#essb_mailform_c").length ? true : false, 1037 errorMessage = $('.essb_mailform').attr('data-error') || '', 1038 sendingMessage = $('.essb_mailform').attr('data-sending') || '', 1039 captcha = captcha_validate ? $("#essb_mailform_c").val() : "", 1040 recaptcha = $( '#g-recaptcha-response' ).val(), 1041 sender_aff_id = $('#essb_mail_affiliate_id').length ? $('#essb_mail_affiliate_id').val() : '', 1042 custom_message = ''; 1043 1044 if (sender_name == '' || sender_email == "" || recepient_email == "" || (captcha == "" && captcha_validate)) { 1045 1046 if (sender_name == '') highlight("#essb_mailform_from_name"); 1047 if (sender_email == '') highlight("#essb_mailform_from"); 1048 if (recepient_email == '') highlight("#essb_mailform_to"); 1049 $('#essb_mailform_status_message').html('<span style="color: #d80001;">' + errorMessage + '</span>'); 1050 return; 1051 } 1052 1053 var mail_salt = $("#essb_mail_salt").val(), 1054 instance_post_id = $("#essb_mail_post").val(); 1055 1056 if (typeof(essb_settings) != "undefined") { 1057 // hiding buttons before sending of the message 1058 $('.essb_mailform_content_buttons').css('visibility', 'hidden'); 1059 $('#essb_mailform_status_message').html(sendingMessage + ' ' + recepient_email); 1060 1061 $.post(essb_settings.ajax_url, { 1062 "action": "essb_mail_action", 1063 "post_id": instance_post_id, 1064 "from": sender_email, 1065 "from_name": sender_name, 1066 "to": recepient_email, 1067 "c": captcha, 1068 "cu": custom_message, 1069 "salt": mail_salt, 1070 'affid': sender_aff_id, 1071 'recapcha': recaptcha, 1072 "nonce": essb_settings.essb3_nonce 1073 }, function (data) { if (data) { 1074 $('.essb_mailform_content_buttons').css('visibility', 'visible'); 1075 if (data['message']) $('#essb_mailform_status_message').html('<span style="color: #d80001;">' + data['message'] + '</span>'); 1076 if (data["code"] == "1") { 1077 essb_close_mailform(); 1078 alert(data['message']); 1079 } 1080 if (data['code']) { 1081 if (data['code'] == '101' && $("#essb_mailform_c").length) highlight("#essb_mailform_c"); 1082 if (data['code'] == '102' && $("#essb_mailform_to").length) highlight("#essb_mailform_to"); 1083 if (data['code'] == '104' && $("#essb_mailform_from").length) highlight("#essb_mailform_from"); 1084 } 1085 }}, 'json'); 1086 } 1087 }; 1088 1089 /** 1090 * After Share Events functions 1091 */ 1092 var essbasc_popup_show = window.essbasc_popup_show = function() { 1093 if (!$('.essbasc-popup').length) return; 1094 if (essb.getCookie('essb_aftershare')) return; // cookie already set for visible events 1095 1096 var cookie_len = (typeof(essbasc_cookie_live) != "undefined") ? essbasc_cookie_live : 7; 1097 if (parseInt(cookie_len) == 0) { cookie_len = 7; } 1098 1099 var win_width = $( window ).width(), base_width = 800, 1100 userwidth = $('.essbasc-popup').attr("data-popup-width") || '', 1101 singleShow = $('.essbasc-popup').attr("data-single") || ''; 1102 1103 if (Number(userwidth) && Number(userwidth) > 0) base_width = userwidth; 1104 if (win_width < base_width) base_width = win_width - 60; 1105 1106 $(".essbasc-popup").css( { width: base_width+'px'}); 1107 $(".essbasc-popup").center(); 1108 $(".essbasc-popup").fadeIn(300); 1109 $(".essbasc-popup-shadow").fadeIn(100); 1110 1111 if (singleShow == 'true') essb.setCookie('essb_aftershare', "yes", cookie_len); 1112 }; 1113 1114 var essbasc_popup_close = window.essbasc_popup_close = function () { 1115 $(".essbasc-popup").fadeOut(200); 1116 $(".essbasc-popup-shadow").fadeOut(100); 1117 }; 1118 1119 $(document).ready(function(){ 1120 1121 /** 1122 * Mobile Share Bar 1123 */ 1124 1125 var mobileHideOnScroll = false; 1126 var mobileHideTriggerPercent = 90;
1127 var mobileAppearOnScroll = false; 1128 var mobileAppearOnScrollPercent = 0; 1129 var mobileAdBarConnected = false; 1130 1131 var essb_mobile_sharebuttons_onscroll = function() { 1132 1133 var current_pos = $(window).scrollTop(); 1134 var height = $(document).height() - $(window).height(); 1135 var percentage = current_pos / height * 100; 1136 1137 var isVisible = true; 1138 if (mobileAppearOnScroll && !mobileHideOnScroll) { 1139 if (percentage < mobileAppearOnScrollPercent) isVisible = false; 1140 } 1141 if (mobileHideOnScroll && !mobileAppearOnScroll) { 1142 if (percentage > mobileHideTriggerPercent) isVisible = false; 1143 } 1144 if (mobileAppearOnScroll && mobileHideOnScroll) { 1145 if (percentage > mobileHideTriggerPercent || percentage < mobileAppearOnScrollPercent) isVisible = false; 1146 1147 } 1148 1149 if (!isVisible) { 1150 if (!$('.essb-mobile-sharebottom').hasClass("essb-mobile-break")) { 1151 $('.essb-mobile-sharebottom').addClass("essb-mobile-break"); 1152 $('.essb-mobile-sharebottom').fadeOut(400); 1153 } 1154 1155 if ($('.essb-adholder-bottom').length && mobileAdBarConnected) { 1156 if (!$('.essb-adholder-bottom').hasClass("essb-mobile-break")) { 1157 $('.essb-adholder-bottom').addClass("essb-mobile-break"); 1158 $('.essb-adholder-bottom').fadeOut(400); 1159 } 1160 } 1161 1162 } else { 1163 if ($('.essb-mobile-sharebottom').hasClass("essb-mobile-break")) { 1164 $('.essb-mobile-sharebottom').removeClass("essb-mobile-break"); 1165 $('.essb-mobile-sharebottom').fadeIn(400); 1166 } 1167 1168 if ($('.essb-adholder-bottom').length && mobileAdBarConnected) { 1169 if ($('.essb-adholder-bottom').hasClass("essb-mobile-break")) { 1170 $('.essb-adholder-bottom').removeClass("essb-mobile-break"); 1171 $('.essb-adholder-bottom').fadeIn(400); 1172 } 1173 } 1174 } 1175 }; 1176 1177 if ($('.essb-mobile-sharebottom').length) { 1178 1179 var hide_on_end = $('.essb-mobile-sharebottom').attr('data-hideend'); 1180 var hide_on_end_user = $('.essb-mobile-sharebottom').attr('data-hideend-percent'); 1181 var appear_on_scroll = $('.essb-mobile-sharebottom').attr('data-show-percent') || ''; 1182 var check_responsive = $('.essb-mobile-sharebottom').attr('data-responsive') || ''; 1183 1184 if (Number(appear_on_scroll)) { 1185 mobileAppearOnScroll = true; 1186 mobileAppearOnScrollPercent = Number(appear_on_scroll); 1187 } 1188 1189 if (hide_on_end == 'true') mobileHideOnScroll = true; 1190 1191 var instance_mobile = false; 1192 if( (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i).test(navigator.userAgent) ) { 1193 instance_mobile = true; 1194 } 1195 1196 if ($('.essb-adholder-bottom').length) { 1197 $adbar_connected = $('.essb-adholder-bottom').attr('data-connected') || ''; 1198 if ($adbar_connected == 'true') mobileAdBarConnected = true; 1199 } 1200 1201 if (mobileHideOnScroll || mobileAppearOnScroll) { 1202 if (parseInt(hide_on_end_user) > 0) 1203 mobileHideTriggerPercent = parseInt(hide_on_end_user); 1204 1205 if (check_responsive == '' || (check_responsive == 'true' && instance_mobile)) 1206 $(window).on('scroll', debounce(essb_mobile_sharebuttons_onscroll, 1)); 1207 1208 } 1209 } 1210 1211 1212 /** 1213 * Display Methods: Float on top 1214 */ 1215 if ($('.essb_displayed_float').length) { 1216 1217 var floatingTop = $('.essb_displayed_float').offset().top - parseFloat($('.essb_displayed_float').css('marginTop').replace(/auto/, 0)), 1218 basicElementWidth = '', 1219 hide_float_percent = $('.essb_displayed_float').data('float-hide') || '', 1220 custom_top_postion = $('.essb_displayed_float').data('float-top') || '', 1221 hide_float_active = false; 1222 1223 if (hide_float_percent != '' && Number(hide_float_percent) > 0) { 1224 hide_float_percent = parseInt(hide_float_percent); 1225 hide_float_active = true; 1226 } 1227 1228 var active_custom_top = false; 1229 if (custom_top_postion != '' && Number(custom_top_postion) > 0) { 1230 custom_top_postion = parseInt(custom_top_postion); 1231 active_custom_top = true; 1232 } 1233 1234 /** 1235 * Hold down scroll event for floating top display method when such is present 1236 * inside code 1237 */ 1238 function essbFloatingButtons() { 1239 var y = $(window).scrollTop(); 1240 1241 if (active_custom_top) 1242 y -= custom_top_postion; 1243 1244 var height = $(document).height() - $(window).height();
1245 var percentage = y/height*100; 1246 // whether that's below the form 1247 if (y >= floatingTop) { 1248 // if so, ad the fixed class 1249 if (basicElementWidth == '') { 1250 var widthOfContainer = $('.essb_displayed_float').width(); 1251 basicElementWidth = widthOfContainer; 1252 $('.essb_displayed_float').width(widthOfContainer); 1253 } 1254 1255 $('.essb_displayed_float').addClass('essb_fixed'); 1256 1257 } else { 1258 // otherwise remove it 1259 $('.essb_displayed_float').removeClass('essb_fixed'); 1260 if (basicElementWidth != '') { 1261 $('.essb_displayed_float').width(basicElementWidth); 1262 } 1263 } 1264 1265 if (hide_float_active) { 1266 if (percentage >= hide_float_percent && !$('.essb_displayed_float').hasClass('hidden-float')) { 1267 $('.essb_displayed_float').addClass('hidden-float'); 1268 $('.essb_displayed_float').fadeOut(100); 1269 return; 1270 } 1271 if (percentage < hide_float_percent && $('.essb_displayed_float').hasClass('hidden-float')) { 1272 $('.essb_displayed_float').removeClass('hidden-float'); 1273 $('.essb_displayed_float').fadeIn(100); 1274 return; 1275 } 1276 } 1277 } // end: essbFloatingButtons 1278 1279 if (essb.responsiveEventsCanRun($('.essb_displayed_float'))) 1280 $(window).on('scroll', debounce(essbFloatingButtons, 1)); 1281 } 1282 1283 /** 1284 * Display Methods: Sidebar 1285 */ 1286 1287 // Sidebar animation reveal on load 1288 if ($('.essb_sidebar_transition').length) { 1289 $('.essb_sidebar_transition').each(function() { 1290 1291 if (!essb.responsiveEventsCanRun($(this))) return; 1292 1293 if ($(this).hasClass('essb_sidebar_transition_slide')) 1294 $(this).toggleClass('essb_sidebar_transition_slide'); 1295 1296 if ($(this).hasClass('essb_sidebar_transition_fade')) 1297 $(this).toggleClass('essb_sidebar_transition_fade'); 1298 1299 1300 }); 1301 } 1302 1303 /** 1304 * Reposition sidebar at the middle of page 1305 */ 1306 if ($('.essb_sidebar_location_middle').length) { 1307 var essbSidebarRepositionMiddle = function() { 1308 var heightOfSidebar = $('.essb_sidebar_location_middle').outerHeight(), 1309 winHeight = $(window).height(), top = 0; 1310 1311 1312 if (heightOfSidebar > winHeight) top = 0; 1313 else { 1314 top = Math.round((winHeight - heightOfSidebar) / 2); 1315 } 1316 $('.essb_sidebar_location_middle').css({'top': top + 'px', 'opacity': '1'}); 1317 }; 1318 1319 essbSidebarRepositionMiddle(); 1320 $(window).on('resize', debounce(essbSidebarRepositionMiddle, 1)); 1321 } 1322 1323 // Sidebar close button 1324 $(".essb_link_sidebar-close a").each(function() { 1325 $(this).on('click', function(event) { 1326 event.preventDefault(); 1327 var links_list = $(this).parent().parent().get(0); 1328 1329 if (!$(links_list).length) return; 1330 1331 $(links_list).find(".essb_item").each(function(){ 1332 if (!$(this).hasClass("essb_link_sidebar-close")) 1333 $(this).toggleClass("essb-sidebar-closed-item"); 1334 else 1335 $(this).toggleClass("essb-sidebar-closed-clicked"); 1336 }); 1337 1338 }); 1339 }); 1340 1341 var essb_sidebar_onscroll = function () { 1342 var current_pos = $(window).scrollTop(); 1343 var height = $(document).height()-$(window).height(); 1344 var percentage = current_pos/height*100; 1345 1346 1347 var element; 1348 if ($(".essb_displayed_sidebar").length) 1349 element = $(".essb_displayed_sidebar"); 1350 1351 if ($(".essb_displayed_sidebar_right").length) 1352 element = $(".essb_displayed_sidebar_right"); 1353 1354 1355 if (!element || typeof(element) == "undefined") return; 1356 1357 var value_disappear = essb_int_value($(element).data('sidebar-disappear-pos') || ''); 1358 var value_appear = essb_int_value($(element).data('sidebar-appear-pos') || ''); 1359 var value_appear_unit = $(element).data('sidebar-appear-unit') || ''; 1360 var value_contenthidden = $(element).data('sidebar-contenthidden') || ''; 1361 if (value_appear_unit == 'px') percentage = current_pos; 1362 1363 var visibleByDisplayCond = true; 1364 1365 if (value_appear > 0 || value_disappear > 0) { 1366 visibleByDisplayCond = false; 1367 if (value_appear && percentage >= value_appear) visibleByDisplayCond = true; 1368 if (value_disappear && percentage <= value_disappear) visibleByDisplayCond = true; 1369 } 1370 1371 // Hiding share buttons when content is visible 1372 if (value_contenthidden == 'yes' && ($('.essb_displayed_top').length || $('.essb_displayed_bottom').length)) { 1373 1374 if (($('.essb_displayed_top').length && isVisibleSelector($('.essb_displayed_top'))) || 1375 ($('.essb_displayed_bottom').length && isVisibleSelector($('.essb_displayed_bottom')))) 1376 element.fadeOut(100); 1377 else { 1378 if (visibleByDisplayCond) element.fadeIn(100); 1379 } 1380 } 1381 1382 if (value_appear > 0 && value_disappear == 0) { 1383 if (percentage >= value_appear && !element.hasClass("active-sidebar")) { 1384 element.fadeIn(100); 1385 element.addClass("active-sidebar"); 1386 return; 1387 } 1388 1389 if (percentage < value_appear && element.hasClass("active-sidebar")) { 1390 element.fadeOut(100); 1391 element.removeClass("active-sidebar"); 1392 return; 1393 } 1394 } 1395 1396 if (value_disappear > 0 && value_appear == 0) { 1397 if (percentage >= value_disappear && !element.hasClass("hidden-sidebar")) { 1398 element.fadeOut(100); 1399 element.addClass("hidden-sidebar"); 1400 return; 1401 } 1402 1403 if (percentage < value_disappear && element.hasClass("hidden-sidebar")) { 1404 element.fadeIn(100); 1405 element.removeClass("hidden-sidebar"); 1406 return; 1407 } 1408 } 1409 1410 if (value_appear > 0 && value_disappear > 0) { 1411 if (percentage >= value_appear && percentage < value_disappear && !element.hasClass("active-sidebar")) { 1412 element.fadeIn(100); 1413 element.addClass("active-sidebar"); 1414 return; 1415 } 1416 1417 if ((percentage < value_appear || percentage >= value_disappear) && element.hasClass("active-sidebar")) { 1418 element.fadeOut(100); 1419 element.removeClass("active-sidebar"); 1420 return; 1421 } 1422 } 1423 }; 1424 1425 if (essb.responsiveEventsCanRun($('.essb_displayed_sidebar'))) { 1426 var essbSidebarContentHidden = $('.essb_displayed_sidebar').data('sidebar-contenthidden') || '', 1427 essbSidebarAppearPos = $('.essb_displayed_sidebar').data('sidebar-appear-pos') || '', 1428 essbSidebarDisappearPos = $('.essb_displayed_sidebar').data('sidebar-disappear-pos') || ''; 1429 if (essbSidebarAppearPos != '' || essbSidebarDisappearPos != '' || essbSidebarContentHidden == 'yes') { 1430 if ($( window ).width() > 800) { 1431 $(window).on('scroll', debounce(essb_sidebar_onscroll, 1)); 1432 essb_sidebar_onscroll(); 1433 } 1434 } 1435 } 1436 1437 /** 1438 * Display Method: Post Vertical Float 1439 */ 1440 1441 if ($('.essb_displayed_postfloat').length) { 1442 var top = $('.essb_displayed_postfloat').offset().top - parseFloat($('.essb_displayed_postfloat').css('marginTop').replace(/auto/, 0));
1443 var postfloat_always_onscreen = ($('.essb_displayed_postfloat').data('postfloat-stay') || '').toString() == 'true' ? true : false; 1444 var postfloat_fix_bottom = ($('.essb_displayed_postfloat').data('postfloat-fixbottom') || '').toString() == 'true' ? true : false; 1445 var custom_user_top = $('.essb_displayed_postfloat').data('postfloat-top') || ''; 1446 var postFloatVisibleSelectors = $('.essb_displayed_postfloat').data('postfloat-selectors') || '', 1447 postFloatViewportCheck = [], 1448 postFloatPercentAppear = $('.essb_displayed_postfloat').data('postfloat-percent') || ''; 1449 1450 if (!Number(postFloatPercentAppear) || Number(postFloatPercentAppear) == 0) { 1451 postFloatPercentAppear = ''; 1452 $('.essb_displayed_postfloat').attr('data-postfloat-percent', ''); 1453 } 1454 1455 if (postFloatVisibleSelectors != '') { 1456 postFloatViewportCheck = postFloatVisibleSelectors.split(','); 1457 for (var i=0;i<postFloatViewportCheck.length;i++) { 1458 if ($(postFloatViewportCheck[i]).length) $(postFloatViewportCheck[i]).addClass('essb-postfloat-monitor'); 1459 } 1460 } 1461 1462 setTimeout(function() { 1463 $('.essb_displayed_postfloat').css({'transition' : 'all 0.3s linear'}); 1464 if (postFloatPercentAppear == '') $('.essb_displayed_postfloat').css({'opacity' : '1'}); 1465 }, 100); 1466 1467 if (custom_user_top != '' && Number(custom_user_top) && !isNaN(custom_user_top)) top -= parseInt(custom_user_top); 1468 1469 function essbPostVerticalFloatScroll() { 1470 var y = $(this).scrollTop(), 1471 break_top = 0, 1472 postFloatPercentAppear = $('.essb_displayed_postfloat').data('postfloat-percent') || '', 1473 postFloatAppearMeasure = $('.essb_displayed_postfloat').data('postfloat-percent-m') || ''; 1474 1475 if ($('.essb_break_scroll').length) { 1476 var break_position = $('.essb_break_scroll').position(); 1477 break_top = break_position.top; 1478 var hasCustomBreak = $('.essb_displayed_postfloat').data('postfloat-bottom') || ''; 1479 1480 if (hasCustomBreak && hasCustomBreak != '' && Number(hasCustomBreak) != 0) break_top = Number(break_top) - Number(hasCustomBreak); 1481 } 1482 1483 if (postFloatPercentAppear != '') { 1484 var height = $(document).height()-$(window).height(), 1485 percentage = y/height*100, 1486 shouldBeVisible = postFloatAppearMeasure == 'px' ? y >= Number(postFloatPercentAppear) : percentage >= Number(postFloatPercentAppear); 1487 1488 if (shouldBeVisible) { 1489 $('.essb_displayed_postfloat').css({'opacity' : '1'}); 1490 $('.essb_displayed_postfloat').css({'transform' : 'translateY(0)'}); 1491 } 1492 else { 1493 $('.essb_displayed_postfloat').css({'opacity' : '0'}); 1494 $('.essb_displayed_postfloat').css({'transform' : 'translateY(50px)'}); 1495 } 1496 } 1497 1498 if (y >= top) { 1499 $('.essb_displayed_postfloat').addClass('essb_postfloat_fixed'); 1500 1501 var element_position = $('.essb_displayed_postfloat').offset(); 1502 var element_height = $('.essb_displayed_postfloat').outerHeight(); 1503 var element_top = parseInt(element_position.top) + parseInt(element_height); 1504 1505 if (!postfloat_always_onscreen) { 1506 if (element_top > break_top) { 1507 if (!$('.essb_displayed_postfloat').hasClass("essb_postfloat_breakscroll")) { 1508 $('.essb_displayed_postfloat').addClass("essb_postfloat_breakscroll"); 1509 } 1510 } 1511 else { 1512 if ($('.essb_displayed_postfloat').hasClass("essb_postfloat_breakscroll")) { 1513 $('.essb_displayed_postfloat').removeClass("essb_postfloat_breakscroll"); 1514 } 1515 } 1516 } 1517 else { 1518 var isOneVisible = false; 1519 $('.essb-postfloat-monitor').each(function() { 1520 if (isVisibleSelector($(this))) 1521 isOneVisible = true; 1522 }); 1523 1524 if (!isOneVisible) { 1525 if ($('.essb_displayed_postfloat').hasClass("essb_postfloat_breakscroll")) { 1526 $('.essb_displayed_postfloat').removeClass("essb_postfloat_breakscroll"); 1527 } 1528 1529 /** 1530 * Fix the postfloat at the bottom of content 1531 */ 1532 if (postfloat_fix_bottom) { 1533 if (element_top > break_top) { 1534 if (!$('.essb_displayed_postfloat').hasClass('essb_postfloat_absolute')) { 1535 $('.essb_displayed_postfloat').removeClass('essb_postfloat_fixed'); 1536 $('.essb_displayed_postfloat').attr('data-unfixed', element_top); 1537 $('.essb_displayed_postfloat').addClass('essb_postfloat_absolute'); 1538 $('.essb_displayed_postfloat').css({ 'position': 'absolute', 'top': ($('.essb_break_scroll').position().top - element_height - 100) + 'px'}); 1539 } 1540 } 1541 else { 1542 if ($('.essb_displayed_postfloat').hasClass('essb_postfloat_absolute')) { 1543 $('.essb_displayed_postfloat').removeClass('essb_postfloat_absolute'); 1544 $('.essb_displayed_postfloat').removeAttr('data-unfixed'); 1545 $('.essb_displayed_postfloat').css({ 'position': '', 'top': '' }); 1546 $('.essb_displayed_postfloat').addClass('essb_postfloat_fixed'); 1547 } 1548 } 1549 } 1550 } 1551 else { 1552 if (!$('.essb_displayed_postfloat').hasClass("essb_postfloat_breakscroll")) { 1553 $('.essb_displayed_postfloat').addClass("essb_postfloat_breakscroll"); 1554 } 1555 } 1556 } 1557 } 1558 else 1559 // otherwise remove it 1560 $('.essb_displayed_postfloat').removeClass('essb_postfloat_fixed'); 1561 1562 } 1563 1564 if (essb.responsiveEventsCanRun($('.essb_displayed_postfloat'))) 1565 $(window).on('scroll', debounce(essbPostVerticalFloatScroll, 1)); 1566 } 1567 1568 1569 1570 1571 /** 1572 * Display Method: Post Vertical Float 1573 */ 1574 function essb_postfloat_onscroll() { 1575 var current_pos = $(window).scrollTop(); 1576 var height = $(document).height()-$(window).height(); 1577 var percentage = current_pos/height*100; 1578 1579 var element; 1580 if ($(".essb_displayed_postfloat").length) 1581 element = $(".essb_displayed_postfloat"); 1582 1583 if (!element || typeof(element) == "undefined") { return; } 1584 var value_appear = essb_int_value($(element).data('postfloat-percent') || ''); 1585 1586 if (value_appear > 0 ) { 1587 if (percentage >= value_appear && !element.hasClass("essb_active_postfloat")) { 1588 element.addClass("essb_active_postfloat"); 1589 return; 1590 } 1591 1592 if (percentage < value_appear && element.hasClass("essb_active_postfloat")) { 1593 element.removeClass("essb_active_postfloat"); 1594 return; 1595 } 1596 } 1597 } 1598 1599 if (essb.responsiveEventsCanRun($('.essb_displayed_postfloat'))) { 1600 if ((essb_settings.postfloat_percent || '') != '' && $(".essb_displayed_postfloat").length) 1601 $(window).on('scroll', debounce(essb_postfloat_onscroll, 1)); 1602 } 1603 1604 /** 1605 * Animated Counters Code 1606 */ 1607 $(".essb_counters .essb_animated").each(function() { 1608 var current_counter = $(this).attr("data-cnt") || ""; 1609 var current_counter_result = $(this).attr("data-cnt-short") || ""; 1610 1611 if ($(this).hasClass("essb_counter_hidden")) return; 1612 1613 $(this).countTo({ 1614 from: 1, 1615 to: current_counter, 1616 speed: 500, 1617 onComplete: function (value) { 1618 $(this).html(current_counter_result); 1619 } 1620 }); 1621 }); 1622 1623 /** 1624 * Display Method: Follow Me 1625 */ 1626 1627 if ($('.essb-followme').length) { 1628 if ($('.essb-followme .essb_links').length) $('.essb-followme .essb_links').removeClass('essb_displayed_followme'); 1629 1630 var dataPosition = $('.essb-followme').attr('data-position') || '', 1631 dataCustomTop = $('.essb-followme').attr('data-top') || '',
1632 dataBackground = $('.essb-followme').attr('data-background') || '', 1633 dataFull = $('.essb-followme').attr('data-full') || '', 1634 dataAvoidLeftMargin = $('.essb-followme').attr('data-avoid-left') || '', 1635 dataFollowmeHide = $('.essb-followme').attr('data-hide') || ''; 1636 1637 1638 if (dataPosition == 'top' && dataCustomTop != '') 1639 $('.essb-followme').css({'top': dataCustomTop+'px'}); 1640 if (dataBackground != '') 1641 $('.essb-followme').css({ 'background-color': dataBackground}); 1642 1643 if (dataFull != '1' && dataPosition != 'left') { 1644 var basicWidth = $('.essb_displayed_followme').width(); 1645 var leftPosition = $('.essb_displayed_followme').position().left; 1646 1647 if (dataAvoidLeftMargin != 'true') 1648 $('.essb-followme .essb_links').attr('style', 'width:'+ basicWidth+'px; margin-left:'+leftPosition+'px !important;'); 1649 else 1650 $('.essb-followme .essb_links').attr('style', 'width:'+ basicWidth+'px;'); 1651 } 1652 1653 function essb_followme_scroll() { 1654 var isOneVisible = false, 1655 dataFollowmeShowAfter = $('.essb-followme').attr('data-showafter') || ''; 1656 1657 if (dataFollowmeShowAfter != '' && !Number(dataFollowmeShowAfter)) dataFollowmeShowAfter = ''; 1658 1659 $('.essb_displayed_followme').each(function() { 1660 if (isElementInViewport($(this))) 1661 isOneVisible = true; 1662 }); 1663 1664 var current_pos = $(window).scrollTop(); 1665 var height = $(document).height() - $(window).height(); 1666 var percentage = current_pos / height * 100; 1667 1668 if (Number(dataFollowmeShowAfter) > 0 && Number(dataFollowmeShowAfter) > current_pos) isOneVisible = true; 1669 1670 if (!isOneVisible) { 1671 if (!$('.essb-followme').hasClass('active')) $('.essb-followme').addClass('active'); 1672 } 1673 else { 1674 if ($('.essb-followme').hasClass('active')) $('.essb-followme').removeClass('active'); 1675 } 1676 1677 if (dataFollowmeHide != '') { 1678 if (percentage > 95) { 1679 if (!$('.essb-followme').hasClass('essb-followme-hiddenend')) { 1680 $('.essb-followme').addClass('essb-followme-hiddenend'); 1681 $('.essb-followme').slideUp(100); 1682 } 1683 } 1684 else { 1685 if ($('.essb-followme').hasClass('essb-followme-hiddenend')) { 1686 $('.essb-followme').removeClass('essb-followme-hiddenend'); 1687 $('.essb-followme').slideDown(100); 1688 } 1689 } 1690 } 1691 } 1692 1693 $(window).on('scroll', debounce(essb_followme_scroll, 1)); 1694 1695 // execute one time after load 1696 essb_followme_scroll(); 1697 } 1698 1699 if ($('.essb-point').length) { 1700 var essb_point_triggered = false; 1701 var essb_point_trigger_mode = ""; 1702 1703 var essb_point_trigger_open_onscroll = function() { 1704 var current_pos = $(window).scrollTop() + $(window).height() - 200; 1705 1706 var top = $('.essb_break_scroll').offset().top - parseFloat($('.essb_break_scroll').css('marginTop').replace(/auto/, 0)); 1707 1708 if (essb_point_trigger_mode == 'end') { 1709 if (current_pos >= top && !essb_point_triggered) { 1710 if (!$('.essb-point-share-buttons').hasClass('essb-point-share-buttons-active')) { 1711 $('.essb-point-share-buttons').addClass('essb-point-share-buttons-active'); 1712 if (essb_point_mode != 'simple') $('.essb-point').toggleClass('essb-point-open'); 1713 essb_point_triggered = true; 1714 1715 if (essb_point_autoclose > 0) { 1716 setTimeout(function() { 1717 $('.essb-point-share-buttons').removeClass('essb-point-share-buttons-active'); 1718 if (essb_point_mode != 'simple') $('.essb-point').removeClass('essb-point-open'); 1719 }, essb_point_autoclose * 1000) 1720 } 1721 } 1722 } 1723 } 1724 if (essb_point_trigger_mode == 'middle') { 1725 var percentage = current_pos * 100 / top; 1726 if (percentage > 49 && !essb_point_triggered) { 1727 if (!$('.essb-point-share-buttons').hasClass('essb-point-share-buttons-active')) { 1728 $('.essb-point-share-buttons').addClass('essb-point-share-buttons-active'); 1729 if (essb_point_mode != 'simple') $('.essb-point').toggleClass('essb-point-open'); 1730 essb_point_triggered = true; 1731 1732 if (essb_point_autoclose > 0) { 1733 setTimeout(function() { 1734 $('.essb-point-share-buttons').removeClass('essb-point-share-buttons-active'); 1735 if (essb_point_mode != 'simple') $('.essb-point').removeClass('essb-point-open'); 1736 }, essb_point_autoclose * 1000) 1737 } 1738 } 1739 } 1740 } 1741 } 1742 1743 var essb_point_onscroll = $('.essb-point').attr('data-trigger-scroll') || ""; 1744 var essb_point_mode = $('.essb-point').attr('data-point-type') || "simple"; 1745 var essb_point_autoclose = Number($('.essb-point').attr('data-autoclose') || 0) || 0; 1746 1747 if (essb.responsiveEventsCanRun($('.essb-point'))) { 1748 if (essb_point_onscroll == 'end' || essb_point_onscroll == 'middle') { 1749 essb_point_trigger_mode = essb_point_onscroll; 1750 $(window).on('scroll', essb_point_trigger_open_onscroll); 1751 } 1752 } 1753 1754 $(".essb-point").on('click', function(){ 1755 1756 $('.essb-point-share-buttons').toggleClass('essb-point-share-buttons-active'); 1757 1758 if (essb_point_mode != 'simple') $('.essb-point').toggleClass('essb-point-open'); 1759 1760 if (essb_point_autoclose > 0) { 1761 setTimeout(function() { 1762 $('.essb-point-share-buttons').removeClass('essb-point-share-buttons-active'); 1763 if (essb_point_mode != 'simple') $('.essb-point').removeClass('essb-point-open'); 1764 }, essb_point_autoclose * 1000) 1765 } 1766 }); 1767 } 1768 1769 /** 1770 * Display Method: Corner Bar 1771 */ 1772 1773 if ($('.essb-cornerbar').length) { 1774 if ($('.essb-cornerbar .essb_links').length) $('.essb-cornerbar .essb_links').removeClass('essb_displayed_cornerbar'); 1775 1776 var dataCornerBarShow = $('.essb-cornerbar').attr('data-show') || '', 1777 dataCornerBarHide = $('.essb-cornerbar').attr('data-hide') || ''; 1778 1779 function essb_cornerbar_scroll() { 1780 var current_pos = $(window).scrollTop(); 1781 var height = $(document).height() - $(window).height(); 1782 var percentage = current_pos / height * 100, 1783 breakPercent = dataCornerBarShow == 'onscroll' ? 5 : 45; 1784 1785 if (dataCornerBarShow == 'onscroll' || dataCornerBarShow == 'onscroll50') { 1786 if (percentage > breakPercent) { 1787 if ($('.essb-cornerbar').hasClass('essb-cornerbar-hidden')) $('.essb-cornerbar').removeClass('essb-cornerbar-hidden'); 1788 } 1789 else { 1790 if (!$('.essb-cornerbar').hasClass('essb-cornerbar-hidden')) $('.essb-cornerbar').addClass('essb-cornerbar-hidden'); 1791 } 1792 } 1793 1794 if (dataCornerBarShow == 'content') { 1795 var isOneVisible = false; 1796 $('.essb_displayed_top').each(function() { 1797 if (isElementInViewport($(this))) 1798 isOneVisible = true; 1799 });
1800 $('.essb_displayed_bottom').each(function() { 1801 if (isElementInViewport($(this))) 1802 isOneVisible = true; 1803 }); 1804 1805 if (!isOneVisible) { 1806 if ($('.essb-cornerbar').hasClass('essb-cornerbar-hidden')) $('.essb-cornerbar').removeClass('essb-cornerbar-hidden'); 1807 } 1808 else { 1809 if (!$('.essb-cornerbar').hasClass('essb-cornerbar-hidden')) $('.essb-cornerbar').addClass('essb-cornerbar-hidden'); 1810 } 1811 } 1812 1813 if (dataCornerBarHide != '') { 1814 if (percentage > 90) { 1815 if (!$('.essb-cornerbar').hasClass('essb-cornerbar-hiddenend')) $('.essb-cornerbar').addClass('essb-cornerbar-hiddenend'); 1816 } 1817 else { 1818 if ($('.essb-cornerbar').hasClass('essb-cornerbar-hiddenend')) $('.essb-cornerbar').removeClass('essb-cornerbar-hiddenend'); 1819 } 1820 } 1821 } 1822 1823 if (essb.responsiveEventsCanRun($('.essb-cornerbar'))) { 1824 if (dataCornerBarHide != '' || dataCornerBarShow != '') 1825 $(window).on('scroll', debounce(essb_cornerbar_scroll, 1)); 1826 1827 if (dataCornerBarShow == 'content') essb_cornerbar_scroll(); 1828 1829 } 1830 1831 1832 } 1833 1834 1835 1836 /** 1837 * Reveal the social followers counter that comes with a transition effect 1838 */ 1839 if ($('.essbfc-container-sidebar').length) { 1840 $(".essbfc-container-sidebar").each(function() { 1841 if ($(this).hasClass("essbfc-container-sidebar-transition")) { 1842 $(this).removeClass("essbfc-container-sidebar-transition"); 1843 } 1844 }); 1845 } 1846 1847 }); 1848 1849 1850} )( jQuery );
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.