parthmax commited on
Commit
7248bd4
·
verified ·
1 Parent(s): ccdc167

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +151 -197
index.html CHANGED
@@ -1,212 +1,166 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>JavaRunner — Learn Java Online for Mobile & Desktop</title>
7
- <meta name="description" content="JavaRunner is a mobile and desktop-friendly interactive Java IDE for beginners. Learn Java safely on your device with auto-formatting, run code, and save files locally.">
8
- <meta name="keywords" content="Java IDE, Learn Java, Online Java Compiler, JavaRunner, Coding for Beginners, Ragini Didi">
9
- <meta name="author" content="JavaRunner Team">
10
-
11
- <!-- OpenGraph / LLM friendly -->
12
- <meta property="og:title" content="JavaRunner — Learn Java Online"/>
13
- <meta property="og:description" content="Interactive Java IDE for mobile and desktop. Write, run, save Java code locally. Perfect for beginners and students."/>
14
- <meta property="og:type" content="website"/>
15
-
16
- <!-- Font -->
17
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
18
-
19
- <!-- FontAwesome Icons -->
20
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" integrity="sha512-t9f6b..." crossorigin="anonymous" referrerpolicy="no-referrer" />
21
-
22
- <!-- CodeMirror -->
23
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
24
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
25
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/clike/clike.min.js"></script>
26
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/addon/edit/closebrackets.min.js"></script>
27
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/addon/edit/matchbrackets.min.js"></script>
28
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/addon/edit/indentation.min.js"></script>
29
-
30
- <style>
31
- :root{
32
- --bg: #0f1720;
33
- --glass: rgba(255,255,255,0.05);
34
- --glass-dark: rgba(0,0,0,0.35);
35
- --accent: #6c8cff;
36
- --accent-light: #8be5d0;
37
- --muted: #9aa4b2;
38
- --card-shadow: 0 8px 30px rgba(2,6,23,0.6);
39
- --radius: 16px;
40
- }
41
-
42
- *{box-sizing:border-box;}
43
- html, body{margin:0;padding:0;font-family:Inter,sans-serif;background: linear-gradient(180deg,#071227 0%,#0d1a2b 100%); color:#e6eef8;}
44
- body{min-height:100vh; display:flex; flex-direction:column; align-items:center; padding:12px;}
45
-
46
- h1,h2,h3,h4,h5,h6{margin:0;}
47
-
48
- .app {
49
- display:grid;
50
- grid-template-columns: 280px 1fr;
51
- gap:16px;
52
- width:100%;
53
- max-width:1200px;
54
- margin:0 auto;
55
- flex:1 1 auto;
56
- }
57
-
58
- /* Glass morph panel */
59
- .panel {
60
- background: var(--glass);
61
- backdrop-filter: blur(10px) saturate(1.05);
62
- border-radius: var(--radius);
63
- border:1px solid rgba(255,255,255,0.08);
64
- padding:14px;
65
- display:flex;
66
- flex-direction:column;
67
- gap:12px;
68
- box-shadow: var(--card-shadow);
69
- transition: all 0.2s ease;
70
- }
71
- .panel:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(8,14,40,0.6); }
72
-
73
- /* File sidebar */
74
- .files {
75
- display:flex;
76
- flex-direction:column;
77
- gap:12px;
78
- min-height:200px;
79
- }
80
- .files .top { display:flex; justify-content:space-between; align-items:center; gap:8px; }
81
- .brand { font-size:18px; font-weight:700; color: var(--accent); display:flex; align-items:center; gap:8px; }
82
- .brand i{font-size:20px; transform:translateY(-1px);}
83
- .file-list { display:flex; flex-direction:column; gap:6px; overflow:auto; max-height:calc(100vh - 220px); }
84
-
85
- .file-item {
86
- padding:8px; border-radius:12px; display:flex; justify-content:space-between; align-items:center; cursor:pointer; background: rgba(255,255,255,0.02);
87
- transition: all .14s ease;
88
- }
89
- .file-item:hover{background: rgba(108,140,255,0.1);}
90
- .file-item.active{background: rgba(108,140,255,0.12); color:#fff;}
91
-
92
- /* Editor area */
93
- .editor-area{display:flex; flex-direction:column; gap:10px;}
94
- .topbar{display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap;}
95
- .title{font-size:14px;color:var(--muted);}
96
- .controls{display:flex; gap:6px; flex-wrap:wrap; margin-top:6px;}
97
-
98
- .btn{
99
- padding:8px 10px; border-radius:12px; border:none; cursor:pointer; font-weight:600; display:inline-flex; align-items:center; gap:6px;
100
- transition: all 0.15s ease; background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); color:var(--muted);
101
- }
102
- .btn:hover{transform:translateY(-2px);color:#fff;box-shadow:0 6px 16px rgba(0,0,0,0.35);}
103
- .primary{background: linear-gradient(90deg,var(--accent), var(--accent-light)); color:#04253b; font-weight:700;}
104
- .secondary{background:transparent; border:1px solid rgba(255,255,255,0.05); color:var(--muted);}
105
-
106
- .cm-wrap{border-radius:14px; overflow:hidden; border:1px solid rgba(255,255,255,0.02);}
107
- .CodeMirror{height:calc(100vh - 400px); background: var(--glass-dark); color:#e8f1ff; font-size:13px;}
108
- .console{background: rgba(0,0,0,0.4); border-radius:12px; padding:10px; font-family:monospace; color:#cfe7ff; max-height:160px; overflow:auto; border:1px solid rgba(255,255,255,0.04);}
109
-
110
- footer{text-align:center; font-size:13px; color:var(--muted); margin-top:14px;}
111
- .note{color:#c7d7ff; font-weight:600;}
112
-
113
- /* Responsive */
114
- @media(max-width:1000px){.app{grid-template-columns:1fr;}}
115
- @media(max-width:600px){.CodeMirror{height:calc(100vh - 380px); font-size:12px;}}
116
- @media(max-width:400px){.topbar{flex-direction:column; align-items:flex-start;} .controls{flex-wrap:wrap;}}
117
- </style>
118
  </head>
119
  <body>
120
 
121
- <div class="app">
122
- <!-- File sidebar -->
123
- <div class="panel files" id="sidebar">
124
- <div class="top">
125
- <div class="brand"><i class="fa-solid fa-rocket"></i> JavaRunner</div>
126
- <div>
127
- <button class="btn" id="newBtn" title="New file"><i class="fa-solid fa-file-circle-plus"></i></button>
128
- </div>
129
  </div>
130
-
131
- <div class="file-list" id="fileList"></div>
132
  </div>
 
 
133
 
134
- <!-- Editor area -->
135
- <div class="panel editor-area">
136
- <div class="topbar">
137
- <div class="title">Interactive Java IDE — Mobile & Desktop Friendly</div>
138
- <div class="controls">
139
- <button class="btn primary" id="runBtn"><i class="fa-solid fa-play"></i> Run</button>
140
- <button class="btn secondary" id="saveBtn"><i class="fa-solid fa-floppy-disk"></i> Save</button>
141
- <button class="btn secondary" id="downloadBtn"><i class="fa-solid fa-download"></i> Download</button>
142
- <button class="btn secondary" id="formatBtn"><i class="fa-solid fa-align-left"></i> Format</button>
143
- <button class="btn secondary" id="deleteBtn"><i class="fa-solid fa-trash"></i> Delete</button>
144
- </div>
145
- </div>
146
- <div class="cm-wrap" id="cmWrap">
147
- <div id="editor"></div>
148
  </div>
149
- <div class="console" id="console">Console output will appear here.</div>
150
  </div>
 
 
 
 
151
  </div>
152
-
153
- <footer>
154
- Made with love for <span class="note">Ragini Didi 💖</span> — Happy Java Learning!
155
- </footer>
156
-
157
- <script>
158
- // ---------- CodeMirror ----------
159
- const editor = CodeMirror(document.getElementById('editor'), {
160
- mode:"text/x-java",
161
- lineNumbers:true,
162
- tabSize:4,
163
- indentUnit:4,
164
- autoCloseBrackets:true,
165
- matchBrackets:true,
166
- theme:"default",
167
- value:`class Main {
168
- public static void main(String[] args) {
169
- System.out.println("Hello Ragini Didi! Welcome to JavaRunner");
170
- }
171
  }`
172
- });
173
-
174
- function resizeEditor(){ editor.setSize('100%', window.innerHeight-400); }
175
- window.addEventListener('resize',resizeEditor);
176
- setTimeout(resizeEditor,200);
177
-
178
- // Local file storage
179
- let files = JSON.parse(localStorage.getItem('java_runner_files')||'{}');
180
- let active = localStorage.getItem('java_runner_active') || null;
181
- const fileListEl = document.getElementById('fileList');
182
- const consoleEl = document.getElementById('console');
183
-
184
- function saveToStorage(){ localStorage.setItem('java_runner_files',JSON.stringify(files)); }
185
- function setActive(name){ active=name; localStorage.setItem('java_runner_active',active); renderFiles(); editor.setValue(files[active]); }
186
- function renderFiles(){ fileListEl.innerHTML=''; Object.keys(files).forEach(f=>{const div=document.createElement('div');div.className='file-item'+(f===active?' active':''); div.innerText=f; div.onclick=()=>setActive(f); fileListEl.appendChild(div); }); }
187
-
188
- function newFile(){ const name='Main.java'; if(files[name]) { alert('File exists'); return;} files[name]=editor.getValue(); saveToStorage(); setActive(name);}
189
- function saveFile(){ if(!active)return; files[active]=editor.getValue(); saveToStorage(); consoleEl.innerText='Saved locally ✔';}
190
- function downloadFile(){ if(!active)return; const blob=new Blob([editor.getValue()],{type:'text/plain'}); const a=document.createElement('a'); a.href=URL.createObjectURL(blob); a.download=active; a.click(); URL.revokeObjectURL(a.href);}
191
- function deleteFile(){ if(!active) return; if(confirm(`Delete ${active}?`)){ delete files[active]; saveToStorage(); active=null; editor.setValue(''); renderFiles(); }}
192
-
193
- document.getElementById('newBtn').onclick=newFile;
194
- document.getElementById('saveBtn').onclick=saveFile;
195
- document.getElementById('downloadBtn').onclick=downloadFile;
196
- document.getElementById('deleteBtn').onclick=deleteFile;
197
-
198
- document.getElementById('formatBtn').onclick=()=>{ editor.execCommand('selectAll'); editor.execCommand('indentAuto'); editor.execCommand('singleSelection');};
199
-
200
- document.getElementById('runBtn').onclick=async()=>{
201
- if(!active) return; saveFile(); consoleEl.innerText='Running...';
202
- try{
203
- const resp=await fetch('/run-java',{method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({code: editor.getValue(), filename: active})});
204
- const data=await resp.json();
205
- consoleEl.innerText=data.output||data.error||'No output';
206
- }catch(e){ consoleEl.innerText='Error: '+e.message; }
207
- };
208
-
209
- if(Object.keys(files).length===0) newFile(); else setActive(Object.keys(files)[0]);
210
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  </body>
212
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>JavaRunner — Learn Java Online</title>
7
+ <meta name="description" content="JavaRunner: Interactive Java IDE to write, run, and manage Java files locally. Perfect for learners.">
8
+ <meta name="author" content="JavaRunner Team">
9
+
10
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
12
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
13
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
14
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/clike/clike.min.js"></script>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/addon/edit/closebrackets.min.js"></script>
16
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/addon/edit/matchbrackets.min.js"></script>
17
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/addon/edit/indentation.min.js"></script>
18
+
19
+ <style>
20
+ :root{
21
+ --bg:#0f1720; --glass:rgba(255,255,255,0.05); --glass-dark:rgba(0,0,0,0.35);
22
+ --accent:#6c8cff; --accent-light:#8be5d0; --muted:#9aa4b2;
23
+ --card-shadow:0 8px 30px rgba(2,6,23,0.6); --radius:16px;
24
+ }
25
+ *{box-sizing:border-box;}
26
+ html, body{margin:0;padding:0;font-family:Inter,sans-serif;background:linear-gradient(180deg,#071227 0%,#0d1a2b 100%);color:#e6eef8;}
27
+ body{min-height:100vh;display:flex;flex-direction:column;align-items:center;padding:12px;}
28
+
29
+ h1,h2,h3,h4,h5,h6{margin:0;}
30
+ .app{display:grid;grid-template-columns:280px 1fr;gap:16px;width:100%;max-width:1200px;margin:0 auto;flex:1 1 auto;}
31
+ .panel{background:var(--glass);backdrop-filter:blur(10px) saturate(1.05);border-radius:var(--radius);
32
+ border:1px solid rgba(255,255,255,0.08);padding:14px;display:flex;flex-direction:column;gap:12px;box-shadow:var(--card-shadow);
33
+ transition:all 0.2s ease;}
34
+ .panel:hover{transform:translateY(-4px);box-shadow:0 16px 40px rgba(8,14,40,0.6);}
35
+
36
+ .files{display:flex;flex-direction:column;gap:12px;min-height:200px;}
37
+ .files .top{display:flex;justify-content:space-between;align-items:center;gap:8px;}
38
+ .brand{font-size:18px;font-weight:700;color:var(--accent);display:flex;align-items:center;gap:8px;}
39
+ .brand i{font-size:20px;transform:translateY(-1px);}
40
+ .file-list{display:flex;flex-direction:column;gap:6px;overflow:auto;max-height:calc(100vh - 220px);}
41
+ .file-item{padding:8px;border-radius:12px;display:flex;justify-content:space-between;align-items:center;cursor:pointer;background:rgba(255,255,255,0.02);transition:all .14s ease;}
42
+ .file-item:hover{background:rgba(108,140,255,0.1);}
43
+ .file-item.active{background:rgba(108,140,255,0.12);color:#fff;}
44
+
45
+ .editor-area{display:flex;flex-direction:column;gap:10px;}
46
+ .topbar{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;}
47
+ .title{font-size:14px;color:var(--muted);}
48
+ .controls{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px;}
49
+ .btn{padding:8px 10px;border-radius:12px;border:none;cursor:pointer;font-weight:600;display:inline-flex;align-items:center;gap:6px;
50
+ transition:all 0.15s ease;background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); color:var(--muted);}
51
+ .btn:hover{transform:translateY(-2px);color:#fff;box-shadow:0 6px 16px rgba(0,0,0,0.35);}
52
+ .primary{background:linear-gradient(90deg,var(--accent), var(--accent-light)); color:#04253b; font-weight:700;}
53
+ .secondary{background:transparent; border:1px solid rgba(255,255,255,0.05); color:var(--muted);}
54
+
55
+ .cm-wrap{border-radius:14px; overflow:hidden; border:1px solid rgba(255,255,255,0.02);}
56
+ .CodeMirror{height:calc(100vh - 400px); background: var(--glass-dark); color:#e8f1ff; font-size:13px;}
57
+ .console{background:rgba(0,0,0,0.4);border-radius:12px;padding:10px;font-family:monospace;color:#cfe7ff;max-height:160px;overflow:auto;border:1px solid rgba(255,255,255,0.04);}
58
+
59
+ footer{text-align:center;font-size:13px;color:var(--muted);margin-top:14px;}
60
+ .note{color:#c7d7ff;font-weight:600;}
61
+ @media(max-width:1000px){.app{grid-template-columns:1fr;}}
62
+ @media(max-width:600px){.CodeMirror{height:calc(100vh - 380px); font-size:12px;}}
63
+ @media(max-width:400px){.topbar{flex-direction:column;align-items:flex-start;} .controls{flex-wrap:wrap;}}
64
+ </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </head>
66
  <body>
67
 
68
+ <div class="app">
69
+ <div class="panel files" id="sidebar">
70
+ <div class="top">
71
+ <div class="brand"><i class="fa-solid fa-rocket"></i> JavaRunner</div>
72
+ <div>
73
+ <button class="btn" id="newBtn" title="New file"><i class="fa-solid fa-file-circle-plus"></i></button>
 
 
74
  </div>
 
 
75
  </div>
76
+ <div class="file-list" id="fileList"></div>
77
+ </div>
78
 
79
+ <div class="panel editor-area">
80
+ <div class="topbar">
81
+ <div class="title">Interactive Java IDE — Mobile & Desktop Friendly</div>
82
+ <div class="controls">
83
+ <button class="btn primary" id="runBtn"><i class="fa-solid fa-play"></i> Run</button>
84
+ <button class="btn secondary" id="saveBtn"><i class="fa-solid fa-floppy-disk"></i> Save</button>
85
+ <button class="btn secondary" id="downloadBtn"><i class="fa-solid fa-download"></i> Download</button>
86
+ <button class="btn secondary" id="formatBtn"><i class="fa-solid fa-align-left"></i> Format</button>
87
+ <button class="btn secondary" id="deleteBtn"><i class="fa-solid fa-trash"></i> Delete</button>
 
 
 
 
 
88
  </div>
 
89
  </div>
90
+ <div class="cm-wrap" id="cmWrap">
91
+ <div id="editor"></div>
92
+ </div>
93
+ <div class="console" id="console">Console output will appear here.</div>
94
  </div>
95
+ </div>
96
+
97
+ <footer>
98
+ Made with love for <span class="note">Ragini Didi</span> — Happy Java Learning!
99
+ </footer>
100
+
101
+ <script>
102
+ const editor = CodeMirror(document.getElementById('editor'), {
103
+ mode:"text/x-java", lineNumbers:true, tabSize:4, indentUnit:4,
104
+ autoCloseBrackets:true, matchBrackets:true, theme:"default",
105
+ value:`class Main {
106
+ public static void main(String[] args) {
107
+ System.out.println("Hello Ragini Didi! Welcome to JavaRunner");
108
+ }
 
 
 
 
 
109
  }`
110
+ });
111
+
112
+ function resizeEditor(){ editor.setSize('100%', window.innerHeight-400); }
113
+ window.addEventListener('resize',resizeEditor);
114
+ setTimeout(resizeEditor,200);
115
+
116
+ let files = JSON.parse(localStorage.getItem('java_runner_files')||'{}');
117
+ let active = localStorage.getItem('java_runner_active') || null;
118
+ const fileListEl = document.getElementById('fileList');
119
+ const consoleEl = document.getElementById('console');
120
+
121
+ function saveToStorage(){ localStorage.setItem('java_runner_files',JSON.stringify(files)); }
122
+ function setActive(name){ active=name; localStorage.setItem('java_runner_active',active); renderFiles(); editor.setValue(files[active]); }
123
+
124
+ function renderFiles(){
125
+ fileListEl.innerHTML='';
126
+ Object.keys(files).forEach(f=>{
127
+ const div=document.createElement('div');
128
+ div.className='file-item'+(f===active?' active':'');
129
+ div.innerText=f;
130
+ div.onclick=()=>setActive(f);
131
+ fileListEl.appendChild(div);
132
+ });
133
+ }
134
+
135
+ function newFile(){
136
+ const name=prompt('Enter new file name (with .java):','NewFile.java');
137
+ if(!name) return;
138
+ if(files[name]){ alert('File already exists!'); return;}
139
+ files[name]=`class ${name.replace('.java','')} {\n public static void main(String[] args) {\n System.out.println("Hello Ragini Didi!");\n }\n}`;
140
+ saveToStorage();
141
+ setActive(name);
142
+ }
143
+
144
+ function saveFile(){ if(!active)return; files[active]=editor.getValue(); saveToStorage(); consoleEl.innerText='Saved locally ✔';}
145
+ function downloadFile(){ if(!active)return; const blob=new Blob([editor.getValue()],{type:'text/plain'}); const a=document.createElement('a'); a.href=URL.createObjectURL(blob); a.download=active; a.click(); URL.revokeObjectURL(a.href);}
146
+ function deleteFile(){ if(!active) return; if(confirm(`Delete ${active}?`)){ delete files[active]; saveToStorage(); active=null; editor.setValue(''); renderFiles(); }}
147
+
148
+ document.getElementById('newBtn').onclick=newFile;
149
+ document.getElementById('saveBtn').onclick=saveFile;
150
+ document.getElementById('downloadBtn').onclick=downloadFile;
151
+ document.getElementById('deleteBtn').onclick=deleteFile;
152
+ document.getElementById('formatBtn').onclick=()=>{ editor.execCommand('selectAll'); editor.execCommand('indentAuto'); editor.execCommand('singleSelection');};
153
+
154
+ document.getElementById('runBtn').onclick=async()=>{
155
+ if(!active) return; saveFile(); consoleEl.innerText='Running...';
156
+ try{
157
+ const resp=await fetch('/run-java',{method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({code: editor.getValue(), filename: active})});
158
+ const data=await resp.json();
159
+ consoleEl.innerText=data.output||data.error||'No output';
160
+ }catch(e){ consoleEl.innerText='Error: '+e.message; }
161
+ };
162
+
163
+ if(Object.keys(files).length===0) newFile(); else setActive(Object.keys(files)[0]);
164
+ </script>
165
  </body>
166
  </html>