diff --git a/scripts/filter.js b/scripts/filter.js index 4ffb21e..a01f1e5 100644 --- a/scripts/filter.js +++ b/scripts/filter.js @@ -5,5 +5,5 @@ hexo.extend.filter.register('before_post_render', function(data){ data.content = data.content.replace(/\]\s*\((?=(?!http).*?\))/gi, `](${hexo.config.picture_cdn}`) } - return data; -}); \ No newline at end of file + return data +}) \ No newline at end of file diff --git a/themes/yilia/source-src/config/photo-wall.json b/themes/yilia/source-src/config/photo-wall.json deleted file mode 100644 index c8c0411..0000000 --- a/themes/yilia/source-src/config/photo-wall.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, - {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"} -] \ No newline at end of file diff --git a/themes/yilia/source-src/js/anm.js b/themes/yilia/source-src/js/anm.js index 8a36657..3547221 100644 --- a/themes/yilia/source-src/js/anm.js +++ b/themes/yilia/source-src/js/anm.js @@ -1,92 +1,92 @@ function init() { - var width, height, largeHeader, canvas, ctx, circles, target, animateHeader = true; + var width, height, largeHeader, canvas, ctx, circles, target, animateHeader = true; - // Main - initHeader(); - addListeners(); + // Main + initHeader(); + addListeners(); - function initHeader() { - width = window.innerWidth; - height = window.innerHeight; - target = {x: 0, y: height}; + function initHeader() { + width = window.innerWidth; + height = window.innerHeight; + target = {x: 0, y: height}; - largeHeader = document.getElementById('container'); - largeHeader.style.height = height+'px'; + largeHeader = document.getElementById('container'); + largeHeader.style.height = height+'px'; - canvas = document.getElementById('anm-canvas'); - canvas.width = width; - canvas.height = height; - ctx = canvas.getContext('2d'); + canvas = document.getElementById('anm-canvas'); + canvas.width = width; + canvas.height = height; + ctx = canvas.getContext('2d'); - // create particles - circles = []; - for(var x = 0; x < width*0.5; x++) { - var c = new Circle(); - circles.push(c); - } - animate(); + // create particles + circles = []; + for(var x = 0; x < width*0.5; x++) { + var c = new Circle(); + circles.push(c); + } + animate(); + } + + // Event handling + function addListeners() { + window.addEventListener('scroll', scrollCheck); + window.addEventListener('resize', resize); + } + + function scrollCheck() { + if(document.body.scrollTop > height) animateHeader = false; + else animateHeader = true; + } + + function resize() { + width = window.innerWidth; + height = window.innerHeight; + largeHeader.style.height = height+'px'; + canvas.width = width; + canvas.height = height; + } + + function animate() { + if(animateHeader) { + ctx.clearRect(0,0,width,height); + for(var i in circles) { + circles[i].draw(); + } + } + requestAnimationFrame(animate); + } + + // Canvas manipulation + function Circle() { + var _this = this; + + // constructor + (function() { + _this.pos = {}; + init(); + //console.log(_this); + })(); + + function init() { + _this.pos.x = Math.random()*width; + _this.pos.y = height+Math.random()*100; + _this.alpha = 0.1+Math.random()*0.3; + _this.scale = 0.1+Math.random()*0.3; + _this.velocity = Math.random(); } - // Event handling - function addListeners() { - window.addEventListener('scroll', scrollCheck); - window.addEventListener('resize', resize); - } - - function scrollCheck() { - if(document.body.scrollTop > height) animateHeader = false; - else animateHeader = true; - } - - function resize() { - width = window.innerWidth; - height = window.innerHeight; - largeHeader.style.height = height+'px'; - canvas.width = width; - canvas.height = height; - } - - function animate() { - if(animateHeader) { - ctx.clearRect(0,0,width,height); - for(var i in circles) { - circles[i].draw(); - } - } - requestAnimationFrame(animate); - } - - // Canvas manipulation - function Circle() { - var _this = this; - - // constructor - (function() { - _this.pos = {}; - init(); - //console.log(_this); - })(); - - function init() { - _this.pos.x = Math.random()*width; - _this.pos.y = height+Math.random()*100; - _this.alpha = 0.1+Math.random()*0.3; - _this.scale = 0.1+Math.random()*0.3; - _this.velocity = Math.random(); - } - - this.draw = function() { - if(_this.alpha <= 0) { - init(); - } - _this.pos.y -= _this.velocity; - _this.alpha -= 0.0005; - ctx.beginPath(); - ctx.arc(_this.pos.x, _this.pos.y, _this.scale*10, 0, 2 * Math.PI, false); - ctx.fillStyle = 'rgba(255,255,255,'+ _this.alpha+')'; - ctx.fill(); - }; - } + this.draw = function() { + if(_this.alpha <= 0) { + init(); + } + _this.pos.y -= _this.velocity; + _this.alpha -= 0.0005; + ctx.beginPath(); + ctx.arc(_this.pos.x, _this.pos.y, _this.scale*10, 0, 2 * Math.PI, false); + ctx.fillStyle = 'rgba(255,255,255,'+ _this.alpha+')'; + ctx.fill(); + }; + } } export default { init } \ No newline at end of file diff --git a/themes/yilia/source-src/js/browser.js b/themes/yilia/source-src/js/browser.js index 40eb88f..d8cc160 100644 --- a/themes/yilia/source-src/js/browser.js +++ b/themes/yilia/source-src/js/browser.js @@ -1,6 +1,6 @@ export default { versions: function() { - var u = window.navigator.userAgent; + var u = window.navigator.userAgent return { trident: u.indexOf('Trident') > -1, //IE内核 presto: u.indexOf('Presto') > -1, //opera内核 @@ -13,6 +13,6 @@ export default { iPad: u.indexOf('iPad') > -1, //是否为iPad webApp: u.indexOf('Safari') == -1, //是否为web应用程序,没有头部与底部 weixin: u.indexOf('MicroMessenger') == -1 //是否为微信浏览器 - }; + } }() } diff --git a/themes/yilia/source-src/js/comment.js b/themes/yilia/source-src/js/comment.js index 92223ca..350172d 100644 --- a/themes/yilia/source-src/js/comment.js +++ b/themes/yilia/source-src/js/comment.js @@ -1,6 +1,6 @@ -// const AV = require('leancloud-storage'); -window.AV = require('leancloud-storage'); -// const Valine = require('../lib/Valine.min'); +// const AV = require('leancloud-storage') +window.AV = require('leancloud-storage') +// const Valine = require('../lib/Valine.min') /** * 使用根据Valine项目源代码重新打包 * 可以支持对于AV对象的传参输入, 而不需要暴露全局变量 @@ -11,6 +11,6 @@ const commentConfig = require("../config/comment.json") import(/* webpackChunkName: "valine" */ '../lib/Valine.min').then(({ default: Valine }) => { commentConfig.valine.config.path = window.location.pathname - // commentConfig.valine.config.av = AV; + // commentConfig.valine.config.av = AV new Valine(commentConfig.valine.config) }) diff --git a/themes/yilia/source-src/js/mobile.js b/themes/yilia/source-src/js/mobile.js index 70a7863..60c48a3 100644 --- a/themes/yilia/source-src/js/mobile.js +++ b/themes/yilia/source-src/js/mobile.js @@ -21,22 +21,22 @@ function tabActive() { } function getElementLeft(element) { - var actualLeft = element.offsetLeft; - var current = element.offsetParent; + var actualLeft = element.offsetLeft + var current = element.offsetParent while (current !== null) { - actualLeft += current.offsetLeft; - current = current.offsetParent; + actualLeft += current.offsetLeft + current = current.offsetParent } - return actualLeft; + return actualLeft } function getElementTop(element) { - var actualTop = element.offsetTop; - var current = element.offsetParent; + var actualTop = element.offsetTop + var current = element.offsetParent while (current !== null) { - actualTop += current.offsetTop; - current = current.offsetParent; + actualTop += current.offsetTop + current = current.offsetParent } - return actualTop; + return actualTop } function scrollStop($dom, top, limit, zIndex, diff) { diff --git a/themes/yilia/source-src/js/photo-wall.js b/themes/yilia/source-src/js/photo-wall.js index 629b674..e8ee072 100644 --- a/themes/yilia/source-src/js/photo-wall.js +++ b/themes/yilia/source-src/js/photo-wall.js @@ -1,13 +1,36 @@ -import photoWallJson from '../config/photo-wall.json' +import axios from 'axios' -var content = '