Repository navigation
Expand file tree
/
Copy pathindex.ejs
More file actions
133 lines (126 loc) · 4.17 KB
/
Copy pathindex.ejs
File metadata and controls
133 lines (126 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ScriptBlocks</title>
<link rel="stylesheet" href="/highlight/default.min.css">
<link rel="stylesheet" href="/xterm.css" />
<style>
@font-face {
font-family: 'RedHat';
src: url('/fonts/redhatmono.woff2') format('woff2'),
url('/fonts/redhatmono.woff') format('woff');
font-weight: normal;
font-style: normal;
}
* {
box-sizing: border-box; /* Include padding in the element's total width and height */
}
html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: Arial, sans-serif;
background-color: #1e1e1e;
color: white;
}
body {
display: flex;
flex-direction: row;
}
main {
flex: 1;
display: flex;
}
#leftSection {
width: 25vw; /* Set width to 25% of the viewport width */
background-color: #222;
border-right: 1px solid #444;
overflow-y: auto;
height: 100%;
color: white;
}
#rightSection {
width: 75vw; /* Set width to 75% of the viewport width */
display: flex;
flex-direction: column;
}
.codearea {
flex: 0 0 66%;
position: relative;
display: flex;
}
#codeBlock {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 10px;
overflow: auto;
background: #1e1e1e;
pointer-events: none;
font-family: "RedHat";
}
textarea {
flex: 1; /* Allow the textarea to grow and fill available space */
color: #fff;
resize: none;
outline: none;
border: none;
background: transparent;
padding: 10px;
white-space: pre-wrap;
color: rgba(0,0,0,0);
}
#terminal {
flex: 1; /* Allow the terminal to grow and fill remaining space */
width: 100%; /* Full width of the parent */
height: 100%; /* Ensure it fills the height of the parent */
background-color: #222; /* Background color */
padding: 0; /* Remove padding to prevent overflow */
overflow: hidden; /* Prevent overflow to avoid double scrolling */
}
</style>
<%- include("partials/head") %>
</head>
<body>
<%- include("partials/ribbon.ejs") %>
<main>
<section id="leftSection">
<h2>Directory Tree</h2>
<p>Content for the directory tree.</p>
</section>
<div id="rightSection">
<div class="codearea">
<textarea id="textarea1" wrap="soft" spellcheck="false"></textarea>
<pre id="codeBlock" class="language-python" wrap="soft"></pre>
</div>
<div id="terminal"></div>
</div>
</main>
<script src="/highlight.js"></script>
<script src="/xterm.js"></script>
<script>
// Syntax Highlighting for Code Editor
const textarea1 = document.getElementById("textarea1");
const codeBlock = document.getElementById("codeBlock");
function updateCode() {
const content = textarea1.value
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>');
codeBlock.innerHTML = content;
hljs.highlightElement(codeBlock);
}
textarea1.addEventListener("input", updateCode);
window.onload = function () {
const initialCode = "# Write your code here...\nprint('Hello, World!')";
textarea1.value = initialCode;
updateCode();
};
</script>
<script src="/renderer.js"></script>
</body>
</html>