-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
104 lines (100 loc) · 4.3 KB
/
index.html
File metadata and controls
104 lines (100 loc) · 4.3 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hosts parser</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="col-md-4 col-md-offset-8"><a href="/parser/csv.html">I want to use csv file as source</a></div>
</div>
<div class="container">
<h2 style="text-align: center">Parsing info</h2>
<form class="form-horizontal" method="post" id="form" onsubmit="event.preventDefault()">
<div class="form-group">
<label class="control-label col-sm-2" for="hosts">Hosts</label>
<div class="col-sm-10">
<textarea style="resize: none" class="form-control" id="hosts"
placeholder="Specify host(s) in protocol with hostname format (e.g. https://google.com/) delimited with whitespaces"
required name="hosts"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="keywords_checkbox">Use default keywords:</label>
<div class="col-sm-10">
<input type="checkbox" id="keywords_checkbox" name="keywords_checkbox"></input>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="keywords">Keywords:</label>
<div class="col-sm-10">
<textarea style="resize: none" class="form-control" id="keywords"
placeholder="Specify keyword(s) for links searching delimited with commas"
name="keywords"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="depth">Parsing depth:</label>
<div class="col-sm-10">
<input type="number" id="depth" name="depth" min="0" max="10" value="0"></input>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Start</button>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="depth">Parsed emails:</label>
<div class="col-sm-10">
<textarea class="form-control" type="number" id="parsed_emails" style="resize: none" disabled></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="depth">Parsed phones:</label>
<div class="col-sm-10">
<textarea class="form-control" type="number" id="parsed_phones" disabled style="resize: none"></textarea>
</div>
</div>
</form>
</div>
<script src="https://gudhub.com/parser/formClasses.js"></script>
<script>
// let rootApi = 'https://gudhub.com/parserapi/';
// let rootApi = 'http://127.0.0.1:10000/parser/';
class Form {
constructor(formId) {
this.keyWordsControl = new KeyWordsControl('keywords', 'keywords_checkbox');
this.hostsTextArea = new InputControl('hosts', false, true);
this.depthInput = new InputControl('depth');
this.form = document.getElementById(formId);
this.form.addEventListener("submit", () => this.onStart());
}
onStart() {
let api = '/parserapi/default-parsing';
let formData = new FormData();
formData.append('hosts', this.hostsTextArea.getValue());
formData.append('keywords', this.keyWordsControl.getValue());
formData.append('depth', this.depthInput.getValue());
$.ajax({
url: api,
type: "POST",
data: formData,
processData: false,
contentType: false,
success: function (data) {
let dataObj = JSON.parse(data);
document.getElementById('parsed_emails').value = dataObj.emails.join(',');
document.getElementById('parsed_phones').value = dataObj.phones.join(',');
}
})
}
}
let form = new Form('form');
</script>
</body>
</html>