Skip to content

Commit 1fc68e9

Browse files
committed
Run prettier --write assets/**/*.js
1 parent 5b7fb09 commit 1fc68e9

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

‎assets/js/controllers/lang.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const debug = 0 ? console.log.bind(console, '[lang]') : function() {};
1+
const debug = 0 ? console.log.bind(console, '[lang]') : function () {};
22

3-
const toggleCodeblockVisibility = function(lang, visible) {
3+
const toggleCodeblockVisibility = function (lang, visible) {
44
debug('toggleCodeblockVisibility', lang, visible);
55
document.querySelectorAll(`.highlight code.language-${lang}`).forEach((el) => {
66
let highlight = el.closest('.highlight');
@@ -11,7 +11,7 @@ const toggleCodeblockVisibility = function(lang, visible) {
1111
export function newLangController() {
1212
return {
1313
tabs: [],
14-
changeLanguage: function(index) {
14+
changeLanguage: function (index) {
1515
debug('changeLanguage', index);
1616
for (let i = 0; i < this.tabs.length; i++) {
1717
let isActive = i === index;
@@ -20,14 +20,14 @@ export function newLangController() {
2020
toggleCodeblockVisibility(this.tabs[i].key, isActive);
2121
}
2222
},
23-
initLangs: function(tabs) {
23+
initLangs: function (tabs) {
2424
debug('initLangs', tabs);
2525
tabs[0].active = true;
2626
this.tabs = tabs;
2727

2828
return this.$nextTick(() => {
2929
this.changeLanguage(0);
3030
});
31-
}
31+
},
3232
};
3333
}

‎assets/js/controllers/search-lunr.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function nextUntil(elem, selector) {
1818
export function newSearchController() {
1919
var index;
2020

21-
var buildIndex = function(config) {
21+
var buildIndex = function (config) {
2222
var builder = new lunr.Builder();
2323

2424
builder.pipeline.add(lunr.trimmer, lunr.stopWordFilter, lunr.stemmer);
@@ -30,7 +30,7 @@ export function newSearchController() {
3030
};
3131

3232
function populateIndex() {
33-
index = buildIndex(function() {
33+
index = buildIndex(function () {
3434
this.ref('id');
3535
this.field('title', { boost: 10 });
3636
this.field('body');
@@ -44,7 +44,7 @@ export function newSearchController() {
4444
this.add({
4545
id: headerEl.id,
4646
title: headerEl.textContent,
47-
body: body
47+
body: body,
4848
});
4949
});
5050
});
@@ -55,29 +55,29 @@ export function newSearchController() {
5555
return {
5656
query: '',
5757
results: [],
58-
init: function() {
58+
init: function () {
5959
return this.$nextTick(() => {
6060
populateIndex();
6161
this.$watch('query', () => {
6262
this.search();
6363
});
6464
});
6565
},
66-
search: function() {
66+
search: function () {
6767
highlight.remove();
6868
let results = index.search(this.query).filter((item) => item.score > 0.0001);
6969

7070
this.results = results.map((item) => {
7171
var elem = document.getElementById(item.ref);
7272

7373
return {
74-
title: elem.innerText
74+
title: elem.innerText,
7575
};
7676
});
7777

7878
if (this.results.length > 0) {
7979
highlight.apply(new RegExp(this.query, 'i'));
8080
}
81-
}
81+
},
8282
};
8383
}

‎assets/js/controllers/toc.js‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
'use strict';
22

3-
const debug = 0 ? console.log.bind(console, '[toc]') : function() {};
3+
const debug = 0 ? console.log.bind(console, '[toc]') : function () {};
44

55
const headerEls = () => document.querySelectorAll('.content h1, .content h2, .content h3');
66

7-
const setProgress = function(self, el) {
7+
const setProgress = function (self, el) {
88
let mainEl = document.querySelector('.content');
99
let mainHeight = mainEl.offsetHeight;
1010
let mainStart = mainEl.offsetTop;
11-
let progress = Math.round((el.offsetTop - mainStart) / mainHeight * 100);
11+
let progress = Math.round(((el.offsetTop - mainStart) / mainHeight) * 100);
1212
self.activeHeading.title = el.innerText;
1313
self.activeHeading.progress = progress;
1414
};
1515

1616
export function newToCController() {
17-
const setOpenRecursive = function(row, shouldOpen) {
17+
const setOpenRecursive = function (row, shouldOpen) {
1818
if (!row.sub) {
1919
return false;
2020
}
@@ -42,37 +42,37 @@ export function newToCController() {
4242
return {
4343
activeHeading: {
4444
title: '',
45-
progress: 0
45+
progress: 0,
4646
},
4747
showHeading: true,
4848
rows: [],
49-
load: function(rows) {
49+
load: function (rows) {
5050
this.rows = rows;
5151
},
5252

53-
transitions: function() {
53+
transitions: function () {
5454
return {
5555
'x-transition:enter.duration.500ms': '',
5656
'x-transition:leave.duration.400ms': '',
57-
'x-transition.scale.origin.top.left.80': ''
57+
'x-transition.scale.origin.top.left.80': '',
5858
};
5959
},
6060

61-
rowClass: function(row) {
61+
rowClass: function (row) {
6262
return {
63-
class: `toc-h${row.level}${row.active ? ' active' : ''}${row.active_parent ? ' active-parent' : ''}`
63+
class: `toc-h${row.level}${row.active ? ' active' : ''}${row.active_parent ? ' active-parent' : ''}`,
6464
};
6565
},
6666

67-
click: function(row) {
67+
click: function (row) {
6868
this.rows.forEach((row2) => {
6969
setOpenRecursive(row2, (row3) => {
7070
return row === row3;
7171
});
7272
});
7373
},
7474

75-
onScroll: function() {
75+
onScroll: function () {
7676
debug('onScroll');
7777
let scrollpos = window.scrollY;
7878

@@ -95,6 +95,6 @@ export function newToCController() {
9595
this.activeHeading.progress = 100;
9696
}
9797
});
98-
}
98+
},
9999
};
100100
}

‎assets/js/helpers/highlight.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export class Highlight {
22
constructor(
33
opts = {
44
contentSelector: '.content',
5-
markClass: 'da-highlight-mark'
5+
markClass: 'da-highlight-mark',
66
}
77
) {
88
this.opts = opts;
@@ -22,7 +22,7 @@ export class Highlight {
2222
return NodeFilter.FILTER_ACCEPT;
2323
}
2424
return NodeFilter.FILTER_REJECT;
25-
}
25+
},
2626
},
2727
false
2828
);
@@ -71,7 +71,7 @@ export class Highlight {
7171
if (node.parentNode && node.parentNode.parentNode) {
7272
this.nodeStack.push({
7373
old: node.parentNode,
74-
new: parentClone
74+
new: parentClone,
7575
});
7676
node.parentNode.parentNode.replaceChild(parentClone, node.parentNode);
7777
}

0 commit comments

Comments
 (0)