summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2019-02-17 22:07:13 +0000
committerGitHub <noreply@github.com>2019-02-17 22:07:13 +0000
commit351149d00847f7e1a5bbaae991a7939365836d51 (patch)
tree073e5247a881e3e0b53b51b917c6add80abb5154
parent4f13404e7bf46aeabfcfd69ef919eaf9a9cad816 (diff)
parent9f2cbaa676748c7757beec56dac572499687d569 (diff)
downloadwiki-351149d00847f7e1a5bbaae991a7939365836d51.tar.gz
wiki-351149d00847f7e1a5bbaae991a7939365836d51.tar.bz2
wiki-351149d00847f7e1a5bbaae991a7939365836d51.zip
Merge pull request #1 from Drassil/master
sync
-rw-r--r--_includes/git-wiki/sections/tail/tail.html4
-rw-r--r--assets/js/toc.js47
2 files changed, 26 insertions, 25 deletions
diff --git a/_includes/git-wiki/sections/tail/tail.html b/_includes/git-wiki/sections/tail/tail.html
index e86191c..ccdf163 100644
--- a/_includes/git-wiki/sections/tail/tail.html
+++ b/_includes/git-wiki/sections/tail/tail.html
@@ -23,7 +23,7 @@
$('#toc').toc({
title: '<i>Contents</i>',
showSpeed: 0,
- headers: '#content h1, #content h2, #content h3, #content h4, #content h5, #content h6'
+ headers: '#git-wiki-content h1, #git-wiki-content h2, #git-wiki-content h3, #git-wiki-content h4, #git-wiki-content h5, #git-wiki-content h6'
});
$(document.body).redLinks();
});
@@ -31,4 +31,4 @@
{% if site.inc_after_tail %}
{% include {{ site.inc_after_tail }} %}
-{% endif %} \ No newline at end of file
+{% endif %}
diff --git a/assets/js/toc.js b/assets/js/toc.js
index ac46c78..bf8fbec 100644
--- a/assets/js/toc.js
+++ b/assets/js/toc.js
@@ -1,6 +1,8 @@
// https://github.com/ghiculescu/jekyll-table-of-contents
(function ($) {
$.fn.toc = function (options) {
+ var element = $(this);
+
setTimeout(function () {
var defaults = {
noBackToTopLinks: false,
@@ -30,21 +32,20 @@
var headers = $(settings.headers).filter(function () {
// get all headers with an ID
- var previousSiblingName = $(this).prev().attr("name");
+ var previousSiblingName = element.prev().attr("name");
if (!this.id && previousSiblingName) {
- this.id = $(this).attr("id", previousSiblingName.replace(/\./g, "-"));
+ this.id = element.attr("id", previousSiblingName.replace(/\./g, "-"));
}
// Yehonal
if (!this.id) {
- this.id = $(this).text().replace(/\W/g, '_');
+ this.id = element.text().replace(/\W/g, '_');
}
return this.id;
- }),
- output = $(this);
- if (!headers.length || headers.length < settings.minimumHeaders || !output.length) {
- $(this).hide();
+ });
+ if (!headers.length || headers.length < settings.minimumHeaders || !element.length) {
+ element.hide();
return;
}
@@ -52,21 +53,6 @@
settings.showEffect = 'none';
}
- var render = {
- show: function () {
- output.hide().html(html).show(settings.showSpeed);
- },
- slideDown: function () {
- output.hide().html(html).slideDown(settings.showSpeed);
- },
- fadeIn: function () {
- output.hide().html(html).fadeIn(settings.showSpeed);
- },
- none: function () {
- output.html(html);
- }
- };
-
var get_level = function (ele) {
return parseInt(ele.nodeName.replace("H", ""), 10);
};
@@ -113,7 +99,22 @@
});
}
+ var render = {
+ show: function () {
+ element.hide().html(html).show(settings.showSpeed);
+ },
+ slideDown: function () {
+ element.hide().html(html).slideDown(settings.showSpeed);
+ },
+ fadeIn: function () {
+ element.hide().html(html).fadeIn(settings.showSpeed);
+ },
+ none: function () {
+ element.html(html).show();
+ }
+ };
+
render[settings.showEffect]();
}, 0);
}
-})(jQuery); \ No newline at end of file
+})(jQuery);