PageSourceSearch

https://giovanniferrario.com/js/vn450l3yd.js

js giovanniferrario.com collected 2026-10-04 21:09:04 UTC 4,715 bytes, 132 lines download raw bytes

1var DOMAnimations = {
2
3    
4    slideUp: function (element, duration) {
5        duration = (duration) ? duration : 500;
6
7        return new Promise(function (resolve, reject) {
8
9            element.style.height = element.offsetHeight + 'px';
10            element.style.transitionProperty = 'height, margin, padding';
11            element.style.transitionDuration = duration + 'ms';
12            element.offsetHeight;
13            element.style.overflow = 'hidden';
14            element.style.height = 0;
15            element.style.paddingTop = 0;
16            element.style.paddingBottom = 0;
17            element.style.marginTop = 0;
18            element.style.marginBottom = 0;
19            window.setTimeout(function () {
20                element.style.display = 'none';
21                element.style.removeProperty('height');
22                element.style.removeProperty('padding-top');
23                element.style.removeProperty('padding-bottom');
24                element.style.removeProperty('margin-top');
25                element.style.removeProperty('margin-bottom');
26                element.style.removeProperty('overflow');
27                element.style.removeProperty('transition-duration');
28                element.style.removeProperty('transition-property');
29                resolve(false);
30            }, duration)
31        })
32    },
33
34    
35    slideDown: function (element, duration) {
36        duration = (duration) ? duration : 500;
37
38        return new Promise(function (resolve, reject) {
39
40            element.style.removeProperty('display');
41            var display;
42            display = window.getComputedStyle(element).display;
43
44            if (display === 'none')
45                display = 'block';
46
47            element.style.display = display;
48            var height;
49            height = element.offsetHeight;
50            element.style.overflow = 'hidden';
51            element.style.height = 0;
52            element.style.paddingTop = 0;
53            element.style.paddingBottom = 0;
54            element.style.marginTop = 0;
55            element.style.marginBottom = 0;
56            element.offsetHeight;
57            element.style.transitionProperty = 'height, margin, padding';
58            element.style.transitionDuration = duration + 'ms';
59            element.style.height = height + 'px';
60            element.style.removeProperty('padding-top');
61            element.style.removeProperty('padding-bottom');
62            element.style.removeProperty('margin-top');
63            element.style.removeProperty('margin-bottom');
64            window.setTimeout(function () {
65                element.style.removeProperty('height');
66                element.style.removeProperty('overflow');
67                element.style.removeProperty('transition-duration');
68                element.style.removeProperty('transition-property');
69            }, duration)
70        })
71    },
72
73    
74    slideToggle: function (element, duration) {
75        duration = (duration) ? duration : 500;
76
77        if (window.getComputedStyle(element).display === 'none') {
78
79            return this.slideDown(element, duration);
80
81        } else {
82
83            return this.slideUp(element, duration);
84        }
85    }
86}
87
88// ------------------------------------------------------
89
90document.addEventListener("DOMContentLoaded", function () {
91
92    var toggle, body;
93    toggle = document.querySelector('.ctoc-toggle');
94    body = document.querySelector('.ctoc-body');
95
96    if (toggle && body) {
97        if (body.offsetLeft <= 0) {
98            toggle.classList.remove('active');
99        }
100        toggle.addEventListener('click', function (event) {
101            event.preventDefault();
102            if (body.offsetLeft <= 0)
103                this.classList.add('active');
104            else
105                this.classList.remove('active');
106            DOMAnimations.slideToggle(body);
107        });
108    }
109
110});
111
112var anchors = document.querySelectorAll('.ctoc__item');
113var supportsNativeSmoothScroll = 'scrollBehavior' in document.documentElement.style;
114if (anchors.length && supportsNativeSmoothScroll) {
115    Object.keys(anchors).forEach(function (anchor) {
116        anchors[anchor].addEventListener('click', function (e) {
117            e.preventDefault();
118            var blockID, element, yCoordinate, yOffset;
119            blockID = anchors[anchor].getAttribute('href').substr(1);
120            element = document.getElementById(blockID);
121            if (element) {
122                yCoordinate = element.getBoundingClientRect().top + window.pageYOffset;
123                yOffset = -50;
124                window.scrollTo({
125                    top: yCoordinate + yOffset,
126                    behavior: 'smooth'
127                });
128            }
129
130        })
131    });
132}

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.