-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (62 loc) · 2.39 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>init.yml.gen</title>
<link rel='stylesheet' href='https://cdnjs.loli.net/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
<style>
textarea {
width: 100%
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<h1> <code>init.yml</code>
Generator
<span class="badge badge-secondary">Beta</span>
</h1>
</div>
<div class="row">
<div class="col">
<div class="input-group mb-3">
<div class="input-group-prepend"><span class="input-group-text">Archive file</span></div>
<input class="form-control" id="achFile" placeholder="[optional]"/>
</div>
<label>Your pattern:</label><br/>
<textarea class="form-control" id="pattern" cols="40">- {points: 10, in: ques%s.in, out: ques%s.ans}</textarea><small>(use %s to replace the number)</small><br/>
<div class="input-group mb-3">
<div class="input-group-prepend"><span class="input-group-text">From</span></div>
<input class="form-control" id="timesF" placeholder="1"/>
<div class="input-group-prepend"><span class="input-group-text">to</span></div>
<input class="form-control" id="timesT" placeholder="10"/>
</div><br/>
<button class="btn btn-primary" id="btnGen">Generate!</button>
</div>
<div class="col">
<textarea class="form-control" id="result" rows="12">(Result goes here)</textarea>
</div>
</div>
</div>
<div class="container">
Written with <a href="//pugjs.org">Pug</a> | <a href="//codepen.io/outloudvi-the-reactor/pen/dQXrZO">Codepen link</a> | Done with :) on Codepen
</div>
<script src='https://cdnjs.loli.net/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<script src='https://cdnjs.loli.net/ajax/libs/popper.js/1.14.5/popper.min.js'></script>
<script src='https://cdnjs.loli.net/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'></script>
<script>
$('#btnGen').click( () => {
let ret = "";
let text = $('#pattern').val();
let fromVal = $('#timesF').val() !== "" ? Number($('#timesF').val()) : 1;
let toVal = $('#timesT').val() !== "" ? Number($('#timesT').val()) : 10;
let achieveFile = $('#achFile').val();
if (achieveFile) ret += "archive: " + achieveFile + '\n';
ret += "test_cases:" + '\n';
for(i = fromVal;i<=toVal;i++) ret += text.replace(/%s/g,i) + '\n';
$('#result').val(ret);
});
</script>
</body>
</html>