PageSourceSearch

https://brambleberriesintherain.com/wp-content/plugins/jetpack/modules/sharedaddy/sharing.js?ver=3.7.2

js brambleberriesintherain.com collected 2026-10-02 14:15:29 UTC 17,455 bytes, 498 lines download raw bytes

1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
3{
4  let window = _____WB$wombat$assign$function_____("window");
5  let self = _____WB$wombat$assign$function_____("self");
6  let document = _____WB$wombat$assign$function_____("document");
7  let location = _____WB$wombat$assign$function_____("location");
8  let top = _____WB$wombat$assign$function_____("top");
9  let parent = _____WB$wombat$assign$function_____("parent");
10  let frames = _____WB$wombat$assign$function_____("frames");
11  let opener = _____WB$wombat$assign$function_____("opener");
12
13/* global WPCOM_sharing_counts, grecaptcha */
14var sharing_js_options;
15if ( sharing_js_options && sharing_js_options.counts ) {
16	var WPCOMSharing = {
17		done_urls : [],
18		twitter_count : {},
19		get_counts : function() {
20			var https_url, http_url, url, urls, id, service, service_url;
21
22			if ( 'undefined' === typeof WPCOM_sharing_counts ) {
23				return;
24			}
25
26			for ( url in WPCOM_sharing_counts ) {
27				id = WPCOM_sharing_counts[ url ];
28
29				if ( 'undefined' !== typeof WPCOMSharing.done_urls[ id ] ) {
30					continue;
31				}
32
33				// get both the http and https version of these URLs
34				https_url = url.replace( /^http:\/\//i, 'https://' );
35				http_url  = url.replace( /^https:\/\//i, 'http://' );
36
37				urls = {
38					twitter: [
39						'https://cdn.api.twitter.com/1/urls/count.json?callback=WPCOMSharing.update_twitter_count&url=' +
40							encodeURIComponent( http_url ),
41						'https://cdn.api.twitter.com/1/urls/count.json?callback=WPCOMSharing.update_twitter_count&url=' +
42							encodeURIComponent( https_url )
43					],
44					// LinkedIn actually gets the share count for both the http and https version automatically -- so we don't need to do extra magic
45					linkedin: [
46							'https://www.linkedin.com/countserv/count/share?format=jsonp&callback=WPCOMSharing.update_linkedin_count&url=' +
47							encodeURIComponent( url )
48					],
49					// Pinterest, like LinkedIn, handles share counts for both http and https
50					pinterest: [
51						window.location.protocol +
52							'http://api.pinterest.com/v1/urls/count.json?callback=WPCOMSharing.update_pinterest_count&url=' +
53							encodeURIComponent( url )
54					],
55					// Facebook protocol summing has been shown to falsely double counts, so we only request the current URL
56					facebook: [
57						window.location.protocol +
58							'http://graph.facebook.com/?callback=WPCOMSharing.update_facebook_count&ids=' +
59							encodeURIComponent( url )
60					]
61				};
62
63				for ( service in urls ) {
64					if ( ! jQuery( 'a[data-shared=sharing-' + service + '-' + id  + ']' ).length ) {
65						continue;
66					}
67
68					while ( ( service_url = urls[ service ].pop() ) ) {
69						jQuery.getScript( service_url );
70					}
71
72					WPCOMSharing.bump_sharing_count_stat( service );
73				}
74
75				WPCOMSharing.done_urls[ id ] = true;
76			}
77		},
78
79		// get the version of the url that was stored in the dom (sharing-$service-URL)
80		get_permalink: function( url ) {
81			var rxTrailingSlash, formattedSlashUrl;
82
83			if ( 'https:' === window.location.protocol ) {
84				url = url.replace( /^http:\/\//i, 'https://' );
85			} else {
86				url = url.replace( /^https:\/\//i, 'http://' );
87			}
88
89			// Some services (e.g. Twitter) canonicalize the URL with a trailing
90			// slash. We can account for this by checking whether either format
91			// exists as a known URL
92			if ( ! ( url in WPCOM_sharing_counts ) ) {
93				rxTrailingSlash = /\/$/,
94				formattedSlashUrl = rxTrailingSlash.test( url ) ?
95					url.replace( rxTrailingSlash, '' ) : url + '/';
96
97				if ( formattedSlashUrl in WPCOM_sharing_counts ) {
98					url = formattedSlashUrl;
99				}
100			}
101
102			return url;
103		},
104		update_facebook_count: function( data ) {
105			var url, permalink;
106
107			if ( ! data ) {
108				return;
109			}
110
111			for ( url in data ) {
112				if ( ! data.hasOwnProperty( url ) || ! data[ url ].shares ) {
113					continue;
114				}
115
116				permalink = WPCOMSharing.get_permalink( url );
117
118				if ( ! ( permalink in WPCOM_sharing_counts ) ) {
119					continue;
120				}
121
122				WPCOMSharing.inject_share_count( 'sharing-facebook-' + WPCOM_sharing_counts[ permalink ], data[ url ].shares );
123			}
124		},
125		update_twitter_count : function( data ) {
126			if ( 'number' === typeof data.count ) {
127				var permalink = WPCOMSharing.get_permalink( data.url );
128
129				if ( ! WPCOMSharing.twitter_count[ permalink ] ) {
130					WPCOMSharing.twitter_count[ permalink ] = 0;
131				}
132
133				WPCOMSharing.twitter_count[ permalink ] += data.count;
134
135				if ( WPCOMSharing.twitter_count[ permalink ] > 0 ) {
136					WPCOMSharing.inject_share_count( 'sharing-twitter-' + WPCOM_sharing_counts[ permalink ], WPCOMSharing.twitter_count[ permalink ] );
137				}
138			}
139		},
140		update_linkedin_count : function( data ) {
141			if ( 'undefined' !== typeof data.count && ( data.count * 1 ) > 0 ) {
142				WPCOMSharing.inject_share_count( 'sharing-linkedin-' + WPCOM_sharing_counts[ data.url ], data.count );
143			}
144		},
145		update_pinterest_count : function( data ) {
146			if ( 'undefined' !== typeof data.count && ( data.count * 1 ) > 0 ) {
147				WPCOMSharing.inject_share_count( 'sharing-pinterest-' + WPCOM_sharing_counts[ data.url ], data.count );
148			}
149		},
150		inject_share_count : function( id, count ) {
151			var $share = jQuery( 'a[data-shared=' + id + '] > span');
152			$share.find( '.share-count' ).remove();
153			$share.append( '<span class="share-count">' + WPCOMSharing.format_count( count ) + '</span>' );
154		},
155		format_count : function( count ) {
156			if ( count < 1000 ) {
157				return count;
158			}
159			if ( count >= 1000 && count < 10000 ) {
160				return String( count ).substring( 0, 1 ) + 'K+';
161			}
162			return '10K+';
163		},
164		bump_sharing_count_stat: function( service ) {
165			new Image().src = document.location.protocol + 'http://pixel.wp.com/g.gif?v=wpcom-no-pv&x_sharing-count-request=' + service + '&r=' + Math.random();
166		}
167	};
168}
169
170(function($){
171	var $body, $sharing_email;
172
173	$.fn.extend( {
174		share_is_email: function() {
175			return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test( this.val() );
176		}
177	} );
178
179	$body = $( document.body ).on( 'post-load', WPCOMSharing_do );
180	$( document ).on( 'ready', function() {
181		$sharing_email = $( '#sharing_email' );
182		$body.append( $sharing_email );
183		WPCOMSharing_do();
184	} );
185
186	function WPCOMSharing_do() {
187		var $more_sharing_buttons;
188		if ( 'undefined' !== typeof WPCOMSharing ) {
189			WPCOMSharing.get_counts();
190		}
191		$more_sharing_buttons = $( '.sharedaddy a.sharing-anchor' );
192
193		$more_sharing_buttons.click( function() {
194			return false;
195		} );
196
197		$( '.sharedaddy a' ).each( function() {
198			if ( $( this ).attr( 'href' ) && $( this ).attr( 'href' ).indexOf( 'share=' ) !== -1 ) {
199				$( this ).attr( 'href', $( this ).attr( 'href' ) + '&nb=1' );
200			}
201		} );
202
203		// Show hidden buttons
204
205		// Touchscreen device: use click.
206		// Non-touchscreen device: use click if not already appearing due to a hover event
207		$more_sharing_buttons.on( 'click', function() {
208			var $more_sharing_button = $( this ),
209				$more_sharing_pane = $more_sharing_button.parents( 'div:first' ).find( '.inner' );
210
211			if ( $more_sharing_pane.is( ':animated' ) ) {
212				// We're in the middle of some other event's animation
213				return;
214			}
215
216			if ( true === $more_sharing_pane.data( 'justSlid' ) ) {
217				// We just finished some other event's animation - don't process click event so that slow-to-react-clickers don't get confused
218				return;
219			}
220
221			$sharing_email.slideUp( 200 );
222
223			$more_sharing_pane.css( {
224				left: $more_sharing_button.position().left + 'px',
225				top: $more_sharing_button.position().top + $more_sharing_button.height() + 3 + 'px'
226			} ).slideToggle( 200 );
227		} );
228
229		if ( document.ontouchstart === undefined ) {
230			// Non-touchscreen device: use hover/mouseout with delay
231			$more_sharing_buttons.hover( function() {
232				var $more_sharing_button = $( this ),
233					$more_sharing_pane = $more_sharing_button.parents( 'div:first' ).find( '.inner' ),
234					timer;
235
236				if ( ! $more_sharing_pane.is( ':animated' ) ) {
237					// Create a timer to make the area appear if the mouse hovers for a period
238					timer = setTimeout( function() {
239						var handler_item_leave, handler_item_enter, handler_original_leave, handler_original_enter, close_it;
240
241						$sharing_email.slideUp( 200 );
242
243						$more_sharing_pane.data( 'justSlid', true );
244						$more_sharing_pane.css( {
245							left: $more_sharing_button.position().left + 'px',
246							top: $more_sharing_button.position().top + $more_sharing_button.height() + 3 + 'px'
247						} ).slideDown( 200, function() {
248							// Mark the item as have being appeared by the hover
249							$more_sharing_button.data( 'hasoriginal', true ).data( 'hasitem', false );
250
251							setTimeout( function() {
252								$more_sharing_pane.data( 'justSlid', false );
253							}, 300 );
254
255							if ( $more_sharing_pane.find( '.share-google-plus-1' ).size() ) {
256								// The pane needs to stay open for the Google+ Button
257								return;
258							}
259
260							$more_sharing_pane.mouseleave( handler_item_leave ).mouseenter( handler_item_enter );
261							$more_sharing_button.mouseleave( handler_original_leave ).mouseenter( handler_original_enter );
262						} );
263
264						// The following handlers take care of the mouseenter/mouseleave for the share button and the share area - if both are left then we close the share area
265						handler_item_leave = function() {
266							$more_sharing_button.data( 'hasitem', false );
267
268							if ( $more_sharing_button.data( 'hasoriginal' ) === false ) {
269								var timer = setTimeout( close_it, 800 );
270								$more_sharing_button.data( 'timer2', timer );
271							}
272						};
273
274						handler_item_enter = function() {
275							$more_sharing_button.data( 'hasitem', true );
276							clearTimeout( $more_sharing_button.data( 'timer2' ) );
277						};
278
279						handler_original_leave = function() {
280							$more_sharing_button.data( 'hasoriginal', false );
281
282							if ( $more_sharing_button.data( 'hasitem' ) === false ) {
283								var timer = setTimeout( close_it, 800 );
284								$more_sharing_button.data( 'timer2', timer );
285							}
286						};
287
288						handler_original_enter = function() {
289							$more_sharing_button.data( 'hasoriginal', true );
290							clearTimeout( $more_sharing_button.data( 'timer2' ) );
291						};
292
293						close_it = function() {
294							$more_sharing_pane.data( 'justSlid', true );
295							$more_sharing_pane.slideUp( 200, function() {
296								setTimeout( function() {
297									$more_sharing_pane.data( 'justSlid', false );
298								}, 300 );
299							} );
300
301							// Clear all hooks
302							$more_sharing_button.unbind( 'mouseleave', handler_original_leave ).unbind( 'mouseenter', handler_original_enter );
303							$more_sharing_pane.unbind( 'mouseleave', handler_item_leave ).unbind( 'mouseenter', handler_item_leave );
304							return false;
305						};
306					}, 200 );
307
308					// Remember the timer so we can detect it on the mouseout
309					$more_sharing_button.data( 'timer', timer );
310				}
311			}, function() {
312				// Mouse out - remove any timer
313				$more_sharing_buttons.each( function() {
314					clearTimeout( $( this ).data( 'timer' ) );
315				} );
316				$more_sharing_buttons.data( 'timer', false );
317			} );
318		}
319
320		$( document ).click(function() {
321
322			// Click outside
323			// remove any timer
324			$more_sharing_buttons.each( function() {
325				clearTimeout( $( this ).data( 'timer' ) );
326			} );
327			$more_sharing_buttons.data( 'timer', false );
328
329			// slide down forcibly
330			$( '.sharedaddy .inner' ).slideUp();
331
332		});
333
334		// Add click functionality
335		$( '.sharedaddy ul' ).each( function() {
336
337			if ( 'yep' === $( this ).data( 'has-click-events' ) ) {
338				return;
339			}
340			$( this ).data( 'has-click-events', 'yep' );
341
342			var printUrl = function ( uniqueId, urlToPrint ) {
343				$( 'body:first' ).append( '<iframe style="position:fixed;top:100;left:100;height:1px;width:1px;border:none;" id="printFrame-' + uniqueId + '" name="printFrame-' + uniqueId + '" src="' + urlToPrint + '" onload="frames[\'printFrame-' + uniqueId + '\'].focus();frames[\'printFrame-' + uniqueId + '\'].print();"></iframe>' );
344			};
345
346			// Print button
347			$( this ).find( 'a.share-print' ).click( function() {
348				var ref = $( this ).attr( 'href' ),
349					do_print = function() {
350						if ( ref.indexOf( '#print' ) === -1 ) {
351							var uid = new Date().getTime();
352							printUrl( uid , ref );
353						} else {
354							print();
355						}
356					};
357
358				// Is the button in a dropdown?
359				if ( $( this ).parents( '.sharing-hidden' ).length > 0 ) {
360					$( this ).parents( '.inner' ).slideUp( 0, function() {
361						do_print();
362					} );
363				} else {
364					do_print();
365				}
366
367				return false;
368			} );
369
370			// Press This button
371			$( this ).find( 'a.share-press-this' ).click( function() {
372				var s = '';
373
374				if ( window.getSelection ) {
375					s = window.getSelection();
376				} else if( document.getSelection ) {
377					s = document.getSelection();
378				} else if( document.selection ) {
379					s = document.selection.createRange().text;
380				}
381
382				if ( s ) {
383					$( this ).attr( 'href', $( this ).attr( 'href' ) + '&sel=' + encodeURI( s ) );
384				}
385
386				if ( !window.open( $( this ).attr( 'href' ), 't', 'toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570' ) ) {
387					document.location.href = $( this ).attr( 'href' );
388				}
389
390				return false;
391			} );
392
393			// Email button
394			$( 'a.share-email', this ).on( 'click', function() {
395				var url = $( this ).attr( 'href' );
396
397				if ( $sharing_email.is( ':visible' ) ) {
398					$sharing_email.slideUp( 200 );
399				} else {
400					$( '.sharedaddy .inner' ).slideUp();
401
402					$( '#sharing_email .response' ).remove();
403					$( '#sharing_email form' ).show();
404					$( '#sharing_email form input[type=submit]' ).removeAttr( 'disabled' );
405					$( '#sharing_email form a.sharing_cancel' ).show();
406
407					// Reset reCATPCHA if exists.
408					if ( 'object' === typeof grecaptcha && 'function' === typeof grecaptcha.reset ) {
409						grecaptcha.reset();
410					}
411
412					// Show dialog
413					$sharing_email.css( {
414						left: $( this ).offset().left + 'px',
415						top: $( this ).offset().top + $( this ).height() + 'px'
416					} ).slideDown( 200 );
417
418					// Hook up other buttons
419					$( '#sharing_email a.sharing_cancel' ).unbind( 'click' ).click( function() {
420						$( '#sharing_email .errors' ).hide();
421						$sharing_email.slideUp( 200 );
422						$( '#sharing_background' ).fadeOut();
423						return false;
424					} );
425
426					// Submit validation
427					$( '#sharing_email input[type=submit]' ).unbind( 'click' ).click( function() {
428						var form = $( this ).parents( 'form' );
429
430						// Disable buttons + enable loading icon
431						$( this ).prop( 'disabled', true );
432						form.find( 'a.sharing_cancel' ).hide();
433						form.find( 'img.loading' ).show();
434
435						$( '#sharing_email .errors' ).hide();
436						$( '#sharing_email .error' ).removeClass( 'error' );
437
438						if ( ! $( '#sharing_email input[name=source_email]' ).share_is_email() ) {
439							$( '#sharing_email input[name=source_email]' ).addClass( 'error' );
440						}
441
442						if ( ! $( '#sharing_email input[name=target_email]' ).share_is_email() ) {
443							$( '#sharing_email input[name=target_email]' ).addClass( 'error' );
444						}
445
446						if ( $( '#sharing_email .error' ).length === 0 ) {
447							// AJAX send the form
448							$.ajax( {
449								url: url,
450								type: 'POST',
451								data: form.serialize(),
452								success: function( response ) {
453									form.find( 'img.loading' ).hide();
454
455									if ( response === '1' || response === '2' || response === '3' ) {
456										$( '#sharing_email .errors-' + response ).show();
457										form.find( 'input[type=submit]' ).removeAttr( 'disabled' );
458										form.find( 'a.sharing_cancel' ).show();
459
460										if ( 'object' === typeof grecaptcha && 'function' === typeof grecaptcha.reset ) {
461											grecaptcha.reset();
462										}
463									}
464									else {
465										$( '#sharing_email form' ).hide();
466										$sharing_email.append( response );
467										$( '#sharing_email a.sharing_cancel' ).click( function() {
468											$sharing_email.slideUp( 200 );
469											$( '#sharing_background' ).fadeOut();
470											return false;
471										} );
472									}
473								}
474							} );
475
476							return false;
477						}
478
479						form.find( 'img.loading' ).hide();
480						form.find( 'input[type=submit]' ).removeAttr( 'disabled' );
481						form.find( 'a.sharing_cancel' ).show();
482						$( '#sharing_email .errors-1' ).show();
483
484						return false;
485					} );
486				}
487
488				return false;
489			} );
490		} );
491
492		$( 'li.share-email, li.share-custom a.sharing-anchor' ).addClass( 'share-service-visible' );
493	}
494})( jQuery );
495
496
497}
498

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.