Repository navigation
Expand file tree
/
Copy pathpopup.js
More file actions
1 lines (1 loc) · 1.54 KB
/
Copy pathpopup.js
File metadata and controls
1 lines (1 loc) · 1.54 KB
1
(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))c(t);new MutationObserver(t=>{for(const n of t)if(n.type==="childList")for(const s of n.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&c(s)}).observe(document,{childList:!0,subtree:!0});function r(t){const n={};return t.integrity&&(n.integrity=t.integrity),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?n.credentials="include":t.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function c(t){if(t.ep)return;t.ep=!0;const n=r(t);fetch(t.href,n)}})();const a=document.getElementById("enabled"),i=document.getElementById("statusText"),l=document.getElementById("status"),u=document.getElementById("update-banner"),f=document.getElementById("updateText"),m=document.getElementById("updateLink");chrome.storage.local.get(["enabled","updateAvailable"],e=>{if(a.checked=e.enabled!==!1,d(a.checked),e.updateAvailable){const{latestVersion:o,releaseUrl:r}=e.updateAvailable;f.textContent=`v${o} available`,m.href=r,u.hidden=!1}});a.addEventListener("change",()=>{const e=a.checked;chrome.storage.local.set({enabled:e}),d(e),p(e?"Enabled":"Disabled")});chrome.storage.onChanged.addListener((e,o)=>{if(o!=="local"||!e.enabled)return;const r=e.enabled.newValue!==!1;r!==a.checked&&(a.checked=r,d(r))});function d(e){i.textContent=e?"Analyzing your feed":"Paused"}function p(e){l.textContent=e,setTimeout(()=>{l.textContent=""},2e3)}