1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__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 opener = _____WB$wombat$assign$function_____("opener"); 10window.socialWarfare = window.socialWarfare || {}; 11( function ( window, $ ) { 12 'use strict'; 13 if ( typeof $ !== 'function' ) { 14 if ( typeof jQuery === 'function' ) { 15 var $ = jQuery; 16 } else { 17 console.log( 18 'Social Warfare requires jQuery, or $ as an alias of jQuery. Please make sure your theme provides access to jQuery before activating Social Warfare.' 19 ); 20 return; 21 } 22 } 23 function isString( maybeString ) { 24 return typeof maybeString === 'string' && maybeString.length > 0; 25 } 26 socialWarfare.paddingTop = parseInt( $( 'body' ).css( 'padding-top' ) ); 27 socialWarfare.paddingBottom = parseInt( 28 $( 'body' ).css( 'padding-bottom' ) 29 ); 30 socialWarfare.initPlugin = function () { 31 $( 'body' ).css( { 32 paddingTop: socialWarfare.paddingTop, 33 paddingBottom: socialWarfare.paddingBottom, 34 } ); 35 socialWarfare.establishPanels(); 36 socialWarfare.establishBreakpoint(); 37 if ( 38 ! socialWarfare.panels.staticHorizontal && 39 ! socialWarfare.panels.floatingSide && 40 ! socialWarfare.panels.floatingHorizontal 41 ) { 42 return; 43 } 44 socialWarfare.emphasizeButtons(); 45 socialWarfare.createFloatHorizontalPanel(); 46 socialWarfare.positionFloatSidePanel(); 47 socialWarfare.activateHoverStates(); 48 socialWarfare.handleButtonClicks(); 49 socialWarfare.updateFloatingButtons(); 50 socialWarfare.closeLightboxOverlay(); 51 socialWarfare.preloadPinterestImages(); 52 if ( typeof swpPinIt === 'object' && swpPinIt.enabled == true ) { 53 socialWarfare.createHoverSaveButton(); 54 socialWarfare.triggerImageListeners(); 55 } 56 setTimeout( function () { 57 socialWarfare.checkListeners( 0, 5 ); 58 }, 2e3 ); 59 let time = Date.now(); 60 const scrollDelay = 50; 61 $( window ).on( 'scroll', function () { 62 if ( time + scrollDelay - Date.now() < 0 ) { 63 socialWarfare.updateFloatingButtons(); 64 time = Date.now(); 65 } 66 } ); 67 }; 68 let resizeWait; 69 socialWarfare.onWindowResize = function () { 70 clearTimeout( resizeWait ); 71 resizeWait = setTimeout( socialWarfare.initPlugin, 100 ); 72 }; 73 socialWarfare.establishPanels = function () { 74 socialWarfare.panels = { 75 staticHorizontal: null, 76 floatingSide: null, 77 floatingHorizontal: null, 78 }; 79 socialWarfare.panels.staticHorizontal = $( '.swp_social_panel' ).not( 80 '.swp_social_panelSide' 81 ); 82 socialWarfare.panels.floatingSide = $( '.swp_social_panelSide' ); 83 return socialWarfare.panels; 84 }; 85 socialWarfare.emphasizeButtons = function () { 86 if ( typeof socialWarfare.variables.emphasizeIcons === 'undefined' ) { 87 return; 88 } 89 if ( socialWarfare.isMobile() ) { 90 return; 91 } 92 jQuery( '.swp_social_panel:not(.swp_social_panelSide)' ).each( 93 function ( i, panel ) { 94 jQuery( panel ) 95 .find( '.nc_tweetContainer:not(.total_shares)' ) 96 .each( function ( index, button ) { 97 if ( index < socialWarfare.variables.emphasizeIcons ) { 98 const shareWidth = jQuery( button ) 99 .find( '.swp_share' ) 100 .width(); 101 const iconWidth = jQuery( button ) 102 .find( 'i.sw' ) 103 .outerWidth(); 104 const iconTextWidth = shareWidth + iconWidth + 35; 105 const containerWidth = jQuery( button ).width(); 106 const change = 107 1 + ( shareWidth + 35 ) / containerWidth; 108 if ( change < 2 ) { 109 jQuery( button ) 110 .addClass( 'swp_nohover' ) 111 .css( { flex: '2 1 0%' } ) 112 .find( '.iconFiller' ) 113 .width( iconTextWidth ); 114 } else { 115 jQuery( button ) 116 .addClass( 'swp_nohover' ) 117 .css( { flex: change + ' 1 0%' } ) 118 .find( '.iconFiller' ) 119 .width( iconTextWidth ); 120 } 121 } 122 } ); 123 } 124 ); 125 }; 126 socialWarfare.activateHoverStates = function () { 127 socialWarfare.trigger( 'pre_activate_buttons' ); 128 $( 129 '.swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer' 130 ).on( 'mouseenter', function () { 131 if ( $( this ).hasClass( 'swp_nohover' ) ) { 132 return; 133 } 134 socialWarfare.resetStaticPanel(); 135 const termWidth = $( this ).find( '.swp_share' ).outerWidth(); 136 const iconWidth = $( this ).find( 'i.sw' ).outerWidth(); 137 const containerWidth = $( this ).width(); 138 const change = 1 + ( termWidth + 35 ) / containerWidth; 139 $( this ) 140 .find( '.iconFiller' ) 141 .width( termWidth + iconWidth + 25 + 'px' ); 142 $( this ).css( 'flex', change + ' 1 0%' ); 143 } ); 144 $( '.swp_social_panel:not(.swp_social_panelSide)' ).on( 145 'mouseleave', 146 socialWarfare.resetStaticPanel 147 ); 148 }; 149 socialWarfare.resetStaticPanel = function () { 150 $( 151 '.swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer:not(.swp_nohover) .iconFiller' 152 ).removeAttr( 'style' ); 153 $( 154 '.swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer:not(.swp_nohover)' 155 ).removeAttr( 'style' ); 156 }; 157 socialWarfare.handleButtonClicks = function () { 158 $( '.nc_tweet, a.swp_CTT' ).off( 'click' ); 159 $( '.nc_tweet, a.swp_CTT' ).on( 'click', function ( event ) { 160 if ( $( this ).parent( '.swp_print' ).length > 0 ) { 161 event.preventDefault(); 162 window.print(); 163 return; 164 } 165 if ( 166 true === $( this ).hasClass( 'pinterest_multi_image_select' ) 167 ) { 168 event.preventDefault(); 169 socialWarfare.openMultiPinterestOverlay( $( this ) ); 170 return; 171 } 172 if ( $( this ).parent( '.swp_more' ).length > 0 ) { 173 event.preventDefault(); 174 socialWarfare.openMoreOptions( $( this ) ); 175 return; 176 } 177 if ( $( this ).hasClass( 'noPop' ) ) { 178 return event; 179 } 180 if ( 181 'undefined' === typeof $( this ).data( 'link' ) && 182 false === $( this ).is( '.swp-hover-pin-button' ) 183 ) { 184 return event; 185 } 186 event.preventDefault(); 187 const href = $( this ).data( 'link' ).replace( 'â', "'" ); 188 let height, width, top, left, instance, windowAttributes, network; 189 height = 270; 190 width = 500; 191 if ( 192 $( this ).is( 193 '.swp_pinterest a, .buffer_link a, .flipboard a, .swp-hover-pin-button' 194 ) 195 ) { 196 height = 550; 197 width = 775; 198 } 199 if ( $( this ).hasClass( 'nc_tweet' ) ) { 200 network = $( this ) 201 .parents( '.nc_tweetContainer' ) 202 .data( 'network' ); 203 } else if ( $( this ).hasClass( 'swp_CTT' ) ) { 204 network = 'ctt'; 205 } 206 top = window.screenY + ( window.innerHeight - height ) / 2; 207 left = window.screenX + ( window.innerWidth - width ) / 2; 208 windowAttributes = 209 'height=' + 210 height + 211 ',width=' + 212 width + 213 ',top=' + 214 top + 215 ',left=' + 216 left; 217 instance = window.open( href, network, windowAttributes ); 218 socialWarfare.trackClick( network ); 219 } ); 220 }; 221 socialWarfare.openMultiPinterestOverlay = function ( element ) { 222 if ( $( '.pinterest-overlay' ).length > 0 ) { 223 $( '.pinterest-overlay' ).fadeIn(); 224 $( '.swp-lightbox-inner' ).scrollTop( 0 ); 225 return; 226 } 227 let html = ''; 228 const pin_data = element.data( 'pins' ); 229 let pin_images = '';
230 pin_data.images.forEach( function ( image ) { 231 const share_url = 232 'https://pinterest.com/pin/create/button/?url=' + 233 pin_data.url + 234 '&media=' + 235 image + 236 '&description=' + 237 encodeURIComponent( pin_data.description ); 238 let pin_html = ''; 239 pin_html += '<div class="pin_image_select_wrapper">'; 240 pin_html += '<img class="pin_image" src="' + image + '" />'; 241 pin_html += 242 '<a class="swp-hover-pin-button" href="' + 243 share_url + 244 '" data-link="' + 245 share_url + 246 '">Save</a>'; 247 pin_html += '</div>'; 248 pin_images += pin_html; 249 } ); 250 html += 251 '<div class="swp-lightbox-wrapper pinterest-overlay"><div class="swp-lightbox-inner">'; 252 html += '<i class="sw swp_pinterest_icon top_icon"></i>'; 253 html += '<div class="swp-lightbox-close"></div>'; 254 html += '<h5>Which image would you like to pin?</h5>'; 255 html += '<div class="pin_images_wrapper">'; 256 html += pin_images; 257 html += '</div>'; 258 html += socialWarfare.buildPoweredByLink(); 259 html += '</div></div>'; 260 $( 'body' ).append( html ); 261 $( '.pinterest-overlay' ).hide().fadeIn(); 262 socialWarfare.handleButtonClicks(); 263 let max_height = 999999; 264 let iteration = 0, 265 images = $( '.pinterest-overlay .pin_images_wrapper img' ); 266 images.load( function () { 267 if ( ++iteration === images.length ) { 268 images 269 .each( function () { 270 if ( $( this ).height() < max_height ) { 271 max_height = $( this ).height(); 272 } 273 } ) 274 .promise() 275 .done( function () { 276 images.height( max_height + 'px' ); 277 const number_of_rows = Math.ceil( images.length / 4 ); 278 for ( i = 0; i < number_of_rows; i++ ) { 279 const current_row_images = images.slice( 280 i * 4, 281 i * 4 + 4 282 ); 283 var max_allowable_width = 284 current_row_images.length / 4; 285 var total_width = $( 286 '.pin_images_wrapper' 287 ).width(); 288 var total_images_width = 0; 289 current_row_images.each( function () { 290 total_images_width = 291 total_images_width + $( this ).width(); 292 } ); 293 var ratio = total_width / total_images_width; 294 current_row_images.each( function () { 295 const new_width = 296 ( ( $( this ).width() * ratio ) / 297 total_width ) * 298 100 * 299 max_allowable_width - 300 1; 301 $( this ) 302 .parent() 303 .width( new_width + '%' ); 304 $( this ).height( 'auto' ); 305 } ); 306 var height = current_row_images.first().height(); 307 current_row_images.each( function () { 308 $( this ) 309 .width( $( this ).width() ) 310 .height( height ); 311 } ); 312 } 313 } ); 314 } 315 } ); 316 }; 317 socialWarfare.buildPoweredByLink = function () { 318 let html = ''; 319 if ( true === socialWarfare.variables.powered_by_toggle ) { 320 let anchor_tag_open = ''; 321 let anchor_tag_close = ''; 322 if ( false !== socialWarfare.variables.affiliate_link ) { 323 anchor_tag_open = 324 '<a href="' + 325 socialWarfare.variables.affiliate_link + 326 '" target="_blank">'; 327 anchor_tag_close = '</a>'; 328 } 329 html = 330 '<div class="swp_powered_by">' + 331 anchor_tag_open + 332 '<span>Powered by</span> <img src="/wp-content/plugins/social-warfare/assets/images/admin-options-page/social-warfare-pro-light.png">' + 333 anchor_tag_close + 334 '</div>'; 335 } 336 return html; 337 }; 338 socialWarfare.preloadPinterestImages = function () { 339 if ( $( '.pinterest_multi_image_select' ).length < 1 ) { 340 return; 341 } 342 const pin_data = $( '.pinterest_multi_image_select' ).data( 'pins' ); 343 pin_data.images.forEach( function ( image_url ) { 344 const image_object = new Image(); 345 image_object.src = image_url; 346 } ); 347 }; 348 socialWarfare.openMoreOptions = function ( element ) { 349 if ( $( '.swp-more-wrapper' ).length > 0 ) { 350 $( '.swp-more-wrapper' ).fadeIn(); 351 return; 352 } 353 const post_id = element 354 .parents( '.swp_social_panel' ) 355 .data( 'post-id' ); 356 const data = { 357 action: 'swp_buttons_panel', 358 post_id, 359 _ajax_nonce: swp_nonce, 360 }; 361 jQuery.post( swp_ajax_url, data, function ( response ) { 362 $( 'body' ).append( response ); 363 $( '.swp-lightbox-wrapper' ).hide().fadeIn(); 364 socialWarfare.activateHoverStates(); 365 socialWarfare.handleButtonClicks(); 366 } ); 367 }; 368 socialWarfare.closeLightboxOverlay = function () { 369 $( 'body' ).on( 'click', '.swp-lightbox-close', function () { 370 $( '.swp-lightbox-wrapper' ).fadeOut(); 371 } ); 372 $( document ).on( 'keyup', function ( e ) { 373 if ( e.key === 'Escape' ) { 374 $( '.swp-lightbox-wrapper' ).fadeOut(); 375 } 376 } ); 377 }; 378 socialWarfare.createFloatHorizontalPanel = function () { 379 if ( ! socialWarfare.panels.staticHorizontal.length ) { 380 return; 381 } 382 const floatLocation = 383 socialWarfare.panels.staticHorizontal.data( 'float' ); 384 const mobileFloatLocation = 385 socialWarfare.panels.staticHorizontal.data( 'float-mobile' ); 386 const backgroundColor = 387 socialWarfare.panels.staticHorizontal.data( 'float-color' ); 388 const wrapper = $( 389 '<div class="nc_wrapper swp_floating_horizontal_wrapper" style="background-color:' + 390 backgroundColor + 391 '"></div>' 392 ); 393 let barLocation = ''; 394 if ( $( '.nc_wrapper' ).length ) { 395 $( '.nc_wrapper' ).remove(); 396 } 397 if ( $( '.swp_floating_horizontal_wrapper' ).length ) { 398 $( '.swp_floating_horizontal_wrapper' ).remove(); 399 } 400 if ( 401 floatLocation != 'top' && 402 floatLocation != 'bottom' && 403 mobileFloatLocation != 'top' && 404 mobileFloatLocation != 'bottom' 405 ) { 406 return; 407 } 408 if ( socialWarfare.isMobile() ) { 409 barLocation = mobileFloatLocation; 410 } else { 411 barLocation = floatLocation; 412 } 413 wrapper.addClass( barLocation ).hide().appendTo( 'body' ); 414 socialWarfare.panels.floatingHorizontal = 415 socialWarfare.panels.staticHorizontal.first().clone(); 416 socialWarfare.panels.floatingHorizontal 417 .addClass( 'nc_floater' ) 418 .appendTo( wrapper ); 419 socialWarfare.updateFloatingHorizontalDimensions(); 420 $( '.swp_social_panel .swp_count' ).css( { 421 transition: 'padding .1s linear', 422 } ); 423 }; 424 socialWarfare.updateFloatingHorizontalDimensions = function () { 425 if ( ! socialWarfare.panels.staticHorizontal.length ) { 426 return; 427 } 428 if ( ! socialWarfare.panels.floatingHorizontal ) { 429 return; 430 } 431 let width = '100%'; 432 let left = 0; 433 const panel = socialWarfare.panels.staticHorizontal; 434 let parent = panel.parent(); 435 if ( parent.hasClass( 'swp-hidden-panel-wrap' ) ) { 436 parent = parent.parent(); 437 } 438 if ( 'undefined' !== typeof panel.offset().left ) { 439 left = panel.offset().left; 440 } 441 if ( 'undefined' !== typeof panel.width() ) { 442 width = panel.width(); 443 } 444 if ( left == 0 ) { 445 left = parent.offset().left; 446 } 447 if ( width == 100 || width == 0 ) { 448 width = parent.width(); 449 } 450 socialWarfare.panels.floatingHorizontal.css( { 451 width, 452 left, 453 } ); 454 }; 455 socialWarfare.staticPanelIsVisible = function () { 456 let visible = false;
457 const scrollPos = $( window ).scrollTop(); 458 $( '.swp_social_panel' ) 459 .not( '.swp_social_panelSide, .nc_floater' ) 460 .each( function ( index ) { 461 const offset = $( this ).offset(); 462 if ( 463 typeof socialWarfare.floatBeforeContent !== 'undefined' && 464 '1' != socialWarfare.floatBeforeContent 465 ) { 466 const theContent = $( '.swp-content-locator' ).parent(); 467 if ( 468 index === 0 && 469 theContent.length && 470 theContent.offset().top > 471 scrollPos + $( window ).height() 472 ) { 473 visible = true; 474 } 475 } 476 if ( 477 $( this ).is( ':visible' ) && 478 offset.top + $( this ).height() > scrollPos && 479 offset.top < scrollPos + $( window ).height() 480 ) { 481 visible = true; 482 } 483 } ); 484 return visible; 485 }; 486 socialWarfare.updateFloatingButtons = function () { 487 if ( socialWarfare.panels.staticHorizontal.length ) { 488 var panel = socialWarfare.panels.staticHorizontal; 489 } else if ( socialWarfare.panels.floatingSide.length ) { 490 var panel = socialWarfare.panels.floatingSide; 491 } else { 492 return; 493 } 494 var location = panel.data( 'float' ); 495 if ( true == socialWarfare.isMobile() ) { 496 var location = panel.data( 'float-mobile' ); 497 } 498 if ( location == 'none' ) { 499 return $( 500 '.nc_wrapper, .swp_floating_horizontal_wrapper, .swp_social_panelSide' 501 ).hide(); 502 } 503 if ( socialWarfare.isMobile() ) { 504 socialWarfare.toggleMobileButtons(); 505 socialWarfare.toggleFloatingHorizontalPanel(); 506 return; 507 } 508 if ( location == 'right' || location == 'left' ) { 509 socialWarfare.toggleFloatingVerticalPanel(); 510 } 511 if ( location == 'bottom' || location == 'top' ) { 512 socialWarfare.toggleFloatingHorizontalPanel(); 513 } 514 }; 515 socialWarfare.toggleMobileButtons = function () { 516 socialWarfare.panels.floatingSide.hide(); 517 const visibility = socialWarfare.staticPanelIsVisible() 518 ? 'collapse' 519 : 'visible'; 520 $( '.nc_wrapper, .swp_floating_horizontal_wrapper' ).css( 521 'visibility', 522 visibility 523 ); 524 }; 525 socialWarfare.toggleFloatingVerticalPanel = function () { 526 let direction = ''; 527 const location = socialWarfare.panels.floatingSide.data( 'float' ); 528 let visible = socialWarfare.staticPanelIsVisible(); 529 let offset = ''; 530 if ( socialWarfare.isMobile() ) { 531 return socialWarfare.panels.floatingSide.hide(); 532 } 533 if ( 534 ! socialWarfare.panels.floatingSide || 535 ! socialWarfare.panels.floatingSide.length 536 ) { 537 visible = true; 538 } 539 if ( 540 socialWarfare.panels.floatingSide.data( 'transition' ) == 'slide' 541 ) { 542 direction = location; 543 offset = visible ? '-150px' : '5px'; 544 socialWarfare.panels.floatingSide.css( direction, offset ).show(); 545 } else if ( visible ) { 546 socialWarfare.panels.floatingSide 547 .css( 'opacity', 1 ) 548 .fadeOut( 300 ) 549 .css( 'opacity', 0 ); 550 } else { 551 socialWarfare.panels.floatingSide 552 .css( 'opacity', 0 ) 553 .fadeIn( 300 ) 554 .css( 'display', 'flex' ) 555 .css( 'opacity', 1 ); 556 } 557 }; 558 socialWarfare.hasReferencePanel = function () { 559 return ( 560 typeof socialWarfare.panels.staticHorizontal !== 'undefined' && 561 socialWarfare.panels.staticHorizontal.length > 0 562 ); 563 }; 564 socialWarfare.toggleFloatingHorizontalPanel = function () { 565 if ( ! socialWarfare.hasReferencePanel() ) { 566 return; 567 } 568 if ( ! socialWarfare.panels.floatingHorizontal ) { 569 return; 570 } 571 const panel = socialWarfare.panels.floatingHorizontal.first(); 572 const location = socialWarfare.isMobile() 573 ? $( panel ).data( 'float-mobile' ) 574 : $( panel ).data( 'float' ); 575 let newPadding = 576 location == 'bottom' 577 ? socialWarfare.paddingBottom 578 : socialWarfare.paddingTop; 579 const paddingProp = 'padding-' + location; 580 if ( location == 'off' ) { 581 return; 582 } 583 if ( socialWarfare.staticPanelIsVisible() ) { 584 $( '.nc_wrapper, .swp_floating_horizontal_wrapper' ).hide(); 585 if ( socialWarfare.isMobile() && $( '#wpadminbar' ).length ) { 586 $( '#wpadminbar' ).css( 'top', 0 ); 587 } 588 } else { 589 newPadding += 50; 590 $( '.nc_wrapper, .swp_floating_horizontal_wrapper' ).show(); 591 if ( 592 socialWarfare.isMobile() && 593 location == 'top' && 594 $( '#wpadminbar' ).length 595 ) {
596 $( '#wpadminbar' ).css( 'top', panel.parent().height() ); 597 } 598 } 599 $( 'body' ).css( paddingProp, newPadding ); 600 }; 601 socialWarfare.positionFloatSidePanel = function () { 602 let panelHeight, windowHeight, offset; 603 const sidePanel = socialWarfare.panels.floatingSide; 604 if ( ! sidePanel || ! sidePanel.length ) { 605 return; 606 } 607 if ( 608 sidePanel.hasClass( 'swp_side_top' ) || 609 sidePanel.hasClass( 'swp_side_bottom' ) 610 ) { 611 return; 612 } 613 panelHeight = sidePanel.outerHeight(); 614 windowHeight = window.innerHeight; 615 if ( panelHeight > windowHeight ) { 616 return sidePanel.css( 'top', 0 ); 617 } 618 offset = ( windowHeight - panelHeight ) / 2; 619 sidePanel.css( 'top', offset ); 620 }; 621 socialWarfare.createHoverSaveButton = function () { 622 if ( $( '.tve_editor_page' ).length ) { 623 $( '.sw-pinit-button' ).remove(); 624 $( '.sw-pinit' ).each( function () { 625 const inner_content = $( '.sw-pinit' ).contents(); 626 $( this ).replaceWith( inner_content ); 627 } ); 628 return; 629 } 630 const button = $( document.createElement( 'a' ) ); 631 button.css( 'display: none' ); 632 button.addClass( 'swp-hover-pin-button' ); 633 button.text( 'Save' ); 634 socialWarfare.hoverSaveButton = $( button ); 635 return button; 636 }; 637 socialWarfare.triggerImageListeners = function () { 638 $( '.swp-content-locator' ) 639 .parent() 640 .find( 'img' ) 641 .off( 'mouseenter', socialWarfare.renderPinterestSaveButton ); 642 $( '.swp-content-locator' ) 643 .parent() 644 .find( 'img' ) 645 .on( 'mouseenter', socialWarfare.renderPinterestSaveButton ); 646 setTimeout( socialWarfare.triggerImageListeners, 2e3 ); 647 }; 648 socialWarfare.getPinMedia = function ( image ) { 649 if ( isString( swpPinIt.image_source ) ) { 650 return swpPinIt.image_source; 651 } 652 if ( isString( image.attr( 'src' ) ) ) { 653 return image.attr( 'src' ); 654 } 655 const dataSources = [ 'src', 'lazy-src', 'media' ]; 656 let media = ''; 657 dataSources.some( function ( maybeSource ) { 658 if ( isString( image.data( maybeSource ) ) ) { 659 media = image.data( maybeSource ); 660 return true; 661 } 662 } ); 663 if ( media == '' ) { 664 return; 665 } 666 const i = $( '<img>' ); 667 i.attr( 'src', media ); 668 return i.prop( 'src' ); 669 }; 670 socialWarfare.getPinDescription = function ( image ) { 671 if ( isString( image.data( 'pin-description' ) ) ) { 672 return image.data( 'pin-description' ); 673 } 674 if ( isString( swpPinIt.image_description ) ) { 675 return swpPinIt.image_description; 676 } 677 if ( isString( image.attr( 'title' ) ) ) { 678 return image.attr( 'title' ); 679 } 680 if ( isString( image.attr( 'alt' ) ) ) { 681 return image.attr( 'alt' ); 682 } 683 if ( isString( swpPinIt.post_title ) ) { 684 return swpPinIt.post_title; 685 } 686 }; 687 socialWarfare.enablePinterestSaveButtons = function () { 688 jQuery( 'img' ).on( 'mouseenter', function () { 689 const pinterestBrowserButtons = 690 socialWarfare.findPinterestBrowserSaveButtons(); 691 if ( 692 typeof pinterestBrowserButtons !== 'undefined' && 693 pinterestBrowserButtons 694 ) { 695 socialWarfare.removePinterestBrowserSaveButtons( 696 pinterestBrowserButtons 697 ); 698 } 699 } ); 700 }; 701 socialWarfare.toggleHoverSaveDisplay = function ( image ) { 702 let top = image.offset().top; 703 let left = image.offset().left; 704 const vMargin = 15; 705 const hMargin = 15; 706 const button_size = swpPinIt.button_size || 1; 707 const buttonHeight = 24; 708 const buttonWidth = 120; 709 switch ( swpPinIt.vLocation ) { 710 case 'top': 711 top += vMargin; 712 break; 713 case 'middle': 714 var offset = 715 image.height() / 2 - vMargin / 2 - buttonHeight / 2; 716 top += offset; 717 break; 718 case 'bottom': 719 top += image.height() - vMargin - buttonHeight; 720 break; 721 } 722 switch ( swpPinIt.hLocation ) { 723 case 'left': 724 left += hMargin; 725 break; 726 case 'center': 727 var offset = image.width() / 2 - hMargin / 2 - buttonWidth / 2; 728 left += offset; 729 break; 730 case 'right': 731 left += image.width() - hMargin - buttonWidth; 732 break; 733 } 734 socialWarfare.hoverSaveButton.css( { 735 top, 736 left, 737 transform: 'scale(' + button_size + ')', 738 'transform-origin': swpPinIt.vLocation + ' ' + swpPinIt.hLocation, 739 } ); 740 image.on( 'mouseleave', function ( event ) { 741 if ( 742 event.relatedTarget != null && 743 event.relatedTarget.className == 'swp-hover-pin-button' 744 ) { 745 return; 746 } 747 $( '.swp-hover-pin-button' ).remove(); 748 } ); 749 $( document.body ).append( socialWarfare.hoverSaveButton ); 750 }; 751 socialWarfare.renderPinterestSaveButton = function ( event ) { 752 if ( 753 event.relatedTarget && 754 event.relatedTarget.className == 'swp-hover-pin-button' 755 ) { 756 return; 757 } 758 if ( $( '.swp-hover-pin-button' ).length > 0 ) { 759 return; 760 } 761 const image = $( event.target ); 762 if (
763 typeof swpPinIt.disableOnAnchors !== undefined && 764 swpPinIt.disableOnAnchors 765 ) { 766 if ( image.parents().filter( 'a' ).length ) { 767 return; 768 } 769 } 770 if ( 771 image.outerHeight() < swpPinIt.minHeight || 772 image.outerWidth() < swpPinIt.minWidth 773 ) { 774 return; 775 } 776 if ( image.hasClass( 'no_pin' ) || image.hasClass( 'no-pin' ) ) { 777 return; 778 } 779 socialWarfare.toggleHoverSaveDisplay( image ); 780 const description = socialWarfare.getPinDescription( image ); 781 const media = socialWarfare.getPinMedia( image ); 782 const shareLink = 783 'http://pinterest.com/pin/create/bookmarklet/?media=' + 784 encodeURI( media ) + 785 '&url=' + 786 encodeURI( document.URL ) + 787 '&is_video=false' + 788 '&description=' + 789 encodeURIComponent( description ); 790 function openPinterestDialogue( event ) { 791 const offsetLeft = ( $( window ).width() - 775 ) / 2; 792 const offsetTop = ( $( window ).height() - 550 ) / 2; 793 const position = ',top=' + offsetTop + ',left=' + offsetLeft; 794 window.open( 795 shareLink, 796 'Pinterest', 797 'width=775,height=550,status=0,toolbar=0,menubar=0,location=1,scrollbars=1' + 798 position 799 ); 800 socialWarfare.trackClick( 'pin_image' ); 801 $( '.swp-hover-pin-button' ).remove(); 802 } 803 $( '.swp-hover-pin-button' ).on( 'click', openPinterestDialogue ); 804 }; 805 socialWarfare.findPinterestBrowserSaveButtons = function () { 806 let pinterestRed, 807 pinterestRed2019, 808 pinterestZIndex, 809 pinterestBackgroundSize, 810 button, 811 style; 812 pinterestRed = 'rgb(189, 8, 28)'; 813 pinterestRed2019 = 'rgb(230, 0, 35)'; 814 pinterestZIndex = '8675309'; 815 pinterestBackgroundSize = '14px 14px'; 816 button = null; 817 document 818 .querySelectorAll( 'span' ) 819 .forEach( function ( element, index ) { 820 style = window.getComputedStyle( element ); 821 if ( 822 style.backgroundColor == pinterestRed || 823 style.backgroundColor == pinterestRed2019 824 ) { 825 if ( 826 style.backgroundSize == pinterestBackgroundSize && 827 style.zIndex == pinterestZIndex 828 ) { 829 button = element; 830 } 831 } 832 } ); 833 return button; 834 }; 835 socialWarfare.removePinterestBrowserSaveButtons = function ( button ) { 836 let pinterestSquare, style, size; 837 pinterestSquare = button.nextSibling; 838 if ( 839 pinterestSquare != undefined && 840 pinterestSquare.nodeName == 'SPAN' 841 ) { 842 style = window.getComputedStyle( pinterestSquare ); 843 size = '24px'; 844 if ( 845 style.width.indexOf( size ) === 0 && 846 style.height.indexOf( size ) === 0 847 ) { 848 pinterestSquare.remove(); 849 } 850 } 851 button.remove(); 852 }; 853 socialWarfare.fetchFacebookShares = function () { 854 const url1 = 855 'https://graph.facebook.com/v18.0/?fields=og_object{engagement}&id=' + 856 swp_post_url; 857 const url2 = swp_post_recovery_url 858 ? 'https://graph.facebook.com/v18.0/?fields=og_object{engagement}&id=' + 859 swp_post_recovery_url 860 : ''; 861 console.log( 'Facebook Share API: ' + url1 ); 862 console.log( 'Facebook Share API (recovery): ' + url2 ); 863 $.when( $.get( url1 ), $.get( url2 ) ).then( 864 function ( response1, response2 ) { 865 var shares, shares1, shares2, data; 866 shares1 = socialWarfare.parseFacebookShares( response1[ 0 ] ); 867 shares2 = 0; 868 if ( swp_post_recovery_url ) { 869 shares2 = socialWarfare.parseFacebookShares( 870 response2[ 0 ] 871 ); 872 } 873 shares = shares1; 874 if ( shares1 !== shares2 ) { 875 shares = shares1 + shares2; 876 } 877 var data = { 878 action: 'swp_facebook_shares_update', 879 post_id: swp_post_id, 880 share_counts: shares, 881 }; 882 $.post( swp_admin_ajax, data, function ( response ) { 883 console.log( response ); 884 } ); 885 } 886 ); 887 }; 888 socialWarfare.parseFacebookShares = function ( response ) { 889 if ( 'undefined' === typeof response.og_object ) { 890 console.log( 'Facebook Shares: 0' ); 891 return 0; 892 } 893 console.log( 894 'Facebook Shares: ' + response.og_object.engagement.count 895 ); 896 return parseInt( response.og_object.engagement.count ); 897 }; 898 socialWarfare.trigger = function ( event ) { 899 $( window ).trigger( $.Event( event ) ); 900 }; 901 socialWarfare.trackClick = function ( event ) { 902 if ( true === swpClickTracking ) { 903 if ( 'function' === typeof ga ) { 904 ga( 905 'send', 906 'event', 907 'social_media', 908 'swp_' + event + '_share' 909 ); 910 } 911 if ( 'object' === typeof dataLayer ) { 912 dataLayer.push( { event: 'swp_' + event + '_share' } ); 913 } 914 } 915 }; 916 socialWarfare.checkListeners = function ( count, limit ) { 917 if ( count > limit ) { 918 return; 919 } 920 const panel = $( '.swp_social_panel' ); 921 if ( panel.length > 0 && panel.find( '.swp_pinterest' ) ) { 922 socialWarfare.handleButtonClicks(); 923 return; 924 } 925 setTimeout( function () { 926 socialWarfare.checkListeners( ++count, limit ); 927 }, 2e3 ); 928 }; 929 socialWarfare.establishBreakpoint = function () { 930 const panel = $( '.swp_social_panel' ); 931 socialWarfare.breakpoint = 1100; 932 if ( 933 ( panel.length && panel.data( 'min-width' ) ) || 934 panel.data( 'min-width' ) == 0 935 ) { 936 socialWarfare.breakpoint = parseInt( panel.data( 'min-width' ) ); 937 } 938 }; 939 socialWarfare.isMobile = function () { 940 return $( window ).width() < socialWarfare.breakpoint; 941 }; 942 $( document ).ready( function () { 943 socialWarfare.initPlugin(); 944 socialWarfare.panels.floatingSide.hide(); 945 $( window ).on( 'resize', socialWarfare.onWindowResize ); 946 if ( 'undefined' !== typeof swpPinIt && swpPinIt.enabled ) { 947 socialWarfare.enablePinterestSaveButtons(); 948 } 949 } ); 950 $( window ).on( 'load', function () { 951 if ( 'undefined' !== typeof swpPinIt && swpPinIt.enabled ) { 952 socialWarfare.enablePinterestSaveButtons(); 953 } 954 window.clearCheckID = 0; 955 } ); 956} )( this, jQuery ); 957//# sourceMappingURL=script.min.js.map 958 959} 960 961/* 962 FILE ARCHIVED ON 12:31:30 Aug 16, 2025 AND RETRIEVED FROM THE 963 INTERNET ARCHIVE ON 04:03:18 Aug 20, 2026. 964 JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. 965
966 ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. 967 SECTION 108(a)(3)). 968*/ 969/* 970playback timings (ms): 971 captures_list: 0.372 972 exclusion.robots: 0.052 973 exclusion.robots.policy: 0.045 974 esindex: 0.005 975 cdx.remote: 12.776 976 LoadShardBlock: 89.975 (3) 977 PetaboxLoader3.resolve: 86.431 (4) 978 PetaboxLoader3.datanode: 77.07 (5) 979 load_resource: 107.868 980 loaddict: 38.626 981*/
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.