PageSourceSearch

https://rootscs.org/themes/contrib/material_base/js/mb-slide.js?tjzkg5

js rootscs.org collected 2026-10-04 05:21:27 UTC 2,414 bytes, 73 lines download raw bytes

1/*
2Vanilla JS replacement of JQuery slideUp, slideDown, slideToggle.
3
4Based on https://gist.github.com/AaronF/bb6170329698277c7585d5be4ecb2583
5*/
6
7const slideUp = (target, duration) => {
8  target.style.transitionProperty = 'height, margin, padding';
9  target.style.transitionDuration = duration + 'ms';
10  target.style.boxSizing = 'border-box';
11  target.style.height = target.offsetHeight + 'px';
12  target.offsetHeight;
13  target.style.overflow = 'hidden';
14  target.style.height = 0;
15  target.style.paddingTop = 0;
16  target.style.paddingBottom = 0;
17  target.style.marginTop = 0;
18  target.style.marginBottom = 0;
19
20  window.setTimeout(function () {
21    target.style.display = 'none';
22    target.style.removeProperty('height');
23    target.style.removeProperty('padding-top');
24    target.style.removeProperty('padding-bottom');
25    target.style.removeProperty('margin-top');
26    target.style.removeProperty('margin-bottom');
27    target.style.removeProperty('overflow');
28    target.style.removeProperty('transition-duration');
29    target.style.removeProperty('transition-property');
30  }, duration);
31}
32
33const slideDown = (target, duration) => {
34  target.style.removeProperty('display');
35  let display = window.getComputedStyle(target).display;
36
37  if (display === 'none') {
38    display = 'block';
39  }
40
41  target.style.display = display;
42  let height = target.offsetHeight;
43  target.style.overflow = 'hidden';
44  target.style.height = 0;
45  target.style.paddingTop = 0;
46  target.style.paddingBottom = 0;
47  target.style.marginTop = 0;
48  target.style.marginBottom = 0;
49  target.offsetHeight;
50  target.style.boxSizing = 'border-box';
51  target.style.transitionProperty = "height, margin, padding";
52  target.style.transitionDuration = duration + 'ms';
53  target.style.height = height + 'px';
54  target.style.removeProperty('padding-top');
55  target.style.removeProperty('padding-bottom');
56  target.style.removeProperty('margin-top');
57  target.style.removeProperty('margin-bottom');
58
59  window.setTimeout(function () {
60    target.style.removeProperty('height');
61    target.style.removeProperty('overflow');
62    target.style.removeProperty('transition-duration');
63    target.style.removeProperty('transition-property');
64  }, duration);
65}
66
67const slideToggle = (target, duration) => {
68  if (window.getComputedStyle(target).display === 'none') {
69    return slideDown(target, duration);
70  } else {
71    return slideUp(target, duration);
72  }
73}

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.