-
Notifications
You must be signed in to change notification settings - Fork 101
/
search.html
93 lines (81 loc) · 3.64 KB
/
search.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Intelx.io - search results</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style> pre { margin:0 0 0 2em; } </style>
<script>
var API_KEY = '00000000-0000-0000-0000-000000000000';
var API_URL = 'https://2.intelx.io/';
$(document).on('click', '#btnSearch', function (event) {
event.preventDefault();
if ($('#searchField').val() == '') {
return;
}
$('#searchResults').html('<p>Searching for results...</p>');
$.ajax({
url: API_URL + "intelligent/search",
headers: { 'x-key': API_KEY },
type: 'POST',
cache: true,
data: JSON.stringify({
term: $('#searchField').val(),
maxresults: 10,
media: 0,
sort: 2,
terminate: []
}),
success: function (p, statusText, xhr) {
$.ajax({
url: API_URL + "intelligent/search/result",
headers: { 'x-key': API_KEY },
type: 'GET',
cache: true,
data: "id=" + p.id + "&limit=10&statistics=1&previewlines=8",
success: function (data, textStatus, xhr) {
$('#searchResults').html("");
if (!!data && data.records.length > 0) {
$.each(data.records, function (i, record) {
$.ajax({
url: API_URL + "file/preview",
headers: { 'x-key': API_KEY },
type: 'GET',
cache: true,
data: "sid=" + record['storageid'] +
"&f=" + 0 +
"&l=" + 8 +
"&c=" + 1 +
"&m=" + 1 +
"&b=" + 'pastes' +
"&k=" + API_KEY,
success: function (preview, textStatus, xhr) {
if (record['name'] != '') {
$('#searchResults').append('<h3>' + record['name'] + '</h3>');
}
$('#searchResults').append(record['date'] + '<br><pre>' + preview + '</pre><br><a href="https://intelx.io/?did=' + record['systemid'] + '" target="_blank">Full Data</a><hr> ');
}
});
});
} else {
$('#searchResults').html('<p>Nothing found :(</p>');
}
}
});
}
});
});
</script>
</head>
<body>
<form>
<fieldset>
<legend>Enter your search phrase</legend>
<input type="search" id="searchField" placeholder="Search topics or keywords" size="50">
<button class="btn btn-lg btn-success" type="submit" id="btnSearch">Search</button>
</fieldset>
</form>
<div id="searchResults">
</div>
</body>
</html>