HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/kiwerkzeuge.de/public_html/assets/site.js
(() => {
  'use strict';

  const button = document.querySelector('[data-menu-button]');
  const nav = document.querySelector('[data-product-nav]');
  if (button && nav) {
    button.addEventListener('click', () => {
      const open = nav.classList.toggle('is-open');
      button.setAttribute('aria-expanded', open ? 'true' : 'false');
    });
    nav.addEventListener('click', (event) => {
      if (event.target.closest('a')) {
        nav.classList.remove('is-open');
        button.setAttribute('aria-expanded', 'false');
      }
    });
  }

  // Conversion-Messung: Klicks auf Kauf-Buttons als Matomo-Event festhalten,
  // damit sichtbar wird, welches Paket wie oft in den Warenkorb geht.
  document.querySelectorAll('[data-hb-pid]').forEach((el) => {
    el.addEventListener('click', () => {
      const pid = el.getAttribute('data-hb-pid') || '';
      const label = String(el.textContent || '').trim().replace(/\s+/g, ' ');
      if (window._paq) {
        window._paq.push(['trackEvent', 'Kauf', 'Checkout-Klick', label + ' (PID ' + pid + ')']);
      }
    });
  });

  const codeForm = document.querySelector('[data-priority-form]');
  if (codeForm) {
    codeForm.addEventListener('submit', async (event) => {
      event.preventDefault();
      const input = codeForm.querySelector('input[name="priority_code"]');
      const status = codeForm.querySelector('[data-priority-status]');
      const submit = codeForm.querySelector('button[type="submit"]');
      const code = String(input && input.value || '').trim().toUpperCase();
      if (!/^[A-Z0-9-]{8,80}$/.test(code)) {
        status.textContent = 'Bitte prüfe den Code.';
        return;
      }

      submit.disabled = true;
      status.textContent = 'Code wird sicher geprüft …';
      document.cookie = 'kiwz_prio=' + encodeURIComponent(code) + '; path=/; max-age=2592000; SameSite=Lax; Secure';
      try {
        const response = await fetch('/service/ki-tools.php?catalog=1', {
          credentials: 'same-origin',
          headers: { Accept: 'application/json' },
          cache: 'no-store'
        });
        const result = await response.json().catch(() => ({}));
        const tiers = {
          starter: 'Starter',
          pro: 'Pro',
          business: 'Business'
        };
        if (!response.ok || !result.ok || !tiers[result.tier]) {
          document.cookie = 'kiwz_prio=; path=/; max-age=0; SameSite=Lax; Secure';
          status.textContent = 'Dieser Code ist ungültig oder nicht mehr aktiv.';
          return;
        }
        input.value = '';
        status.textContent = 'Code gültig: Paket ' + tiers[result.tier] + ' ist jetzt aktiv.';
        if (window._paq) {
          window._paq.push(['trackEvent', 'Prio-Code', 'Eingelöst', tiers[result.tier]]);
        }
      } catch {
        document.cookie = 'kiwz_prio=; path=/; max-age=0; SameSite=Lax; Secure';
        status.textContent = 'Der Code konnte gerade nicht geprüft werden. Bitte versuche es erneut.';
      } finally {
        submit.disabled = false;
      }
    });
  }
})();