PageSourceSearch

https://syklo.com/wp-content/themes/Syklo_WP/js/scripts.js?ver=1.2.0

js syklo.com collected 2026-10-09 04:44:14 UTC 10,007 bytes, 317 lines download raw bytes

1(function ($, root, undefined) {
2	
3
4	
5	
6	
7	
8	
9	/*$(document).ready(function () {
10  // Focus on top-level link
11  $('ul.pages-nav li.menu-item-has-children > a').on('focus', function () {
12    $(this).closest('li').addClass('submenu-open');
13  });
14
15  // Blur from top-level link (wait a tick to check where focus moves)
16  $('ul.pages-nav li.menu-item-has-children > a').on('blur', function () {
17    let $parent = $(this).closest('li');
18    setTimeout(function () {
19      if (!$parent.find(':focus').length) {
20        $parent.removeClass('submenu-open');
21      }
22    }, 10);
23  });
24
25  // Focus/blur for submenu items
26  $('ul.pages-nav .sub-menu a').on('focus', function () {
27    $(this).closest('li.menu-item-has-children').addClass('submenu-open');
28  });
29
30  $('ul.pages-nav .sub-menu a').on('blur', function () {
31    let $submenu = $(this).closest('ul.sub-menu');
32    let $parent = $submenu.closest('li.menu-item-has-children');
33    setTimeout(function () {
34      if (!$parent.find(':focus').length) {
35        $parent.removeClass('submenu-open');
36      }
37    }, 10);
38  });
39});*/
40
41/*$(document).ready(function () {
42  // When any link inside a top-level menu-item-has-children gains focus
43  $('ul.pages-nav li.menu-item-has-children > a').on('focus', function () {
44    $(this).closest('li.menu-item-has-children').addClass('submenu-open');
45  });
46
47  // Handle blur globally for all links inside the menu
48  $('ul.pages-nav a').on('blur', function () {
49    const $allParents = $('ul.pages-nav li.menu-item-has-children');
50
51    setTimeout(function () {
52      $allParents.each(function () {
53        const $parent = $(this);
54
55        // If no focused element exists inside this parent, close it
56        if ($parent.find(':focus').length === 0) {
57          $parent.removeClass('submenu-open');
58        }
59      });
60    }, 20); // Delay lets next element receive focus first
61  });
62});*/
63
64	$(document).ready(function () {
65  // Focus on top-level link
66  $('ul.pages-nav li.menu-item-has-children > a').on('focus', function () {
67    const $li = $(this).closest('li.menu-item-has-children');
68    $li.addClass('submenu-open');
69    $li.children('.sub-menu').addClass('open');
70  });
71
72  // Blur from any link in the menu
73  $('ul.pages-nav a').on('blur', function () {
74    const $allParents = $('ul.pages-nav li.menu-item-has-children');
75
76    setTimeout(function () {
77      $allParents.each(function () {
78        const $parent = $(this);
79        if ($parent.find(':focus').length === 0) {
80          $parent.removeClass('submenu-open');
81          $parent.children('.sub-menu').removeClass('open');
82        }
83      });
84    }, 20); // Allow time for focus to move
85  });
86		
87		
88		
89		
90		
91		
92		
93		
94		
95		
96		
97		
98		
99		
100		
101		
102		// Background video toggle for .dg-etusivu-hero
103const $heroContainer = $('.dg-etusivu-hero');
104const $video = $heroContainer.find('video');
105
106if ($heroContainer.length && $video.length) {
107  const $toggleBtn = $('<button>', {
108    id: 'video-toggle',
109    'aria-label': 'Pause background video',
110text: '\u23F8', // ⏸ for pause
111    css: {
112      position: 'absolute',
113      bottom: '1rem',
114      left: '1rem',
115      zIndex: 10,
116      background: 'rgba(0,0,0,0.4)',
117      color: '#fff',
118      border: 'none',
119      padding: '0.5rem 1rem',
120      fontSize: '3rem',
121      cursor: 'pointer',
122      borderRadius: '4px'
123    }
124  });
125
126  $heroContainer.css('position', 'relative').append($toggleBtn);
127  console.log('Video toggle button added');
128
129  $toggleBtn.on('click', function () {
130    if ($video.get(0).paused) {
131      $video.get(0).play();
132      $toggleBtn.text('\u23F8').attr('aria-label', 'Pause background video');
133      console.log('Video played');
134    } else {
135      $video.get(0).pause();
136      $toggleBtn.text('►').attr('aria-label', 'Play background video');
137      console.log('Video paused');
138    }
139  });
140}
141
142		
143		
144		
145		
146		
147		
148		
149		
150		
151		
152		
153		
154		
155		
156		
157		
158		
159		
160});
161
162	
163    $(document).ready(function () {
164
165		
166const mailtoLinks = document.querySelectorAll('a[href^="mailto:"]');
167console.log('mailto links found:', mailtoLinks.length); // <-- add this
168
169mailtoLinks.forEach(link => {
170  link.innerHTML = link.innerHTML.replace('@', '<wbr>@');
171  console.log('added wbr to:', link.innerHTML);
172});
173		
174	$('li.menu-item-has-children > a').on('focus', function () {
175  $(this).closest('li.menu-item-has-children').children('.sub-menu').addClass('open');
176}).on('blur', function () {
177  //$(this).closest('li.menu-item-has-children').children('.sub-menu').removeClass('open');
178});
179		
180		
181		
182		
183		
184        $(".desktop-menu .sub-menu").css("display", "block");
185        $(".menu-button").click(function () {
186            $(".nav").toggleClass("close");
187            $(this).toggleClass("exit");
188            $(".dark-overlay").toggleClass("active");
189			
190			//Accessibility fixes
191			const $btn = $(this);
192			const isExpanded = $btn.attr("aria-expanded") === "true";
193			$btn.attr("aria-expanded", String(!isExpanded));
194
195			
196			
197			
198        });
199        $(".menu-item-has-children").click(function () {
200            $(this).siblings().removeClass("arrow-close").children(".sub-menu").removeClass("open").removeClass("arrow-close");
201            $(this).children(".sub-menu").toggleClass("open");
202            $(this).toggleClass("arrow-close").children();
203        });
204        $(".sub-menu .menu-item-has-children").click(function (e) {
205            e.stopPropagation();
206        });
207        $(".bg-column").each(function () {
208            $(this).css("background-image", "url(" + $(this).find("img").attr("src") + ")");
209            $(this).find("img").remove();
210        });
211        function heroImage() {
212            if (window.innerWidth < 600) {
213                $(".hero-bg-column").each(function () {
214                    $(this).css("background-image", "url(" + $(this).find("img").attr("src") + ")");
215                    $(this).parent().css("background-image", "none");
216                    $(this).find("img").addClass("hide");
217                });
218            } else {
219                $(".hero-bg-column").each(function () {
220                    $(this).css("background-image", "none");
221                    $(this).css("background-image", "url(" + $(this).find("img").attr("src") + ")");
222                    $(this).find("img").addClass("hide");
223                });
224                $(".fullwidth-hero .hero-bg-column").each(function () {
225                    $(this).css("background-image", "none");
226                    $(this)
227                        .parent()
228                        .css("background-image", "url(" + $(this).find("img").attr("src") + ")");
229                    $(this).find("img").addClass("hide");
230                });
231            }
232        }
233        heroImage();
234        $(window).resize(function () {
235            heroImage();
236        });
237        function checkWidthBigScreen() {
238            var visibleArticles = $(".other-article").not(".hidden");
239            var numItems = visibleArticles.length;
240            if (numItems < 9) {
241                $("#more").addClass("hidden");
242            } else {
243                $("#more").removeClass("hidden");
244                $(".other-article:not('.hidden'):gt(7)").addClass("hidden");
245            }
246        }
247        function checkWidthSmallScreen() {
248            var visibleArticles = $(".other-article").not(".hidden");
249            var numItems = visibleArticles.length;
250            if (numItems < 9) {
251                $("#more").addClass("hidden");
252            } else {
253                $("#more").removeClass("hidden");
254                $(".other-article:not('.hidden'):gt(7)").addClass("hidden");
255            }
256        }
257        var numItems = $(".other-article").not(".hidden").length;
258        if (numItems < 9) {
259            $("#more").addClass("hidden");
260        } else {
261            $("#more").removeClass("hidden");
262            $(".other-article:not('.hidden'):gt(7)").addClass("hidden");
263        }
264        $(".category-filter").click(function () {
265            $(".category-show-all").removeClass("show-category");
266            $(this).toggleClass("show-category");
267            $(".other-article").addClass("hidden");
268            if ($(".category-filter").hasClass("show-category")) {
269                $(".show-category").each(function () {
270                    var id = $(this).attr("id");
271                    $(".other-article." + id).removeClass("hidden");
272                });
273            } else {
274                $(".category-show-all").addClass("show-category");
275                $(".other-article").removeClass("hidden");
276            }
277            if (window.innerWidth > 1024) {
278                checkWidthBigScreen();
279            } else {
280                checkWidthSmallScreen();
281            }
282        });
283        $(".category-show-all").click(function () {
284            $(".category-filter").removeClass("show-category");
285            $(this).addClass("show-category");
286            $(".other-article").removeClass("hidden");
287            if (window.innerWidth > 1024) {
288                checkWidthBigScreen();
289            } else {
290                checkWidthSmallScreen();
291            }
292        });
293        function clickMoreBigScreen() {
294            $(".other-article.hidden").slice(0, 8).removeClass("hidden");
295            var hiddenArticles = $(".other-article.hidden").length;
296            if (hiddenArticles < 1) {
297                $("#more").addClass("hidden");
298            }
299        }
300        function clickMoreSmallScreen() {
301            $(".other-article.hidden").slice(0, 8).removeClass("hidden");
302            var hiddenArticles = $(".other-article.hidden").length;
303            if (hiddenArticles < 1) {
304                $("#more").addClass("hidden");
305            }
306        }
307        $("#more").click(function () {
308            if (window.innerWidth > 1024) {
309                clickMoreBigScreen();
310            } else {
311                clickMoreSmallScreen();
312            }
313        });
314        $(".category-show-all").click();
315        LottieInteractivity.create({ player: "#drawing1", actions: [{ visibility: [0.5, 1.0], type: "play" }] });
316    });
317})(jQuery, this);

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.