Format settings code nicer and run prettier

This commit is contained in:
wearrrrr 2024-07-28 22:31:52 -05:00
parent 33e80ef1eb
commit 90e5bbb7f2
4 changed files with 257 additions and 267 deletions

View file

@ -32,9 +32,7 @@ module.exports = {
project: "./tsconfig.json", project: "./tsconfig.json",
}, },
plugins: ["@typescript-eslint"], plugins: ["@typescript-eslint"],
extends: [ extends: ["plugin:@typescript-eslint/recommended"],
"plugin:@typescript-eslint/recommended",
],
}, },
{ {
// Define the configuration for `<script>` tag. // Define the configuration for `<script>` tag.

View file

@ -66,7 +66,6 @@ export async function registerAndUpdateSW(): Promise<void> {
} }
} }
export async function initTransport() { export async function initTransport() {
await TransportMgr.setTransport(TransportMgr.getTransport(), localStorage.getItem("alu__wispUrl") || wispURLDefault); await TransportMgr.setTransport(TransportMgr.getTransport(), localStorage.getItem("alu__wispUrl") || wispURLDefault);
} }

View file

@ -60,7 +60,6 @@ export function getStaticPaths() {
</div> </div>
</div> </div>
</section> </section>
<script src="@components/ts/WispServerTiming.ts"></script>
</main> </main>
<ProxyRegistrar /> <ProxyRegistrar />
<script> <script>

View file

@ -73,7 +73,7 @@ export function getStaticPaths() {
loadContent(event.target.id); loadContent(event.target.id);
}); });
}); });
}
function loadContent(tabID) { function loadContent(tabID) {
if (window.currentlySelectedTab == tabID) return; if (window.currentlySelectedTab == tabID) return;
else window.currentlySelectedTab = tabID; else window.currentlySelectedTab = tabID;
@ -339,10 +339,6 @@ export function getStaticPaths() {
if (savedSearxngUrl == "") localStorage.setItem("alu__searxngUrl", "https://searxng.site/"); if (savedSearxngUrl == "") localStorage.setItem("alu__searxngUrl", "https://searxng.site/");
searxngUrlInput.value = localStorage.getItem("alu__searxngUrl"); searxngUrlInput.value = localStorage.getItem("alu__searxngUrl");
} }
// const useWss = location.protocol == "https:";
// const webSocketProtocol = useWss ? "wss://" : "ws://";
// let savedWispUrl = localStorage.getItem("alu__wispUrl");
// if (savedWispUrl == null || savedWispUrl == "") localStorage.setItem("alu__wispUrl", webSocketProtocol + location.host + "/wisp/");
const savedBareUrl = localStorage.getItem("alu__bareUrl"); const savedBareUrl = localStorage.getItem("alu__bareUrl");
if (savedBareUrl == null || savedBareUrl == "") localStorage.setItem("alu__bareUrl", location.origin + "/bare/"); if (savedBareUrl == null || savedBareUrl == "") localStorage.setItem("alu__bareUrl", location.origin + "/bare/");
@ -364,7 +360,7 @@ export function getStaticPaths() {
} }
function checkSearxng() { function checkSearxng() {
// This function checks if the "searxng" option was clicked, display an additional option if so. // Callback for search engine dropdown
const search_engine = JSON.parse(localStorage.getItem("alu__search_engine")); const search_engine = JSON.parse(localStorage.getItem("alu__search_engine"));
if (search_engine) { if (search_engine) {
if (search_engine.value.toLowerCase() == "searx") { if (search_engine.value.toLowerCase() == "searx") {
@ -380,15 +376,13 @@ export function getStaticPaths() {
function navigateToNewLangaugePage() { function navigateToNewLangaugePage() {
const value = JSON.parse(localStorage.getItem("alu__selectedLanguage")).value; const value = JSON.parse(localStorage.getItem("alu__selectedLanguage")).value;
const currentLanguage = window.location.pathname.split("/")[1]; const currentLanguage = window.location.pathname.split("/")[1];
// Do nothing.. because we're already on the page.
if (value == currentLanguage) return; if (value == currentLanguage) return;
window.location.href = `/${value}/settings`; window.location.href = `/${value}/settings`;
} }
}
document.addEventListener("astro:after-swap", () => { document.addEventListener("astro:after-swap", () => {
setTimeout(() => { setTimeout(() => {
settingsLoad(); settingsLoad();
}, 300); }, 200);
}); });
settingsLoad(); settingsLoad();
</script> </script>