function openWebsite() {
  chrome.tabs.create({ url: 'https://xiaoqingwa.vip/' });
  window.close();
}

function renderCurrentVersion() {
  const versionEl = document.getElementById('extensionVersion');
  if (!versionEl) return;
  try {
    versionEl.textContent = chrome.runtime.getManifest?.().version || '未知';
  } catch (_) {
    versionEl.textContent = '未知';
  }
}

renderCurrentVersion();

document.getElementById('openWebsiteBtn')?.addEventListener('click', openWebsite);

document.getElementById('reloadExtensionBtn')?.addEventListener('click', () => {
  chrome.runtime.reload();
});
