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