Skip to content

Commit efd1a29

Browse files
committed
custom.js: Format
1 parent e208097 commit efd1a29

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

docs/js/custom.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ $(document).ready(function() {
6767
$('.rst-other-versions.switcher__list dl.versions dd strong').parent().addClass('rtd-current-item');
6868

6969
if ('master' !== (vl = $('.rst-other-versions.switcher__list dl.versions')).find('dd:first').text()) {
70-
vl.find('dd').each(function() {$(this).detach().prependTo(vl)});
70+
vl.find('dd').each(function() {
71+
$(this).detach().prependTo(vl);
72+
});
7173
}
7274

7375
const allVersions = [...document.querySelectorAll('.switcher__list .versions dd')];
@@ -119,12 +121,12 @@ $(document).ready(function() {
119121
inputSelector: '#search_input',
120122
transformData: function(hits) {
121123
$.each(hits, function(index, hit) {
122-
for (let lvl=2; lvl<=6; lvl++) {
123-
if (null !== hit.hierarchy['lvl'+lvl]) {
124+
for (let lvl = 2; lvl <= 6; lvl++) {
125+
if (null !== hit.hierarchy['lvl' + lvl]) {
124126
hits[index].hierarchy['lvl' + lvl] = hit.hierarchy['lvl' + lvl];
125127
}
126-
if ('undefined' !== typeof hit._highlightResult.hierarchy['lvl'+lvl]) {
127-
hits[index]._highlightResult.hierarchy['lvl'+lvl].value = hit._highlightResult.hierarchy['lvl'+lvl].value;
128+
if ('undefined' !== typeof hit._highlightResult.hierarchy['lvl' + lvl]) {
129+
hits[index]._highlightResult.hierarchy['lvl' + lvl].value = hit._highlightResult.hierarchy['lvl' + lvl].value;
128130
}
129131
}
130132
});
@@ -148,7 +150,7 @@ $(document).ready(function() {
148150
facetFilters: ['lang:en', 'version:' + branchName],
149151
hitsPerPage: hitsPerPage,
150152
},
151-
handleSelected: function (input, event, suggestion, datasetNumber, context) {
153+
handleSelected: function(input, event, suggestion, datasetNumber, context) {
152154
if (context.selectionMethod == 'click') {
153155
window.location = suggestion.url;
154156
} else if (context.selectionMethod == 'enterKey') {
@@ -171,7 +173,7 @@ $(document).ready(function() {
171173
if (event.keyCode == 13) {
172174
event.preventDefault();
173175

174-
return false
176+
return false;
175177
}
176178
});
177179

@@ -200,7 +202,7 @@ $(document).ready(function() {
200202

201203
if ($('.md-sidebar--primary .md-sidebar__scrollwrap')[0] && $('.md-sidebar--primary .md-nav__item--active:not(.md-nav__item--nested)')[0]) {
202204
$('.md-sidebar--primary .md-sidebar__scrollwrap')[0].scrollTop =
203-
$('.md-sidebar--primary .md-nav__item--active:not(.md-nav__item--nested)')[0].offsetTop - 33;
205+
$('.md-sidebar--primary .md-nav__item--active:not(.md-nav__item--nested)')[0].offsetTop - 33;
204206
}
205207

206208
$(document).scroll(function() {
@@ -231,5 +233,5 @@ $(document).ready(function() {
231233
});
232234

233235
// Mark higher-level nodes with "New" pill, not only the actual item
234-
$(".pill.new:not([hidden])").parents(".md-nav__item").children('label').children(".pill.new[hidden]").removeAttr('hidden');
236+
$('.pill.new:not([hidden])').parents('.md-nav__item').children('label').children('.pill.new[hidden]').removeAttr('hidden');
235237
});

0 commit comments

Comments
 (0)