You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.0 KiB

  1. function noFormat() {
  2. let elements = [
  3. "remove_comments",
  4. "remove_lines",
  5. "remove_report",
  6. "check_alias",
  7. "sign_align_in",
  8. "sign_align_port",
  9. "sign_align_generic",
  10. "sign_align_function",
  11. "sign_align_procedure",
  12. "sign_align_all",
  13. "new_line_after",
  14. "use_space",
  15. "customise_indentation",
  16. "compress",
  17. "mix_letter",
  18. "cust_eol",
  19. "sign_align_mode",
  20. "keyword",
  21. "typename"
  22. ];
  23. var isDisabled = getHTMLInputElement("no_format").checked;
  24. elements.forEach(element => {
  25. var htmlElement = getHTMLInputElement(element + "_div");
  26. try {
  27. getHTMLInputElement(element).disabled = isDisabled;
  28. }
  29. catch (_a) { }
  30. if (isDisabled) {
  31. htmlElement.className += " disabled";
  32. }
  33. else {
  34. htmlElement.className = htmlElement.className.replace(/\bdisabled\b/g, "");
  35. }
  36. });
  37. let radioButtons = document.getElementsByTagName("input");
  38. for (let i = 0; i < radioButtons.length; i++) {
  39. if (radioButtons[i].type == "radio") {
  40. radioButtons[i].disabled = isDisabled;
  41. }
  42. }
  43. }
  44. function getHTMLInputElement(id) {
  45. return document.getElementById(id);
  46. }
  47. function Compress(input) {
  48. input = input.replace(/\r\n/g, '');
  49. input = input.replace(/[\t ]+/g, ' ');
  50. input = input.replace(/[ ]?([&=:\-<>\+|])[ ]?/g, '$1');
  51. return input;
  52. }
  53. function MixLetters(input) {
  54. let arr = input.split("");
  55. for (var k = 0; k < arr.length; k++) {
  56. if (arr[k] === arr[k].toUpperCase() && Math.random() > 0.5) {
  57. arr[k] = arr[k].toLowerCase();
  58. }
  59. else if (Math.random() > 0.5) {
  60. arr[k] = arr[k].toUpperCase();
  61. }
  62. }
  63. return arr.join("");
  64. }
  65. function wordWrap() {
  66. var d = document.getElementById("result");
  67. if (d.className == "") {
  68. d.className = "wordwrap";
  69. }
  70. else {
  71. d.className = "";
  72. }
  73. }
  74. //# sourceMappingURL=main.js.map