summaryrefslogtreecommitdiff
path: root/src/ui/siteInfo.js
blob: 708c983048d16562f97669eb45be4441d26ff71e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(async () => {
  let [domain, tabId] = decodeURIComponent(location.hash.replace("#", "")).split(";");
  const BASE =  "https://noscript.net";
  await include(['/lib/punycode.js', '/common/Storage.js']);
  let {siteInfoConsent} = await Storage.get("sync", "siteInfoConsent");
  if (!siteInfoConsent) {
    await include('/common/locale.js');
    siteInfoConsent = confirm(_("siteInfo_confirm", [domain, BASE]));
    if (siteInfoConsent) {
      await Storage.set("sync", {siteInfoConsent});
    } else {
      let current = await browser.tabs.getCurrent();
      await browser.tabs.update(parseInt(tabId), {active: true});
      await browser.tabs.remove(current.id);
      return;
    }
  }
  let ace  = punycode.toASCII(domain);
  location.href = `${BASE}/about/${domain};${ace}`;
})();