PageSourceSearch

https://fastlifegarage.com/wp-content/themes/ovation/assets/js/vendor/fitie.js?ver=1.0.0

js fastlifegarage.com collected 2026-10-02 15:38:39 UTC 2,935 bytes, 101 lines download raw bytes

1/*!
2 * fitie.js - 1.0.0
3 * https://github.com/jonathantneal/fitie
4 *
5 * License: CC0-1.0
6 */
7this.fitie = function (node) {
8	// restrict to valid object-fit value
9	var objectFit = node.currentStyle['object-fit'];
10
11	if (!objectFit || !/^(contain|cover|fill)$/.test(objectFit)) return;
12
13	// prepare container styles
14	var outerWidth  = node.clientWidth;
15	var outerHeight = node.clientHeight;
16	var outerRatio  = outerWidth / outerHeight;
17
18	var name = node.nodeName.toLowerCase();
19
20	var setCSS = node.runtimeStyle;
21	var getCSS = node.currentStyle;
22
23	var addEventListener = node.addEventListener || node.attachEvent;
24	var removeEventListener = node.removeEventListener || node.detachEvent;
25	var on = node.addEventListener ? '' : 'on';
26	var img = name === 'img';
27	var type = img ? 'load' : 'loadedmetadata';
28
29	addEventListener.call(node, on + type, onload);
30
31	if (node.complete) onload();
32
33	function onload() {
34		removeEventListener.call(node, on + type, onload);
35
36		// prepare container styles
37		var imgCSS = {
38			boxSizing: 'content-box',
39			display:   'inline-block',
40			overflow:  'hidden'
41		};
42
43		'backgroundColor backgroundImage borderColor borderStyle borderWidth bottom fontSize lineHeight height left opacity margin position right top visibility width'.replace(/\w+/g, function (key) {
44			imgCSS[key] = getCSS[key];
45		});
46
47		// prepare image styles
48		setCSS.border = setCSS.margin = setCSS.padding = 0;
49		setCSS.display = 'block';
50		setCSS.height = setCSS.width = 'auto';
51		setCSS.opacity = 1;
52
53		var innerWidth  = node.videoWidth || node.width;
54		var innerHeight = node.videoHeight || node.height;
55		var innerRatio  = innerWidth / innerHeight;
56
57		// style container
58		var imgx = document.createElement('object-fit');
59
60		imgx.appendChild(node.parentNode.replaceChild(imgx, node));
61
62		for (var key in imgCSS) imgx.runtimeStyle[key] = imgCSS[key];
63
64		// style image
65		var newSize;
66
67		if (objectFit === 'fill') {
68			if (img) {
69				setCSS.width = outerWidth;
70				setCSS.height = outerHeight;
71			} else {
72				setCSS['-ms-transform-origin'] = '0% 0%';
73				setCSS['-ms-transform'] = 'scale(' + outerWidth / innerWidth + ',' + outerHeight / innerHeight + ')';
74			}
75		} else if (innerRatio < outerRatio ? objectFit === 'contain' : objectFit === 'cover') {
76			newSize = outerHeight * innerRatio;
77
78			setCSS.width  = Math.round(newSize) + 'px';
79			setCSS.height = outerHeight + 'px';
80			setCSS.marginLeft = Math.round((outerWidth - newSize) / 2) + 'px';
81		} else {
82			newSize = outerWidth / innerRatio;
83
84			setCSS.width  = outerWidth + 'px';
85			setCSS.height = Math.round(newSize) + 'px';
86			setCSS.marginTop = Math.round((outerHeight - newSize) / 2) + 'px';
87		}
88	}
89};
90this.fitie.init = function () {
91	if (document.body) {
92		var all = document.querySelectorAll('img,video');
93		var index = -1;
94
95		while (all[++index]) fitie(all[index]);
96	} else {
97		setTimeout(fitie.init);
98	}
99};
100
101if (/MSIE|Trident/.test(navigator.userAgent)) this.fitie.init();

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.