更多服务开关

i18n
xaoxuu 4 years ago
parent dfe1a6b797
commit b96e40e809
  1. 31
      _config.yml
  2. 6
      layout/_partial/scripts.ejs
  3. 4
      source/js/backstretch.min.js
  4. 0
      source/js/comment_typing.js

@ -14,39 +14,34 @@ info:
############################### 服务开关 ###############################
# ⚠ 注意:开启过多服务会导致网页加载缓慢、运行缓慢
service:
jquery: '//cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js'
############################# 提升速度类的服务
################################################## 提升速度类的服务
# 鼠标放在链接上就提前开始加载了
instant_page: '//instant.page/3.0.0'
############################# 优化体验类的服务
################################################## 优化体验类的服务
# 图片放大预览
fancybox:
css: '//cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css'
js: '//cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js'
# 页面滚动显示动画
scrollreveal: '//cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js'
# scrollreveal: '//cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js'
# 代码块复制按钮
clipboard: '//cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js'
# 图片懒加载 需要安装插件 npm i --save hexo-lazyload-image
lazyload: '//cdn.jsdelivr.net/gh/toddmotto/echo@1.7.3/src/echo.js'
############################# 运维服务
# clipboard: '//cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js'
################################################## 运维服务
# 访问量统计【加载非常缓慢】
busuanzi: '//cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js'
# busuanzi: '//cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js'
# 文章字数统计、阅读时长,开启需要安装插件: npm i --save hexo-wordcount
wordcount: #true
############################# 美化类的服务
# 幻灯片背景
backstretch: '//cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@20.2.32/js/backstretch.min.js'
# wordcount: true
################################################## 美化类的服务
# 按钮点击涟漪效果
nodewaves:
css: '//cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css'
js: '//cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js'
# nodewaves:
# css: '//cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css'
# js: '//cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js'
# 文本框打字机特效
commentTyping: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@20.2.32/js/commentTyping.js
# comment_typing: '//cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@20.2.33/js/comment_typing.js'
@ -72,6 +67,8 @@ style:
# 幻灯片背景
backstretch:
enable: true # 是否启用
js: '//cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js'
position: fixed # cover: 封面背景 fixed: 整个网页背景
duration: 10000 # 持续时间(毫秒)
fade: 2500 # 渐变(毫秒)

