-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.html
188 lines (136 loc) · 6.53 KB
/
template.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> -->
<meta content="width=device-width, initial-scale=1" name="viewport" />
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="assets/css/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism-tomorrow.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/plugins/line-highlight/prism-line-highlight.min.css">
<link rel="shortcut icon" type="image/png" href="favicon.png">
<script src="assets/js/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="assets/js/codemirror/lib/codemirror.css">
<script src="assets/js/codemirror/mode/clike/clike.js"></script>
<script src="assets/js/codemirror/mode/python/python.js"></script>
<script src="assets/js/codemirror/mode/css/css.js"></script>
<link rel="stylesheet" href="assets/js/codemirror/theme/monokai.css">
<link rel="stylesheet" href="assets/js/codemirror/theme/dracula.css">
<script src="assets/js/codemirror/addon/edit/matchbrackets.js"></script>
<script src="assets/js/codemirror/addon/edit/closebrackets.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-QCLB4N1VMG"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QCLB4N1VMG');
</script>
<title>Set Template</title>
<style>
.CodeMirror {
font-size: 16px;
}
</style>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<body >
<header class="site-header">
<nav class="navbar navbar-expand-md navbar-dark bg-steel fixed-top">
<div class="container">
<a class="navbar-brand mr-4" href="index.html">Leetcode2IDE</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggle" aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggle">
<div class="navbar-nav mr-auto">
<a class="nav-item nav-link" href="index.html">Home</a>
<a class="nav-item nav-link" href="parser.html">Parse Task</a>
<a class="nav-item nav-link" href="template.html">Set Template</a>
</div>
<a class="github-button" href="https://github.com/s-i-d-d-i-s" data-size="large" data-show-count="true" aria-label="Follow @s-i-d-d-i-s on GitHub">Follow @s-i-d-d-i-s</a>
</div>
</div>
</nav>
</header>
<div class="container">
<h3 class="text">Paste Your Template</h3>
<div class="container mt-4 border p-3">
<div class="card m-2">
<div class="card-body">
Your Template Should Have <strong><<func_def>></strong> and <strong><<samples>></strong>. They will be replaced by Function definition and Samples respectively
</div>
</div>
</div>
<hr class="hr-primary" />
<div class="row">
<div class="col-md-12 pt-3">
<input type="hidden" name="csrfmiddlewaretoken" value="roeeF50qMKmo7tXeQiX84YNTuib6rmV5lFGXmMrykiBY8MTbjm1c4e5MwEkltRv3">
<button type="submit" class="btn btn-success" style="margin-bottom: 10px;" onclick="save()">Save</button>
<button type="submit" class="btn btn-success" style="margin-bottom: 10px;" onclick="reset()">Reset </button>
<img id="compiling_loader" src="/static/main/compiling.gif" style="display:none;width: 40px; height: 50px; padding-bottom: 10px;">
<textarea type="text" name="textfield" class="mt-3" style="width: 100%;" rows="50" id="editor">// Hello !,Paste Your Page Source</textarea>
</div>
</div>
</div>
<script>
//
function save(){
var src = editor.getValue();
if(src.indexOf("<<samples>>")==-1){
alert("In your template, you need to have \"<<samples>>\"");
return;
}
if(src.indexOf("<<func_def>>")==-1){
alert("In your template, you need to have \"<<func_def>>\"");
return;
}
localStorage.setItem("TEMPLATE", src);
}
function reset(){
editor.setValue("");
localStorage.removeItem("TEMPLATE");
}
function getLocal(){
var temp = localStorage.getItem("TEMPLATE");
if(temp!=null){
editor.setValue(temp);
}else{
var temp = temp = `
// Generated By Leetcode2IDE
#include <bits/stdc++.h>
using namespace std;
<<func_def>>
int main() {
<<samples>>
return 0;
}
`
editor.setValue(temp);
}
}
var editor = CodeMirror.fromTextArea(document.getElementById('editor'),{
mode: "text/x-c++src",
theme: "monokai",
autoCloseBrackets: true,
lineNumbers: true,
matchBrackets: true,
smartIndent: true,
indentWithTabs: true,
indentUnit: 4
});
editor.setSize(1110, 500);
getLocal();
</script>
<footer class="page-footer font-small teal pt-1 fixed-bottom" id="baseFooter">
<div class="footer-copyright text-center py-2">© 2020 Copyright: s59_60r </div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/components/prism-cpp.min.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="assets/js/main.js"></script>
</body>
</html>