Debian Codegraph @

addon/doxycommentview/index.html

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Doxygen comment viewer</title>
6 <link rel="stylesheet" type="text/css" href="/doxygen.css"/>
7 <style>
8 body {
9 margin: 0;
10 padding: 0;
11 display: flex;
12 height: 100vh;
13 }
14 .panel {
15 display: flex;
16 width: 50%;
17 padding: 20px;
18 box-sizing: border-box;
19 }
20 .line-numbers {
21 background: #f0f0f0;
22 padding: 10px;
23 margin: 0px;
24 margin-top: 2px;
25 text-align: right;
26 user-select: none;
27 white-space: pre;
28 border-right: 1px solid #ccc;
29 font-family: monospace;
30 font-size: 14px;
31 line-height: 1.5;
32 overflow: hidden;
33 }
34 #input {
35 width: 100%;
36 height: 100%;
37 padding: 10px;
38 margin: 0px;
39 box-sizing: border-box;
40 resize: none;
41 font-family: monospace;
42 font-size: 14px;
43 line-height: 1.5;
44 }
45 #output {
46 border-left: 1px solid #ccc;
47 display: flex;
48 flex-direction: column;
49 overflow: hidden;
50 }
51 #output-area {
52 flex: 1;
53 overflow: auto;
54 }
55 #console-area {
56 height: 150px; /* Fixed height for the console area */
57 border-top: 1px solid #ccc;
58 overflow: auto;
59 background-color: #f9f9f9; /* Light grey background for console area */
60 padding: 10px;
61 box-sizing: border-box;
62 }
63 </style>
64 </head>
65 <body>
66 <div class="panel">
67 <div class="line-numbers" id="line-numbers">1</div>
68 <textarea id="input" oninput="updateLineNumbers()" onscroll="syncScroll()" onkeydown="updateLineNumbers()" onkeyup="updateLineNumbers()"></textarea>
69 </div>
70 <div class="panel" id="output">
71 <!-- Processed output will appear here -->
72 <div id="output-area">
73 <!-- Processed output will appear here -->
74 </div>
75 <div id="console-area">
76 <!-- Error messages will appear here -->
77 </div>
78 </div>
79 <script>
80 function updateLineNumbers() {
81 const textarea = document.getElementById('input');
82 const lineNumbers = document.getElementById('line-numbers');
83
84 const lines = textarea.value.split('\n').length;
85 let lineNumberString = '';
86 for (let i = 1; i <= lines; i++) {
87 lineNumberString += i + '\n';
88 }
89
90 lineNumbers.textContent = lineNumberString;
91 }
92
93 function syncScroll() {
94 const textarea = document.getElementById('input');
95 const lineNumbers = document.getElementById('line-numbers');
96 lineNumbers.scrollTop = textarea.scrollTop;
97 }
98
99 function processInput() {
100 const input = document.getElementById('input').value;
101 sessionStorage.setItem('userInput', input);
102 fetch('/process', {
103 method: 'POST',
104 headers: {
105 'Content-Type': 'application/json',
106 },
107 body: JSON.stringify({ input: input }),
108 })
109 .then(response => response.json())
110 .then(result => {
111 document.getElementById('output-area').innerHTML = result.html_output;
112 document.getElementById('console-area').innerHTML = result.error_output;
113 });
114 }
115
116 document.getElementById('input').addEventListener('input', () => {
117 processInput();
118 });
119
120 // Load previously saved input from local storage
121 window.onload = () => {
122 const savedInput = sessionStorage.getItem('userInput');
123 if (savedInput) {
124 document.getElementById('input').value = savedInput;
125 processInput();
126 }
127 // Initial line numbers update
128 updateLineNumbers();
129 };
130 </script>
131 </body>
132 </html>