mirror of
https://github.com/placeholder-soft/prodigyapi.git
synced 2026-04-28 11:55:00 +08:00
Update app javascript to pass jslint, fixes #80
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
var content, darkBox, searchInfo;
|
var content, darkBox, searchInfo;
|
||||||
var highlightOpts = { element: 'span', className: 'search-highlight' };
|
var highlightOpts = { element: 'span', className: 'search-highlight' };
|
||||||
|
|
||||||
var index = new lunr.Index;
|
var index = new lunr.Index();
|
||||||
|
|
||||||
index.ref('id');
|
index.ref('id');
|
||||||
index.field('title', { boost: 10 });
|
index.field('title', { boost: 10 });
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
// position first element. it wasn't positioned above if len > 1
|
// position first element. it wasn't positioned above if len > 1
|
||||||
if (results.length > 1) {
|
if (results.length > 1) {
|
||||||
var firstRef = results[0].ref;
|
var firstRef = results[0].ref;
|
||||||
var secondRef = results[1].ref
|
var secondRef = results[1].ref;
|
||||||
refToHeader(firstRef).insertBefore(refToHeader(secondRef));
|
refToHeader(firstRef).insertBefore(refToHeader(secondRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,12 @@
|
|||||||
(function (global) {
|
(function (global) {
|
||||||
|
|
||||||
var toc;
|
|
||||||
|
|
||||||
global.toc = toc;
|
|
||||||
|
|
||||||
$(toc);
|
|
||||||
$(animate);
|
|
||||||
|
|
||||||
var closeToc = function() {
|
var closeToc = function() {
|
||||||
$(".tocify-wrapper").removeClass('open');
|
$(".tocify-wrapper").removeClass('open');
|
||||||
$("#nav-button").removeClass('open');
|
$("#nav-button").removeClass('open');
|
||||||
};
|
};
|
||||||
|
|
||||||
function toc () {
|
var makeToc = function() {
|
||||||
toc = $("#toc").tocify({
|
global.toc = $("#toc").tocify({
|
||||||
selectors: 'h1, h2',
|
selectors: 'h1, h2',
|
||||||
extendPage: false,
|
extendPage: false,
|
||||||
theme: 'none',
|
theme: 'none',
|
||||||
@@ -37,7 +30,7 @@
|
|||||||
|
|
||||||
$(".page-wrapper").click(closeToc);
|
$(".page-wrapper").click(closeToc);
|
||||||
$(".tocify-item").click(closeToc);
|
$(".tocify-item").click(closeToc);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Hack to make already open sections to start opened,
|
// Hack to make already open sections to start opened,
|
||||||
// instead of displaying an ugly animation
|
// instead of displaying an ugly animation
|
||||||
@@ -47,5 +40,8 @@
|
|||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(makeToc);
|
||||||
|
$(animate);
|
||||||
|
|
||||||
})(window);
|
})(window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user