Add new consulting page with consulting services and calendly link
This commit is contained in:
1
js/Meting.min.js
vendored
1
js/Meting.min.js
vendored
@@ -1 +0,0 @@
|
||||
'use strict';console.log('\n %c MetingJS v1.2.0 %c https://github.com/metowolf/MetingJS \n','color: #fadfa3; background: #030307; padding:5px 0;','background: #fadfa3; padding:5px 0;');var aplayers=[],loadMeting=function(){function a(a,b){var c={container:a,audio:b,mini:null,fixed:null,autoplay:!1,mutex:!0,lrcType:3,listFolded:!1,preload:'auto',theme:'#2980b9',loop:'all',order:'list',volume:null,listMaxHeight:null,customAudioType:null,storageName:'metingjs'};if(b.length){b[0].lrc||(c.lrcType=0);var d={};for(var e in c){var f=e.toLowerCase();(a.dataset.hasOwnProperty(f)||a.dataset.hasOwnProperty(e)||null!==c[e])&&(d[e]=a.dataset[f]||a.dataset[e]||c[e],('true'===d[e]||'false'===d[e])&&(d[e]='true'==d[e]))}aplayers.push(new APlayer(d))}}var b='https://api.i-meto.com/meting/api?server=:server&type=:type&id=:id&r=:r';'undefined'!=typeof meting_api&&(b=meting_api);for(var f=0;f<aplayers.length;f++)try{aplayers[f].destroy()}catch(a){console.log(a)}aplayers=[];for(var c=document.querySelectorAll('.aplayer'),d=function(){var d=c[e],f=d.dataset.id;if(f){var g=d.dataset.api||b;g=g.replace(':server',d.dataset.server),g=g.replace(':type',d.dataset.type),g=g.replace(':id',d.dataset.id),g=g.replace(':auth',d.dataset.auth),g=g.replace(':r',Math.random());var h=new XMLHttpRequest;h.onreadystatechange=function(){if(4===h.readyState&&(200<=h.status&&300>h.status||304===h.status)){var b=JSON.parse(h.responseText);a(d,b)}},h.open('get',g,!0),h.send(null)}else if(d.dataset.url){var i=[{name:d.dataset.name||d.dataset.title||'Audio name',artist:d.dataset.artist||d.dataset.author||'Audio artist',url:d.dataset.url,cover:d.dataset.cover||d.dataset.pic,lrc:d.dataset.lrc,type:d.dataset.type||'auto'}];a(d,i)}},e=0;e<c.length;e++)d()};document.addEventListener('DOMContentLoaded',loadMeting,!1);
|
||||
@@ -1,64 +0,0 @@
|
||||
function initialBusuanzi() {
|
||||
var bszCaller, bszTag;
|
||||
! function() {
|
||||
var c, d, e, a = !1,
|
||||
b = [];
|
||||
ready = function(c) {
|
||||
return a || "interactive" === document.readyState || "complete" === document.readyState ? c.call(document) : b.push(function() {
|
||||
return c.call(this)
|
||||
}), this
|
||||
}, d = function() {
|
||||
for (var a = 0, c = b.length; c > a; a++) b[a].apply(document);
|
||||
b = []
|
||||
}, e = function() {
|
||||
a || (a = !0, d.call(window), document.removeEventListener ? document.removeEventListener("DOMContentLoaded", e, !1) : document.attachEvent && (document.detachEvent("onreadystatechange", e), window == window.top && (clearInterval(c), c = null)))
|
||||
}, document.addEventListener ? document.addEventListener("DOMContentLoaded", e, !1) : document.attachEvent && (document.attachEvent("onreadystatechange", function() {
|
||||
/loaded|complete/.test(document.readyState) && e()
|
||||
}), window == window.top && (c = setInterval(function() {
|
||||
try {
|
||||
a || document.documentElement.doScroll("left")
|
||||
} catch (b) {
|
||||
return
|
||||
}
|
||||
e()
|
||||
}, 5)))
|
||||
}(), bszCaller = {
|
||||
fetch: function(a, b) {
|
||||
var c = "BusuanziCallback_" + Math.floor(1099511627776 * Math.random());
|
||||
window[c] = this.evalCall(b), a = a.replace("=BusuanziCallback", "=" + c), scriptTag = document.createElement("SCRIPT"), scriptTag.type = "text/javascript", scriptTag.defer = !0, scriptTag.src = a, document.getElementsByTagName("HEAD")[0].appendChild(scriptTag)
|
||||
},
|
||||
evalCall: function(a) {
|
||||
return function(b) {
|
||||
ready(function() {
|
||||
try {
|
||||
a(b), scriptTag.parentElement.removeChild(scriptTag)
|
||||
} catch (c) {
|
||||
bszTag.hides()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}, bszCaller.fetch("//busuanzi.ibruce.info/busuanzi?jsonpCallback=BusuanziCallback", function(a) {
|
||||
bszTag.texts(a), bszTag.shows()
|
||||
}), bszTag = {
|
||||
bszs: ["site_pv", "page_pv", "site_uv"],
|
||||
texts: function(a) {
|
||||
this.bszs.map(function(b) {
|
||||
var c = document.getElementById("busuanzi_value_" + b);
|
||||
c && (c.innerHTML = a[b])
|
||||
})
|
||||
},
|
||||
hides: function() {
|
||||
this.bszs.map(function(a) {
|
||||
var b = document.getElementById("busuanzi_container_" + a);
|
||||
b && (b.style.display = "none")
|
||||
})
|
||||
},
|
||||
shows: function() {
|
||||
this.bszs.map(function(a) {
|
||||
var b = document.getElementById("busuanzi_container_" + a);
|
||||
b && (b.style.display = "flex")
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
1
js/busuanzi.min.js
vendored
1
js/busuanzi.min.js
vendored
@@ -1 +0,0 @@
|
||||
function initialBusuanzi(){var bszCaller,bszTag,c,d,e,a,b;a=!1,b=[],ready=function(c){return a||"interactive"===document.readyState||"complete"===document.readyState?c.call(document):b.push((function(){return c.call(this)})),this},d=function(){for(var a=0,c=b.length;c>a;a++)b[a].apply(document);b=[]},e=function(){a||(a=!0,d.call(window),document.removeEventListener?document.removeEventListener("DOMContentLoaded",e,!1):document.attachEvent&&(document.detachEvent("onreadystatechange",e),window==window.top&&(clearInterval(c),c=null)))},document.addEventListener?document.addEventListener("DOMContentLoaded",e,!1):document.attachEvent&&(document.attachEvent("onreadystatechange",(function(){/loaded|complete/.test(document.readyState)&&e()})),window==window.top&&(c=setInterval((function(){try{a||document.documentElement.doScroll("left")}catch(b){return}e()}),5))),(bszCaller={fetch:function(a,b){var c="BusuanziCallback_"+Math.floor(1099511627776*Math.random());window[c]=this.evalCall(b),a=a.replace("=BusuanziCallback","="+c),scriptTag=document.createElement("SCRIPT"),scriptTag.type="text/javascript",scriptTag.defer=!0,scriptTag.src=a,document.getElementsByTagName("HEAD")[0].appendChild(scriptTag)},evalCall:function(a){return function(b){ready((function(){try{a(b),scriptTag.parentElement.removeChild(scriptTag)}catch(c){bszTag.hides()}}))}}}).fetch("//busuanzi.ibruce.info/busuanzi?jsonpCallback=BusuanziCallback",(function(a){bszTag.texts(a),bszTag.shows()})),bszTag={bszs:["site_pv","page_pv","site_uv"],texts:function(a){this.bszs.map((function(b){var c=document.getElementById("busuanzi_value_"+b);c&&(c.innerHTML=a[b])}))},hides:function(){this.bszs.map((function(a){var b=document.getElementById("busuanzi_container_"+a);b&&(b.style.display="none")}))},shows:function(){this.bszs.map((function(a){var b=document.getElementById("busuanzi_container_"+a);b&&(b.style.display="flex")}))}}}
|
||||
141
js/canvas_bg.js
141
js/canvas_bg.js
@@ -1,141 +0,0 @@
|
||||
/**
|
||||
* created by lvfan
|
||||
* 2018-09-04
|
||||
*/
|
||||
|
||||
|
||||
(function drawBg() {
|
||||
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
|
||||
const starDensity = 0.216;
|
||||
const speedCoeff = 0.05;
|
||||
let width;
|
||||
let height;
|
||||
let starCount;
|
||||
/* no-unused-vars */
|
||||
// let circleRadius;
|
||||
// let circleCenter;
|
||||
let first = true;
|
||||
let giantColor = '180,184,240';
|
||||
let starColor = '226,225,142';
|
||||
let cometColor = '226,225,224';
|
||||
const canva = document.getElementById('universe');
|
||||
let stars = [];
|
||||
let universe;
|
||||
windowResizeHandler();
|
||||
window.addEventListener('resize', windowResizeHandler, false);
|
||||
|
||||
function windowResizeHandler() {
|
||||
width = window.innerWidth;
|
||||
height = window.innerHeight;
|
||||
starCount = width * starDensity;
|
||||
// circleRadius = (width > height ? height / 2 : width / 2);
|
||||
// circleCenter = {
|
||||
// x: width / 2,
|
||||
// y: height / 2
|
||||
// };
|
||||
canva.setAttribute('width', width);
|
||||
canva.setAttribute('height', height);
|
||||
}
|
||||
|
||||
createUniverse();
|
||||
|
||||
function createUniverse() {
|
||||
universe = canva.getContext('2d');
|
||||
for (let i = 0; i < starCount; i++) {
|
||||
stars[i] = new Star();
|
||||
stars[i].reset();
|
||||
}
|
||||
draw();
|
||||
}
|
||||
|
||||
function draw() {
|
||||
universe.clearRect(0, 0, width, height);
|
||||
let starsLength = stars.length;
|
||||
for (let i = 0; i < starsLength; i++) {
|
||||
let star = stars[i];
|
||||
star.move();
|
||||
star.fadeIn();
|
||||
star.fadeOut();
|
||||
star.draw();
|
||||
}
|
||||
window.requestAnimationFrame(draw);
|
||||
}
|
||||
|
||||
function Star() {
|
||||
this.reset = function () {
|
||||
this.giant = getProbability(3);
|
||||
this.comet = this.giant || first ? false : getProbability(10);
|
||||
this.x = getRandInterval(0, width - 10);
|
||||
this.y = getRandInterval(0, height);
|
||||
this.r = getRandInterval(1.1, 2.6);
|
||||
this.dx = getRandInterval(speedCoeff, 6 * speedCoeff) + (this.comet + 1 - 1) * speedCoeff * getRandInterval(50, 120) + speedCoeff * 2;
|
||||
this.dy = -getRandInterval(speedCoeff, 6 * speedCoeff) - (this.comet + 1 - 1) * speedCoeff * getRandInterval(50, 120);
|
||||
this.fadingOut = null;
|
||||
this.fadingIn = true;
|
||||
this.opacity = 0;
|
||||
this.opacityTresh = getRandInterval(0.2, 1 - (this.comet + 1 - 1) * 0.4);
|
||||
this.do = getRandInterval(0.0005, 0.002) + (this.comet + 1 - 1) * 0.001;
|
||||
};
|
||||
this.fadeIn = function () {
|
||||
if (this.fadingIn) {
|
||||
this.fadingIn = !(this.opacity > this.opacityTresh);
|
||||
this.opacity += this.do;
|
||||
}
|
||||
};
|
||||
this.fadeOut = function () {
|
||||
if (this.fadingOut) {
|
||||
this.fadingOut = !(this.opacity < 0);
|
||||
this.opacity -= this.do / 2;
|
||||
if (this.x > width || this.y < 0) {
|
||||
this.fadingOut = false;
|
||||
this.reset();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.draw = function () {
|
||||
universe.beginPath();
|
||||
if (this.giant) {
|
||||
universe.fillStyle = 'rgba(' + giantColor + ',' + this.opacity + ')';
|
||||
universe.arc(this.x, this.y, 2, 0, 2 * Math.PI, false);
|
||||
} else if (this.comet) {
|
||||
universe.fillStyle = 'rgba(' + cometColor + ',' + this.opacity + ')';
|
||||
universe.arc(this.x, this.y, 1.5, 0, 2 * Math.PI, false);
|
||||
// comet tail
|
||||
for (let i = 0; i < 30; i++) {
|
||||
universe.fillStyle = 'rgba(' + cometColor + ',' + (this.opacity - (this.opacity / 20) * i) + ')';
|
||||
universe.rect(this.x - this.dx / 4 * i, this.y - this.dy / 4 * i - 2, 2, 2);
|
||||
universe.fill();
|
||||
}
|
||||
} else {
|
||||
universe.fillStyle = 'rgba(' + starColor + ',' + this.opacity + ')';
|
||||
universe.rect(this.x, this.y, this.r, this.r);
|
||||
}
|
||||
universe.closePath();
|
||||
universe.fill();
|
||||
};
|
||||
this.move = function () {
|
||||
this.x += this.dx;
|
||||
this.y += this.dy;
|
||||
if (this.fadingOut === false) {
|
||||
this.reset();
|
||||
}
|
||||
if (this.x > width - (width / 4) || this.y < 0) {
|
||||
this.fadingOut = true;
|
||||
}
|
||||
};
|
||||
(function () {
|
||||
setTimeout(function () {
|
||||
first = false;
|
||||
}, 50);
|
||||
})();
|
||||
}
|
||||
|
||||
function getProbability(percents) {
|
||||
return ((Math.floor(Math.random() * 1000) + 1) < percents * 10);
|
||||
}
|
||||
|
||||
function getRandInterval(min, max) {
|
||||
return (Math.random() * (max - min) + min);
|
||||
}
|
||||
}());
|
||||
@@ -1,51 +0,0 @@
|
||||
(function () {
|
||||
var newGitment = 'https://imsun.github.io/gitment/dist/gitment.browser.js';
|
||||
var oldGitment = 'imsun.github.io/gitment/dist/gitment.browser.js';
|
||||
|
||||
var replaceScript = function (script, src) {
|
||||
//
|
||||
// Make redirected script
|
||||
//
|
||||
var newScript = document.createElement('script');
|
||||
newScript.src = newGitment + src.replace(/.*?(\?|$)/, '$1');
|
||||
//
|
||||
// Move onload and onerror handlers to new script
|
||||
//
|
||||
newScript.onload = script.onload;
|
||||
newScript.onerror = script.onerror;
|
||||
script.onload = script.onerror = null;
|
||||
//
|
||||
// Move any content (old-style configuration scripts)
|
||||
//
|
||||
while (script.firstChild) newScript.appendChild(script.firstChild);
|
||||
//
|
||||
// Copy script id
|
||||
//
|
||||
if (script.id != null) newScript.id = script.id;
|
||||
//
|
||||
// Replace original script with new one
|
||||
//
|
||||
script.parentNode.replaceChild(newScript, script);
|
||||
};
|
||||
|
||||
if (document.currentScript) {
|
||||
var script = document.currentScript;
|
||||
replaceScript(script, script.src);
|
||||
|
||||
} else {
|
||||
//
|
||||
// Look for current script by searching for one with the right source
|
||||
//
|
||||
var n = oldGitment.length;
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var script = scripts[i];
|
||||
var src = (script.src || '').replace(/.*?:\/\//, '');
|
||||
if (src.substr(0, n) === oldGitment) {
|
||||
replaceScript(script, src);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
2
js/comments/twikoo.all.min.js
vendored
2
js/comments/twikoo.all.min.js
vendored
File diff suppressed because one or more lines are too long
50
js/copy.js
50
js/copy.js
@@ -1,50 +0,0 @@
|
||||
$(function () {
|
||||
// Add copy icon
|
||||
var $copyIcon = $('<i class="fa fa-clipboard" aria-hidden="true"></i>');
|
||||
var $notice = $('<div class="copy-notice"></div>');
|
||||
$('figure.highlight').prepend($copyIcon);
|
||||
$('figure.highlight').prepend($notice);
|
||||
// copy function
|
||||
function copy (text, ctx) {
|
||||
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
||||
try {
|
||||
document.execCommand('copy'); // Security exception may be thrown by some browsers.
|
||||
$(ctx).prev('.copy-notice')
|
||||
.text(GLOBAL_CONFIG.copy.success)
|
||||
.velocity({
|
||||
translateX: -30,
|
||||
opacity: 1
|
||||
}, {
|
||||
loop: 1,
|
||||
duration: 750,
|
||||
easing: 'easeOutQuint'
|
||||
});
|
||||
} catch (ex) {
|
||||
$(ctx).prev('.copy-notice')
|
||||
.text(GLOBAL_CONFIG.copy.error)
|
||||
.velocity({
|
||||
translateX: -30,
|
||||
opacity: 1
|
||||
}, {
|
||||
loop: 1,
|
||||
duration: 750,
|
||||
easing: 'easeOutQuint'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$(ctx).prev('.copy-notice').text(GLOBAL_CONFIG.copy.noSupport);
|
||||
}
|
||||
}
|
||||
// click events
|
||||
$('.highlight .fa-clipboard').on('click', function () {
|
||||
var selection = window.getSelection();
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents($(this).next('table').find('.code pre')[0]);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
var text = selection.toString();
|
||||
copy(text, this);
|
||||
selection.removeAllRanges();
|
||||
});
|
||||
});
|
||||
63
js/fan.js
63
js/fan.js
@@ -1,63 +0,0 @@
|
||||
(function () {
|
||||
/**
|
||||
* 内容的宽度为 900 ,侧边栏的宽度为 300
|
||||
* 900 的时候不能出现侧边栏
|
||||
*/
|
||||
window.onresize = (e) => {
|
||||
let width = e.currentTarget.innerWidth;
|
||||
let open = $('#side-button').hasClass('close');
|
||||
if (width <= 900) {
|
||||
document.documentElement.style.fontSize = width / 7.5 + 'px';
|
||||
//设置body字体大小,不影响body内字体大小
|
||||
document.body.style.fontSize = '12px';
|
||||
|
||||
$('#menu-inner').addClass('min-menu-inner');
|
||||
|
||||
$('#side-button').hide();
|
||||
if (open) {
|
||||
$('#sidebar').velocity('stop').velocity({left: '-300px'}, 800, 'spring');
|
||||
$('#main-container').velocity('stop').velocity({marginLeft: '0px'}, 800, 'spring');
|
||||
}
|
||||
} else {
|
||||
document.documentElement.style.fontSize = '12px';
|
||||
//设置body字体大小,不影响body内字体大小
|
||||
document.body.style.fontSize = '12px';
|
||||
|
||||
$('#menu-inner').removeClass('min-menu-inner');
|
||||
|
||||
$('#side-button').show();
|
||||
if (open) {
|
||||
$('#sidebar').velocity('stop').velocity({left: '0px'}, 800, 'spring');
|
||||
$('#main-container').velocity('stop').velocity({marginLeft: '300px'}, 800, 'spring');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 当宽度小于 900 的时候不显示展开侧边栏按钮
|
||||
*/
|
||||
if (window.innerWidth <= 900) {
|
||||
document.documentElement.style.fontSize = window.innerWidth / 7.5 + 'px';
|
||||
//设置body字体大小,不影响body内字体大小
|
||||
document.body.style.fontSize = '12px';
|
||||
|
||||
$('#menu-inner').addClass('min-menu-inner');
|
||||
|
||||
$('#side-button').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description post 页面展开侧边栏
|
||||
* 第一次加载时候判断页面的宽度,如果宽度小则不展开侧边栏
|
||||
*/
|
||||
if (window.innerWidth > 900 && $('#post').length > 0) {
|
||||
setTimeout(function () {
|
||||
$('#side-button').click();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
$('.menu-list-icon').click(() => {
|
||||
$('#menu-inner').toggleClass('show-min-menu-inner');
|
||||
});
|
||||
|
||||
})();
|
||||
4
js/jquery.min.js
vendored
4
js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,103 +0,0 @@
|
||||
(function($) {
|
||||
|
||||
// Matches trailing non-space characters.
|
||||
var chop = /(\s*\S+|\s)$/;
|
||||
|
||||
// Matches the first word in the string.
|
||||
var start = /^(\S*)/;
|
||||
|
||||
// Return a truncated html string. Delegates to $.fn.truncate.
|
||||
$.truncate = function(html, options) {
|
||||
return $('<div></div>').append(html).truncate(options).html();
|
||||
};
|
||||
|
||||
// Truncate the contents of an element in place.
|
||||
$.fn.truncate = function(options) {
|
||||
if ($.isNumeric(options)) options = {length: options};
|
||||
var o = $.extend({}, $.truncate.defaults, options);
|
||||
|
||||
return this.each(function() {
|
||||
var self = $(this);
|
||||
|
||||
if (o.noBreaks) self.find('br').replaceWith(' ');
|
||||
|
||||
var text = self.text();
|
||||
var excess = text.length - o.length;
|
||||
|
||||
if (o.stripTags) self.text(text);
|
||||
|
||||
// Chop off any partial words if appropriate.
|
||||
if (o.words && excess > 0) {
|
||||
var truncated = text.slice(0, o.length).replace(chop, '').length;
|
||||
|
||||
if (o.keepFirstWord && truncated === 0) {
|
||||
excess = text.length - start.exec(text)[0].length - 1;
|
||||
} else {
|
||||
excess = text.length - truncated - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (excess < 0 || !excess && !o.truncated) return;
|
||||
|
||||
// Iterate over each child node in reverse, removing excess text.
|
||||
$.each(self.contents().get().reverse(), function(i, el) {
|
||||
var $el = $(el);
|
||||
var text = $el.text();
|
||||
var length = text.length;
|
||||
|
||||
// If the text is longer than the excess, remove the node and continue.
|
||||
if (length <= excess) {
|
||||
o.truncated = true;
|
||||
excess -= length;
|
||||
$el.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the excess text and append the ellipsis.
|
||||
if (el.nodeType === 3) {
|
||||
// should we finish the block anyway?
|
||||
if (o.finishBlock) {
|
||||
$(el.splitText(length)).replaceWith(o.ellipsis);
|
||||
} else {
|
||||
$(el.splitText(length - excess - 1)).replaceWith(o.ellipsis);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Recursively truncate child nodes.
|
||||
$el.truncate($.extend(o, {length: length - excess}));
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.truncate.defaults = {
|
||||
|
||||
// Strip all html elements, leaving only plain text.
|
||||
stripTags: false,
|
||||
|
||||
// Only truncate at word boundaries.
|
||||
words: false,
|
||||
|
||||
// When 'words' is active, keeps the first word in the string
|
||||
// even if it's longer than a target length.
|
||||
keepFirstWord: false,
|
||||
|
||||
// Replace instances of <br> with a single space.
|
||||
noBreaks: false,
|
||||
|
||||
// if true always truncate the content at the end of the block.
|
||||
finishBlock: false,
|
||||
|
||||
// The maximum length of the truncated html.
|
||||
length: Infinity,
|
||||
|
||||
// The character to use as the ellipsis. The word joiner (U+2060) can be
|
||||
// used to prevent a hanging ellipsis, but displays incorrectly in Chrome
|
||||
// on Windows 7.
|
||||
// http://code.google.com/p/chromium/issues/detail?id=68323
|
||||
ellipsis: '\u2026' // '\u2060\u2026'
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1
js/jquery.truncate.min.js
vendored
1
js/jquery.truncate.min.js
vendored
@@ -1 +0,0 @@
|
||||
!function($){var chop=/(\s*\S+|\s)$/,start=/^(\S*)/;$.truncate=function(html,options){return $("<div></div>").append(html).truncate(options).html()},$.fn.truncate=function(options){$.isNumeric(options)&&(options={length:options});var o=$.extend({},$.truncate.defaults,options);return this.each(function(){var self=$(this);o.noBreaks&&self.find("br").replaceWith(" ");var text=self.text(),excess=text.length-o.length;if(o.stripTags&&self.text(text),o.words&&excess>0){var truncated=text.slice(0,o.length).replace(chop,"").length;excess=o.keepFirstWord&&0===truncated?text.length-start.exec(text)[0].length-1:text.length-truncated-1}excess<0||!excess&&!o.truncated||$.each(self.contents().get().reverse(),function(i,el){var $el=$(el),text,length=$el.text().length;return length<=excess?(o.truncated=!0,excess-=length,void $el.remove()):3===el.nodeType?(o.finishBlock?$(el.splitText(length)).replaceWith(o.ellipsis):$(el.splitText(length-excess-1)).replaceWith(o.ellipsis),!1):($el.truncate($.extend(o,{length:length-excess})),!1)})})},$.truncate.defaults={stripTags:!1,words:!1,keepFirstWord:!1,noBreaks:!1,finishBlock:!1,length:1/0,ellipsis:"…"}}(jQuery);
|
||||
@@ -1,33 +0,0 @@
|
||||
var aplayerconf = "<!-- 我使用的APlayer本体 -->"
|
||||
aplayerconf += "<div class=\"aplayer\" "
|
||||
aplayerconf += "data-id=\"" + musiclist + "\" "
|
||||
aplayerconf += "data-server=\"netease\" "
|
||||
aplayerconf += "data-type=\"playlist\" "
|
||||
aplayerconf += "data-fixed=\"true\" "
|
||||
aplayerconf += "data-autoplay=\"false\" "
|
||||
aplayerconf += "data-order=\"random\" "
|
||||
aplayerconf += "data-volume=\"0.55\" "
|
||||
aplayerconf += "data-preload=\"true\""
|
||||
aplayerconf += "data-mutex=\"true\""
|
||||
aplayerconf += "</div>"
|
||||
aplayerconf += "<!--如果将本体放在body里面导致页面加载出现问题,请尝试放到body体后面-->"
|
||||
|
||||
function removelrc() {
|
||||
//检测是否存在歌词按钮
|
||||
if (!document.querySelector(".aplayer-icon-lrc"))
|
||||
return;
|
||||
else
|
||||
{
|
||||
//触发以后立刻移除监听
|
||||
document.removeEventListener("DOMNodeInserted",removelrc);
|
||||
//稍作延时保证触发函数时存在按钮
|
||||
setTimeout(function() {
|
||||
//以触发按钮的方式隐藏歌词,防止在点击显示歌词按钮时需要点击两次才能出现的问题
|
||||
document.querySelector(".aplayer-icon-lrc").click();
|
||||
}, 1);
|
||||
// console.log("success");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMNodeInserted', removelrc)
|
||||
@@ -1,53 +0,0 @@
|
||||
(function () {
|
||||
var newMathJax = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js';
|
||||
var oldMathJax = 'cdn.mathjax.org/mathjax/latest/MathJax.js';
|
||||
|
||||
var replaceScript = function (script, src) {
|
||||
//
|
||||
// Make redirected script
|
||||
//
|
||||
var newScript = document.createElement('script');
|
||||
newScript.src = newMathJax + src.replace(/.*?(\?|$)/, '$1');
|
||||
//
|
||||
// Move onload and onerror handlers to new script
|
||||
//
|
||||
newScript.onload = script.onload;
|
||||
newScript.onerror = script.onerror;
|
||||
script.onload = script.onerror = null;
|
||||
//
|
||||
// Move any content (old-style configuration scripts)
|
||||
//
|
||||
while (script.firstChild) newScript.appendChild(script.firstChild);
|
||||
//
|
||||
// Copy script id
|
||||
//
|
||||
if (script.id != null) newScript.id = script.id;
|
||||
//
|
||||
// Replace original script with new one
|
||||
//
|
||||
script.parentNode.replaceChild(newScript, script);
|
||||
//
|
||||
// Issue a console warning
|
||||
//
|
||||
console.warn('WARNING: cdn.mathjax.org has been retired. Check https://www.mathjax.org/cdn-shutting-down/ for migration tips.')
|
||||
}
|
||||
|
||||
if (document.currentScript) {
|
||||
var script = document.currentScript;
|
||||
replaceScript(script, script.src);
|
||||
} else {
|
||||
//
|
||||
// Look for current script by searching for one with the right source
|
||||
//
|
||||
var n = oldMathJax.length;
|
||||
var scripts = document.getElementsByTagName('script');
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var script = scripts[i];
|
||||
var src = (script.src || '').replace(/.*?:\/\//, '');
|
||||
if (src.substr(0, n) === oldMathJax) {
|
||||
replaceScript(script, src);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
1343
js/obsidian.js
1343
js/obsidian.js
File diff suppressed because it is too large
Load Diff
1
js/obsidian.min.js
vendored
1
js/obsidian.min.js
vendored
File diff suppressed because one or more lines are too long
61
js/plugin.js
61
js/plugin.js
File diff suppressed because one or more lines are too long
137
js/scroll.js
137
js/scroll.js
@@ -1,137 +0,0 @@
|
||||
(function () {
|
||||
|
||||
/**
|
||||
* @description 监听滚动高度,是否显示返回顶部
|
||||
*/
|
||||
function myCustomFn(el) {
|
||||
if (el.mcs.top < -600) {
|
||||
if ($('#return-top').css('opacity') === '0') {
|
||||
$('#return-top').velocity('stop').velocity({opacity: 1}, {
|
||||
duration: 500,
|
||||
display: 'block'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$('#return-top').velocity('stop').velocity({opacity: 0}, {
|
||||
duration: 500,
|
||||
display: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 阅读进度
|
||||
* @param el
|
||||
*/
|
||||
function readPercent(el) {
|
||||
// console.log(el.mcs.content[0].offsetHeight);
|
||||
let percent = Math.round(-el.mcs.top / (el.mcs.content[0].offsetHeight - el.offsetHeight) * 100);
|
||||
$('.sidebar-toc-progress .progress-num').text(percent);
|
||||
$('.sidebar-toc-progress-bar').velocity('stop').velocity({width: percent + '%'}, {
|
||||
duration: 100,
|
||||
easing: 'easeInOutQuart'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 滚动到页面顶部
|
||||
*/
|
||||
$('#return-top').on('click', function () {
|
||||
$('#content-outer').mCustomScrollbar('scrollTo', 'top', {
|
||||
scrollInertia: 1000,
|
||||
scrollEasing: 'easeInOut'
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 滚动条修饰 - jquery 插件
|
||||
*/
|
||||
$('#content-outer').mCustomScrollbar({
|
||||
theme: 'minimal',
|
||||
axis: 'y', // horizontal scrollbar
|
||||
callbacks: {
|
||||
whileScrolling: function () {
|
||||
myCustomFn(this);
|
||||
readPercent(this);
|
||||
findHeadPosition(this);
|
||||
},
|
||||
onScroll: function () {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#sidebar-toc-content').mCustomScrollbar({
|
||||
theme: 'minimal',
|
||||
axis: 'y', // horizontal scrollbar
|
||||
callbacks: {}
|
||||
});
|
||||
|
||||
// $('figure.highlight').mCustomScrollbar({
|
||||
// theme: 'minimal',
|
||||
// axis: 'x', // horizontal scrollbar
|
||||
// mouseWheel: {
|
||||
// enable: false
|
||||
// },
|
||||
// callbacks: {}
|
||||
// });
|
||||
|
||||
/**
|
||||
* @description menu link scroll to content
|
||||
*/
|
||||
$('.sidebar-toc-content .toc-link').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
let _id = $(this).attr('href');
|
||||
$('#content-outer').mCustomScrollbar('scrollTo', _id, {
|
||||
scrollInertia: 500
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 找到当前页面的位置,更改 active 目录
|
||||
* @param el
|
||||
*/
|
||||
function findHeadPosition(el) {
|
||||
let currentId = '';
|
||||
const menuHeight = $('#menu-outer').height() + 1;
|
||||
// console.log(el.mcs);
|
||||
let list = $('#post').find('h1,h2,h3,h4,h5,h6');
|
||||
list.each(function () {
|
||||
if ($(this).offset().top <= menuHeight) {
|
||||
currentId = $(this).attr('id');
|
||||
}
|
||||
});
|
||||
$('.sidebar-toc-content .toc-link').removeClass('active');
|
||||
if (currentId === '') {
|
||||
// currentId = list[0].id;
|
||||
return;
|
||||
}
|
||||
let $this = $('.sidebar-toc-content .toc-link[href="#' + currentId + '"]');
|
||||
$this.addClass('active');
|
||||
let parents = $this.parents('.toc-child');
|
||||
if (parents.length > 0) {
|
||||
let child = null;
|
||||
parents.length > 1 ? child = parents.eq(parents.length - 1).find('.toc-child') : child = parents;
|
||||
if (child.length > 0 && child.is(':hidden')) {
|
||||
expandToc(child);
|
||||
}
|
||||
parents.eq(parents.length - 1).closest('.toc-item').siblings('.toc-item').find('.toc-child').hide();
|
||||
} else {
|
||||
if ($this.closest('.toc-item').find('.toc-child').is(':hidden')) {
|
||||
expandToc($this.closest('.toc-item').find('.toc-child'));
|
||||
}
|
||||
$this.closest('.toc-item').siblings('.toc-item').find('.toc-child').hide();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description expand toc-item
|
||||
* @param $item
|
||||
*/
|
||||
function expandToc($item) {
|
||||
// $item.show();
|
||||
$item.velocity('stop').velocity('fadeIn', {
|
||||
duration: 500,
|
||||
easing: 'easeInQuart'
|
||||
});
|
||||
}
|
||||
}());
|
||||
142
js/search.js
142
js/search.js
@@ -1,142 +0,0 @@
|
||||
// A local search script with the help of [hexo-generator-search](https://github.com/PaicHyperionDev/hexo-generator-search)
|
||||
// Copyright (C) 2017
|
||||
// Liam Huang <http://github.com/Liam0205>
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
// 02110-1301 USA
|
||||
//
|
||||
|
||||
var searchFunc = function (path, search_id, content_id) {
|
||||
// 0x00. environment initialization
|
||||
'use strict';
|
||||
var BTN = "<i id='local-search-close'></i>";
|
||||
var SEARCH_START = "<span>" + $('#local-search-result').data('start') + "</span>",
|
||||
SEARCH_INITIALISE = "<span class='local-search-empty'>" + $('#local-search-result').data('initialise') + "<span>",
|
||||
SEARCH_EMPTY = "<span class='local-search-empty'>" + $('#local-search-result').data('empty') + "<span>";
|
||||
var $input = document.getElementById(search_id);
|
||||
var $resultContent = document.getElementById(content_id);
|
||||
$resultContent.innerHTML = BTN + "<ul>" + SEARCH_INITIALISE + "</ul>";
|
||||
$.ajax({
|
||||
// 0x01. load xml file
|
||||
url: path,
|
||||
dataType: "xml",
|
||||
success: function (xmlResponse) {
|
||||
// 0x02. parse xml file
|
||||
var datas = $("entry", xmlResponse).map(function () {
|
||||
return {
|
||||
title: $("title", this).text(),
|
||||
content: $("content", this).text(),
|
||||
url: $("url", this).text()
|
||||
};
|
||||
}).get();
|
||||
$resultContent.innerHTML = "";
|
||||
|
||||
$input.addEventListener('input', function () {
|
||||
// 0x03. parse query to keywords list
|
||||
var str = '<ul class=\"search-result-list\">';
|
||||
var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
|
||||
$resultContent.innerHTML = "";
|
||||
if (this.value.trim().length <= 0) {
|
||||
$('#local-search-result').html(SEARCH_START);
|
||||
return;
|
||||
}
|
||||
// 0x04. perform local searching
|
||||
datas.forEach(function (data) {
|
||||
var isMatch = true;
|
||||
var content_index = [];
|
||||
if (!data.title || data.title.trim() === '') {
|
||||
data.title = "Untitled";
|
||||
}
|
||||
var orig_data_title = data.title.trim();
|
||||
var data_title = orig_data_title.toLowerCase();
|
||||
var orig_data_content = data.content.trim().replace(/<[^>]+>/g, "");
|
||||
var data_content = orig_data_content.toLowerCase();
|
||||
var data_url = /^\//.test(data.url) ? '' : '/' + data.url;
|
||||
var index_title = -1;
|
||||
var index_content = -1;
|
||||
var first_occur = -1;
|
||||
// only match artiles with not empty contents
|
||||
if (data_content !== '') {
|
||||
keywords.forEach(function (keyword, i) {
|
||||
index_title = data_title.indexOf(keyword);
|
||||
index_content = data_content.indexOf(keyword);
|
||||
|
||||
if (index_title < 0 && index_content < 0) {
|
||||
isMatch = false;
|
||||
} else {
|
||||
if (index_content < 0) {
|
||||
index_content = 0;
|
||||
}
|
||||
if (i == 0) {
|
||||
first_occur = index_content;
|
||||
}
|
||||
// content_index.push({index_content:index_content, keyword_len:keyword_len});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
isMatch = false;
|
||||
}
|
||||
// 0x05. show search results
|
||||
if (isMatch) {
|
||||
str += "<li><a href='" + data_url + "' class='search-result-title posttitle' target='_blank'>" + orig_data_title + "</a>";
|
||||
var content = orig_data_content;
|
||||
if (first_occur >= 0) {
|
||||
// cut out 100 characters
|
||||
var start = first_occur - 20;
|
||||
var end = first_occur + 80;
|
||||
|
||||
if (start < 0) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start == 0) {
|
||||
end = 100;
|
||||
}
|
||||
|
||||
if (end > content.length) {
|
||||
end = content.length;
|
||||
}
|
||||
|
||||
var match_content = content.substr(start, end);
|
||||
|
||||
// highlight all keywords
|
||||
keywords.forEach(function (keyword) {
|
||||
var regS = new RegExp(keyword, "gi");
|
||||
match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
|
||||
});
|
||||
|
||||
str += "<p class=\"search-result\">" + match_content + "...</p>";
|
||||
}
|
||||
str += "</li>";
|
||||
}
|
||||
});
|
||||
str += "</ul>";
|
||||
if (str.indexOf('<li>') === -1) {
|
||||
$resultContent.innerHTML = BTN + "<ul>" + SEARCH_EMPTY + "</ul>";
|
||||
return;
|
||||
}
|
||||
$resultContent.innerHTML = BTN + str;
|
||||
});
|
||||
}
|
||||
});
|
||||
$(document).on('click', '#local-search-close', function() {
|
||||
$('#local-search-input').val('');
|
||||
$('#local-search-result').html(SEARCH_START);
|
||||
});
|
||||
};
|
||||
|
||||
var getSearchFile = function(){
|
||||
var path = "/search.xml";
|
||||
searchFunc(path, 'local-search-input', 'local-search-result');
|
||||
};
|
||||
@@ -1,219 +0,0 @@
|
||||
(function () {
|
||||
$('a.social-icon.search').on('click', function () {
|
||||
$('body').css('width', '100%');
|
||||
$('body').css('overflow', 'hidden');
|
||||
$('.search-dialog').velocity('stop').velocity('fadeIn', {
|
||||
duration: 300,
|
||||
complete: function () {
|
||||
$('.ais-search-box--input').focus();
|
||||
}
|
||||
});
|
||||
$('.search-mask').velocity('stop').velocity('fadeIn', {
|
||||
duration: 300
|
||||
});
|
||||
|
||||
// shortcut: ESC
|
||||
document.addEventListener('keydown', function f(event) {
|
||||
if (event.code === 'Escape') {
|
||||
closeSearch();
|
||||
document.removeEventListener('keydown', f);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var closeSearch = function () {
|
||||
$('body').css('overflow', 'auto');
|
||||
$('.search-dialog').velocity('stop').velocity('fadeOut', {
|
||||
duration: 300
|
||||
});
|
||||
$('.search-mask').velocity('stop').velocity('fadeOut', {
|
||||
duration: 300
|
||||
});
|
||||
};
|
||||
$('.search-mask, .search-close-button').on('click', closeSearch);
|
||||
|
||||
|
||||
var algolia = window.GLOBAL_CONFIG.algolia;
|
||||
var isAlgoliaValid = algolia.appId && algolia.apiKey && algolia.indexName;
|
||||
if (!isAlgoliaValid) {
|
||||
return console.error('Algolia setting is invalid!');
|
||||
}
|
||||
|
||||
var search = instantsearch({
|
||||
appId: algolia.appId,
|
||||
apiKey: algolia.apiKey,
|
||||
indexName: algolia.indexName,
|
||||
routing: true,
|
||||
searchParameters: {
|
||||
hitsPerPage: algolia.hits.per_page || 10
|
||||
}
|
||||
// searchFunction: function (helper) {
|
||||
// var searchInput = $('#search-box').find('input');
|
||||
// if (searchInput.val()) {
|
||||
// helper.search();
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
// initialize currentRefinedValues
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.currentRefinedValues({
|
||||
// container: '#current-refined-values',
|
||||
// // This widget can also contain a clear all link to remove all filters,
|
||||
// // we disable it in this example since we use `clearAll` widget on its own.
|
||||
// clearAll: false
|
||||
// })
|
||||
// );
|
||||
|
||||
// initialize clearAll
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.clearAll({
|
||||
// container: '#clear-all',
|
||||
// templates: {
|
||||
// link: 'Reset everything'
|
||||
// },
|
||||
// autoHideContainer: false
|
||||
// })
|
||||
// );
|
||||
|
||||
// initialize pagination
|
||||
search.addWidget(
|
||||
instantsearch.widgets.pagination({
|
||||
container: '#algolia-pagination',
|
||||
scrollTo: false,
|
||||
showFirstLast: false,
|
||||
labels: {
|
||||
first: '<i class="fa fa-angle-double-left"></i>',
|
||||
last: '<i class="fa fa-angle-double-right"></i>',
|
||||
previous: '<i class="fa fa-angle-left"></i>',
|
||||
next: '<i class="fa fa-angle-right"></i>'
|
||||
},
|
||||
cssClasses: {
|
||||
root: 'pagination',
|
||||
item: 'pagination-item',
|
||||
link: 'page-number',
|
||||
active: 'current',
|
||||
disabled: 'disabled-item'
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// initialize RefinementList
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.refinementList({
|
||||
// container: '#refinement-list',
|
||||
// attributeName: 'categories'
|
||||
// })
|
||||
// );
|
||||
|
||||
// initialize SearchBox
|
||||
search.addWidget(
|
||||
instantsearch.widgets.searchBox({
|
||||
container: '#search-box',
|
||||
placeholder: window.GLOBAL_CONFIG.algolia.languages.input_placeholder
|
||||
})
|
||||
);
|
||||
|
||||
search.addWidget(
|
||||
instantsearch.widgets.hits({
|
||||
container: '#hits',
|
||||
templates: {
|
||||
item: function (data) {
|
||||
var link = data.permalink ? data.permalink : (window.GLOBAL_CONFIG.root + data.path);
|
||||
return (
|
||||
'<a href="' + link + '" class="algolia-hit-item-link">' +
|
||||
data._highlightResult.title.value +
|
||||
'</a>'
|
||||
);
|
||||
},
|
||||
empty: function (data) {
|
||||
return (
|
||||
'<div id="algolia-hits-empty">' +
|
||||
window.GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
item: 'algolia-hit-item'
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.searchBox({
|
||||
// container: '#algolia-search-input',
|
||||
// reset: false,
|
||||
// magnifier: false,
|
||||
// placeholder: window.GLOBAL_CONFIG.algolia.languages.input_placeholder
|
||||
// })
|
||||
// );
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.hits({
|
||||
// container: '#algolia-hits',
|
||||
// templates: {
|
||||
// item: function (data) {
|
||||
// var link = data.permalink ? data.permalink : (window.GLOBAL_CONFIG.root + data.path);
|
||||
// return (
|
||||
// '<a href="' + link + '" class="algolia-hit-item-link">' +
|
||||
// data._highlightResult.title.value +
|
||||
// '</a>'
|
||||
// );
|
||||
// },
|
||||
// empty: function (data) {
|
||||
// return (
|
||||
// '<div id="algolia-hits-empty">' +
|
||||
// window.GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
|
||||
// '</div>'
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// cssClasses: {
|
||||
// item: 'algolia-hit-item'
|
||||
// }
|
||||
// })
|
||||
// );
|
||||
//
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.stats({
|
||||
// container: '#algolia-stats',
|
||||
// templates: {
|
||||
// body: function (data) {
|
||||
// var stats = window.GLOBAL_CONFIG.algolia.languages.hits_stats
|
||||
// .replace(/\$\{hits}/, data.nbHits)
|
||||
// .replace(/\$\{time}/, data.processingTimeMS);
|
||||
// return (
|
||||
// '<hr>' +
|
||||
// stats +
|
||||
// '<span class="algolia-logo pull-right">' +
|
||||
// ' <img src="' + window.GLOBAL_CONFIG.root + 'img/algolia.svg" alt="Algolia" />' +
|
||||
// '</span>'
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
//
|
||||
// search.addWidget(
|
||||
// instantsearch.widgets.pagination({
|
||||
// container: '#algolia-pagination',
|
||||
// scrollTo: false,
|
||||
// showFirstLast: false,
|
||||
// labels: {
|
||||
// first: '<i class="fa fa-angle-double-left"></i>',
|
||||
// last: '<i class="fa fa-angle-double-right"></i>',
|
||||
// previous: '<i class="fa fa-angle-left"></i>',
|
||||
// next: '<i class="fa fa-angle-right"></i>'
|
||||
// },
|
||||
// cssClasses: {
|
||||
// root: 'pagination',
|
||||
// item: 'pagination-item',
|
||||
// link: 'page-number',
|
||||
// active: 'current',
|
||||
// disabled: 'disabled-item'
|
||||
// }
|
||||
// })
|
||||
// );
|
||||
|
||||
search.start();
|
||||
})();
|
||||
116
js/sidebar.js
116
js/sidebar.js
@@ -1,116 +0,0 @@
|
||||
(function() {
|
||||
/**
|
||||
* @description 侧边栏展开/隐藏
|
||||
* @let open true -展开状态; false -收缩状态
|
||||
*/
|
||||
$('#side-button').on('click', function() {
|
||||
let open = $('#side-button').hasClass('close');
|
||||
if (open) {
|
||||
$('#side-button').removeClass('close');
|
||||
$('#sidebar').velocity('stop').velocity({ left: '-300px' }, 800, 'spring');
|
||||
$('#main-container').velocity('stop').velocity({ marginLeft: '0px' }, 800, 'spring');
|
||||
} else {
|
||||
$('#side-button').addClass('close');
|
||||
$('#sidebar').velocity('stop').velocity({ left: '0px' }, 800, 'spring');
|
||||
$('#main-container').velocity('stop').velocity({ marginLeft: '300px' }, 800, 'spring');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 文章详情页面侧边栏切换文章与概览
|
||||
*/
|
||||
$('.toggle-sidebar-info span').on('click', function() {
|
||||
let toggleText = $(this).attr('data-toggle');
|
||||
$(this).attr('data-toggle', $(this).text());
|
||||
$(this).text(toggleText);
|
||||
if ($('#sidebar .author-info').is(':visible')) {
|
||||
$('#sidebar .author-info').velocity('stop').velocity({
|
||||
left: '80px',
|
||||
opacity: 0
|
||||
}, {
|
||||
duration: 300,
|
||||
display: 'none',
|
||||
easing: 'ease-in',
|
||||
complete: function() {
|
||||
$('#sidebar .sidebar-toc').velocity('stop').velocity({
|
||||
opacity: 1,
|
||||
left: 0
|
||||
}, {
|
||||
duration: 500,
|
||||
display: 'block',
|
||||
easing: 'ease-out'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#sidebar .sidebar-toc').velocity('stop').velocity({
|
||||
opacity: 0,
|
||||
left: '-80px'
|
||||
}, {
|
||||
duration: 300,
|
||||
display: 'none',
|
||||
easing: 'ease-in',
|
||||
complete: function() {
|
||||
$('#sidebar .author-info').velocity('stop').velocity({
|
||||
left: '0px',
|
||||
opacity: 1
|
||||
}, {
|
||||
duration: 500,
|
||||
display: 'flex',
|
||||
easing: 'ease-out'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// let left = $('#sidebar .sidebar-toc').css('left');
|
||||
// if (left === '0px') {
|
||||
// $('#sidebar .sidebar-toc').velocity('stop').velocity({
|
||||
// left: '-80px',
|
||||
// opacity: '0'
|
||||
// }, {
|
||||
// duration: 300,
|
||||
// easing: 'easeInQuart',
|
||||
// display: 'none',
|
||||
// component: function () {
|
||||
// $('#sidebar .author-info').velocity('stop').velocity({
|
||||
// left: '0px',
|
||||
// opacity: '1'
|
||||
// }, {
|
||||
// duration: 300,
|
||||
// easing: 'easeOutQuart',
|
||||
// display: 'flex'
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// $('#sidebar .author-info').velocity('stop').velocity({
|
||||
// left: '80px',
|
||||
// opacity: '0'
|
||||
// }, {
|
||||
// duration: 300,
|
||||
// easing: 'easeInQuart',
|
||||
// display: 'none',
|
||||
// component: function () {
|
||||
// $('#sidebar .sidebar-toc').velocity('stop').velocity({
|
||||
// left: '0px',
|
||||
// opacity: '1'
|
||||
// }, {
|
||||
// duration: 300,
|
||||
// easing: 'easeOutQuart',
|
||||
// display: 'block'
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
});
|
||||
/**
|
||||
* @description 为toc-link添加URI解码,适配Hexo 5.0.0+
|
||||
*/
|
||||
var list = document.getElementsByClassName('toc-link');
|
||||
for (var i in list) {
|
||||
if (list.hasOwnProperty(i)) {
|
||||
var tochref = decodeURI(list[i].getAttribute('href'));
|
||||
list[i].href = tochref;
|
||||
}
|
||||
}
|
||||
}());
|
||||
2
js/thirdparty/jquery-3.3.1.min.js
vendored
2
js/thirdparty/jquery-3.3.1.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
js/thirdparty/velocity.min.js
vendored
4
js/thirdparty/velocity.min.js
vendored
File diff suppressed because one or more lines are too long
62
js/utils.js
62
js/utils.js
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* created by lvfan
|
||||
* 2018-09-04
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description 获取实时时间,写入 id 为 now-time 的标签中
|
||||
*/
|
||||
(function () {
|
||||
const divTime = document.getElementById('now-time');
|
||||
|
||||
function getTime() {
|
||||
let time = new Date();
|
||||
let hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours();
|
||||
let minute = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes();
|
||||
let second = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds();
|
||||
divTime.innerText = hour + ':' + minute + ':' + second;
|
||||
}
|
||||
|
||||
getTime();
|
||||
setInterval(function () {
|
||||
getTime();
|
||||
}, 1000);
|
||||
}());
|
||||
|
||||
/**
|
||||
* @description 判断当前页面是否为活动页
|
||||
*/
|
||||
(function () {
|
||||
// 网页当前状态判断
|
||||
let state, visibilityChange, status, doc = document;
|
||||
if (typeof document.hidden !== 'undefined') {
|
||||
visibilityChange = 'visibilitychange';
|
||||
state = 'visibilityState';
|
||||
} else if (typeof document.mozHidden !== 'undefined') {
|
||||
visibilityChange = 'mozvisibilitychange';
|
||||
state = 'mozVisibilityState';
|
||||
} else if (typeof document.msHidden !== 'undefined') {
|
||||
visibilityChange = 'msvisibilitychange';
|
||||
state = 'msVisibilityState';
|
||||
} else if (typeof document.webkitHidden !== 'undefined') {
|
||||
visibilityChange = 'webkitvisibilitychange';
|
||||
state = 'webkitVisibilityState';
|
||||
}
|
||||
let docText = doc.title;
|
||||
// 添加监听器,在title里显示状态变化
|
||||
doc.addEventListener(visibilityChange, function () {
|
||||
if (doc[state] === 'visible') {
|
||||
doc.title = '欢迎回来!d(`・∀・)b 👏';
|
||||
status = setTimeout(() => {
|
||||
doc.title = docText;
|
||||
}, 1000);
|
||||
} else {
|
||||
doc.title = '藏起来了d(`x_x)b';
|
||||
if (status) {
|
||||
clearTimeout(status);
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
// 初始化页面状态
|
||||
// doc.title = '吕钒的后花园';
|
||||
}());
|
||||
Reference in New Issue
Block a user