File size: 1,198 Bytes
46c7a16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script>
    //All this code does is set the intial values and set things that need to persist
    import {
        changeFavicon,
        changeTitle,
        setProxy,
        setTheme,
        setTransport,
    } from '@scripts/settings.ts';
    function searchUrl() {
        const currentSearch = localStorage.getItem('incog||search');
        if (!currentSearch) {
            localStorage.setItem('incog||search', 'https://www.google.com/search?q=%s');
        }
    }
    setTheme(localStorage.getItem('incog||currentTheme') as string || 'ocean');
    setProxy(localStorage.getItem('incog||proxy') as string || 'uv');
    setTransport(localStorage.getItem('incog||transport') as string || 'epoxy');
    searchUrl();
    changeTitle(localStorage.getItem('incog||title') as string || null);
    changeFavicon(localStorage.getItem('incog||favicon') as string || null);
    document.addEventListener('astro:after-swap', function () {
        setTheme(localStorage.getItem('incog||currentTheme') as string || 'ocean');
        changeTitle(localStorage.getItem('incog||title') as string || null);
        changeFavicon(localStorage.getItem('incog||favicon') as string || null);
    });
</script>