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

Function edit

public/src/js/edit.js:10–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8} from './utils.js';
9
10export const edit = () => {
11 if (userLoggedIn) {
12 appendNormal(`Please click and select one of the following editing actions<ul class='editList listClass'><li>Username</li><li>Security Clearance Level</li><li>Personnel Classification</li><li>Staff Title</li><li>Working Site</li><li>Profile Picture</li></ul>`)
13 $d.find(".editList li").unbind('click').bind('click', function() {
14 if (userLoggedIn) {
15 btnHide()
16 editState = $(this).index() + 1
17 $d.append($(this).text())
18 if (editState != 2 && editState != 3 && editState != 6) {
19 appendNormal(`Please enter your new ${$(this).text().toLowerCase()}`)
20 } else {
21 if (editState == 2) {
22 cmdHide()
23 var clearanceText = "Please click and select your Foundation security clearance (Available Security Clearance Level is 0 - 5)<br><ul id='clearanceEditList' class='listClass'><li>Level 0 (For Official Use Only)</li><li>Level 1 (Confidential)</li><li>Level 2 (Restricted)</li><li>Level 3 (Secret)</li><li>Level 4 (Top Secret)</li><li style='color:red'>Level 5 (Thaumiel)</li></ul><hr><small style='opacity:0.7'>Foundation security clearances granted to personnel represent the highest level or type of information to which they can be granted access. </small>"
24 appendNormal(clearanceText)
25 clearanceEditListClick()
26
27 function clearanceEditListClick() {
28 $d.find("#clearanceEditList li").unbind('click').bind('click', function() {
29 $(this).parent("#clearanceEditList").find("li").unbind("click") //disable all clicking
30 $(this).parent("#clearanceEditList").attr("id", "") //remove the id so it won't cause error
31 $(this).parent("ul").attr("class", "") //fade the option
32 $(this).addClass("disabledList") //fade the option
33 if ($(this).index() > 5 || $(this).index() < 0) {
34 appendError("ERROR OCCURED, PLEASE TRY AGAIN")
35 appendNormal(clearanceText)
36 clearanceEditListClick()
37 } else {
38 clearance = $(this).index()
39 if (clearance == 5) {
40 errorEffect()
41 } else {
42 keyphrase = ""
43 $d.append(`Foundation security clearance selected: <span class="highlight">Level ${clearance}</span>`)
44 updateUsersInfo()
45 }
46 }
47 });
48 }
49 } else if (editState == 3) {
50 cmdHide()
51 var classText = `Please click and select your personnel classifications<br><ul id='personnelEditList' class='listClass'><li>Class A (Deemed essential to Foundation strategic operations)</li><li>Class B (Deemed essential to local Foundation operations)</li><li>Class C (Personnel with direct access to most anomalies not deemed strictly hostile or dangerous)</li><li>Class D (expendable personnel used to handle extremely hazardous anomalies)</li><li>Class E (Provisional classification applied to field agents and containment personnel)</li></ul><hr><small style='opacity:0.7'>Classifications are assigned to personnel based on their proximity to potentially dangerous anomalous objects, entities, or phenomena. </small>`
52 appendNormal(classText)
53 personnellistEditClick()
54 } else {
55 if (firebase.auth().getUid() != null) {
56 loadCroppie(function() {
57 console.log("loaded")
58 })
59 appendNormal(`<blockquote class="editingPfp editPhoto" data-uid="${firebase.auth().getUid()}"><div class="upload" style="margin:0">Click to add a profile picture<br><b>+</b><br><small>File should not exceed 20 MB</small><input class="file_upload" type="file" accept="image/*" onchange="parent.uploadfile(this)" onclick="this.value=null;" /></div></blockquote>`)
60 } else {
61 appendError("PLEASE LOGIN FIRST AND CHECK YOUR INTERNET CONNECTION")
62 }
63 cmdShow()
64 btnShow()
65 editState = 0
66 }
67 }

Callers

nothing calls this directly

Calls 9

appendNormalFunction · 0.90
btnHideFunction · 0.90
cmdHideFunction · 0.90
appendErrorFunction · 0.90
cmdShowFunction · 0.90
btnShowFunction · 0.90
clearanceEditListClickFunction · 0.85
personnellistEditClickFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected