mirror of
https://git.adityakumar.xyz/hugo-theme-even.git
synced 2024-11-09 14:59:45 +00:00
parent
5e2df2d9db
commit
e1f5be88d3
6 changed files with 8 additions and 7 deletions
|
@ -62,7 +62,7 @@
|
|||
{{- end }}
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ "dist/even.min.css?v=2.7.1" | relURL }}" rel="stylesheet">
|
||||
<link href="{{ "dist/even.min.css?v=2.7.2" | relURL }}" rel="stylesheet">
|
||||
{{ if .Site.Params.bootcdn -}}
|
||||
{{ if .Site.Params.fancybox }}<link href="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.css" rel="stylesheet" crossorigin="anonymous">{{ end }}
|
||||
{{- else if .Site.Params.publicCDN.enable -}}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<script type="text/javascript" src="{{ "lib/slideout/slideout-1.0.1.min.js" | relURL }}"></script>
|
||||
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }}
|
||||
{{- end }}
|
||||
<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.1" | relURL }}"></script>
|
||||
<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.2" | relURL }}"></script>
|
||||
|
||||
{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -183,6 +183,7 @@ Even.toc = function () {
|
|||
}
|
||||
|
||||
Even._refactorToc = function (toc) {
|
||||
// when headings do not start with `h1`
|
||||
const oldTocList = toc.children[0]
|
||||
let newTocList = oldTocList
|
||||
let temp
|
||||
|
@ -192,14 +193,14 @@ Even._refactorToc = function (toc) {
|
|||
}
|
||||
|
||||
Even._linkToc = function () {
|
||||
const links = document.querySelectorAll('#TableOfContents a')
|
||||
const links = document.querySelectorAll('#TableOfContents a:first-child')
|
||||
for (let i = 0; i < links.length; i++) links[i].className += ' toc-link'
|
||||
|
||||
for (let num = 1; num <= 6; num++) {
|
||||
const headers = document.querySelectorAll('.post-content>h' + num)
|
||||
for (let i = 0; i < headers.length; i++) {
|
||||
const header = headers[i]
|
||||
header.innerHTML = `<a href="#${header.id}" class="headerlink" title="${header.innerHTML}"></a>${header.innerHTML}`
|
||||
header.innerHTML = `<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "even-src",
|
||||
"version": "2.7.1",
|
||||
"version": "2.7.2",
|
||||
"description": "even source file",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
2
static/dist/even.min.js
vendored
2
static/dist/even.min.js
vendored
|
@ -1,2 +1,2 @@
|
|||
!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";var o=t(1);t(2),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.toc(),o.Even.fancybox()}),hljs.initHighlighting(),o.Even.highlight()},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o={};o.backToTop=function(){var e=$("#back-to-top");$(window).scroll(function(){$(window).scrollTop()>100?e.fadeIn(1e3):e.fadeOut(1e3)}),e.click(function(){$("body,html").animate({scrollTop:0})})},o.mobileNavbar=function(){var e=$("#mobile-navbar"),n=$(".mobile-navbar-icon"),t=new Slideout({panel:document.getElementById("mobile-panel"),menu:document.getElementById("mobile-menu"),padding:180,tolerance:70});t.disableTouch(),n.click(function(){t.toggle()}),t.on("beforeopen",function(){e.addClass("fixed-open"),n.addClass("icon-click").removeClass("icon-out")}),t.on("beforeclose",function(){e.removeClass("fixed-open"),n.addClass("icon-out").removeClass("icon-click")}),$("#mobile-panel").on("touchend",function(){t.isOpen()&&n.click()})},o._initToc=function(){var e=$(".post-toc"),n=$(".post-footer");if(e.length){var t=e.offset().top-20,o=n.offset().top-e.height()-20,r={start:{position:"absolute",top:t},process:{position:"fixed",top:20},end:{position:"absolute",top:o}};$(window).scroll(function(){var n=$(window).scrollTop();n<t?e.css(r.start):n>o?e.css(r.end):e.css(r.process)})}var c=$(".toc-link"),i=$(".headerlink"),a=$(".post-toc-content li"),l=$.map(i,function(e){return $(e).offset().top}),s=$.map(l,function(e){return e-30});$(window).scroll(function(){var e=$(window).scrollTop(),n=function(e,n){for(var t=0;t<e.length-1;t++)if(n>e[t]&&n<=e[t+1])return t;return n>e[e.length-1]?e.length-1:-1}(s,e);if($(c).removeClass("active"),$(a).removeClass("has-active"),-1!==n){$(c[n]).addClass("active");for(var t=c[n].parentNode;"NAV"!==t.tagName;)$(t).addClass("has-active"),t=t.parentNode.parentNode}})},o.fancybox=function(){$.fancybox&&($(".post-content").each(function(){$(this).find("img").each(function(){$(this).wrap('<a class="fancybox" href="'+this.src+'" data-fancybox="gallery" data-caption="'+this.title+'"></a>')})}),$(".fancybox").fancybox({selector:".fancybox",protect:!0}))},o.highlight=function(){for(var e=document.querySelectorAll("pre code"),n=0;n<e.length;n++){var t=e[n],o=t.parentElement,r=t.innerHTML.split(/\n/);""===r[r.length-1]&&r.pop();for(var c=r.length,i="",a=0;a<c;a++)i+='<div class="line">'+(a+1)+"</div>";for(var l="",s=0;s<c;s++)l+='<div class="line">'+r[s]+"</div>";t.className+=" highlight";var d=document.createElement("figure");d.className=t.className,d.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+i+'</pre></td><td class="code"><pre>'+l+"</pre></td></tr></tbody></table>",o.parentElement.replaceChild(d,o)}},o.toc=function(){var e=document.getElementById("post-toc");if(null!==e){var n=document.getElementById("TableOfContents");null===n?e.parentNode.removeChild(e):(this._refactorToc(n),this._linkToc(),this._initToc())}},o._refactorToc=function(e){for(var n=e.children[0],t=n,o=void 0;1===t.children.length&&"UL"===(o=t.children[0].children[0]).tagName;)t=o;t!==n&&e.replaceChild(t,n)},o._linkToc=function(){for(var e=document.querySelectorAll("#TableOfContents a"),n=0;n<e.length;n++)e[n].className+=" toc-link";for(var t=1;t<=6;t++)for(var o=document.querySelectorAll(".post-content>h"+t),r=0;r<o.length;r++){var c=o[r];c.innerHTML='<a href="#'+c.id+'" class="headerlink" title="'+c.innerHTML+'"></a>'+c.innerHTML}},n.Even=o},function(e,n){}]);
|
||||
!function(e){var n={};function t(o){if(n[o])return n[o].exports;var c=n[o]={i:o,l:!1,exports:{}};return e[o].call(c.exports,c,c.exports,t),c.l=!0,c.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){"use strict";var o=t(1);t(2),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.toc(),o.Even.fancybox()}),hljs.initHighlighting(),o.Even.highlight()},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o={};o.backToTop=function(){var e=$("#back-to-top");$(window).scroll(function(){$(window).scrollTop()>100?e.fadeIn(1e3):e.fadeOut(1e3)}),e.click(function(){$("body,html").animate({scrollTop:0})})},o.mobileNavbar=function(){var e=$("#mobile-navbar"),n=$(".mobile-navbar-icon"),t=new Slideout({panel:document.getElementById("mobile-panel"),menu:document.getElementById("mobile-menu"),padding:180,tolerance:70});t.disableTouch(),n.click(function(){t.toggle()}),t.on("beforeopen",function(){e.addClass("fixed-open"),n.addClass("icon-click").removeClass("icon-out")}),t.on("beforeclose",function(){e.removeClass("fixed-open"),n.addClass("icon-out").removeClass("icon-click")}),$("#mobile-panel").on("touchend",function(){t.isOpen()&&n.click()})},o._initToc=function(){var e=$(".post-toc"),n=$(".post-footer");if(e.length){var t=e.offset().top-20,o=n.offset().top-e.height()-20,c={start:{position:"absolute",top:t},process:{position:"fixed",top:20},end:{position:"absolute",top:o}};$(window).scroll(function(){var n=$(window).scrollTop();n<t?e.css(c.start):n>o?e.css(c.end):e.css(c.process)})}var r=$(".toc-link"),i=$(".headerlink"),a=$(".post-toc-content li"),l=$.map(i,function(e){return $(e).offset().top}),s=$.map(l,function(e){return e-30});$(window).scroll(function(){var e=$(window).scrollTop(),n=function(e,n){for(var t=0;t<e.length-1;t++)if(n>e[t]&&n<=e[t+1])return t;return n>e[e.length-1]?e.length-1:-1}(s,e);if($(r).removeClass("active"),$(a).removeClass("has-active"),-1!==n){$(r[n]).addClass("active");for(var t=r[n].parentNode;"NAV"!==t.tagName;)$(t).addClass("has-active"),t=t.parentNode.parentNode}})},o.fancybox=function(){$.fancybox&&($(".post-content").each(function(){$(this).find("img").each(function(){$(this).wrap('<a class="fancybox" href="'+this.src+'" data-fancybox="gallery" data-caption="'+this.title+'"></a>')})}),$(".fancybox").fancybox({selector:".fancybox",protect:!0}))},o.highlight=function(){for(var e=document.querySelectorAll("pre code"),n=0;n<e.length;n++){var t=e[n],o=t.parentElement,c=t.innerHTML.split(/\n/);""===c[c.length-1]&&c.pop();for(var r=c.length,i="",a=0;a<r;a++)i+='<div class="line">'+(a+1)+"</div>";for(var l="",s=0;s<r;s++)l+='<div class="line">'+c[s]+"</div>";t.className+=" highlight";var d=document.createElement("figure");d.className=t.className,d.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+i+'</pre></td><td class="code"><pre>'+l+"</pre></td></tr></tbody></table>",o.parentElement.replaceChild(d,o)}},o.toc=function(){var e=document.getElementById("post-toc");if(null!==e){var n=document.getElementById("TableOfContents");null===n?e.parentNode.removeChild(e):(this._refactorToc(n),this._linkToc(),this._initToc())}},o._refactorToc=function(e){for(var n=e.children[0],t=n,o=void 0;1===t.children.length&&"UL"===(o=t.children[0].children[0]).tagName;)t=o;t!==n&&e.replaceChild(t,n)},o._linkToc=function(){for(var e=document.querySelectorAll("#TableOfContents a:first-child"),n=0;n<e.length;n++)e[n].className+=" toc-link";for(var t=1;t<=6;t++)for(var o=document.querySelectorAll(".post-content>h"+t),c=0;c<o.length;c++){var r=o[c];r.innerHTML='<a href="#'+r.id+'" class="headerlink"></a>'+r.innerHTML}},n.Even=o},function(e,n){}]);
|
||||
//# sourceMappingURL=even.min.js.map
|
2
static/dist/even.min.js.map
vendored
2
static/dist/even.min.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue