PageSourceSearch

https://radio86.fi/wp-content/plugins/custom-homepage-description/assets/js/rmw-home-desc.js?ver=1.0.1

js radio86.fi collected 2026-10-02 13:48:24 UTC 3,520 bytes, 90 lines download raw bytes

1(function () {
2  function onClick(e) {
3    var btn = e.target.closest && e.target.closest('.rmw-toggle');
4    if (!btn) return;
5    var id = btn.getAttribute('aria-controls');
6    if (!id) return;
7    var rest = document.getElementById(id);
8    if (!rest) return;
9
10    if (btn.classList.contains('rmw-down')) {
11      rest.hidden = false;
12      btn.setAttribute('aria-expanded', 'true');
13      btn.style.display = 'none';
14      rest.setAttribute('tabindex', '-1');
15      try { rest.focus({ preventScroll: false }); } catch(e){}
16    } else if (btn.classList.contains('rmw-up')) {
17      rest.hidden = true;
18      btn.setAttribute('aria-expanded', 'false');
19      var down = btn.closest('.rmw-home-desc').querySelector('.rmw-toggle.rmw-down');
20      if (down) { down.style.display = 'inline-flex'; down.focus(); }
21    }
22  }
23  document.addEventListener('click', onClick, false);
24
25  // Heuristics to find the posts GRID container (not an individual article)
26  function findPostsContainer(root) {
27    // Common wrappers used by themes
28    var selectors = [
29      '.posts', '.post-list', '.posts-list', '.blog-posts', '.archive-posts',
30      '.post-grid', '.posts-grid', '.blog-grid', '.loop-posts',
31      '.site-main > .row', '.content-area .row', '.site-main .entries',
32      '.hfeed', '.content-area .posts-wrapper'
33    ];
34    for (var i = 0; i < selectors.length; i++) {
35      var el = root.querySelector(selectors[i]);
36      if (el) return el;
37    }
38    // Fallback: parent of the first article
39    var firstArticle = root.querySelector('article, .hentry, [class*="post"]');
40    return firstArticle ? firstArticle.parentNode : null;
41  }
42
43  function insertAfter(node, ref) {
44    if (!ref.parentNode) return;
45    if (ref.nextSibling) ref.parentNode.insertBefore(node, ref.nextSibling);
46    else ref.parentNode.appendChild(node);
47  }
48
49  function relocate() {
50    if (window.RMW_HD_MODE !== 'js') return;
51    var src = document.getElementById('rmw-hd-src');
52    if (!src) return;
53
54    var pre = src.querySelector('.rmw-home-desc.rmw-pre');
55    var post = src.querySelector('.rmw-home-desc.rmw-post');
56
57    // Where are the posts rendered?
58    var container = document.querySelector('main, .site-main, #primary, .content-area') || document.body;
59    var grid = findPostsContainer(container);
60    if (!grid) {
61      // Give up gracefully: place relative to first/last post (old behavior)
62      var posts = container.querySelectorAll('article, .hentry, [class*="post"]');
63      if (posts.length) {
64        if (pre) posts[0].parentNode.insertBefore(pre, posts[0]);
65        if (post) insertAfter(post, posts[posts.length - 1]);
66      }
67      return;
68    }
69
70    // Reveal blocks
71    if (pre)  pre.style.display  = '';
72    if (post) post.style.display = '';
73
74    // Insert PRE before the grid container (sibling)
75    if (pre) grid.parentNode.insertBefore(pre, grid);
76
77    // Insert POST after the grid container (sibling), but before pagination if present
78    if (post) {
79      var pagination = grid.parentNode.querySelector('.navigation, .pagination, .nav-links, .archive-pagination');
80      if (pagination && pagination.parentNode === grid.parentNode) {
81        grid.parentNode.insertBefore(post, pagination);
82      } else {
83        insertAfter(post, grid);
84      }
85    }
86  }
87
88  if (document.readyState === 'complete' || document.readyState === 'interactive') relocate();
89  else document.addEventListener('DOMContentLoaded', relocate);
90})();

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.