Skip to content

Commit 116fca3

Browse files
committed
Merge master
2 parents 3848d30 + 85568c1 commit 116fca3

File tree

6 files changed

+490
-484
lines changed

6 files changed

+490
-484
lines changed

assets/script/search.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ function typeSearch(el: HTMLInputElement) {
3131
displayKey: 't',
3232
templates: {
3333
suggestion: (obj: MinifiedSearchRecord) => {
34-
return `<div class="suggestion">
34+
return `
35+
<div class="suggestion">
3536
<span class="type-package-name">${obj.t}</span>
3637
<span class="library-name">${obj.l}</span>
37-
</div>`
38+
</div>
39+
`;
3840
}
3941
}
4042
};
@@ -57,7 +59,7 @@ function typeSearch(el: HTMLInputElement) {
5759
return new Bloodhound<MinifiedSearchRecord>({
5860
// See https://github.com/twitter/typeahead.js/blob/master/doc/bloodhound.md#options
5961
prefetch: searchIndexUrl,
60-
datumTokenizer: entry => {
62+
datumTokenizer: (entry: MinifiedSearchRecord) => {
6163
return [entry.l, entry.p, entry.t].concat(entry.g).concat(entry.m);
6264
},
6365
queryTokenizer: input => {
@@ -71,12 +73,12 @@ function typeSearch(el: HTMLInputElement) {
7173
if (x.t === query || x.t === (query + "js") || x.t === (query + ".js") || x.t === (query + "-js")) {
7274
return -1;
7375
}
74-
else if (y.t === query || y.t === (query + "js") || y.t === (query + ".js") || y.t === (query + "-js")) {
76+
77+
if (y.t === query || y.t === (query + "js") || y.t === (query + ".js") || y.t === (query + "-js")) {
7578
return 1;
7679
}
77-
else {
78-
return y.d - x.d;
79-
}
80+
81+
return y.d - x.d;
8082
}
8183
});
8284
}

assets/static/demo.css

Lines changed: 0 additions & 31 deletions
This file was deleted.

assets/static/index.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
<meta charset="utf-8">
55
<title>TypeScript Types Search</title>
66
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">
7-
<link rel="stylesheet" href="demo.css">
87
<link rel="stylesheet" href="style.css">
98
<script src="lib/jquery.min.js"></script>
109
<script src="lib/typeahead.bundle.min.js"></script>
1110
<script src="script/search.js"></script>
1211
<script>
1312
$(function() {
14-
var el = document.getElementById('demo');
15-
typeSearch(el);
16-
$(el).focus();
13+
var el = document.getElementById('demo');
14+
typeSearch(el);
15+
$(el).focus();
1716
});
1817
</script>
1918
</head>
@@ -24,8 +23,17 @@ <h1><span class="typescript"><span class="bold">Type</span>Search</span></h1>
2423
<div id="output"></div>
2524
</div>
2625

27-
<div class="footer">Powered by <a href="https://github.com/DefinitelyTyped/DefinitelyTyped">DefinitelyTyped</a> and <a href="https://github.com/Microsoft/types-publisher">types-publisher</a></div>
26+
<div class="footer">
27+
Powered by <a href="https://github.com/DefinitelyTyped/DefinitelyTyped">DefinitelyTyped</a> and <a href="https://github.com/Microsoft/types-publisher">types-publisher</a>
28+
</div>
2829

29-
<a href="https://github.com/Microsoft/TypeSearch"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
30+
<a href="https://github.com/Microsoft/TypeSearch">
31+
<img
32+
style="position: absolute; top: 0; right: 0; border: 0;"
33+
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
34+
alt="Fork me on GitHub"
35+
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
36+
/>
37+
</a>
3038
</body>
3139
</html>

assets/static/style.css

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
body {
2-
font-family: wf_segoe-ui_normal,Verdana,Geneva,Tahoma,sans-serif;;
2+
margin: 0;
3+
text-align: center;
4+
font-family: wf_segoe-ui_normal, Verdana, Geneva, Tahoma, sans-serif;
5+
font-size: 24px;
6+
line-height: 1.4;
7+
position: relative;
8+
padding-top: 1em;
39
}
410

5-
h1 {
11+
h1.headline {
612
font-weight: 100;
13+
margin-bottom: 1.4em;
14+
color: #294E80;
715
}
816

917
span.bold {
10-
font-weight: 500;
18+
font-weight: 700;
19+
}
20+
21+
#demo {
22+
width: 20em;
1123
}
1224

1325
div.suggestion {
1426
border: solid 1px gray;
27+
border-radius: 8px;
1528
cursor: pointer;
29+
background-color: #FFFFFF;
1630
}
1731

18-
.twitter-typehead {
19-
position: relative;
32+
.tt-hint, .tt-input, .tt-menu {
33+
width: 100%;
2034
}
2135

22-
.tt-hint, .tt-input, .tt-menu { width: 100%; }
23-
2436
span.type-package-name {
2537
font-family: monospace;
2638
text-align: left;
@@ -47,9 +59,10 @@ span.library-name {
4759
.tt-dropdown-menu, .gist {
4860
text-align: left;
4961
}
62+
5063
.typeahead, .tt-query, .tt-hint {
5164
border: 2px solid #CCCCCC;
52-
border-radius: 8px 8px 8px 8px;
65+
border-radius: 8px;
5366
font-size: 24px;
5467
height: 30px;
5568
line-height: 30px;
@@ -61,7 +74,7 @@ span.library-name {
6174
background-color: #FFFFFF;
6275
}
6376
.typeahead:focus {
64-
border: 2px solid #0097CF;
77+
border: 2px solid #294E80;
6578
}
6679
.tt-query {
6780
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
@@ -84,9 +97,22 @@ span.library-name {
8497
height: 24px;
8598
}
8699
.tt-suggestion.tt-cursor {
87-
background-color: #0097CF;
100+
background-color: #294E80;
88101
color: #FFFFFF;
89102
}
90103
.tt-suggestion p {
91104
margin: 0;
92105
}
106+
107+
.footer {
108+
font-size: 80%;
109+
position: fixed;
110+
bottom: 12px;
111+
left: 0px;
112+
right: 0px;
113+
text-align: center;
114+
}
115+
116+
.footer a, .footer a:visited {
117+
color: #294E80;
118+
}

0 commit comments

Comments
 (0)