-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.php
More file actions
172 lines (142 loc) · 4.33 KB
/
Copy patheditor.php
File metadata and controls
172 lines (142 loc) · 4.33 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>CODE ADIUTOR</title>
<style type="text/css" media="screen">
#editor {
margin-top:10px;
height:800px;
width:1300px;
font-size: 20px;
}
.login_page{
margin-top:5%;
margin-left:10%;
display:none;
}
.reg_page{
margin-top:5%;
margin-left: 10%;
display:none;
}
</style>
<script>
function login_fun(){
var x = document.getElementById("login_page");
var y = document.getElementById("reg_page");
if(x.style.display=="block"){
x.style.display="none";
}
else{
x.style.display="block";
y.style.display="none";
}
console.log(x.style.display);
}
function reg(){
var x = document.getElementById("reg_page");
var y = document.getElementById("login_page");
if(x.style.display=="block"){
x.style.display="none";
}
else{
x.style.display="block";
y.style.display="none";
}
console.log(x.style.display);
}
</script>
</head>
<body>
<div id="login">
<span onclick="login_fun()">login</span>   
<span onclick="reg()">Register</span>
</div>
<div class = "login_page" id = "login_page">
<form action="login.php" method = "POST">
Username : <input type="text" name="username"></input><br><br>
Password : <input type="password" name="pass"></input><br><br>
<input type="submit" name="submit"><br><br>
</form>
</div>
<div class= "reg_page" id="reg_page">
<form action="reg.php" method="POST">
Username : <input type="text" name="username"></input><br><br>
Email : <input type="text" name="email"></input><br><br>
Password : <input type="password" name="pass"></input><br><br>
<input type="submit" name="submit"><br><br>
</form>
</div>
<form id="form">
<select id="language" name="language" onchange="languageChange()">
<option value="C" selected="selected">C</option>
<option value="c_cpp">C++14</option>
<option value="java">Java</option>
<option value="python">Python</option>
</select>
<div type="text" id="editor" name="div_code"></div>
<textarea hidden id="code" name="code"></textarea>
INPUT :
<div class="input">
<textarea name="input" id = "in" rows="10" cols="50"></textarea>
</div>
<input type="submit" id="but" name="run"></button>
</form>
<script src="ace-builds-master/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.session.setMode("ace/mode/c_cpp");
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true,
autoScrollEditorIntoView: true
});
var input = $('#code');
editor.getSession().on("change", function () {
input.val(editor.getSession().getValue());
});
editor.commands.addCommand({
name: "showKeyboardShortcuts",
bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
exec: function(editor) {
ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
module.init(editor);
editor.showKeyboardShortcuts()
})
}
})
function languageChange(){
var s = document.getElementById("language").value;
s = "ace/mode/"+s;
editor.session.setMode(s);
editor.setValue("");
}
$('#form').submit(function(event){
var xhr;
// alert(input.val());
event.preventDefault();
$("#out").html('loading...');
var values = $(this).serialize();
console.log(values);
xhr = $.ajax({
url : "compile.php",
type : "POST",
data : values
});
xhr.done(function (response, textStatus, jqXHR){
// Show successfully for submit message
$("#out").html(response);
});
xhr.fail(function (){
// Show error
$("#result").html('There is error while submit');
});
});
</script>
OUTPUT : <br>
<textarea id="out" rows="10" cols="50"></textarea>
</body>
</html>