PageSourceSearch

https://www.hoteldonpepe.it/js_source/vanilla/plainJSslideToggle/plainJSslideToggle.js?vrnsh=1&v=1785489521

js hoteldonpepe.it collected 2026-10-06 17:47:39 UTC 2,029 bytes, 58 lines download raw bytes

1/* plain JS slideToggle https://github.com/ericbutler555/plain-js-slidetoggle */
2// UTILIZZO:
3// element.slideToggle(duration, callback); // opens and closes an element
4// element.slideUp(duration, callback); // closes/collapses an element
5// element.slideDown(duration, callback); // opens/expands an element
6
7function _s(o, i, p, l) {
8	void 0 === i && (i = 400),
9		void 0 === l && (l = !1),
10		(o.style.overflow = "hidden"),
11		l && (o.style.display = "block");
12	var n,
13		t = window.getComputedStyle(o),
14		s = parseFloat(t.getPropertyValue("height")),
15		a = parseFloat(t.getPropertyValue("padding-top")),
16		r = parseFloat(t.getPropertyValue("padding-bottom")),
17		y = parseFloat(t.getPropertyValue("margin-top")),
18		d = parseFloat(t.getPropertyValue("margin-bottom")),
19		g = s / i,
20		m = a / i,
21		h = r / i,
22		u = y / i,
23		x = d / i;
24	window.requestAnimationFrame(function t(e) {
25		void 0 === n && (n = e);
26		e -= n;
27		l
28			? ((o.style.height = g * e + "px"),
29			  (o.style.paddingTop = m * e + "px"),
30			  (o.style.paddingBottom = h * e + "px"),
31			  (o.style.marginTop = u * e + "px"),
32			  (o.style.marginBottom = x * e + "px"))
33			: ((o.style.height = s - g * e + "px"),
34			  (o.style.paddingTop = a - m * e + "px"),
35			  (o.style.paddingBottom = r - h * e + "px"),
36			  (o.style.marginTop = y - u * e + "px"),
37			  (o.style.marginBottom = d - x * e + "px")),
38			i <= e
39				? ((o.style.height = ""),
40				  (o.style.paddingTop = ""),
41				  (o.style.paddingBottom = ""),
42				  (o.style.marginTop = ""),
43				  (o.style.marginBottom = ""),
44				  (o.style.overflow = ""),
45				  l || (o.style.display = "none"),
46				  "function" == typeof p && p())
47				: window.requestAnimationFrame(t);
48	});
49}
50(HTMLElement.prototype.slideToggle = function (t, e) {
51	0 === this.clientHeight ? _s(this, t, e, !0) : _s(this, t, e);
52}),
53	(HTMLElement.prototype.slideUp = function (t, e) {
54		_s(this, t, e);
55	}),
56	(HTMLElement.prototype.slideDown = function (t, e) {
57		_s(this, t, e, !0);
58	});

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.