MCPcopy Create free account
hub / github.com/Milkyroad/SCiPNET / settings

Function settings

public/src/js/settings.js:1–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1export const settings = () => {
2 popUp(`Settings`, `
3 <blockquote class="darken">
4 <input class="settingsCheckbox" id="maskLocationBox" type="checkbox"></input>
5 Mask and prevent SCiPNET from displaying details regarding your location
6 </blockquote>
7 <blockquote class="darken">
8 <input class="settingsCheckbox" checked="${setting["audioStatus"]}" id="audioStatusBox" type="checkbox"></input>
9 Terminal sound effect
10 </blockquote>`)
11
12 if (setting["audioStatus"] == true) {
13 $("#audioStatusBox").prop('checked', true);
14 } else {
15 $("#audioStatusBox").prop('checked', false);
16 }
17
18 function backupSettings() {
19 if (userLoggedIn && firebase.auth().currentUser.uid != null) {
20 firebase.firestore().collection("users").doc(firebase.auth().currentUser.uid).set({
21 Settings: {
22 checkLocation: $('#maskLocationBox').is(':checked'),
23 audioStatus: $('#audioStatusBox').is(':checked'),
24 },
25 }, {
26 merge: true
27 })
28 }
29
30 setting["checkLocation"] = $('#maskLocationBox').is(':checked')
31 setting["audioStatus"] = $('#audioStatusBox').is(':checked')
32 localStorage.setItem('checkLocation', $('#maskLocationBox').is(':checked'));
33 localStorage.setItem('audioStatus', $('#audioStatusBox').is(':checked'));
34 }
35
36 //location masking function
37 $('#maskLocationBox').change(function() {
38 addEventLog(`Location masking set to: ${this.checked}`)
39 locationMasking(this.checked)
40 });
41
42 $('#audioStatusBox').change(function() {
43 addEventLog(`Audio set to: ${this.checked}`)
44 });
45
46 $('.settingsCheckbox').change(function() {
47 backupSettings()
48 })
49
50}

Callers

nothing calls this directly

Calls 2

backupSettingsFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected