Skip to content

Commit f9d7917

Browse files
committed
Added top websites to search results
1 parent e003f22 commit f9d7917

1 file changed

Lines changed: 12 additions & 25 deletions

File tree

script.js

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -116,31 +116,6 @@ function initSearchBar() {
116116
search_results_element.innerHTML = '';
117117

118118
if (this.value.length > 0 && event.inputType !== 'deleteContentBackward') {
119-
/*for (var i = 0; i < TOP_SITES_length; i++) {
120-
var result = TOP_SITES[i];
121-
122-
if (result.indexOf(this.value) === 0 && first === null) {
123-
first = result;
124-
} else if (result.indexOf(this.value) !== -1) {
125-
results.push(result);
126-
}
127-
}*/
128-
129-
/*for (var key in BOOKMARKS) {
130-
if (key.indexOf(this.value) !== -1) {
131-
results.push([key.match(/\/\/(.*)/)[1], 9999]);
132-
}
133-
}*/
134-
135-
/*for (var i = 0, l = SEARCH.length; i < l; i++) {
136-
var item = SEARCH[i],
137-
m = item[0].match(r);
138-
139-
if (m) {
140-
results.push(item);
141-
}
142-
}*/
143-
144119
for (var i = 0, l = SEARCH.length; i < l; i++) {
145120
var item = SEARCH[i];
146121

@@ -161,6 +136,18 @@ function initSearchBar() {
161136
}
162137
}
163138

139+
for (var i = 0; i < TOP_SITES_length; i++) {
140+
var key = TOP_SITES[i];
141+
142+
if (key.indexOf(this.value) === 0) {
143+
results.push([
144+
key,
145+
0,
146+
'https://'
147+
]);
148+
}
149+
}
150+
164151
results = sort(results, 1);
165152

166153
results = results.slice(0, 6);

0 commit comments

Comments
 (0)