PageSourceSearch

https://www.elle.cz/js/modules/articleGalleryLink.js

js elle.cz collected 2026-10-02 07:55:29 UTC 1,115 bytes, 43 lines download raw bytes

1export function initArticleGalleryLinks() {
2  const MOBILE_BREAKPOINT_QUERY = '(max-width: 1023px)';
3  const galleryLinkQuery = window.matchMedia(MOBILE_BREAKPOINT_QUERY);
4  const roots = document.querySelectorAll('[data-article-gallery-link-root]');
5
6  function shouldHandleClick(event, link) {
7    return galleryLinkQuery.matches
8      && event.button === 0
9      && !event.defaultPrevented
10      && !event.metaKey
11      && !event.ctrlKey
12      && !event.shiftKey
13      && !event.altKey
14      && link.target !== '_blank';
15  }
16
17  function getOnePageHref(link) {
18    const url = new URL(link.href);
19    if (!url.hash) {
20      return null;
21    }
22
23    url.hash = '';
24    return url.toString();
25  }
26
27  roots.forEach((root) => {
28    root.addEventListener('click', (event) => {
29      const link = event.target.closest('[data-article-gallery-link]');
30      if (!link || !root.contains(link) || !shouldHandleClick(event, link)) {
31        return;
32      }
33
34      const href = getOnePageHref(link);
35      if (!href) {
36        return;
37      }
38
39      event.preventDefault();
40      window.location.assign(href);
41    });
42  });
43}

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.