chore(deps): remove jQuery
This commit is contained in:
@@ -68,22 +68,25 @@
|
|||||||
h5,
|
h5,
|
||||||
h6 {
|
h6 {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
margin: 1.2rem 0;
|
||||||
|
|
||||||
.dark-theme & {
|
.dark-theme & {
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h2,
|
h2::before,
|
||||||
h3,
|
h3::before,
|
||||||
h4,
|
h4::before,
|
||||||
h5,
|
h5::before,
|
||||||
h6 {
|
h6::before {
|
||||||
padding-top: .8rem;
|
display: block;
|
||||||
padding-bottom: .3rem;
|
content: "";
|
||||||
|
height: 1.2 * $header-height;
|
||||||
|
margin: -1.2 * $header-height 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2::before {
|
h2 > a:first-child::before {
|
||||||
content: "#";
|
content: "#";
|
||||||
margin-right: .3125rem;
|
margin-right: .3125rem;
|
||||||
color: $single-link-color;
|
color: $single-link-color;
|
||||||
@@ -93,16 +96,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h3::before,
|
h3,
|
||||||
h4::before,
|
h4,
|
||||||
h5::before,
|
h5,
|
||||||
h6::before {
|
h6 {
|
||||||
content: "|";
|
& > a:first-child::before {
|
||||||
margin-right: .3125rem;
|
content: "|";
|
||||||
color: $single-link-color;
|
margin-right: .3125rem;
|
||||||
|
color: $single-link-color;
|
||||||
|
|
||||||
.dark-theme & {
|
.dark-theme & {
|
||||||
color: $single-link-color-dark;
|
color: $single-link-color-dark;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
header.desktop {
|
header {
|
||||||
display: block;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 100;
|
height: $header-height;
|
||||||
height: 4rem;
|
line-height: $header-height;
|
||||||
line-height: 4rem;
|
|
||||||
background-color: $header-background-color;
|
background-color: $header-background-color;
|
||||||
|
|
||||||
.dark-theme & {
|
.dark-theme & {
|
||||||
background-color: $header-background-color-dark;
|
background-color: $header-background-color-dark;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header.desktop {
|
||||||
|
display: block;
|
||||||
|
z-index: 100;
|
||||||
|
|
||||||
.header-wrapper {
|
.header-wrapper {
|
||||||
width: auto;
|
width: auto;
|
||||||
@@ -44,17 +47,12 @@ header.desktop {
|
|||||||
|
|
||||||
header.mobile {
|
header.mobile {
|
||||||
display: none;
|
display: none;
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
transition: all 0.3s ease 0s;
|
transition: all 0.3s ease 0s;
|
||||||
|
|
||||||
.header-wrapper {
|
.header-wrapper {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 4rem;
|
|
||||||
line-height: 4rem;
|
|
||||||
background: $global-background-color;
|
|
||||||
|
|
||||||
.header-container {
|
.header-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -82,9 +80,9 @@ header.mobile {
|
|||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
-webkit-transition: .2s margin .2s, .2s transform;
|
-webkit-transition: .1s margin .1s, .1s transform;
|
||||||
-moz-transition: .2s margin .2s, .2s transform;
|
-moz-transition: .1s margin .1s, .1s transform;
|
||||||
transition: .2s margin .2s, .2s transform;
|
transition: .1s margin .1s, .1s transform;
|
||||||
|
|
||||||
.dark-theme & {
|
.dark-theme & {
|
||||||
background: $global-font-color-dark;
|
background: $global-font-color-dark;
|
||||||
@@ -101,9 +99,9 @@ header.mobile {
|
|||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
span {
|
span {
|
||||||
-webkit-transition: .2s margin, .2s transform .2s;
|
-webkit-transition: .1s margin, .1s transform .1s;
|
||||||
-moz-transition: .2s margin, .2s transform .2s;
|
-moz-transition: .1s margin, .1s transform .1s;
|
||||||
transition: .2s margin, .2s transform .2s;
|
transition: .1s margin, .1s transform .1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
span:nth-child(1) {
|
span:nth-child(1) {
|
||||||
@@ -148,9 +146,5 @@ header.mobile {
|
|||||||
border-top: 2px solid $global-font-color-dark;
|
border-top: 2px solid $global-font-color-dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark-theme & {
|
|
||||||
background: $global-background-color-dark;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ $selection-color-dark: rgba(38, 139, 211, 0.3) !default;
|
|||||||
// ========== Selection ========== //
|
// ========== Selection ========== //
|
||||||
|
|
||||||
// ========== Header ========== //
|
// ========== Header ========== //
|
||||||
|
// Height of the header
|
||||||
|
$header-height: 4rem !default;
|
||||||
|
|
||||||
// Color of the header background
|
// Color of the header background
|
||||||
$header-background-color: #fafafa !default;
|
$header-background-color: #fafafa !default;
|
||||||
$header-background-color-dark: #252627 !default;
|
$header-background-color-dark: #252627 !default;
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
gitalk@1.5.0
|
gitalk@1.5.0
|
||||||
valine@1.3.10
|
valine@1.3.10
|
||||||
jquery@3.4.1
|
|
||||||
lazysizes@5.1.2
|
lazysizes@5.1.2
|
||||||
katex@0.11.1
|
katex@0.11.1
|
||||||
mermaid@8.4.2
|
mermaid@8.4.2
|
||||||
echarts@4.5.0
|
echarts@4.5.0
|
||||||
typeit@6.0.3
|
typeit@6.0.3
|
||||||
jquery-countdown@2.2.0
|
|
||||||
aplayer@1.10.1
|
aplayer@1.10.1
|
||||||
meting@2.0.1
|
meting@2.0.1
|
||||||
smooth-scroll@16.1.0
|
smooth-scroll@16.1.0
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
/*!
|
|
||||||
* The Final Countdown for jQuery v2.2.0 (http://hilios.github.io/jQuery.countdown/)
|
|
||||||
* Copyright (c) 2016 Edson Hilios
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to
|
|
||||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;f<g;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&m<10&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),Math.abs(b)>1?c:d}var f=[],g=[],h={precision:100,elapse:!1,defer:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",d:"daysToWeek",w:"weeks",W:"weeksToMonth",H:"hours",M:"minutes",S:"seconds",D:"totalDays",I:"totalHours",N:"totalMinutes",T:"totalSeconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.options.defer===!1&&this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&b<0?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),weeksToMonth:Math.floor(this.totalSecsLeft/60/60/24/7)%4,months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear()),totalDays:Math.floor(this.totalSecsLeft/60/60/24),totalHours:Math.floor(this.totalSecsLeft/60/60),totalMinutes:Math.floor(this.totalSecsLeft/60),totalSeconds:this.totalSecsLeft},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});
|
|
||||||
2
assets/js/lib/jquery/jquery.slim.min.js
vendored
2
assets/js/lib/jquery/jquery.slim.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,313 +1,288 @@
|
|||||||
jQuery(function($) {
|
(() => {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var _Theme = window._Theme || {};
|
const forEachElement = (elements, handler) => {
|
||||||
|
elements = elements || [];
|
||||||
_Theme.scroll = function () {
|
for (let i = 0; i < elements.length; i++) {
|
||||||
window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});
|
handler(elements[i]);
|
||||||
}
|
|
||||||
|
|
||||||
_Theme.toggleMobileMenu = function () {
|
|
||||||
$('#menu-toggle').on('click', () => {
|
|
||||||
$('#menu-toggle').toggleClass('active');
|
|
||||||
$('#menu-mobile').toggleClass('active');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
_Theme.toggleTheme = function () {
|
|
||||||
$('.theme-switch').on('click', () => {
|
|
||||||
$('body').toggleClass('dark-theme');
|
|
||||||
window.isDark = !window.isDark;
|
|
||||||
window.localStorage && window.localStorage.setItem('theme', window.isDark ? 'dark' : 'light');
|
|
||||||
this.echarts();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
_Theme.dynamicToTop = function () {
|
|
||||||
const min = 300;
|
|
||||||
var $toTop = $('#dynamic-to-top');
|
|
||||||
$(window).scroll(() => {
|
|
||||||
var scrollTop = $(window).scrollTop();
|
|
||||||
if (typeof document.body.style.maxHeight === 'undefined') {
|
|
||||||
$toTop.css({
|
|
||||||
'position': 'absolute',
|
|
||||||
'top': scrollTop + $(window).height() - 20,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (scrollTop > min) {
|
|
||||||
(function fadeIn(el, display){
|
|
||||||
display = display || "block";
|
|
||||||
if (el.style.display !== display) {
|
|
||||||
el.style.opacity = 0;
|
|
||||||
el.style.display = display;
|
|
||||||
(function fade() {
|
|
||||||
var val = parseFloat(el.style.opacity);
|
|
||||||
if (!((val += .1) > 1)) {
|
|
||||||
el.style.opacity = val;
|
|
||||||
requestAnimationFrame(fade);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
})(document.getElementById('dynamic-to-top'));
|
|
||||||
} else {
|
|
||||||
(function fadeOut(el){
|
|
||||||
if (el.style.display !== "none") {
|
|
||||||
el.style.opacity = 1;
|
|
||||||
(function fade() {
|
|
||||||
if ((el.style.opacity -= .1) < 0) {
|
|
||||||
el.style.display = "none";
|
|
||||||
} else {
|
|
||||||
requestAnimationFrame(fade);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
})(document.getElementById('dynamic-to-top'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
_Theme.chroma = function () {
|
|
||||||
const blocks = document.querySelectorAll('.highlight > .chroma');
|
|
||||||
for (let i = 0; i < blocks.length; i++) {
|
|
||||||
const block = blocks[i];
|
|
||||||
const codes = block.querySelectorAll('pre.chroma > code');
|
|
||||||
const code = codes[codes.length - 1];
|
|
||||||
const lang = code ? code.className.toLowerCase() : '';
|
|
||||||
block.className += ' ' + lang;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nolinenosBlocks = document.querySelectorAll('.highlight > pre.chroma');
|
|
||||||
for (let i = 0; i < nolinenosBlocks.length; i++) {
|
|
||||||
const block = nolinenosBlocks[i];
|
|
||||||
const chroma = document.createElement('div');
|
|
||||||
chroma.className = block.className;
|
|
||||||
const table = document.createElement('table');
|
|
||||||
chroma.appendChild(table);
|
|
||||||
const tbody = document.createElement('tbody');
|
|
||||||
table.appendChild(tbody);
|
|
||||||
const tr = document.createElement('tr');
|
|
||||||
tbody.appendChild(tr);
|
|
||||||
const td = document.createElement('td');
|
|
||||||
tr.appendChild(td);
|
|
||||||
block.parentElement.replaceChild(chroma, block);
|
|
||||||
td.appendChild(block);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_Theme.responsiveTable = function () {
|
class Theme {
|
||||||
const tables = document.querySelectorAll('.content table');
|
initSmoothScroll() {
|
||||||
for (let i = 0; i < tables.length; i++) {
|
new SmoothScroll('[smooth-scroll]', {speed: 300, speedAsDuration: true});
|
||||||
const table = tables[i];
|
|
||||||
const wrapper = document.createElement('div');
|
|
||||||
wrapper.className = 'table-wrapper';
|
|
||||||
table.parentElement.replaceChild(wrapper, table);
|
|
||||||
wrapper.appendChild(table);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
_Theme._refactorToc = function(toc) {
|
initMobileMenu() {
|
||||||
// when headings do not start with `h1`
|
document.getElementById('menu-toggle').onclick = () => {
|
||||||
const oldTocList = toc.children[0];
|
document.getElementById('menu-toggle').classList.toggle('active');
|
||||||
let newTocList = oldTocList;
|
document.getElementById('menu-mobile').classList.toggle('active');
|
||||||
let temp;
|
};
|
||||||
while (newTocList.children.length === 1
|
|
||||||
&& (temp = newTocList.children[0].children[0]).tagName === 'UL') {
|
|
||||||
newTocList = temp;
|
|
||||||
}
|
}
|
||||||
if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList);
|
|
||||||
};
|
|
||||||
|
|
||||||
_Theme._linkToc = function () {
|
initSwitchTheme() {
|
||||||
const links = document.querySelectorAll('#TableOfContents a:first-child');
|
forEachElement(document.getElementsByClassName('theme-switch'), (button) => {
|
||||||
for (let i = 0; i < links.length; i++) links[i].className += ' toc-link';
|
button.onclick = () => {
|
||||||
|
document.body.classList.toggle('dark-theme');
|
||||||
for (let num = 1; num <= 6; num++) {
|
window.isDark = !window.isDark;
|
||||||
const headers = document.querySelectorAll('.content>h' + num);
|
window.localStorage && window.localStorage.setItem('theme', window.isDark ? 'dark' : 'light');
|
||||||
for (let i = 0; i < headers.length; i++) {
|
this.initEcharts();
|
||||||
const header = headers[i];
|
|
||||||
header.innerHTML = `<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_Theme._initToc = function () {
|
|
||||||
const $toc = $('#post-toc');
|
|
||||||
if ($toc.length && $toc.css('display') !== 'none') {
|
|
||||||
const SPACING = 80;
|
|
||||||
const $footer = $('#post-footer');
|
|
||||||
const minTop = $toc.position().top;;
|
|
||||||
const mainTop = $('main').position().top;
|
|
||||||
const minScrollTop = minTop + mainTop - SPACING;
|
|
||||||
const changeTocState = function () {
|
|
||||||
const scrollTop = $(window).scrollTop();
|
|
||||||
const maxTop = $footer.position().top - $toc.height();
|
|
||||||
const maxScrollTop = maxTop + mainTop - SPACING;
|
|
||||||
|
|
||||||
const tocState = {
|
|
||||||
start: {
|
|
||||||
'position': 'absolute',
|
|
||||||
'top': minTop,
|
|
||||||
},
|
|
||||||
process: {
|
|
||||||
'position': 'fixed',
|
|
||||||
'top': SPACING,
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
'position': 'absolute',
|
|
||||||
'top': maxTop,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (scrollTop < minScrollTop) {
|
initDynamicToTop() {
|
||||||
$toc.css(tocState.start);
|
const min = 300;
|
||||||
} else if (scrollTop > maxScrollTop) {
|
const toTopButton = document.getElementById('dynamic-to-top');
|
||||||
$toc.css(tocState.end);
|
window.onscroll = () => {
|
||||||
|
const scrollTop = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
|
||||||
|
if (typeof document.body.style.maxHeight === 'undefined') {
|
||||||
|
toTopButton.style.position = 'absolute';
|
||||||
|
toTopButton.style.top = scrollTop + window.document.documentElement.clientHeight - 20;
|
||||||
|
}
|
||||||
|
if (scrollTop > min) {
|
||||||
|
(function fadeIn(el, display){
|
||||||
|
display = display || 'block';
|
||||||
|
if (el.style.display !== display) {
|
||||||
|
el.style.opacity = 0;
|
||||||
|
el.style.display = display;
|
||||||
|
(function fade() {
|
||||||
|
let val = parseFloat(el.style.opacity);
|
||||||
|
if ((val += .1) <= 1) {
|
||||||
|
el.style.opacity = val;
|
||||||
|
requestAnimationFrame(fade);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
})(document.getElementById('dynamic-to-top'));
|
||||||
} else {
|
} else {
|
||||||
$toc.css(tocState.process);
|
(function fadeOut(el){
|
||||||
|
if (el.style.display !== 'none') {
|
||||||
|
el.style.opacity = 1;
|
||||||
|
(function fade() {
|
||||||
|
if ((el.style.opacity -= .1) < 0) {
|
||||||
|
el.style.display = 'none';
|
||||||
|
} else {
|
||||||
|
requestAnimationFrame(fade);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
})(document.getElementById('dynamic-to-top'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
changeTocState();
|
}
|
||||||
|
|
||||||
const $toclink = $('.toc-link');
|
initHighlight() {
|
||||||
const $headerDummyLink = $('.post-dummy-target');
|
forEachElement(document.querySelectorAll('.highlight > .chroma'), (block) => {
|
||||||
const $tocLinkLis = $('.post-toc-content li');
|
const codes = block.querySelectorAll('pre.chroma > code');
|
||||||
const activeIndex = function () {
|
const code = codes[codes.length - 1];
|
||||||
const scrollTop = $(window).scrollTop();
|
const lang = code ? code.className.toLowerCase() : '';
|
||||||
const headerlinkTop = $.map($headerDummyLink, function(link) {
|
block.className += ' ' + lang;
|
||||||
return $(link).offset().top;
|
});
|
||||||
|
forEachElement(document.querySelectorAll('.highlight > pre.chroma'), (block) => {
|
||||||
|
const chroma = document.createElement('div');
|
||||||
|
chroma.className = block.className;
|
||||||
|
const table = document.createElement('table');
|
||||||
|
chroma.appendChild(table);
|
||||||
|
const tbody = document.createElement('tbody');
|
||||||
|
table.appendChild(tbody);
|
||||||
|
const tr = document.createElement('tr');
|
||||||
|
tbody.appendChild(tr);
|
||||||
|
const td = document.createElement('td');
|
||||||
|
tr.appendChild(td);
|
||||||
|
block.parentElement.replaceChild(chroma, block);
|
||||||
|
td.appendChild(block);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initTable() {
|
||||||
|
forEachElement(document.querySelectorAll('.content table'), (table) => {
|
||||||
|
const wrapper = document.createElement('div');
|
||||||
|
wrapper.className = 'table-wrapper';
|
||||||
|
table.parentElement.replaceChild(wrapper, table);
|
||||||
|
wrapper.appendChild(table);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_refactorToc(toc) {
|
||||||
|
// when headings do not start with `h1`
|
||||||
|
const oldTocList = toc.children[0];
|
||||||
|
let newTocList = oldTocList;
|
||||||
|
let temp;
|
||||||
|
while (newTocList.children.length === 1
|
||||||
|
&& (temp = newTocList.children[0].children[0]).tagName === 'UL') {
|
||||||
|
newTocList = temp;
|
||||||
|
}
|
||||||
|
if (newTocList !== oldTocList) toc.replaceChild(newTocList, oldTocList);
|
||||||
|
}
|
||||||
|
|
||||||
|
_linkToc() {
|
||||||
|
forEachElement(document.querySelectorAll('#TableOfContents a:first-child'), (link) => {
|
||||||
|
link.classList.add('toc-link');
|
||||||
|
});
|
||||||
|
for (let num = 1; num <= 6; num++) {
|
||||||
|
forEachElement(document.querySelectorAll('.content > h' + num), (header) => {
|
||||||
|
header.classList.add('headerLink');
|
||||||
|
header.innerHTML = `<a href="#${header.id}"></a>${header.innerHTML}`;
|
||||||
});
|
});
|
||||||
const searchActiveTocIndex = function(array, target) {
|
|
||||||
for (let i = 0; i < array.length - 1; i++) {
|
|
||||||
if ( target < array[i + 1]) return i;
|
|
||||||
}
|
|
||||||
return array.length - 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
const activeTocIndex = searchActiveTocIndex(headerlinkTop, scrollTop);
|
|
||||||
|
|
||||||
$($toclink).removeClass('active');
|
|
||||||
$($tocLinkLis).removeClass('has-active');
|
|
||||||
|
|
||||||
if (activeTocIndex !== -1) {
|
|
||||||
$($toclink[activeTocIndex]).addClass('active');
|
|
||||||
let ancestor = $toclink[activeTocIndex].parentNode;
|
|
||||||
while (ancestor.tagName !== 'NAV') {
|
|
||||||
$(ancestor).addClass('has-active');
|
|
||||||
ancestor = ancestor.parentNode.parentNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
activeIndex();
|
|
||||||
if (!this._initTocOnce) {
|
|
||||||
$(window).scroll(changeTocState);
|
|
||||||
$(window).scroll(activeIndex);
|
|
||||||
this._initTocOnce = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
_Theme.toc = function () {
|
_initTocState() {
|
||||||
const tocContainer = document.getElementById('post-toc');
|
const toc = document.getElementById('post-toc');
|
||||||
if (tocContainer !== null) {
|
if (toc && window.getComputedStyle(toc, null).display !== 'none') {
|
||||||
const toc = document.getElementById('TableOfContents');
|
const HEADER_SPACING = 80;
|
||||||
if (toc === null) {
|
const minTop = toc.offsetTop;
|
||||||
// toc = true, but there are no headings
|
const minScrollTop = minTop - HEADER_SPACING;
|
||||||
tocContainer.parentNode.removeChild(tocContainer);
|
const footerTop = document.getElementById('post-footer').offsetTop;
|
||||||
} else {
|
const toclinks = toc.getElementsByClassName('toc-link');
|
||||||
this._refactorToc(toc);
|
const headerLinks = document.getElementsByClassName('headerLink') || [];
|
||||||
this._linkToc();
|
const tocLinkLis = toc.querySelectorAll('.post-toc-content li');
|
||||||
this._initToc();
|
const INDEX_SPACING = 10;
|
||||||
// Listen for orientation changes
|
|
||||||
|
const changeTocState = () => {
|
||||||
|
const scrollTop = document.documentElement.scrollTop;
|
||||||
|
const maxTop = footerTop - toc.getBoundingClientRect().height;
|
||||||
|
const maxScrollTop = maxTop - HEADER_SPACING;
|
||||||
|
if (scrollTop < minScrollTop) {
|
||||||
|
toc.style.position = 'absolute';
|
||||||
|
toc.style.top = `${minTop}px`;
|
||||||
|
} else if (scrollTop > maxScrollTop) {
|
||||||
|
toc.style.position = 'absolute';
|
||||||
|
toc.style.top = `${maxTop}px`;
|
||||||
|
} else {
|
||||||
|
toc.style.position = 'fixed';
|
||||||
|
toc.style.top = `${HEADER_SPACING}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
forEachElement(toclinks, (link) => { link.classList.remove('active'); });
|
||||||
|
forEachElement(tocLinkLis, (link) => { link.classList.remove('has-active'); });
|
||||||
|
let activeTocIndex = headerLinks.length - 1;
|
||||||
|
for (let i = 0; i < headerLinks.length - 1; i++) {
|
||||||
|
const thisTop = headerLinks[i].getBoundingClientRect().top;
|
||||||
|
const nextTop = headerLinks[i + 1].getBoundingClientRect().top;
|
||||||
|
if ((i == 0 && thisTop > INDEX_SPACING)
|
||||||
|
|| (thisTop <= INDEX_SPACING && nextTop > INDEX_SPACING)) {
|
||||||
|
activeTocIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (activeTocIndex !== -1) {
|
||||||
|
toclinks[activeTocIndex].classList.add('active');
|
||||||
|
let parent = toclinks[activeTocIndex].parentElement;
|
||||||
|
while (parent.tagName !== 'NAV') {
|
||||||
|
parent.classList.add('has-active');
|
||||||
|
parent = parent.parentElement.parentElement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
changeTocState();
|
||||||
|
|
||||||
|
if (!this._initTocOnce) {
|
||||||
|
window.onscroll = changeTocState;
|
||||||
|
this._initTocOnce = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initToc() {
|
||||||
|
const tocContainer = document.getElementById('post-toc');
|
||||||
|
if (tocContainer !== null) {
|
||||||
|
const toc = document.getElementById('TableOfContents');
|
||||||
|
if (toc === null) {
|
||||||
|
tocContainer.parentElement.removeChild(tocContainer);
|
||||||
|
} else {
|
||||||
|
this._refactorToc(toc);
|
||||||
|
this._linkToc();
|
||||||
|
this._initTocState();
|
||||||
|
window.addEventListener("resize", () => {
|
||||||
|
window.setTimeout(this._initTocState, 0);
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initMermaid() {
|
||||||
|
if (window.mermaidMap) {
|
||||||
|
mermaid.initialize({startOnLoad: false, theme: null});
|
||||||
|
Object.keys(mermaidMap).forEach((id) => {
|
||||||
|
const element = document.getElementById(id);
|
||||||
|
mermaid.mermaidAPI.render("d" + id, mermaidMap[id], (svgCode) => {
|
||||||
|
element.innerHTML = svgCode;
|
||||||
|
const svg = element.firstChild;
|
||||||
|
svg.style.width = "100%"
|
||||||
|
}, element);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initEcharts() {
|
||||||
|
if (window.echartsMap) {
|
||||||
|
for (let i = 0; i < echartsArr.length; i++) {
|
||||||
|
echartsArr[i].dispose();
|
||||||
|
}
|
||||||
|
echartsArr = [];
|
||||||
|
Object.keys(echartsMap).forEach((id) => {
|
||||||
|
let myChart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});
|
||||||
|
myChart.setOption(echartsMap[id]);
|
||||||
|
echartsArr.push(myChart);
|
||||||
|
});
|
||||||
window.addEventListener("resize", function () {
|
window.addEventListener("resize", function () {
|
||||||
this.setTimeout(_Theme._initToc, 0);
|
this.setTimeout(() => {
|
||||||
|
for (let i = 0; i < echartsArr.length; i++) {
|
||||||
|
echartsArr[i].resize();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
_Theme.mermaid = function () {
|
initTypeit() {
|
||||||
if (window.mermaidMap) {
|
if (window.typeitArr) {
|
||||||
mermaid.initialize({startOnLoad: false, theme: null});
|
for (let i = 0; i < typeitArr.length; i++) {
|
||||||
const mermaidAPI = mermaid.mermaidAPI
|
const group = typeitArr[i];
|
||||||
Object.keys(mermaidMap).forEach((id) => {
|
(function typeone(i) {
|
||||||
const element = document.getElementById(id);
|
const content = document.getElementById(`r${group[i]}`).innerHTML;
|
||||||
mermaidAPI.render("d" + id, mermaidMap[id], (svgCode) => {
|
if (i === group.length - 1) {
|
||||||
element.innerHTML = svgCode;
|
new TypeIt(`#${group[i]}`, {
|
||||||
const svg = element.firstChild;
|
strings: content,
|
||||||
svg.style.width = "100%"
|
}).go();
|
||||||
}, element);
|
return;
|
||||||
});
|
}
|
||||||
}
|
let instance = new TypeIt(`#${group[i]}`, {
|
||||||
}
|
|
||||||
|
|
||||||
_Theme.echarts = function () {
|
|
||||||
if (window.echartsMap) {
|
|
||||||
for (let i = 0; i < echartsArr.length; i++) {
|
|
||||||
echartsArr[i].dispose();
|
|
||||||
}
|
|
||||||
echartsArr = [];
|
|
||||||
Object.keys(echartsMap).forEach((id) => {
|
|
||||||
let myChart = echarts.init(document.getElementById(id), window.isDark ? 'dark' : 'macarons', {renderer: 'svg'});
|
|
||||||
myChart.setOption(echartsMap[id]);
|
|
||||||
echartsArr.push(myChart);
|
|
||||||
});
|
|
||||||
window.addEventListener("resize", function () {
|
|
||||||
this.setTimeout(() => {
|
|
||||||
for (let i = 0; i < echartsArr.length; i++) {
|
|
||||||
echartsArr[i].resize();
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_Theme.countdown = function () {
|
|
||||||
if (window.countdownMap) {
|
|
||||||
Object.keys(countdownMap).forEach(function(id) {
|
|
||||||
$(`#${id}`).countdown(countdownMap[id]['date'], {elapse: true})
|
|
||||||
.on('update.countdown', function(event) {
|
|
||||||
$(this).html(event.strftime(countdownMap[id]['pattern']));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_Theme.typeit = function () {
|
|
||||||
if (window.typeitArr) {
|
|
||||||
for (let i = 0; i < typeitArr.length; i++) {
|
|
||||||
const group = typeitArr[i];
|
|
||||||
(function typeone(i) {
|
|
||||||
const content = document.getElementById(`r${group[i]}`).innerHTML;
|
|
||||||
if (i === group.length - 1) {
|
|
||||||
new TypeIt(`#${group[i]}`, {
|
|
||||||
strings: content,
|
strings: content,
|
||||||
|
afterComplete: () => {
|
||||||
|
instance.destroy();
|
||||||
|
typeone(i + 1);
|
||||||
|
},
|
||||||
}).go();
|
}).go();
|
||||||
return;
|
})(0);
|
||||||
}
|
}
|
||||||
let instance = new TypeIt(`#${group[i]}`, {
|
|
||||||
strings: content,
|
|
||||||
afterComplete: () => {
|
|
||||||
instance.destroy();
|
|
||||||
typeone(i + 1);
|
|
||||||
},
|
|
||||||
}).go();
|
|
||||||
})(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.initSmoothScroll();
|
||||||
|
this.initMobileMenu();
|
||||||
|
this.initSwitchTheme();
|
||||||
|
this.initDynamicToTop();
|
||||||
|
this.initHighlight();
|
||||||
|
this.initTable();
|
||||||
|
this.initMermaid();
|
||||||
|
this.initEcharts();
|
||||||
|
this.initTypeit();
|
||||||
|
this.initToc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const themeInit = () => {
|
||||||
|
const theme = new Theme();
|
||||||
|
theme.init();
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(() => {
|
if (document.readyState !== 'loading') {
|
||||||
_Theme.scroll();
|
themeInit();
|
||||||
_Theme.toggleMobileMenu();
|
} else {
|
||||||
_Theme.toggleTheme();
|
document.addEventListener('DOMContentLoaded', themeInit);
|
||||||
_Theme.dynamicToTop();
|
}
|
||||||
_Theme.chroma();
|
})();
|
||||||
_Theme.responsiveTable();
|
|
||||||
_Theme.mermaid();
|
|
||||||
_Theme.echarts();
|
|
||||||
_Theme.countdown();
|
|
||||||
_Theme.typeit();
|
|
||||||
_Theme.toc();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ dateFormatToUse = "2006-01-02"
|
|||||||
gitalk_css = ''
|
gitalk_css = ''
|
||||||
gitalk_js = ''
|
gitalk_js = ''
|
||||||
valine_js = ''
|
valine_js = ''
|
||||||
jquery_js = ''
|
|
||||||
lazysizes_js = ''
|
lazysizes_js = ''
|
||||||
smooth_scroll_js = ''
|
smooth_scroll_js = ''
|
||||||
katex_css = ''
|
katex_css = ''
|
||||||
@@ -180,7 +179,6 @@ dateFormatToUse = "2006-01-02"
|
|||||||
echarts_js = ''
|
echarts_js = ''
|
||||||
echarts_macarons_js = ''
|
echarts_macarons_js = ''
|
||||||
typeit_js = ''
|
typeit_js = ''
|
||||||
jquery_countdown_js = ''
|
|
||||||
aplayer_css = ''
|
aplayer_css = ''
|
||||||
aplayer_js = ''
|
aplayer_js = ''
|
||||||
meting_js = ''
|
meting_js = ''
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
|
|||||||
* :(far fa-bell): Kinds of admonitions shortcode support
|
* :(far fa-bell): Kinds of admonitions shortcode support
|
||||||
* :(fas fa-align-left): Custom align and float style shortcodes support
|
* :(fas fa-align-left): Custom align and float style shortcodes support
|
||||||
* :(fas fa-i-cursor): Animated typing support by [TypeIt](https://typeitjs.com/)
|
* :(fas fa-i-cursor): Animated typing support by [TypeIt](https://typeitjs.com/)
|
||||||
* :(far fa-clock): Animated coutdown support by [jQuery.countdown](https://github.com/hilios/jQuery.countdown)
|
|
||||||
* :(fas fa-arrow-up): Dynamic to top support by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
* :(fas fa-arrow-up): Dynamic to top support by [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||||
* ...
|
* ...
|
||||||
|
|
||||||
@@ -69,8 +68,6 @@ Thanks to the authors of following resources included in the theme:
|
|||||||
* [lazysizes](https://github.com/aFarkas/lazysizes)
|
* [lazysizes](https://github.com/aFarkas/lazysizes)
|
||||||
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||||
* [TypeIt](https://typeitjs.com/)
|
* [TypeIt](https://typeitjs.com/)
|
||||||
* [jQuery](https://github.com/jquery/jquery)
|
|
||||||
* [jQuery.countdown](https://github.com/hilios/jQuery.countdown)
|
|
||||||
* [Katex](https://katex.org/)
|
* [Katex](https://katex.org/)
|
||||||
* [mermaid](https://github.com/knsv/mermaid)
|
* [mermaid](https://github.com/knsv/mermaid)
|
||||||
* [APlayer](https://github.com/MoePlayer/APlayer)
|
* [APlayer](https://github.com/MoePlayer/APlayer)
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ dateFormatToUse = "2006-01-02"
|
|||||||
gitalk_css = ''
|
gitalk_css = ''
|
||||||
gitalk_js = ''
|
gitalk_js = ''
|
||||||
valine_js = ''
|
valine_js = ''
|
||||||
jquery_js = ''
|
|
||||||
lazysizes_js = ''
|
lazysizes_js = ''
|
||||||
smooth_scroll_js = ''
|
smooth_scroll_js = ''
|
||||||
katex_css = ''
|
katex_css = ''
|
||||||
@@ -180,7 +179,6 @@ dateFormatToUse = "2006-01-02"
|
|||||||
echarts_js = ''
|
echarts_js = ''
|
||||||
echarts_macarons_js = ''
|
echarts_macarons_js = ''
|
||||||
typeit_js = ''
|
typeit_js = ''
|
||||||
jquery_countdown_js = ''
|
|
||||||
aplayer_css = ''
|
aplayer_css = ''
|
||||||
aplayer_js = ''
|
aplayer_js = ''
|
||||||
meting_js = ''
|
meting_js = ''
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ draft: false
|
|||||||
* :(far fa-bell): 支持多种提醒样式的 shortcode
|
* :(far fa-bell): 支持多种提醒样式的 shortcode
|
||||||
* :(fas fa-align-left): 支持自定义对齐和浮动方式的 shortcode
|
* :(fas fa-align-left): 支持自定义对齐和浮动方式的 shortcode
|
||||||
* :(fas fa-i-cursor): 支持基于 [TypeIt](https://typeitjs.com/) 的打字动画
|
* :(fas fa-i-cursor): 支持基于 [TypeIt](https://typeitjs.com/) 的打字动画
|
||||||
* :(far fa-clock): 支持基于 [jQuery.countdown](https://github.com/hilios/jQuery.countdown) 的倒计时动画
|
|
||||||
* :(fas fa-arrow-up): 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll) 的回到顶部动画
|
* :(fas fa-arrow-up): 支持基于 [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll) 的回到顶部动画
|
||||||
* ...
|
* ...
|
||||||
|
|
||||||
@@ -69,8 +68,6 @@ LoveIt 根据 MIT 许可协议授权。
|
|||||||
* [lazysizes](https://github.com/aFarkas/lazysizes)
|
* [lazysizes](https://github.com/aFarkas/lazysizes)
|
||||||
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
* [Smooth Scroll](https://github.com/cferdinandi/smooth-scroll)
|
||||||
* [TypeIt](https://typeitjs.com/)
|
* [TypeIt](https://typeitjs.com/)
|
||||||
* [jQuery](https://github.com/jquery/jquery)
|
|
||||||
* [jQuery.countdown](https://github.com/hilios/jQuery.countdown)
|
|
||||||
* [Katex](https://katex.org/)
|
* [Katex](https://katex.org/)
|
||||||
* [mermaid](https://github.com/knsv/mermaid)
|
* [mermaid](https://github.com/knsv/mermaid)
|
||||||
* [APlayer](https://github.com/MoePlayer/APlayer)
|
* [APlayer](https://github.com/MoePlayer/APlayer)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{- /* Dynamic to top button */ -}}
|
{{- /* Dynamic to top button */ -}}
|
||||||
<a href="#" class="dynamic-to-top" id="dynamic-to-top" data-scroll>
|
<a href="#" class="dynamic-to-top" id="dynamic-to-top" smooth-scroll>
|
||||||
<span> </span>
|
<span> </span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,6 @@
|
|||||||
{{- $REout = `↩︎` -}}
|
{{- $REout = `↩︎` -}}
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
{{- $content = replaceRE $REin $REout $content -}}
|
||||||
|
|
||||||
{{- /* Dummy target */ -}}
|
|
||||||
{{- $REin = `<(h[23456]) (id=".+?")>` -}}
|
|
||||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
|
||||||
{{- $content = replaceRE $REin $REout $content -}}
|
|
||||||
|
|
||||||
{{- /* Dummy target */ -}}
|
{{- /* Dummy target */ -}}
|
||||||
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
{{- $REin = `<(.+) (id="fnref:.+?")>` -}}
|
||||||
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
{{- $REout = `<a class="post-dummy-target" $2></a><$1>` -}}
|
||||||
|
|||||||
@@ -5,13 +5,6 @@
|
|||||||
{{- template "_internal/google_analytics_async.html" . -}}
|
{{- template "_internal/google_analytics_async.html" . -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* jQuery https://github.com/jquery/jquery */ -}}
|
|
||||||
{{- with $CDN.jquery_js -}}
|
|
||||||
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- slice "js/lib/jquery/jquery.slim.min.js" | .Scratch.Add "scriptLocal" -}}
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- /* lazysizes https://github.com/aFarkas/lazysizes */ -}}
|
{{- /* lazysizes https://github.com/aFarkas/lazysizes */ -}}
|
||||||
{{- with $CDN.lazysizes_js -}}
|
{{- with $CDN.lazysizes_js -}}
|
||||||
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
||||||
@@ -133,18 +126,6 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* jQuery.countdown https://github.com/hilios/jQuery.countdown */ -}}
|
|
||||||
{{- with .Scratch.Get "countdownMap" -}}
|
|
||||||
{{- with $CDN.jquery_countdown_js -}}
|
|
||||||
{{- slice . | $.Scratch.Add "scriptCDN" -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- slice "js/lib/jquery-countdown/jquery.countdown.min.js" | $.Scratch.Add "scriptLocal" -}}
|
|
||||||
{{- end -}}
|
|
||||||
<script>
|
|
||||||
window.countdownMap = {{ jsonify . | safeJS }};
|
|
||||||
</script>
|
|
||||||
{{- end -}}
|
|
||||||
|
|
||||||
{{- /* dev feature */ -}}
|
{{- /* dev feature */ -}}
|
||||||
{{- if .Params.dev -}}
|
{{- if .Params.dev -}}
|
||||||
{{- /* ECharts https://github.com/apache/incubator-echarts */ -}}
|
{{- /* ECharts https://github.com/apache/incubator-echarts */ -}}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
{{- if .Get "date" -}}
|
|
||||||
{{- $date := .Get "date" -}}
|
|
||||||
{{- $id := delimit (split (md5 $date) "" | shuffle) "" | printf "countdown-%s" -}}
|
|
||||||
{{- $defaultPattern := printf "%%D %s %%H %s %%M %s %%S %s" (T "day") (T "hour") (T "minute") (T "second") -}}
|
|
||||||
{{- $new := dict $id (dict "date" $date "pattern" (.Get "pattern" | default $defaultPattern)) -}}
|
|
||||||
{{- with .Page.Scratch.Get "countdownMap" -}}
|
|
||||||
{{- .Page.Scratch.Set "countdownMap" (merge . $new) -}}
|
|
||||||
{{- else -}}
|
|
||||||
{{- .Page.Scratch.Set "countdownMap" $new -}}
|
|
||||||
{{- end -}}
|
|
||||||
<div id="{{ $id }}" style={{ .Get "style" | safeCSS }}></div>
|
|
||||||
{{- end -}}
|
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user