(val)
| 456 | |
| 457 | //main control unit that identifies the user input and allocate command |
| 458 | function reply(val) { |
| 459 | val = val.toLowerCase().trim(); |
| 460 | //check the user input |
| 461 | $("#input").attr("placeholder", "Enter Command..."); |
| 462 | addEventLog(`Command -${splitValue(val)[0]}- accessed`); |
| 463 | switch (splitValue(val)[0]) { |
| 464 | case "access": |
| 465 | cmdHide(); |
| 466 | var accessNo = splitValue(val)[1]; |
| 467 | var accessCl = splitValue(val)[2]; |
| 468 | if (accessCl == undefined) { |
| 469 | if (userLoggedIn) { |
| 470 | accessCl = clearance; |
| 471 | } else { |
| 472 | accessCl = 0; |
| 473 | } |
| 474 | } |
| 475 | if (accessNo != undefined) { |
| 476 | if (accessCl > 5 || accessCl < 0 || isNumber(accessCl) == false) { |
| 477 | cmdShow(); |
| 478 | btnShow(); |
| 479 | appendWarn(`INVALID SECURITY CLEARANCE LEVEL. PLEASE ACCESS ANOTHER CLEARANCE LEVEL VERSION OF THE FILE. (Available Security Clearance Level is 0 - 5)`); |
| 480 | } else { |
| 481 | if (isNumber(accessNo) == true) { |
| 482 | accessNo = Number(accessNo).toLocaleString("en-US", { |
| 483 | minimumIntegerDigits: 3, |
| 484 | useGrouping: false, |
| 485 | }); |
| 486 | accessNo = "scp-" + accessNo; |
| 487 | } |
| 488 | if (userLoggedIn) { |
| 489 | if (clearance < accessCl) { |
| 490 | cmdShow(); |
| 491 | btnShow(); |
| 492 | appendWarn( |
| 493 | `INSUFFICIENT SECURITY CLEARANCE. PLEASE ACCESS ANOTHER CLEARANCE LEVEL VERSION OF THE FILE. (Your current security clearance level is ${clearance}, however, you are trying to access a level ${accessCl} document)` |
| 494 | ); |
| 495 | } else { |
| 496 | accessLoad(accessNo, accessCl); |
| 497 | } |
| 498 | } else { |
| 499 | accessLoad(accessNo, 0); |
| 500 | } |
| 501 | } |
| 502 | } else { |
| 503 | cmdShow(); |
| 504 | btnShow(); |
| 505 | appendWarn( |
| 506 | "PLEASE ENTER THE SCP NUMBER OF THE DOCUMENT YOU WISH TO CONSULT<br><hr><small style='opacity:0.7'> Example: <b>access 173 </b><small>[SCP No. Required]</small> <b>5</b> <small>[Clearance Lvl. Optional]</small></small>" |
| 507 | ); |
| 508 | } |
| 509 | break; |
| 510 | case "language": |
| 511 | appendNormal( |
| 512 | "<div>Please click and select the language of the SCP documentation you wish to access below:<ol class='languageSelect listClass'><li>Traditional Chinese</li><li>Simplified Chinese</li><li>Russian</li><li>Korean</li><li>French</li><li>Polish</li><li>Spanish</li><li>Thai</li><li>Japanese</li><li>German</li><li>Italian</li><li>Ukrainian</li><li>Portuguese</li><li>Czech</li><li>English</li></ol></div>" |
| 513 | ); |
| 514 | $d.find(".languageSelect li") |
| 515 | .unbind("click") |
no test coverage detected