-
Notifications
You must be signed in to change notification settings - Fork 0
/
WEBSCRIPT S&BOX .html
300 lines (256 loc) · 9.01 KB
/
WEBSCRIPT S&BOX .html
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE html>
<html>
<head>
<title>Web-Script SandBox.exe</title>
<style>
body {
margin: 0;
padding: 20px;
zoom: 44%; /* Set the default zoom level to 25% */
}
.container {
display: flex;
flex-direction: column;
align-items: stretch;
height: calc(200vh - 400px);
margin-bottom: 20px;
}
.header9999 {
color: green;
font-size: xx-large;
}
.code-input {
flex: 1;
border: 2px solid green;
resize: none;
padding: 10px;
font-family: monospace;
font-size: xx-large;
}
.output {
flex: 1;
border: 2px solid purple;
resize: none;
padding: 10px;
font-family: monospace;
font-size: x-large;
}
.code-input.error,
.output.error {
border-color: red;
}
.button-container {
display: flex;
justify-content: space-between;
margin-top: 30px;
}
button {
padding: 10px 20px;
width: 200px;
height: 100px;
font-size: x-large;
}
#bitoFrameContainer {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 9999;
}
.close-button {
position: absolute;
top: 0;
right: 0;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
background-color: red;
color: white;
font-size: 20px;
cursor: pointer;
}
#bitoFrame {
width: 700px;
height: 500px;
border: none;
}
.drag-handle {
width: 20px;
height: 20px;
position: absolute;
background-image: url('https://icons.veryicon.com/png/o/miscellaneous/cockpit/drag-4.png');
background-size: cover;
cursor: move;
}
/* Dark mode styles */
body.dark-mode {
color: #eee;
background-color: #333;
}
body.dark-mode button {
background-color: #555;
color: #eee;
}
body.dark-mode .container {
border-color: #555;
}
body.dark-mode .code-input,
body.dark-mode .output {
background-color: #222;
color: #eee;
}
body.dark-mode .code-input.error,
body.dark-mode .output.error {
border-color: #ff5555;
}
label {
font-size: x-large;
}
</style>
</head>
<body>
<header9999 class="header9999">|Web-Script SandBox v3.4 Pre-Alpha|</header9999>
<div class="container">
<textarea id="codeInput" class="code-input" rows="5" cols="50"></textarea>
<div id="sandbox" class="output"></div>
</div>
<div class="button-container">
<button onclick="startListening()">Start live-code</button>
<button onclick="stopListening()">Stop live-code</button>
<button onclick="runCode()">Run</button>
<button onclick="saveInputText()">Save Input as Text</button>
<button onclick="saveOutputHTML()">Save Output as HTML</button>
<button onclick="sendToJSFiddle()">Send to JSFiddle</button>
<button onclick="startJdoodleEditor()">Initialize C++ Compiler/Editor & Interpreter</button> <!-- New Button -->
<button onclick="openBitoFrame()">Open Bito AI</button>
<button onclick="changeTheme()">Theme</button>
<label><input type="checkbox" onclick="toggleDarkMode()">Dark Mode</label>
</div>
<form id="jsfiddleForm" method="post" action="https://jsfiddle.net/api/post/library/pure/" target="_blank">
<input type="hidden" name="title" value="Code Sandbox">
<input type="hidden" name="html" id="jsfiddleHtml">
<input type="hidden" name="css" value="">
<input type="hidden" name="js" value="">
</form>
<div id="bitoFrameContainer">
<div class="close-button" onclick="closeBitoFrame()">✖</div>
<iframe id="bitoFrame"></iframe>
<div class="drag-handle" onmousedown="startDrag(event)"></div>
</div>
<div data-pym-src="https://www.jdoodle.com/plugin" data-language="cpp" data-version-index="3" data-libs=""></div>
<script src="https://www.jdoodle.com/assets/jdoodle-pym.min.js" type="text/javascript"></script>
<script>
var isListening = false;
var inputInterval;
var bitoFrameContainer = document.getElementById('bitoFrameContainer');
var bitoFrame = document.getElementById('bitoFrame');
var dragHandle = document.querySelector('.drag-handle');
function runCode() {
var codeInput = document.getElementById('codeInput');
var sandbox = document.getElementById('sandbox');
try {
sandbox.innerHTML = codeInput.value;
codeInput.classList.remove('error');
sandbox.classList.remove('error');
} catch (error) {
console.error(error);
codeInput.classList.add('error');
sandbox.classList.add('error');
}
}
function startListening() {
if (isListening) return;
isListening = true;
inputInterval = setInterval(function () {
runCode();
}, 1000);
}
function stopListening() {
isListening = false;
clearInterval(inputInterval);
}
function saveInputText() {
var codeInput = document.getElementById('codeInput').value;
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(codeInput));
element.setAttribute('download', 'input.txt');
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function saveOutputHTML() {
var output = document.getElementById('sandbox').innerHTML;
var element = document.createElement('a');
element.setAttribute('href', 'data:text/html;charset=utf-8,' + encodeURIComponent(output));
element.setAttribute('download', 'output.html');
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function sendToJSFiddle() {
var codeInput = document.getElementById('codeInput').value;
document.getElementById('jsfiddleHtml').value = codeInput;
document.getElementById('jsfiddleForm').submit();
}
function startJdoodleEditor() {
var jdoodleContainer = document.querySelector('[data-pym-src="https://www.jdoodle.com/plugin"]');
jdoodleContainer.innerHTML = ''; // Clear existing content
var newJdoodleContainer = document.createElement('div');
newJdoodleContainer.setAttribute('data-pym-src', 'https://www.jdoodle.com/plugin');
newJdoodleContainer.setAttribute('data-language', 'cpp');
newJdoodleContainer.setAttribute('data-version-index', '3');
newJdoodleContainer.setAttribute('data-libs', '');
jdoodleContainer.appendChild(newJdoodleContainer);
// Load the JDoodle C++ editor
var script = document.createElement('script');
script.src = 'https://www.jdoodle.com/assets/jdoodle-pym.min.js';
script.type = 'text/javascript';
document.head.appendChild(script);
}
function openBitoFrame() {
bitoFrameContainer.style.display = 'block';
bitoFrame.src = 'https://alpha.bito.co/bitoai/';
}
function closeBitoFrame() {
bitoFrameContainer.style.display = 'none';
bitoFrame.src = '';
}
function startDrag(event) {
event.preventDefault();
var offsetX = event.clientX - bitoFrameContainer.offsetLeft;
var offsetY = event.clientY - bitoFrameContainer.offsetTop;
document.onmousemove = function (event) {
if (event.buttons !== 1) return; // Only drag when the left mouse button is held
var x = event.clientX - offsetX;
var y = event.clientY - offsetY;
bitoFrameContainer.style.left = x + 'px';
bitoFrameContainer.style.top = y + 'px';
};
document.onmouseup = function () {
document.onmousemove = null;
document.onmouseup = null;
};
}
function changeTheme() {
var imageUrl = prompt("Try this theme https://gcdnb.pbrd.co/images/TDIkPmbJugHn.jpg?o=1 Now Otherwise Create and upload & or Enter the URL of the background image to change the theme:");
if (imageUrl) {
document.body.style.backgroundImage = 'url(' + imageUrl + ')';
} else {
document.body.style.backgroundImage = 'url(https://gcdnb.pbrd.co/images/TDIkPmbJugHn.jpg?o=1)';
}
}
function toggleDarkMode() {
document.body.classList.toggle('dark-mode');
}
//-This Code Sandbox is a text editor and interpreter made to replace javascript sandbox once and for alL.
// HOPE YOU ENJOY THIS PROGRAM AND FEEL FREE TO CONTACT ME VIA DISCORD REGARDING USING ANY OF MY CODE FOR OTHER PURPOSES OUTSIED ITS ALREADY FOUND USAGE...
// THANKYOU AND HAVE A NICE DAY.
//THIS TOOL IS BROUGHT TO YOU BY Indie_Unlimited @discord invite link here : ( https://discord.gg/M8TcAmbJgS )
</script>
</body>
</html>