PageSourceSearch

https://www.ladiesagainstfeminism.com/_static/---eJzTLy/QTc7PK0nNK…XpCcn4vGBeqzz7U1NDMyNjI2Nzc0zgIASVwtEQ--.js

js ladiesagainstfeminism.com collected 2026-10-02 13:40:37 UTC 9,587 bytes, 307 lines download raw bytes

1( function () {
2	function TiledGalleryCollection() {
3		this.galleries = [];
4		this.findAndSetupNewGalleries();
5	}
6
7	TiledGalleryCollection.prototype.findAndSetupNewGalleries = function () {
8		var self = this;
9		var unresizedGalleries = document.querySelectorAll( '.tiled-gallery.tiled-gallery-unresized' );
10
11		Array.prototype.forEach.call( unresizedGalleries, function ( el ) {
12			self.galleries.push( new TiledGallery( el ) );
13		} );
14	};
15
16	TiledGalleryCollection.prototype.resizeAll = function () {
17		Array.prototype.forEach.call( this.galleries, function ( gallery ) {
18			gallery.resize();
19		} );
20	};
21
22	function TiledGallery( galleryElem ) {
23		this.gallery = galleryElem;
24
25		this.addCaptionEvents();
26
27		// Resize when initialized to fit the gallery to window dimensions
28		this.resize();
29
30		// Displays the gallery and prevents it from being initialized again
31		this.gallery.classList.remove( 'tiled-gallery-unresized' );
32	}
33
34	/**
35	 * Selector for all resizeable elements inside a Tiled Gallery
36	 */
37
38	TiledGallery.prototype.resizeableElementsSelector =
39		'.gallery-row, .gallery-group, .tiled-gallery-item img';
40
41	/**
42	 * Story
43	 */
44
45	TiledGallery.prototype.addCaptionEvents = function () {
46		// Hide captions
47		var galleryCaptions = this.gallery.querySelectorAll( '.tiled-gallery-caption' );
48		Array.prototype.forEach.call( galleryCaptions, function ( el ) {
49			el.style.display = 'none';
50		} );
51
52		var mouseHoverHandler = function ( e ) {
53			var itemEl = e.target.closest( '.tiled-gallery-item' );
54			var displayValue = 'mouseover' === e.type ? 'block' : 'none';
55
56			if ( itemEl ) {
57				var itemCaption = itemEl.querySelector( '.tiled-gallery-caption' );
58				if ( itemCaption ) {
59					itemCaption.style.display = displayValue;
60				}
61			}
62		};
63
64		// Add hover effects to bring the caption up and down for each item
65		this.gallery.addEventListener( 'mouseover', mouseHoverHandler );
66		this.gallery.addEventListener( 'mouseout', mouseHoverHandler );
67	};
68
69	TiledGallery.prototype.getExtraDimension = function ( el, attribute, mode ) {
70		if ( mode === 'horizontal' ) {
71			var left = attribute === 'border' ? 'borderLeftWidth' : attribute + 'Left';
72			var right = attribute === 'border' ? 'borderRightWidth' : attribute + 'Right';
73			return ( parseInt( el.style[ left ], 10 ) || 0 ) + ( parseInt( el.style[ right ], 10 ) || 0 );
74		} else if ( mode === 'vertical' ) {
75			var top = attribute === 'border' ? 'borderTopWidth' : attribute + 'Top';
76			var bottom = attribute === 'border' ? 'borderBottomWidth' : attribute + 'Bottom';
77			return ( parseInt( el.style[ top ], 10 ) || 0 ) + ( parseInt( el.style[ bottom ], 10 ) || 0 );
78		} else {
79			return 0;
80		}
81	};
82
83	TiledGallery.prototype.resize = function () {
84		// Resize everything in the gallery based on the ratio of the current content width
85		// to the original content width;
86		var originalWidth = parseInt( this.gallery.dataset.originalWidth, 10 );
87		var currentWidth = parseFloat(
88			getComputedStyle( this.gallery.parentNode, null ).width.replace( 'px', '' )
89		);
90		var resizeRatio = Math.min( 1, currentWidth / originalWidth );
91
92		var self = this;
93		var resizableElements = this.gallery.querySelectorAll( this.resizeableElementsSelector );
94		Array.prototype.forEach.call( resizableElements, function ( el ) {
95			var marginWidth = self.getExtraDimension( el, 'margin', 'horizontal' );
96			var marginHeight = self.getExtraDimension( el, 'margin', 'vertical' );
97
98			var paddingWidth = self.getExtraDimension( el, 'padding', 'horizontal' );
99			var paddingHeight = self.getExtraDimension( el, 'padding', 'vertical' );
100
101			var borderWidth = self.getExtraDimension( el, 'border', 'horizontal' );
102			var borderHeight = self.getExtraDimension( el, 'border', 'vertical' );
103
104			// Take all outer dimensions into account when resizing so that images
105			// scale with constant empty space between them
106			var outerWidth =
107				parseInt( el.dataset.originalWidth, 10 ) + paddingWidth + borderWidth + marginWidth;
108			var outerHeight =
109				parseInt( el.dataset.originalHeight, 10 ) + paddingHeight + borderHeight + marginHeight;
110
111			// Subtract margins so that images don't overflow on small browser windows
112			el.style.width = Math.floor( resizeRatio * outerWidth ) - marginWidth + 'px';
113			el.style.height = Math.floor( resizeRatio * outerHeight ) - marginHeight + 'px';
114		} );
115	};
116
117	/**
118	 * Resizing logic
119	 */
120
121	var requestAnimationFrame =
122		window.requestAnimationFrame ||
123		window.mozRequestAnimationFrame ||
124		window.webkitRequestAnimationFrame ||
125		window.msRequestAnimationFrame;
126
127	function attachResizeInAnimationFrames( tiledGalleries ) {
128		var resizing = false;
129		var resizeTimeout = null;
130
131		function handleFrame() {
132			tiledGalleries.resizeAll();
133			if ( resizing ) {
134				requestAnimationFrame( handleFrame );
135			}
136		}
137
138		window.addEventListener( 'resize', function () {
139			clearTimeout( resizeTimeout );
140
141			if ( ! resizing ) {
142				requestAnimationFrame( handleFrame );
143			}
144			resizing = true;
145			resizeTimeout = setTimeout( function () {
146				resizing = false;
147			}, 15 );
148		} );
149	}
150
151	function attachPlainResize( tiledGalleries ) {
152		window.addEventListener( 'resize', function () {
153			tiledGalleries.resizeAll();
154		} );
155	}
156
157	/**
158	 * Ready, set...
159	 */
160	function ready( fn ) {
161		if ( document.readyState !== 'loading' ) {
162			fn();
163		} else {
164			document.addEventListener( 'DOMContentLoaded', fn );
165		}
166	}
167	ready( function () {
168		var tiledGalleries = new TiledGalleryCollection();
169
170		document.body.addEventListener( 'is.post-load', function () {
171			tiledGalleries.findAndSetupNewGalleries();
172		} );
173
174		if ( typeof jQuery === 'function' ) {
175			jQuery( document ).on( 'page-rendered.wpcom-newdash', function () {
176				tiledGalleries.findAndSetupNewGalleries();
177			} );
178		}
179
180		// Chrome is a unique snow flake and will start lagging on occasion
181		// It helps if we only resize on animation frames
182		//
183		// For other browsers it seems like there is no lag even if we resize every
184		// time there is an event
185		if ( window.chrome && requestAnimationFrame ) {
186			attachResizeInAnimationFrames( tiledGalleries );
187		} else {
188			attachPlainResize( tiledGalleries );
189		}
190
191		if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
192			wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function ( placement ) {
193				if ( wp.isJetpackWidgetPlaced( placement, 'gallery' ) ) {
194					tiledGalleries.findAndSetupNewGalleries();
195				}
196			} );
197		}
198	} );
199} )();
200;
201( function () {
202	'use strict';
203
204	if ( typeof window.wpcom === 'undefined' ) {
205		window.wpcom = {};
206	}
207
208	if ( window.wpcom.carousel ) {
209		return;
210	}
211
212	var prebuilt_widths = jetpackCarouselStrings.widths;
213	var pageviews_stats_args = jetpackCarouselStrings.stats_query_args;
214
215	var findFirstLargeEnoughWidth = function ( original_w, original_h, dest_w, dest_h ) {
216		var inverse_ratio = original_h / original_w;
217
218		for ( var i = 0; i < prebuilt_widths.length; ++i ) {
219			if ( prebuilt_widths[ i ] >= dest_w || prebuilt_widths[ i ] * inverse_ratio >= dest_h ) {
220				return prebuilt_widths[ i ];
221			}
222		}
223
224		return original_w;
225	};
226
227	var removeResizeFromImageURL = function ( url ) {
228		return removeArgFromURL( url, 'resize' );
229	};
230
231	var removeArgFromURL = function ( url, arg ) {
232		var re = new RegExp( '[\\?&]' + arg + '(=[^?&]+)?' );
233		if ( url.match( re ) ) {
234			return url.replace( re, '' );
235		}
236		return url;
237	};
238
239	var addWidthToImageURL = function ( url, width ) {
240		width = parseInt( width, 10 );
241		// Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc)
242		if ( 'undefined' !== typeof window.devicePixelRatio && window.devicePixelRatio > 1 ) {
243			width = Math.round( width * window.devicePixelRatio );
244		}
245		url = addArgToURL( url, 'w', width );
246		url = addArgToURL( url, 'h', '' );
247		return url;
248	};
249
250	var addArgToURL = function ( url, arg, value ) {
251		var re = new RegExp( arg + '=[^?&]+' );
252		if ( url.match( re ) ) {
253			return url.replace( re, arg + '=' + value );
254		} else {
255			var divider = url.indexOf( '?' ) !== -1 ? '&' : '?';
256			return url + divider + arg + '=' + value;
257		}
258	};
259
260	var stat = function ( names ) {
261		if ( typeof names !== 'string' ) {
262			names = names.join( ',' );
263		}
264
265		new Image().src = window.location.protocol +
266			'https://pixel.wp.com/g.gif?v=wpcom-no-pv' +
267			'&x_carousel=' + names +
268			'&baba=' + Math.random();
269	};
270
271	var pageview = function ( post_id ) {
272		new Image().src = window.location.protocol +
273			'https://pixel.wp.com/g.gif?host=' + encodeURIComponent( window.location.host ) +
274			'&ref=' + encodeURIComponent( document.referrer ) +
275			'&rand=' + Math.random() +
276			'&' + pageviews_stats_args +
277			'&post=' + encodeURIComponent( post_id );
278	};
279
280	var generateImgSrc = function ( srcItem, max ) {
281		var origSize = srcItem.getAttribute( 'data-orig-size' ) || '';
282
283		var src = srcItem.getAttribute( 'src' ) || srcItem.getAttribute( 'original' ) || srcItem.getAttribute( 'data-original' ) || srcItem.getAttribute( 'data-lazy-src' );
284		if ( src.indexOf( 'imgpress' ) !== -1 ) {
285			src = srcItem.getAttribute( 'data-orig-file' );
286		}
287		// Square/Circle galleries use a resize param that needs to be removed.
288		src = removeResizeFromImageURL( src );
289		src = addWidthToImageURL(
290			src,
291			findFirstLargeEnoughWidth( origSize.width, origSize.height, max.width, max.height )
292		);
293
294		return src;
295	};
296
297	window.wpcom.carousel = {
298		findFirstLargeEnoughWidth: findFirstLargeEnoughWidth,
299		removeResizeFromImageURL: removeResizeFromImageURL,
300		addWidthToImageURL: addWidthToImageURL,
301		stat: stat,
302		pageview: pageview,
303		generateImgSrc: generateImgSrc
304	};
305
306} )();
307;

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.