PageSourceSearch

https://toponlinegunsmithingschools.com/wp-content/plugins/yuzo-re…/assets/js/jquery.equalizer.js?ver=5.12.18

js toponlinegunsmithingschools.com collected 2026-10-04 18:41:58 UTC 6,431 bytes, 199 lines download raw bytes

1/*
2	Equalizer v1.2.5
3
4	Original by Chris Coyier: http://css-tricks.com/equal-height-blocks-in-rows/
5	from an idea by Stephen Akins: http://stephenakins.blogspot.com/2011/01/uniform-div-heights-for-liquid-css-p.html
6	with ideas from Mike Avello: https://github.com/madmike1029/matchHeights
7	converted into a plugin with some improvements by Rob Garrison: https://github.com/Mottie
8*/
9/*jshint browser:true, jquery:true */
10;(function($){
11"use strict";
12$.equalizer = function(el, options){
13	var o, base = this;
14	base.$el = $(el);
15	base.$el.data("equalizer", base);
16
17	base.init = function(){
18		base.options = o = $.extend({}, $.equalizer.defaultOptions, options);
19
20		// save columns to equalize
21		base.$col = base.$el.find(o.columns);
22		var t = base.$col.find('.equalizer-inner').length;
23
24		// Setup sizes
25		o.min = parseInt(o.min, 10) || 0;
26		o.max = parseInt(o.max, 10) || 0;
27		base.hasMax = (o.max === 0) ? false : true;
28		base.hasMin = (o.min === 0) ? false : true;
29
30		base.curRowTop = 0; // current row offset top position
31		base.isEnabled = true; // plugin enabled
32
33		// height to use
34		base.useHeight = (/^o/.test(o.useHeight)) ? 'outerHeight' : /^i/.test(o.useHeight) ? 'innerHeight' : 'height';
35
36		if (!t) {
37			// wrap content with a span so we can always get the exact height of the content on resize
38			// the span must have display:block, or use a div
39			base.$col.wrapInner('<span class="equalizer-inner" style="display:block;" />');
40		}
41
42		// throttle window resize if option set
43		if (!t && o.resizeable) {
44			// throttled resize columns
45			$(window).resize(function(){
46				clearTimeout(base.throttle);
47				base.throttle = setTimeout(function(){
48					if (o.breakpoint) {
49						base.checkBreakpoint();
50					}
51					base.update();
52				}, 100);
53			});
54		}
55
56		// enable/disable method
57		base.$el
58			.unbind('enable.equalizer disable.equalizer')
59			.bind('enable.equalizer disable.equalizer', function(e){
60				base.enable(e.type === 'enable');
61			});
62
63		base.checkBreakpoint();
64		base.update();
65
66	};
67
68	base.checkBreakpoint = function(){
69		var w = o.breakpoint && base.$el.width() || 0;
70		if (w && w < o.breakpoint) {
71			base.suspend(false);
72		} else if (w && base.$el.hasClass(o.disabled) && w > o.breakpoint) {
73			base.suspend();
74		}
75	};
76
77	base.checkBoxSizing = function(){
78		var v = (function(version) {
79			version[0] = parseInt(version[0], 10);
80			return (version[0] > 1) || (version[0] === 1 && parseInt(version[1], 10) >= 8);
81		})($.fn.jquery.split("."));
82		if (v) { return false; }
83		// older versions of jQuery need padding added to the border box to get the correct height
84		var i, s = ['boxSizing', 'MozBoxSizing', 'WebkitBoxSizing', 'msBoxSizing'],
85			l = s.length;
86		for ( i = 0; i < l ; i++ ) {
87			if ( base.$col.css(s[i]) === 'border-box') {
88				return true;
89			}
90		}
91		return false;
92	};
93
94	base.update = function(){
95		if (base.$el.hasClass(o.disabled) || !base.isEnabled) { return; }
96
97		// if box-sizing is set to border-box, include the top/bottom padding from the parent.
98		base.hasBoxSizing = base.checkBoxSizing();
99		base.padding = (base.hasBoxSizing) ? parseInt(base.$col.css('padding-top'), 10) + parseInt(base.$col.css('padding-bottom'), 10) : 0;
100
101		base.curMax = o.min; // current max height
102
103		base.$col
104		.removeClass(o.overflow) // removed as it may have changed on resize
105		.each(function(){
106			var $this = $(this),
107				$el = $this.find('span.equalizer-inner');
108			// find offset (position relative to document)
109			base.curTop = $this.offset().top;
110
111			// Check for new row
112			if (base.curRowTop !== base.curTop) {
113				// New row, so check for max height first
114				if (base.hasMax && base.curMax > o.max) {
115					base.curMax = o.max;
116					base.curRows.addClass(o.overflow);
117				}
118				// New row found, set the heights of the previous row
119				// but ignore the row if not defined (very first element)
120				if (base.curRows) { base.curRows.height(base.curMax + base.padding); }
121				// Set the variables for the new row
122				base.curMax = $el[base.useHeight]();
123				base.curMax = (base.hasMin) ? Math.max(o.min, base.curMax) : base.curMax;
124				base.curRowTop = base.curTop;
125				base.curRows = $this;
126			} else {
127				// Same row, continue comparing heights
128				base.curMax = Math.max(base.curMax, $el[base.useHeight]());
129				// Check limitations
130				base.curMax = (base.hasMax && base.curMax > o.max) ?
131					o.max :
132					(base.hasMin && base.curMax < o.min) ? o.min : base.curMax;
133				// another div on the current row, add it to the list
134				base.curRows = base.curRows.add($this);
135			}
136			// catch last row
137			if (base.curRows) {
138				base.curRows.height(base.curMax + base.padding);
139				if (base.hasMax && base.curMax >= o.max) {
140					base.curRows.addClass(o.overflow);
141				}
142			}
143		});
144	};
145
146	// suspend equalizer plugin when below the breakpoint
147	base.suspend = function(flag){
148		if (flag !== false) {
149			base.$el.removeClass(o.disabled);
150		} else {
151			base.$el.addClass(o.disabled);
152			base.$col
153				.removeClass(o.overflow)
154				.css('height', ''); // not using "auto" so it doesn't override css
155		}
156		base.update();
157	};
158
159	base.enable = function(flag){
160		base.isEnabled = flag !== false;
161		base.suspend(flag);
162	};
163
164	base.init();
165};
166
167$.equalizer.defaultOptions = {
168	// height = type of height to use
169	// "o" or "outer" = "outerHeight" - includes height + padding + border + margin
170	// "i" or "inner" = "innerHeight" - includes height + padding + border
171	// default        = "height"      - use just the height
172	columns    : '> div',     // elements inside of the wrapper
173	useHeight  : 'height',    // height measurement to use
174	resizeable : true,        // when true, heights are adjusted on window resize
175	min        : 0,           // Minimum height applied to all columns
176	max        : 0,           // Max height applied to all columns
177	breakpoint : null,        // if browser less than this width, disable the plugin
178	disabled   : 'noresize',  // class applied when browser width is less than the breakpoint value
179	overflow   : 'overflowed' // class applied to columns that are taller than the allowable max
180};
181
182$.fn.equalizer = function(options){
183	return this.each(function(){
184		var equalizer = $(this).data('equalizer');
185		// initialize the slider but prevent multiple initializations
186		if (!equalizer) {
187			(new $.equalizer(this, options));
188		} else {
189			equalizer.update();
190		}
191	});
192};
193
194// return the equalizer object
195$.fn.getequalizer = function(){
196	return this.data("equalizer");
197};
198
199})(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.