PageSourceSearch

https://todrive.co.il/js/app.js

js todrive.co.il collected 2026-10-02 01:55:24 UTC 8,127 bytes, 249 lines download raw bytes

1
2
3
4window.addEventListener('load',   fn , false )
5
6//  window.onload = function loader() {
7function fn() {
8    // Preloader
9    if(document.getElementById('preloader')){
10        setTimeout(() => {
11            document.getElementById('preloader').style.visibility = 'hidden';
12            document.getElementById('preloader').style.opacity = '0';
13        }, 350);
14    }
15    // Menus
16    activateMenu();
17}
18
19//Menu
20// Toggle menu
21function toggleMenu() {
22    document.getElementById('isToggle').classList.toggle('open');
23    var isOpen = document.getElementById('navigation')
24    if (isOpen.style.display === "block") {
25        isOpen.style.display = "none";
26    } else {
27        isOpen.style.display = "block";
28    }
29};
30
31//Menu Active
32function getClosest(elem, selector) {
33
34    // Element.matches() polyfill
35    if (!Element.prototype.matches) {
36        Element.prototype.matches =
37            Element.prototype.matchesSelector ||
38            Element.prototype.mozMatchesSelector ||
39            Element.prototype.msMatchesSelector ||
40            Element.prototype.oMatchesSelector ||
41            Element.prototype.webkitMatchesSelector ||
42            function (s) {
43                var matches = (this.document || this.ownerDocument).querySelectorAll(s),
44                    i = matches.length;
45                while (--i >= 0 && matches.item(i) !== this) { }
46                return i > -1;
47            };
48    }
49
50    // Get the closest matching element
51    for (; elem && elem !== document; elem = elem.parentNode) {
52        if (elem.matches(selector)) return elem;
53    }
54    return null;
55
56};
57
58function activateMenu() {
59    var menuItems = document.getElementsByClassName("sub-menu-item");
60    if (menuItems) {
61
62        var matchingMenuItem = null;
63        for (var idx = 0; idx < menuItems.length; idx++) {
64            if (menuItems[idx].href === window.location.href) {
65                matchingMenuItem = menuItems[idx];
66            }
67        }
68
69        if (matchingMenuItem) {
70            matchingMenuItem.classList.add('active');
71            var immediateParent = getClosest(matchingMenuItem, 'li');
72            if (immediateParent) {
73                immediateParent.classList.add('active');
74            }
75
76            var parent = getClosest(matchingMenuItem, '.parent-menu-item');
77            if (parent) {
78                parent.classList.add('active');
79                var parentMenuitem = parent.querySelector('.menu-item');
80                if (parentMenuitem) {
81                    parentMenuitem.classList.add('active');
82                }
83                var parentOfParent = getClosest(parent, '.parent-parent-menu-item');
84                if (parentOfParent) {
85                    parentOfParent.classList.add('active');
86                }
87            } else {
88                var parentOfParent = getClosest(matchingMenuItem, '.parent-parent-menu-item');
89                if (parentOfParent) {
90                    parentOfParent.classList.add('active');
91                }
92            }
93        }
94    }
95}
96
97// Clickable Menu
98if(document.getElementById("navigation")){
99    var elements = document.getElementById("navigation").getElementsByTagName("a");
100    for(var i = 0, len = elements.length; i < len; i++) {
101        elements[i].onclick = function (elem) {
102            if(elem.target.getAttribute("href") === "javascript:void(0)") {
103                var submenu = elem.target.nextElementSibling.nextElementSibling;
104                submenu.classList.toggle('open');
105            }
106        }
107    }
108}
109
110// Menu sticky
111function windowScroll() {
112    const navbar = document.getElementById("topnav");
113    if(navbar!=null){
114        if (
115            document.body.scrollTop >= 50 ||
116            document.documentElement.scrollTop >= 50
117        ) {
118            navbar.classList.add("nav-sticky");
119        } else {
120            navbar.classList.remove("nav-sticky");
121        }
122    }
123}
124
125window.addEventListener('scroll', (ev) => {
126    ev.preventDefault();
127    windowScroll();
128})
129
130// back-to-top
131var mybutton = document.getElementById("back-to-top");
132window.onscroll = function () {
133    scrollFunction();
134};
135
136function scrollFunction() {
137    if(mybutton!=null){
138        if (document.body.scrollTop > 500 || document.documentElement.scrollTop > 500) {
139            mybutton.style.display = "block";
140        } else {
141            mybutton.style.display = "none";
142        }
143    }
144}
145
146function topFunction() {
147    document.body.scrollTop = 0;
148    document.documentElement.scrollTop = 0;
149}
150
151
152
153//ACtive Sidebar
154(function () {
155    var current = location.pathname.substring(location.pathname.lastIndexOf('/') + 1);;
156    if (current === "") return;
157    var menuItems = document.querySelectorAll('.sidebar-nav a');
158    for (var i = 0, len = menuItems.length; i < len; i++) {
159        if (menuItems[i].getAttribute("href").indexOf(current) !== -1) {
160            menuItems[i].parentElement.className += " active";
161        }
162    }
163})();
164
165//Feather icon
166feather.replace();
167
168// dd-menu
169var ddmenu = document.getElementsByClassName("dd-menu");
170for(var i = 0, len = ddmenu.length; i < len; i++) {
171    ddmenu[i].onclick = function (elem) {
172        elem.stopPropagation();
173    }
174}
175
176//Tooltip
177var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
178var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
179  return new bootstrap.Tooltip(tooltipTriggerEl)
180});
181
182//small menu
183try {
184    var spy = new Gumshoe('#navmenu-nav a');
185}catch(err) {
186    
187}
188//********************* */
189/*     Contact us       */
190//********************* */
191try {
192    function validateForm() {
193        var name = document.forms["myForm"]["name"].value;
194        var email = document.forms["myForm"]["email"].value;
195        var subject = document.forms["myForm"]["subject"].value;
196        var comments = document.forms["myForm"]["comments"].value;
197        document.getElementById("error-msg").style.opacity = 0;
198        document.getElementById('error-msg').innerHTML = "";
199        if (name == "" || name == null) {
200            document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Name*</div>";
201            fadeIn();
202            return false;
203        }
204        if (email == "" || email == null) {
205            document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Email*</div>";
206            fadeIn();
207            return false;
208        }
209        if (subject == "" || subject == null) {
210            document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Subject*</div>";
211            fadeIn();
212            return false;
213        }
214        if (comments == "" || comments == null) {
215            document.getElementById('error-msg').innerHTML = "<div class='alert alert-warning error_message'>*Please enter a Comments*</div>";
216            fadeIn();
217            return false;
218        }
219        var xhttp = new XMLHttpRequest();
220        xhttp.onreadystatechange = function () {
221            if (this.readyState == 4 && this.status == 200) {
222                document.getElementById("simple-msg").innerHTML = this.responseText;
223                document.forms["myForm"]["name"].value = "";
224                document.forms["myForm"]["email"].value = "";
225                document.forms["myForm"]["subject"].value = "";
226                document.forms["myForm"]["comments"].value = "";
227            }
228        };
229        xhttp.open("POST", "php/contact.php", true);
230        xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
231        xhttp.send("name=" + name + "&email=" + email + "&subject=" + subject + "&comments=" + comments);
232        return false;
233      }
234    
235      function fadeIn() {
236        var fade = document.getElementById("error-msg");
237        var opacity = 0;
238        var intervalID = setInterval(function () {
239            if (opacity < 1) {
240                opacity = opacity + 0.5
241                fade.style.opacity = opacity;
242            } else {
243                clearInterval(intervalID);
244            }
245        }, 200);
246    }
247} catch (err) {
248
249}

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.