@ -56,15 +56,15 @@
<script async src="<%- theme.service.busuanzi %>"></script>
<% } %>
<% if (theme.backstretch && (theme.backstretch.images || page.images)) { %>
<% if (theme.backstretch && theme.backstretch.enable && (theme.backstretch.images || page.images)) { %>
<% var imgs = theme.backstretch.images || page.images; %>
<% var posi = null;
if (theme.backstretch.position == 'cover') {
posi = '.cover';
}
%>
<% if (imgs != undefined && theme.backstretch.position != undefined && theme.service.backstretch){ %>
<%- js(theme.service.backstretch) %>
<% if (imgs != undefined && theme.backstretch.position != undefined){ %>
<%- js(theme.backstretch.js) %>
<script type="text/javascript">
$(function(){
if ('<%- posi %>') {

@ -1,4 +0,0 @@
/*! Backstretch - v2.0.4 - 2013-06-19
* http://srobbin.com/jquery-plugins/backstretch/
* Copyright (c) 2013 Scott Robbin; Licensed MIT */
(function(a,d,p){a.fn.backstretch=function(c,b){(c===p||0===c.length)&&a.error("No images were supplied for Backstretch");0===a(d).scrollTop()&&d.scrollTo(0,0);return this.each(function(){var d=a(this),g=d.data("backstretch");if(g){if("string"==typeof c&&"function"==typeof g[c]){g[c](b);return}b=a.extend(g.options,b);g.destroy(!0)}g=new q(this,c,b);d.data("backstretch",g)})};a.backstretch=function(c,b){return a("body").backstretch(c,b).data("backstretch")};a.expr[":"].backstretch=function(c){return a(c).data("backstretch")!==p};a.fn.backstretch.defaults={centeredX:!0,centeredY:!0,duration:5E3,fade:0};var r={left:0,top:0,overflow:"hidden",margin:0,padding:0,height:"100%",width:"100%",zIndex:-999999},s={position:"absolute",display:"none",margin:0,padding:0,border:"none",width:"auto",height:"auto",maxHeight:"none",maxWidth:"none",zIndex:-999999},q=function(c,b,e){this.options=a.extend({},a.fn.backstretch.defaults,e||{});this.images=a.isArray(b)?b:[b];a.each(this.images,function(){a("<img />")[0].src=this});this.isBody=c===document.body;this.$container=a(c);this.$root=this.isBody?l?a(d):a(document):this.$container;c=this.$container.children(".backstretch").first();this.$wrap=c.length?c:a('<div class="backstretch"></div>').css(r).appendTo(this.$container);this.isBody||(c=this.$container.css("position"),b=this.$container.css("zIndex"),this.$container.css({position:"static"===c?"relative":c,zIndex:"auto"===b?0:b,background:"none"}),this.$wrap.css({zIndex:-999998}));this.$wrap.css({position:this.isBody&&l?"fixed":"absolute"});this.index=0;this.show(this.index);a(d).on("resize.backstretch",a.proxy(this.resize,this)).on("orientationchange.backstretch",a.proxy(function(){this.isBody&&0===d.pageYOffset&&(d.scrollTo(0,1),this.resize())},this))};q.prototype={resize:function(){try{var a={left:0,top:0},b=this.isBody?this.$root.width():this.$root.innerWidth(),e=b,g=this.isBody?d.innerHeight?d.innerHeight:this.$root.height():this.$root.innerHeight(),j=e/this.$img.data("ratio"),f;j>=g?(f=(j-g)/2,this.options.centeredY&&(a.top="-"+f+"px")):(j=g,e=j*this.$img.data("ratio"),f=(e-b)/2,this.options.centeredX&&(a.left="-"+f+"px"));this.$wrap.css({width:b,height:g}).find("img:not(.deleteable)").css({width:e,height:j}).css(a)}catch(h){}return this},show:function(c){if(!(Math.abs(c)>this.images.length-1)){var b=this,e=b.$wrap.find("img").addClass("deleteable"),d={relatedTarget:b.$container[0]};b.$container.trigger(a.Event("backstretch.before",d),[b,c]);this.index=c;clearInterval(b.interval);b.$img=a("<img />").css(s).bind("load",function(f){var h=this.width||a(f.target).width();f=this.height||a(f.target).height();a(this).data("ratio",h/f);a(this).fadeIn(b.options.speed||b.options.fade,function(){e.remove();b.paused||b.cycle();a(["after","show"]).each(function(){b.$container.trigger(a.Event("backstretch."+this,d),[b,c])})});b.resize()}).appendTo(b.$wrap);b.$img.attr("src",b.images[c]);return b}},next:function(){return this.show(this.index<this.images.length-1?this.index+1:0)},prev:function(){return this.show(0===this.index?this.images.length-1:this.index-1)},pause:function(){this.paused=!0;return this},resume:function(){this.paused=!1;this.next();return this},cycle:function(){1<this.images.length&&(clearInterval(this.interval),this.interval=setInterval(a.proxy(function(){this.paused||this.next()},this),this.options.duration));return this},destroy:function(c){a(d).off("resize.backstretch orientationchange.backstretch");clearInterval(this.interval);c||this.$wrap.remove();this.$container.removeData("backstretch")}};var l,f=navigator.userAgent,m=navigator.platform,e=f.match(/AppleWebKit\/([0-9]+)/),e=!!e&&e[1],h=f.match(/Fennec\/([0-9]+)/),h=!!h&&h[1],n=f.match(/Opera Mobi\/([0-9]+)/),t=!!n&&n[1],k=f.match(/MSIE ([0-9]+)/),k=!!k&&k[1];l=!((-1<m.indexOf("iPhone")||-1<m.indexOf("iPad")||-1<m.indexOf("iPod"))&&e&&534>e||d.operamini&&"[object OperaMini]"==={}.toString.call(d.operamini)||n&&7458>t||-1<f.indexOf("Android")&&e&&533>e||h&&6>h||"palmGetResource"in d&&e&&534>e||-1<f.indexOf("MeeGo")&&-1<f.indexOf("NokiaBrowser/8.5.0")||k&&6>=k)})(jQuery,window);
Loading…
Cancel
Save