PageSourceSearch

https://plusworld.ru/local/templates/plus_new/components/ituka/news.list/seo_retail/script.js?17558917501894

js plusworld.ru collected 2026-10-01 10:32:02 UTC 1,894 bytes, 49 lines download raw bytes

1// Лёгкая логика темы + анимация бейджа
2document.addEventListener('DOMContentLoaded', function () {
3  // Переключатель темы (если присутствует в шапке)
4  const themeToggle = document.getElementById('themeToggle');
5  if (themeToggle) {
6    const savedTheme = localStorage.getItem('theme') || 'light';
7    document.documentElement.setAttribute('data-theme', savedTheme);
8    updateThemeIcon(savedTheme);
9
10    themeToggle.addEventListener('click', () => {
11      const current = document.documentElement.getAttribute('data-theme');
12      const next = current === 'light' ? 'dark' : 'light';
13      document.documentElement.setAttribute('data-theme', next);
14      localStorage.setItem('theme', next);
15      updateThemeIcon(next);
16
17      // небольшая анимация кнопки
18      themeToggle.style.transform = 'scale(0.92)';
19      setTimeout(() => { themeToggle.style.transform = ''; }, 150);
20    });
21
22    function updateThemeIcon(theme) {
23      const icon = themeToggle.querySelector('i');
24      if (!icon) return;
25      if (theme === 'dark') {
26        icon.classList.remove('fa-moon');
27        icon.classList.add('fa-sun');
28      } else {
29        icon.classList.remove('fa-sun');
30        icon.classList.add('fa-moon');
31      }
32    }
33  }
34
35  // Анимация бейджей Новое/Топ
36  const badges = document.querySelectorAll('.article-badge');
37  badges.forEach(badge => {
38    badge.addEventListener('mouseenter', () => {
39      if (badge.classList.contains('pulse-animation')) {
40        badge.classList.remove('pulse-animation');
41      }
42    });
43    badge.addEventListener('mouseleave', () => {
44      if (!badge.classList.contains('pulse-animation')) {
45        setTimeout(() => { badge.classList.add('pulse-animation'); }, 100);
46      }
47    });
48  });
49});

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.