PageSourceSearch

https://www.comfort-israel.com/cache/1_oicnjdd4lzrh.2b64eb4f5960.js

js comfort-israel.com collected 2026-09-27 02:12:04 UTC 4,055 bytes, 128 lines download raw bytes

1var comfortIsrael = comfortIsrael || {};
2
3comfortIsrael.common = (function () {
4    'use strict';
5    /** @var {Function} */
6    var init;
7    /** @var {Object} */
8    var elements = {};
9    /** @var {Object} */
10    var storage = {};
11
12    init = function () {
13        elements.contentContainer = document.querySelector('.content-container');
14        elements.headerWidthElement = document.querySelector('.header__inner');
15
16        // Handle on resize
17        document.fire('window:resize');
18        Event.observe(window, 'resize', handleOnResize);
19
20        observeAnchorLinkClicks();
21
22        document.observe('window:resize', calcHeaderHeight);
23        calcHeaderHeight();
24    };
25
26    /**
27     * handleOnResize
28     */
29    function handleOnResize () {
30        // First of all, create a timer to prevent this function firing 100s of times during the resize event
31        if (typeof(storage.resizeTo) === 'number') {
32            window.clearTimeout(storage.resizeTo);
33            delete storage.resizeTo;
34        }
35        storage.resizeTo = function () {
36            document.fire('window:resize');
37        }.delay(0.1);
38    }
39
40    /**
41     * Scroll to smoothly to target
42     */
43    function observeAnchorLinkClicks() {
44        var anchorLinks = document.querySelectorAll('body a[href*="#"]');
45        var i;
46
47        for (i = 0; anchorLinks.length > i; i++) {
48            var anchor = anchorLinks[i];
49            anchor.addEventListener('click', handleAnchorLinkClick);
50        }
51    }
52
53    function handleAnchorLinkClick (event) {
54        event.preventDefault();
55        var element = event.target;
56        var link = element.getAttribute('href');
57
58        if (link === '#') {
59            return;
60        }
61
62        var activeLinks = document.querySelectorAll("nav li.active");
63        var i;
64        for (i = 0; i < activeLinks.length; i++) {
65            activeLinks[i].classList.remove("active");
66        }
67        element.parentElement.classList.add("active");
68
69        var destination = document.querySelector(link);
70        var position = destination.getBoundingClientRect().top + window.document.documentElement.scrollTop;
71
72        if ('scrollBehavior' in document.documentElement.style) {
73            window.scroll({
74                top : position-'50', //to make title of section visible
75                left : 0,
76                behavior : 'smooth'
77            });
78        } else {
79            smoothScrollTo(0, position, 500);
80        }
81    }
82
83    /**
84     * @param {int} endX
85     * @param {int} endY
86     * @param {int} duration
87     * @source https://stackoverflow.com/questions/49636727/why-is-scroll-behaviorsmooth-not-working-but-javascript-window-scroll-smooth-is
88     */
89    function smoothScrollTo (endX, endY, duration) {
90        let startX = window.scrollX || window.pageXOffset,
91            startY = window.scrollY || window.pageYOffset,
92            distanceX = endX - startX,
93            distanceY = endY - startY,
94            startTime = new Date().getTime();
95
96        let easeInOutQuart = function(time, from, distance, duration) {
97            if ((time /= duration / 2) < 1) return distance / 2 * time * time * time * time + from;
98            return -distance / 2 * ((time -= 2) * time * time * time - 2) + from;
99        };
100
101        let timer = window.setInterval(function() {
102            let time = new Date().getTime() - startTime,
103                newX = easeInOutQuart(time, startX, distanceX, duration),
104                newY = easeInOutQuart(time, startY, distanceY, duration);
105            if (time >= duration) {
106                window.clearInterval(timer);
107            }
108            window.scrollTo(newX, newY);
109        }, 1000 / 60); // 60 fps
110    }
111
112
113    function calcHeaderHeight() {
114        var headerInner = elements.headerWidthElement;
115        var headerHeight = headerInner.offsetHeight;
116
117        elements.contentContainer.style.paddingTop = headerHeight+'px';
118    }
119
120    return {
121        init: init
122    };
123}());
124
125document.observe('dom:loaded', function () {
126    'use strict';
127    comfortIsrael.common.init();
128});

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.