mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 23:36:11 +00:00
feat: add cross-browser X GeoBlock extension
This commit is contained in:
commit
0944faab3e
26 files changed
+803
No files matched your search
@@ -0,0 +1 @@
|
||||
:root { color-scheme: light dark; font: 14px/1.4 system-ui,sans-serif; } body { margin: 0; min-width: 280px; background: #0f1419; color: #e7e9ea; } main { padding: 18px; } h1 { font-size: 20px; margin: 0 0 16px; } label { display:block; } p { color:#8b98a5; } button { border:0; border-radius:999px; padding:8px 14px; background:#1d9bf0; color:white; font-weight:700; cursor:pointer; }
|
||||
@@ -0,0 +1,2 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>X GeoBlock</title><link rel="stylesheet" href="popup.css"></head>
|
||||
<body><main><h1>X GeoBlock</h1><label><input id="enabled" type="checkbox"> Filtering enabled</label><p id="summary"></p><button id="settings">Open settings</button></main><script src="../lib/config.js"></script><script src="popup.js"></script></body></html>
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
const extensionApi = globalThis.browser || chrome;
|
||||
const enabled = document.querySelector("#enabled");
|
||||
const summary = document.querySelector("#summary");
|
||||
extensionApi.storage.sync.get(XGeoConfig.DEFAULT_SETTINGS).then((value) => {
|
||||
enabled.checked = value.enabled;
|
||||
summary.textContent = `${value.blacklist.length} ${value.blacklist.length === 1 ? "country" : "countries"} blocked.`;
|
||||
});
|
||||
enabled.addEventListener("change", () => extensionApi.storage.sync.set({ enabled: enabled.checked }));
|
||||
document.querySelector("#settings").addEventListener("click", () => extensionApi.runtime.openOptionsPage());
|
||||
Reference in new issue
Block a user