[build] 4.3.13
This commit is contained in:
parent
1b912272df
commit
f1272a2f1c
11 changed files with 21 additions and 13 deletions
|
|
@ -70,14 +70,22 @@ function genIndex (path, content, router, depth) {
|
|||
return index
|
||||
}
|
||||
|
||||
function search (keywords) {
|
||||
/**
|
||||
* @param {String} query
|
||||
* @returns {Array}
|
||||
*/
|
||||
function search (query) {
|
||||
var matchingResults = [];
|
||||
var data = [];
|
||||
Object.keys(INDEXS).forEach(function (key) {
|
||||
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
|
||||
});
|
||||
|
||||
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\,\\/]+/));
|
||||
query = query.trim();
|
||||
var keywords = query.split(/[\s\-\,\\/]+/);
|
||||
if (keywords.length !== 1) {
|
||||
keywords = [].concat(query, keywords);
|
||||
}
|
||||
|
||||
var loop = function ( i ) {
|
||||
var post = data[i];
|
||||
|
|
@ -202,7 +210,7 @@ function doSearch (value) {
|
|||
|
||||
var html = '';
|
||||
matchs.forEach(function (post) {
|
||||
html += "<div class=\"matching-post\">\n<h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n<p>" + (post.content) + "</p>\n</div>";
|
||||
html += "<div class=\"matching-post\">\n<a href=\"" + (post.url) + "\"> \n<h2>" + (post.title) + "</h2>\n<p>" + (post.content) + "</p>\n</a>\n</div>";
|
||||
});
|
||||
|
||||
$panel.classList.add('show');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue