1(function($){ 2 $(document).ready(function() { 3 var all_networks_opened = 0; 4 5 $( 'body' ).on( 'click', '.et_social_share', function() { 6 var $this_el = $(this), 7 social_network = $this_el.data( 'social_name' ), 8 social_type = $this_el.data( 'social_type' ), 9 media_url = 'media' == social_type ? $this_el.closest( '.et_social_media_wrapper' ).find( 'img' ).attr( 'src' ) : '', 10 post_id = $this_el.data( 'post_id' ), 11 share_link = 'media' == social_type ? $this_el.data( 'social_link' ) : $this_el.prop( 'href' ); 12 13 update_stats_table( social_type, social_network, media_url, post_id, $this_el ); 14 15 if ( 'like' === social_network ) { 16 return false; 17 } 18 19 var left = ( $( window ).width()/2 ) - ( 550/2 ); 20 var top = ( $( window ).height()/2 ) - ( 450/2 ); 21 var new_window = window.open( share_link, '', 'scrollbars=1, height=450, width=550, left=' + left + ', top=' + top ); 22 23 if ( window.focus ) { 24 new_window.focus(); 25 } 26 27 return false; 28 }); 29 30 $( '.et_social_follow' ).click( function() { 31 var $this_el = $(this), 32 social_network = $this_el.data( 'social_name' ), 33 social_type = $this_el.data( 'social_type' ), 34 media_url = 'media' == social_type ? $this_el.closest( '.et_social_media_wrapper' ).find('img').attr('src') : '', 35 post_id = $this_el.data( 'post_id' ); 36 37 update_stats_table( social_type, social_network, media_url, post_id, $this_el ); 38 39 if ( 'like' === social_network ) { 40 return false; 41 } 42 }); 43 44 $( 'body' ).on( 'click', '.et_social_share_pinterest', function() { 45 if ( $( this ).hasClass( 'et_social_pin_all' ) ) { 46 var left = ( $( window ).width()/2 ) - ( 550/2 ), 47 top = ( $( window ).height()/2 ) - ( 450/2 ), 48 share_link = $( this ).attr( 'href' ), 49 new_window = window.open( share_link, '', 'scrollbars=1, height=450, width=550, left=' + left + ', top=' + top ); 50 51 if ( window.focus ) { 52 new_window.focus(); 53 } 54 } else { 55 $( '.et_social_pin_images_outer' ).fadeToggle( 400 ); 56 } 57 58 return false; 59 }); 60 61 function get_url_parameter( param_name ) { 62 var page_url = window.location.search.substring(1); 63 var url_variables = page_url.split('&'); 64 for ( var i = 0; i < url_variables.length; i++ ) { 65 var curr_param_name = url_variables[i].split( '=' ); 66 if ( curr_param_name[0] == param_name ) { 67 return curr_param_name[1]; 68 } 69 } 70 } 71 72 function update_stats_table( $action, $social_network, $media_url, $post_id, $this_el ) { 73 $stats_data = JSON.stringify({ 'action' : $action, 'network' : $social_network, 'media_url' : $media_url, 'post_id' : $post_id }); 74 $.ajax({ 75 type: 'POST', 76 url: monarchSettings.ajaxurl, 77 data: { 78 action : 'add_stats_record_db', 79 stats_data_array : $stats_data, 80 add_stats_nonce : monarchSettings.stats_nonce 81 }, 82 success: function( data ) { 83 if ( true == data ){ 84 if ( 'like' === $action ){
85 update_single_shares( $this_el, '', $post_id, $social_network, 'like' ); 86 } 87 if ( 'media' == $action ){ 88 update_total_media_shares( $this_el.closest( '.et_social_media_wrapper' ) ); 89 update_single_shares( $this_el, $media_url, $post_id, $social_network, 'media' ); 90 } 91 } 92 } 93 }); 94 } 95 96 function append_share_counts( $current_network ) { 97 var network = $current_network.data( 'social_name' ), 98 min_count = $current_network.data( 'min_count' ), 99 post_id = $current_network.data( 'post_id' ), 100 url = monarchSettings.pageurl !== '' ? monarchSettings.pageurl : window.location.href, 101 label_div = $current_network.find( '.et_social_network_label' ), 102 append_to = ( 0 != ( label_div.length ) ) ? label_div : $current_network; 103 104 $share_count_data = JSON.stringify({ 'network' : network, 'min_count' : min_count, 'post_id' : post_id, 'url' : url }); 105 106 $.ajax({ 107 type: 'POST', 108 url: monarchSettings.ajaxurl, 109 data: { 110 action : 'get_shares_count', 111 share_count_array : $share_count_data, 112 get_share_counts_nonce : monarchSettings.share_counts 113 }, 114 beforeSend: function( data ){ 115 append_to.append( '<span class="et_social_placeholder"></span>' ); 116 }, 117 success: function( data ){ 118 $current_network.find( 'span.et_social_placeholder' ).remove(); 119 append_to.append( data ); 120 } 121 }); 122 } 123 124 function append_total_shares( $current_area ) { 125 var post_id = $current_area.data( 'post_id' ), 126 url = monarchSettings.pageurl !== '' ? monarchSettings.pageurl : window.location.href,
127 append_to = $current_area; 128 129 $share_total_count_data = JSON.stringify({ 'post_id' : post_id, 'url' : url }); 130 131 $.ajax({ 132 type: 'POST', 133 url: monarchSettings.ajaxurl, 134 data: { 135 action : 'get_total_shares', 136 share_total_count_array : $share_total_count_data, 137 get_total_counts_nonce : monarchSettings.total_counts 138 }, 139 beforeSend: function( data ){ 140 append_to.append( '<span class="et_social_placeholder"></span>' ); 141 }, 142 success: function( data ){ 143 append_to.find( 'span.et_social_placeholder' ).remove(); 144 append_to.append( data ); 145 } 146 }); 147 } 148 149 function append_follow_counts( $current_area ) { 150 var network = $current_area.data( 'network' ), 151 min_count = $current_area.data( 'min_count' ), 152 index = $current_area.data( 'index' ), 153 append_to = $current_area; 154 155 $follow_count_data = JSON.stringify({ 'network' : network, 'min_count' : min_count, 'index' : index }); 156 $.ajax({ 157 type: 'POST', 158 url: monarchSettings.ajaxurl, 159 data: { 160 action : 'get_follow_counts', 161 follow_count_array : $follow_count_data, 162 get_follow_counts_nonce : monarchSettings.follow_counts 163 }, 164 beforeSend: function( data ){ 165 append_to.append( '<span class="et_social_placeholder"></span>' ); 166 }, 167 success: function( data ){ 168 $current_area.find( 'span.et_social_placeholder' ).remove(); 169 append_to.append( data ); 170 } 171 }); 172 } 173 174 function append_total_follows( $current_area ) {
175 var append_to = $current_area; 176 $.ajax({ 177 type: 'POST', 178 url: monarchSettings.ajaxurl, 179 data: { 180 action : 'get_follow_total', 181 get_total_counts_nonce : monarchSettings.total_counts 182 }, 183 beforeSend: function( data ){ 184 append_to.append( '<span class="et_social_placeholder"></span>' ); 185 }, 186 success: function( data ){ 187 append_to.find( 'span.et_social_placeholder' ).remove(); 188 append_to.append( data ); 189 } 190 }); 191 } 192 193 if ( $( '.et_social_display_follow_counts' ).length ) { 194 $( '.et_social_display_follow_counts' ).each( function(){ 195 append_follow_counts( $( this) ); 196 }); 197 } 198 199 if ( $( '.et_social_follow_total' ).length ) { 200 $( '.et_social_follow_total' ).each( function(){ 201 append_total_follows( $( this) ); 202 }); 203 } 204 205 206 if ( $( '.et_social_total_share' ).length ) { 207 $( '.et_social_total_share' ).each( function(){ 208 append_total_shares( $( this) ); 209 }); 210 } 211 212 if ( $( '.et_social_display_count' ).length ) { 213 $( '.et_social_display_count' ).each( function(){ 214 append_share_counts( $( this) ); 215 }); 216 } 217 218 if ( $( '.et_social_media_wrapper' ).length && $( '.et_social_media_wrapper .et_social_totalcount' ).length ) { 219 220 $( '.et_social_media_wrapper' ).each( function() { 221 update_total_media_shares( $( this ) ); 222 }); 223 } 224 225 if ( $( '.et_social_media_wrapper' ).length && $( '.et_social_media_wrapper .et_social_withcounts' ).length ) { 226 227 $( '.et_social_media_wrapper .et_social_share' ).each( function() { 228 var this_el = $( this ), 229 media_url = this_el.closest( '.et_social_media_wrapper' ).find('img').attr('src'), 230 post_id = this_el.data( 'post_id' ), 231 social_network = this_el.data( 'social_name' ); 232 233 update_single_shares( this_el, media_url, post_id, social_network, 'media' ); 234 235 }); 236 } 237 238 function update_total_media_shares( $element ) { 239 if ( $( '.et_social_totalcount' ).length ) { 240 var this_el = $element, 241 media_url = this_el.find( 'img' ).attr( 'src' ), 242 post_id = this_el.find( '.et_social_share' ).first().data( 'post_id' ), 243 media_data = JSON.stringify({ 'media_url' : media_url, 'post_id' : post_id }); 244 245 $.ajax({
246 type: 'POST', 247 url: monarchSettings.ajaxurl, 248 data: { 249 action : 'get_media_shares_total', 250 media_total : media_data, 251 get_media_shares_total_nonce : monarchSettings.media_total 252 }, 253 success: function( data ){ 254 this_el.find( '.et_social_totalcount_count' ).empty().append( data ); 255 } 256 }); 257 } 258 } 259 260 function update_single_shares( $this_el, $media_url, $post_id, $network, $action ) { 261 if( $( '.et_social_withcounts' ).length ) { 262 var media_data = JSON.stringify({ 'media_url' : $media_url, 'post_id' : $post_id, 'network' : $network, 'action' : $action }); 263 $.ajax({ 264 type: 'POST', 265 url: monarchSettings.ajaxurl, 266 data: { 267 action : 'get_shares_single', 268 media_single : media_data, 269 get_media_shares_nonce : monarchSettings.media_single 270 }, 271 success: function( data ){ 272 $this_el.find( '.et_social_count span' ).not('.et_social_count_label').empty().append( data ); 273 } 274 }); 275 } 276 } 277 278 function setCookieExpire(days) { 279 280 var ms = days*24*60*60*1000; 281 282 var date = new Date(); 283 date.setTime(date.getTime() + ms); 284 285 return "; expires=" + date.toUTCString(); 286 } 287 288 function checkCookieValue(cookieName, value) { 289 return parseCookies()[cookieName] === value; 290 } 291 292 function parseCookies() { 293 var cookies = document.cookie.split('; '); 294 295 var ret = {}; 296 for (var i = cookies.length - 1; i >= 0; i--) { 297 var el = cookies[i].split('='); 298 ret[el[0]] = el[1]; 299 } 300 return ret; 301 } 302 303 function set_cookie( $expire ) { 304 cookieExpire = setCookieExpire( $expire ); 305 document.cookie = 'etSocialCookie=true' + cookieExpire; 306 } 307 308 //separate function for the setTimeout to make it work properly within the loop. 309 function make_popup_visible( $popup, $delay ){ 310 setTimeout( function() { 311 $popup.addClass( 'et_social_visible et_social_animated' ); 312 if ( $( '.et_social_resize' ).length ) { 313 $( '.et_social_resize' ).each( function() { 314 define_popup_position( $( this ) ); 315 }); 316 } 317 }, $delay ); 318 } 319 320 function auto_popup( this_el, delay ) { 321 var $current_popup_auto = this_el; 322 if ( ! $current_popup_auto.hasClass( 'et_social_animated' ) ) { 323 var $cookies_expire_auto = $current_popup_auto.data( 'cookie_duration' ) ? $current_popup_auto.data( 'cookie_duration' ) : false, 324 $delay = delay; 325 326 if ( ( false !== $cookies_expire_auto && ! checkCookieValue( 'etSocialCookie', 'true' ) ) || false == $cookies_expire_auto ) { 327 328 make_popup_visible ( $current_popup_auto, $delay ); 329 330 if ( false !== $cookies_expire_auto ) { 331 set_cookie( $cookies_expire_auto ); 332 } 333 } 334 } 335 } 336 337 if ( 'true' == get_url_parameter( 'et_monarch_popup' ) ) { 338 $( '.et_social_after_comment' ).each( function() { 339 var $current_popup = $( this ); 340 auto_popup( $current_popup, 0 ); 341 }); 342 } 343 344 if( $( '.et_social_auto_popup' ).length ) { 345 $( '.et_social_auto_popup' ).each( function() { 346 var $current_popup_auto = $( this ); 347 auto_popup( $current_popup_auto, '' !== $current_popup_auto.data( 'delay' ) ? $current_popup_auto.data( 'delay' ) * 1000 : 0 ); 348 }); 349 } 350 351 $( '.et_social_pinterest_window .et_social_close' ).on( 'click', function(){ 352 $( '.et_social_pin_images_outer' ).fadeToggle( 400 ); 353 }); 354 355 $ ( 'body' ).on( 'click', '.et_social_icon_cancel', function(){ 356 var this_el = $( this ); 357 if ( this_el.parent().hasClass( 'et_social_flyin' ) ) { 358 $popup = this_el.parent(); 359 } else { 360 $popup = this_el.parent().parent(); 361 362 if ( $popup.hasClass( 'et_social_all_networks_popup' ) ) { 363 all_networks_opened = 0; 364 } 365 } 366 367 $popup.addClass( 'et_social_fadeout' ); 368 369 setTimeout( function() { 370 $popup.remove(); 371 }, 800 ); 372 return false; 373 }); 374 375 if ( $( '.et_monarch_after_order' ).length ) { 376 $( '.et_social_after_purchase' ).each( function() { 377 var $current_popup = $( this ); 378 if ( ! $current_popup.hasClass( 'et_social_animated' ) ) { 379 var $cookies_expire = $current_popup.data( 'cookie_duration' ) ? $current_popup.data( 'cookie_duration' ) : false, 380 $delay = 0; 381 382 if ( ( false !== $cookies_expire && ! checkCookieValue( 'etSocialCookie', 'true' ) ) || false == $cookies_expire ) { 383 384 make_popup_visible ( $current_popup, $delay ); 385 386 if ( false !== $cookies_expire ) { 387 set_cookie( $cookies_expire ); 388 } 389 } 390 } 391 } ); 392 } 393 394 if( $( '.et_social_trigger_bottom' ).length ) { 395 396 $( '.et_social_trigger_bottom' ).each(function(){ 397 scroll_trigger( $( this ), true ); 398 }); 399 400 } 401 402 if( $( '.et_social_scroll' ).length ) { 403 404 $( '.et_social_scroll' ).each(function(){ 405 scroll_trigger( $( this ), false ); 406 }); 407 408 } 409 410 function scroll_trigger( this_el, is_bottom_trigger ) { 411 var current_popup_bottom = this_el; 412 if ( ! current_popup_bottom.hasClass( 'et_social_animated' ) ) { 413 var cookies_expire_bottom = current_popup_bottom.data( 'cookie_duration' ) ? current_popup_bottom.data( 'cookie_duration' ) : false; 414 415 if ( true == is_bottom_trigger ) { 416 var scroll_trigger = $( '.et_social_bottom_trigger' ).length ? $( '.et_social_bottom_trigger' ).offset().top : $( document ).height() - 500; 417 } else { 418 var scroll_pos = this_el.data( 'scroll_pos' ) > 100 ? 100 : this_el.data( 'scroll_pos' ), 419 scroll_trigger = 100 == scroll_pos ? $( document ).height() - 10 : $( document ).height() * scroll_pos / 100; 420 } 421 422 $( window ).scroll( function(){ 423 if ( ( false !== cookies_expire_bottom && ! checkCookieValue( 'etSocialCookie', 'true' ) ) || false == cookies_expire_bottom ) { 424 if( $( window ).scrollTop() + $( window ).height() > scroll_trigger ) { 425 current_popup_bottom.addClass( 'et_social_visible et_social_animated' ); 426 if ( $( '.et_social_resize' ).length ) { 427 $( '.et_social_resize' ).each( function() { 428 define_popup_position( $( this ) ); 429 });
430 } 431 if ( false !== cookies_expire_bottom ) { 432 set_cookie( cookies_expire_bottom ); 433 } 434 } 435 } 436 }); 437 } 438 } 439 440 if( $( '.et_social_trigger_idle' ).length ) { 441 $( '.et_social_trigger_idle' ).each( function() { 442 var this_el = $( this ); 443 444 if ( ! this_el.hasClass( 'et_social_animated' ) ) { 445 var $cookies_expire_idle = this_el.data( 'cookie_duration' ) ? this_el.data( 'cookie_duration' ) : false, 446 $idle_timeout = '' !== this_el.data( 'idle_timeout' ) ? this_el.data( 'idle_timeout' ) * 1000 : 30000; 447 448 if ( ( false !== $cookies_expire_idle && ! checkCookieValue( 'etSocialCookie', 'true' ) ) || false == $cookies_expire_idle ) { 449 $( document ).idleTimer( $idle_timeout ); 450 451 $( document ).on( "idle.idleTimer", function(){ 452 make_popup_visible ( this_el, 0 ); 453 }); 454 455 if ( false !== $cookies_expire_idle ) { 456 set_cookie( $cookies_expire_idle ); 457 } 458 } 459 } 460 }); 461 } 462 463 // open close the mobile sideabr on header click 464 $( '.et_social_heading, .et_social_mobile_button' ).click( function(){ 465 $this_mobile_div = $( '.et_social_mobile' ); 466 467 $this_mobile_div.css( {'display' : 'block' } ); 468 $( '.et_social_mobile_button').removeClass( 'et_social_active_button' ); 469 470 if ( $this_mobile_div.hasClass( 'et_social_opened' ) ) { 471 $this_mobile_div.find( '.et_social_networks' ).slideToggle( 600 ); 472 $this_mobile_div.removeClass( 'et_social_opened' ).addClass( 'et_social_closed' ); 473 $( '.et_social_mobile_overlay' ).removeClass( 'et_social_visible_overlay' ); 474 $( '.et_social_mobile_overlay' ).fadeToggle( 600 ); 475 } else { 476 $this_mobile_div.removeClass( 'et_social_closed' ).addClass( 'et_social_opened' ); 477 $this_mobile_div.find( '.et_social_networks' ).slideToggle( 600 ); 478 $( '.et_social_mobile_overlay' ).addClass( 'et_social_visible_overlay' ).css({ 'display' : 'block' }); 479 } 480 }); 481 482 //if close button clicked - hide the mobile sidebar from screen 483 $( '.et_social_mobile .et_social_close' ).click( function(){ 484 $mobile_div = $( '.et_social_mobile' ); 485 $mobile_div.fadeToggle( 600 ); 486 $( '.et_social_mobile_button' ).addClass( 'et_social_active_button' ); 487 488 if ( $mobile_div.hasClass( 'et_social_opened' ) ) { 489 $( '.et_social_mobile_overlay' ).fadeToggle( 600 ); 490 $mobile_div.removeClass( 'et_social_opened' ); 491 $mobile_div.find( '.et_social_networks' ).fadeToggle( 600 ); 492 } 493 494 }); 495 496 // Move inline icons into appropriate sections in Divi theme 497 if( $( '.et_social_inline' ).length ) { 498 if ( $( 'body' ).hasClass( 'et_pb_pagebuilder_layout' ) ) { 499 var top_inline = $( '.et_social_inline_top' ), 500 bottom_inline = $( '.et_social_inline_bottom' ), 501 divi_container = '<div class="et_pb_row"><div class="et_pb_column et_pb_column_4_4"></div></div>'; 502 503 if ( top_inline.length ) { 504 $( '.et_pb_section' ).not( '.et_pb_fullwidth_section' ).first().prepend( divi_container ).find( '.et_pb_row' ).first().find( '.et_pb_column' ).append( top_inline ); 505 } 506 507 if ( bottom_inline.length ) { 508 $( '.et_pb_section' ).not( '.et_pb_fullwidth_section' ).last().append( divi_container ).find( '.et_pb_row' ).last().find( '.et_pb_column' ).append( bottom_inline ); 509 } 510 } 511 } 512 513 function define_popup_position( $this_popup ) { 514 setTimeout( function() { // make sure all css transitions are finished to calculate the heights correctly 515 var this_popup = $this_popup, 516 networks_div = this_popup.find( '.et_social_networks' ), 517 header_height = this_popup.find( '.et_social_header' ).outerHeight(), 518 total_count_height = this_popup.find( '.et_social_totalcount' ).height(), 519 extra_height = 0 < total_count_height ? 20 : 0; 520 521 this_popup.height( this_popup.find( '.et_social_icons_container' ).innerHeight() + header_height + total_count_height + 20 + extra_height ); 522 523 var popup_max_height = this_popup.hasClass( 'et_social_popup_content' ) ? $( window ).height() : $( window ).height() - 60; 524 525 if ( this_popup.hasClass( 'et_social_popup_content' ) && 768 < $( window ).width() ) { 526 popup_max_height = popup_max_height - 50; 527 } 528 529 this_popup.css( { 'max-height' : popup_max_height } ); 530 531 if( this_popup.hasClass( 'et_social_popup_content' ) ) { 532 var top_position = $( window ).height() / 2 - this_popup.innerHeight() / 2; 533 this_popup.css( { 'top' : top_position + 'px' } ); 534 } 535 536 var networks_div_height = this_popup.height() - header_height + total_count_height - extra_height; 537 networks_div.height( networks_div_height ); 538 }, 400 ); 539 } 540 541 function set_mobile_sidebar_height() { 542 setTimeout( function() { // make sure all css transitions are finished to calculate the heights correctly 543 var mobile_div = $( '.et_social_mobile' ); 544 545 if ( !mobile_div.hasClass( 'et_social_opened' ) ){ 546 $('.et_social_mobile .et_social_networks').css({'display' : 'block'});
547 } 548 if( $('.et_social_active_button').length ) { 549 mobile_div.css({'display' : 'block'}); 550 } 551 552 var inner_contatiner_height = mobile_div.find( '.et_social_icons_container' ).innerHeight() + 45; 553 554 if ( !mobile_div.hasClass( 'et_social_opened' ) ){ 555 $('.et_social_mobile .et_social_networks').css({'display' : 'none'}); 556 } 557 if( $('.et_social_active_button').length ) { 558 mobile_div.css({'display' : 'none'}); 559 } 560 561 mobile_div.find( '.et_social_networks' ).css( { 'max-height' : inner_contatiner_height, 'height' : inner_contatiner_height } ); 562 if ( $( window ).height() < inner_contatiner_height ) { 563 var inner_height = $( window ).height() - mobile_div.find( '.et_social_heading' ).innerHeight() + 10; 564 mobile_div.find( '.et_social_networks' ).css({ 'height' : inner_height }); 565 } 566 }, 400 ); 567 } 568 569 function set_sidebar_position(){ 570 if( $( '.et_social_sidebar_networks' ).length ){ 571 var this_sidebar = $( '.et_social_sidebar_networks' ), 572 top_position = $( window ).height() / 2 - this_sidebar.innerHeight() / 2; 573 top_position = 0 > top_position ? 0 : top_position; 574 this_sidebar.css( { 'top' : top_position + 'px' } ); 575 } 576 } 577 578 function set_media_wrapper_size() { 579 if ( $( '.et_social_media_wrapper' ).length ) { 580 $( '.et_social_media_wrapper' ).each( function(){ 581 var this_wrapper = $( this ), 582 this_wrapper_media = this_wrapper.find( '.et_social_media' ), 583 this_image = this_wrapper.find( 'img' ), 584 this_image_height = this_image.height(), 585 this_image_width = this_image.width(); 586 587 this_wrapper.addClass( this_image.attr( 'class' ) ); 588 this_wrapper_media.height( this_image_height ); 589 this_wrapper_media.width( this_image_width - 80 ); 590 }); 591 } 592 } 593 594 $ ( 'body' ).on( 'click', '.et_social_open_all', function() { 595 all_networks_opened++; 596 if ( 1 == all_networks_opened ) { 597 var this_button = $( this ), 598 page_id = this_button.data( 'page_id' ), 599 permalink = this_button.data( 'permalink' ), 600 title = this_button.data( 'title' ), 601 media = typeof this_button.data( 'media' ) !== 'undefined' ? this_button.data( 'media' ) : '', 602 is_popup = 'popup' == this_button.data( 'location' ) ? 'true' : 'false'; 603 604 $.ajax({
605 type: 'POST', 606 url: monarchSettings.ajaxurl, 607 data: { 608 action : 'generate_all_networks_popup', 609 all_networks_page_id : page_id, 610 all_networks_link : permalink, 611 all_networks_title : title, 612 all_networks_media : media, 613 is_popup : is_popup, 614 generate_all_window_nonce : monarchSettings.generate_all_window_nonce 615 }, 616 success: function( data ) { 617 if ( 'false' == is_popup ) { 618 $( 'body' ).append( data ); 619 make_popup_visible( $( '.et_social_all_networks_popup' ), 1 ); 620 } else { 621 var popup_container = this_button.parent().closest( '.et_social_popup_content' ); 622 623 this_button.parent().replaceWith( data ); 624 define_popup_position( popup_container ); 625 all_networks_opened = 0; 626 } 627 } 628 }); 629 } 630 631 return false; 632 }); 633 634 set_mobile_sidebar_height(); 635 636 set_sidebar_position(); 637 638 $( window ).resize( function(){ 639 if ( $( '.et_social_resize' ).length ) { 640 $( '.et_social_resize' ).each( function() { 641 define_popup_position( $( this ) ); 642 }); 643 } 644 if ( $('.et_social_mobile') ) { 645 set_mobile_sidebar_height(); 646 } 647 if( $( '.et_social_sidebar_networks' ).length ){ 648 set_sidebar_position(); 649 } 650 651 set_media_wrapper_size(); 652 }); 653 654 $( '.et_social_hide_sidebar' ).click( function(){ 655 $( '.et_social_hide_sidebar' ).toggleClass( 'et_social_hidden_sidebar' ); 656 $( '.et_social_sidebar_networks' ).toggleClass( 'et_social_hidden_sidebar et_social_visible_sidebar' ); 657 }); 658 659 $( window ).load( function(){ 660 set_media_wrapper_size(); 661 662 if ( $( '.et_social_pin_images' ).length && ( $( '.et_social_all_button' ).length || $( '.et_social_pinterest' ).length ) ) { 663 var pin_container = $( '.et_social_pin_images' ), 664 permalink = pin_container.data( 'permalink' ), 665 title = pin_container.data( 'title' ), 666 post_id = pin_container.data( 'post_id' ), 667 $i = 0; 668 669 $( 'img' ).each( function(){ 670 //do not include comment avatars into the Modal 671 if ( ! $( this ).hasClass( 'avatar' ) ) { 672 var this_img = $( this ).attr( 'src' ), 673 this_alt = $( this ).attr( 'alt' ); 674 675 if ( '' != this_img ) { 676 var pin_link = 'http://www.pinterest.com/pin/create/button/?url=' + permalink + '&media=' + this_img + '&description=' + title, 677 this_img_container = '<div class="et_social_pin_image"><a href="' + pin_link + '" rel="nofollow" class="et_social_icon et_social_share" data-social_name="pinterest" data-post_id="' + post_id + '" data-social_type="share"><img src="' + this_img + '" alt="' + this_alt + '"/><span class="et_social_pin_overlay et_social_icon"></span></a></div>'; 678 $( '.et_social_pin_images' ).append( this_img_container ); 679 $i++; 680 } 681 } 682 }); 683 684 //Append error message if no images found on page 685 if ( 0 == $i ) { 686 $( '.et_social_pin_images' ).append( monarchSettings.no_img_message ); 687 } 688 } 689 }); 690 }); 691})(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.