From ca9194b84e1da425173eceedaefd5e36344c7b13 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 8 Mar 2021 01:41:59 +0800 Subject: [PATCH] image cdn --- _config.yml | 15 ++++++++------- layout/404.ejs | 2 +- layout/_partial/main/article/article_footer.ejs | 8 ++++---- layout/_partial/main/post_list/paginator.ejs | 4 ++-- layout/_partial/main/post_list/post_card.ejs | 2 +- scripts/filters/lib/img_onerror.js | 3 ++- source/css/_layout/tag-plugins/frame.styl | 2 +- source/js/plugins/friends.js | 2 +- source/js/plugins/sites.js | 4 ++-- 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/_config.yml b/_config.yml index 9f30e68..91b0528 100755 --- a/_config.yml +++ b/_config.yml @@ -82,13 +82,13 @@ comments: ######## Footer ######## footer: social: - - icon: '' + - icon: '' url: /atom.xml - - icon: '' + - icon: '' url: / - - icon: '' + - icon: '' url: / - - icon: '' + - icon: '' url: / license: '[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)' source: #'[GitHub](https://github.com/xaoxuu/hexo-theme-stellar)' @@ -147,6 +147,7 @@ plugins: scale: 1 # 0.1~1 default: - avatar: https://7.dusays.com/2021/03/03/87519671e4837.svg - link: https://7.dusays.com/2021/02/20/8f277b4ee0ecd.svg - cover: https://7.dusays.com/2021/02/20/76b86c0226ffd.svg + avatar: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg + link: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg + cover: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg + image: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/image/2659360.svg diff --git a/layout/404.ejs b/layout/404.ejs index 4981414..842a1d7 100755 --- a/layout/404.ejs +++ b/layout/404.ejs @@ -6,7 +6,7 @@ page.header = false; page.robots = 'none'; %>
-

+

<%- __('page.error.what') %> diff --git a/layout/_partial/main/article/article_footer.ejs b/layout/_partial/main/article/article_footer.ejs index be167a4..6db7fb5 100644 --- a/layout/_partial/main/article/article_footer.ejs +++ b/layout/_partial/main/article/article_footer.ejs @@ -73,13 +73,13 @@ function layoutDiv() { } el += '>'; if (item == 'wechat') { - el += ''; + el += ''; } else if (item == 'weibo') { - el += ''; + el += ''; } else if (item == 'email') { - el += ''; + el += ''; } else if (item == 'link') { - el += ''; + el += ''; } el += ''; } diff --git a/layout/_partial/main/post_list/paginator.ejs b/layout/_partial/main/post_list/paginator.ejs index 406682f..b63b4ec 100644 --- a/layout/_partial/main/post_list/paginator.ejs +++ b/layout/_partial/main/post_list/paginator.ejs @@ -1,13 +1,13 @@ <% if (is_home() && page.total > 1) { %>

- +
<%- page.current %><%- page.total %>
- +
<% } %> diff --git a/layout/_partial/main/post_list/post_card.ejs b/layout/_partial/main/post_list/post_card.ejs index 71a46ea..941e5fd 100755 --- a/layout/_partial/main/post_list/post_card.ejs +++ b/layout/_partial/main/post_list/post_card.ejs @@ -50,6 +50,6 @@ if (post.categories && post.categories.length > 0) { <% } %> <% } %> <% if (post.pin) { %> - + <% } %> diff --git a/scripts/filters/lib/img_onerror.js b/scripts/filters/lib/img_onerror.js index 1a78166..a71dec5 100644 --- a/scripts/filters/lib/img_onerror.js +++ b/scripts/filters/lib/img_onerror.js @@ -8,6 +8,7 @@ const fs = require('hexo-fs'); module.exports.processSite = function(htmlContent) { + const default_image = this.theme.config.default.image; return htmlContent.replace(//gi, function(imgTag) { if (/="data:image(.*?)/gi.test(imgTag)) { return imgTag; @@ -18,6 +19,6 @@ module.exports.processSite = function(htmlContent) { if (imgTag.includes(' no-lazy ') == false) { return imgTag; } - return imgTag.slice(0,imgTag.length-1) + ' onerror="javascript:this.classList.add(\'error\');this.src=\'https://7.dusays.com/2021/03/03/87519671e4837.svg\';"' + imgTag.slice(imgTag.length-1); + return imgTag.slice(0,imgTag.length-1) + ' onerror="javascript:this.classList.add(\'error\');this.src=\'' + default_image + '\';"' + imgTag.slice(imgTag.length-1); }); }; diff --git a/source/css/_layout/tag-plugins/frame.styl b/source/css/_layout/tag-plugins/frame.styl index 23138f1..7ce15d9 100644 --- a/source/css/_layout/tag-plugins/frame.styl +++ b/source/css/_layout/tag-plugins/frame.styl @@ -27,7 +27,7 @@ margin-top: 19px margin-bottom: 20px .frame - background-image: url(https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@3/img/frame/iphone11.svg); + background-image: url(https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/frame/iphone11.svg); width: 329px height: 658px &[focus='top'] diff --git a/source/js/plugins/friends.js b/source/js/plugins/friends.js index 88f9aad..e5189bc 100644 --- a/source/js/plugins/friends.js +++ b/source/js/plugins/friends.js @@ -77,7 +77,7 @@ $(function () { cfg.el = el; cfg.api = api; cfg.class = el.getAttribute('class'); - cfg.avatar = 'https://7.dusays.com/2021/03/03/87519671e4837.svg'; + cfg.avatar = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg'; friendsjs.layout(cfg); } }); diff --git a/source/js/plugins/sites.js b/source/js/plugins/sites.js index 4b6c5fe..c798af4 100644 --- a/source/js/plugins/sites.js +++ b/source/js/plugins/sites.js @@ -80,8 +80,8 @@ $(function () { cfg.class = el.getAttribute('class'); cfg.el = el; cfg.api = api; - cfg.avatar = 'https://7.dusays.com/2021/02/20/8f277b4ee0ecd.svg'; - cfg.screenshot = 'https://7.dusays.com/2021/02/20/76b86c0226ffd.svg'; + cfg.avatar = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg'; + cfg.screenshot = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg'; sitesjs.layout(cfg); } });