-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.html
59 lines (54 loc) · 2.28 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Simple Domainr Search Demo</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/dist/domainr-search-box.css" />
<style>
body { text-align: center; }
body, input { font-family: "helvetica neue", helvetica, sans-serif; font-size: 18px; }
#example { position: relative; width: 320px; margin: 40px auto; text-align: left; }
#example input { box-sizing: border-box; width: 100%; border: 1px solid #ccc; border-radius: 2px; padding: 3px 10px; appearance: none; }
#example input:focus { outline: none; }
#results { position: relative; width: 100%; }
#note { display: none; font-size: 14px; color: #f00; }
</style>
</head>
<body>
<div id="example">
<h1>Simple Domainr Search Demo</h1>
<input type="text" id="search" name="search" placeholder="search all domains" autofocus="autofocus" autocomplete="off">
<div id="results"></div>
<p id="note">To make this demo work, make a config.js with your <tt>clientId</tt> or <tt>mashapeKey</tt> and put it in the same directory. See config-sample.js for an example.</p>
</div>
<script src="/dist/domainr-search-box.min.js"></script>
<script src="config.js"></script>
<script>
'use strict';
/* global console, config */
if (!window.config) {
console.error('You need a config.js.');
document.getElementById('note').style.display = 'block';
}
if (!config.clientId && !config.mashapeKey) {
console.error('Your config needs to specify either a clientId or a mashapeKey.');
}
if (config.clientId && config.mashapeKey) {
console.error('Please provide only a clientId or a mashapeKey; not both.');
}
new domainr.SearchBox({
clientId: config.clientId,
mashapeKey: config.mashapeKey,
observe: document.getElementById('search'),
renderTo: document.getElementById('results'),
limit: 10,
onSelect: function(result) {
window.open('https://domainr.com/' + result.domain);
}
});
</script>
</body>
</html>