PageSourceSearch

https://pacman-games.com/script.js

js pacman-games.com collected 2026-10-09 05:15:24 UTC 1,303 bytes, 37 lines download raw bytes

1/* Pacman Games - minimal JS */
2(function() {
3  'use strict';
4
5  // Mobile nav toggle
6  var toggle = document.querySelector('.nav-toggle');
7  var nav = document.querySelector('.nav');
8  if (toggle && nav) {
9    toggle.addEventListener('click', function() {
10      nav.classList.toggle('open');
11      toggle.setAttribute('aria-expanded', nav.classList.contains('open'));
12    });
13  }
14
15  // Lazy-load game iframes — only load when "Play" is clicked
16  // This is critical for Core Web Vitals on game pages
17  var playButtons = document.querySelectorAll('[data-play-game]');
18  playButtons.forEach(function(btn) {
19    btn.addEventListener('click', function(e) {
20      e.preventDefault();
21      var url = btn.getAttribute('data-play-game');
22      var container = btn.closest('.game-frame');
23      if (!container) return;
24      var iframe = document.createElement('iframe');
25      iframe.src = url;
26      iframe.setAttribute('allowfullscreen', '');
27      iframe.setAttribute('loading', 'eager');
28      iframe.setAttribute('title', 'Game player');
29      container.innerHTML = '';
30      container.appendChild(iframe);
31    });
32  });
33
34  // Set the current year in footer
35  var yearEls = document.querySelectorAll('[data-year]');
36  yearEls.forEach(function(el) { el.textContent = new Date().getFullYear(); });
37})();

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.