Skip to content

File tree

9 files changed

+44
-34
lines changed

9 files changed

+44
-34
lines changed

static/js/clipboard.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/featherlight.min.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/highlight.pack.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/hugo-learn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ $(document).ready(function(){
6565

6666
jQuery(document).ready(function() {
6767
// Add link button for every
68-
var text, clip = new Clipboard('.anchor');
68+
var text, clip = new ClipboardJS('.anchor');
6969
$("h1~h2,h1~h3,h1~h4,h1~h5,h1~h6").append(function(index, html){
7070
var element = $(this);
7171
var url = encodeURI(document.location.origin + document.location.pathname);

static/js/jquery-3.3.1.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/learn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jQuery(document).ready(function() {
181181

182182
if (text.length > 5) {
183183
if (!clipInit) {
184-
var text, clip = new Clipboard('.copy-to-clipboard', {
184+
var text, clip = new ClipboardJS('.copy-to-clipboard', {
185185
text: function(trigger) {
186186
text = $(trigger).prev('code').text();
187187
return text.replace(/^\$\s/gm, '');

static/js/lunr.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/modernizr.custom-3.6.0.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/search.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,33 @@ function initLunr() {
1313
// First retrieve the index file
1414
$.getJSON(baseurl +"index.json")
1515
.done(function(index) {
16-
pagesIndex = index;
16+
pagesIndex = index;
1717
// Set up lunrjs by declaring the fields we use
1818
// Also provide their boost level for the ranking
19-
lunrIndex = new lunr.Index
20-
lunrIndex.ref("uri");
21-
lunrIndex.field('title', {
22-
boost: 15
23-
});
24-
lunrIndex.field('tags', {
25-
boost: 10
26-
});
27-
lunrIndex.field("content", {
28-
boost: 5
29-
});
30-
31-
// Feed lunr with each file and let lunr actually index them
32-
pagesIndex.forEach(function(page) {
33-
lunrIndex.add(page);
34-
});
35-
lunrIndex.pipeline.remove(lunrIndex.stemmer)
19+
lunrIndex = lunr(function() {
20+
this.ref("uri");
21+
this.field('title', {
22+
boost: 15
23+
});
24+
this.field('tags', {
25+
boost: 10
26+
});
27+
this.field("content", {
28+
boost: 5
29+
});
30+
31+
this.pipeline.remove(lunr.stemmer);
32+
this.searchPipeline.remove(lunr.stemmer);
33+
34+
// Feed lunr with each file and let lunr actually index them
35+
pagesIndex.forEach(function(page) {
36+
this.add(page);
37+
}, this);
38+
})
3639
})
3740
.fail(function(jqxhr, textStatus, error) {
3841
var err = textStatus + ", " + error;
39-
console.error("Error getting Hugo index flie:", err);
42+
console.error("Error getting Hugo index file:", err);
4043
});
4144
}
4245

@@ -46,9 +49,9 @@ function initLunr() {
4649
* @param {String} query
4750
* @return {Array} results
4851
*/
49-
function search(query) {
52+
function search(queryTerm) {
5053
// Find the item in our index corresponding to the lunr one to have more info
51-
return lunrIndex.search(query).map(function(result) {
54+
return lunrIndex.search(queryTerm+"^100"+" "+queryTerm+"*^10"+" "+"*"+queryTerm+"^10"+" "+queryTerm+"~2^1").map(function(result) {
5255
return pagesIndex.filter(function(page) {
5356
return page.uri === result.ref;
5457
})[0];

0 commit comments

Comments
 (0)