File size: 1,530 Bytes
ddebc3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
window.renderSiteFooter = async function renderSiteFooter() {
  if (document.querySelector('.site-footer')) return;

  let version = '';
  try {
    const res = await fetch('/meta', { cache: 'no-store' });
    if (res.ok) {
      const data = await res.json();
      version = String(data?.version || '').trim();
    }
  } catch {}

  const footer = document.createElement('div');
  footer.className = 'site-footer';
  footer.setAttribute('aria-hidden', 'true');

  const link = (text, href) => {
    const node = document.createElement('a');
    node.href = href;
    node.target = '_blank';
    node.rel = 'noopener';
    node.textContent = text;
    return node;
  };

  const sep = () => {
    const node = document.createElement('span');
    node.textContent = '·';
    return node;
  };

  const brand = link('Grok2API', 'https://github.com/jiujiu532/grok2api');
  footer.appendChild(brand);

  footer.appendChild(sep());

  const author = link('@Chenyme', 'https://blog.cheny.me/');
  footer.appendChild(author);

  footer.appendChild(sep());

  const author2 = link('@jiu', 'https://github.com/jiujiu532');
  footer.appendChild(author2);

  document.body.appendChild(footer);
};

const _bootSiteFooter = () => {
  if (typeof window.renderSiteFooter === 'function') {
    void window.renderSiteFooter();
  }
};

if (document.readyState === 'loading') {
  document.addEventListener('DOMContentLoaded', _bootSiteFooter, { once: true });
} else {
  _bootSiteFooter();
}

window.addEventListener('pageshow', _bootSiteFooter);