image cdn

This commit is contained in:
xaoxuu 2021-03-08 01:41:59 +08:00
parent d813199658
commit ca9194b84e
9 changed files with 22 additions and 20 deletions

View File

@ -82,13 +82,13 @@ comments:
######## Footer ######## ######## Footer ########
footer: footer:
social: social:
- icon: '<img src="https://7.dusays.com/2021/02/14/25678f144c438.svg"/>' - icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/25678f144c438.svg"/>'
url: /atom.xml url: /atom.xml
- icon: '<img src="https://7.dusays.com/2021/02/14/08a41b181ce68.svg"/>' - icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/08a41b181ce68.svg"/>'
url: / url: /
- icon: '<img src="https://7.dusays.com/2021/02/14/cf1ae151f9e83.svg"/>' - icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/cf1ae151f9e83.svg"/>'
url: / url: /
- icon: '<img src="https://7.dusays.com/2021/02/14/942ebbf1a4b91.svg"/>' - icon: '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/942ebbf1a4b91.svg"/>'
url: / url: /
license: '[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)' 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)' source: #'[GitHub](https://github.com/xaoxuu/hexo-theme-stellar)'
@ -147,6 +147,7 @@ plugins:
scale: 1 # 0.1~1 scale: 1 # 0.1~1
default: default:
avatar: https://7.dusays.com/2021/03/03/87519671e4837.svg avatar: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg
link: https://7.dusays.com/2021/02/20/8f277b4ee0ecd.svg link: https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg
cover: https://7.dusays.com/2021/02/20/76b86c0226ffd.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

View File

@ -6,7 +6,7 @@ page.header = false;
page.robots = 'none'; page.robots = 'none';
%> %>
<article class='md error-page'> <article class='md error-page'>
<h1><img id='error' src="https://7.dusays.com/2021/02/20/1c830bfcd517d.svg" alt=""></h1> <h1><img id='error' src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/404/1c830bfcd517d.svg" alt=""></h1>
<p class='what'> <p class='what'>
<strong> <strong>
<%- __('page.error.what') %> <%- __('page.error.what') %>

View File

@ -73,13 +73,13 @@ function layoutDiv() {
} }
el += '>'; el += '>';
if (item == 'wechat') { if (item == 'wechat') {
el += '<img src="https://7.dusays.com/2021/02/24/b32ef3da1162a.svg"/>'; el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/b32ef3da1162a.svg"/>';
} else if (item == 'weibo') { } else if (item == 'weibo') {
el += '<img src="https://7.dusays.com/2021/02/24/80c07e4dbb303.svg"/>'; el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/80c07e4dbb303.svg"/>';
} else if (item == 'email') { } else if (item == 'email') {
el += '<img src="https://7.dusays.com/2021/02/24/a1b00e20f425d.svg"/>'; el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/a1b00e20f425d.svg"/>';
} else if (item == 'link') { } else if (item == 'link') {
el += '<img src="https://7.dusays.com/2021/02/24/8411ed322ced6.svg"/>'; el += '<img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/social/8411ed322ced6.svg"/>';
} }
el += '</a>'; el += '</a>';
} }

View File

@ -1,13 +1,13 @@
<% if (is_home() && page.total > 1) { %> <% if (is_home() && page.total > 1) { %>
<div class='paginator-wrap dis-select'> <div class='paginator-wrap dis-select'>
<a class='paginator prev<%- page.prev != 0 ? "" : " disable" %>' href='<%- url_for(page.prev_link) %>'> <a class='paginator prev<%- page.prev != 0 ? "" : " disable" %>' href='<%- url_for(page.prev_link) %>'>
<img src='https://7.dusays.com/2021/02/26/f049bbd4e88ec.svg'/> <img src='https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/f049bbd4e88ec.svg'/>
</a> </a>
<div class='paginator current'> <div class='paginator current'>
<%- page.current %><span class='sep'></span><%- page.total %> <%- page.current %><span class='sep'></span><%- page.total %>
</div> </div>
<a class='paginator next<%- page.next != 0 ? "" : " disable" %>' href='<%- url_for(page.next_link) %>'> <a class='paginator next<%- page.next != 0 ? "" : " disable" %>' href='<%- url_for(page.next_link) %>'>
<img src='https://7.dusays.com/2021/02/26/064b95430caf4.svg'/> <img src='https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/arrow/064b95430caf4.svg'/>
</a> </a>
</div> </div>
<% } %> <% } %>

View File

@ -50,6 +50,6 @@ if (post.categories && post.categories.length > 0) {
<% } %> <% } %>
<% } %> <% } %>
<% if (post.pin) { %> <% if (post.pin) { %>
<span class='pin'><img src='https://7.dusays.com/2021/02/27/3279dd441df8b.svg'/></span> <span class='pin'><img src='https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/badge/3279dd441df8b.svg'/></span>
<% } %> <% } %>
</div> </div>

View File

@ -8,6 +8,7 @@
const fs = require('hexo-fs'); const fs = require('hexo-fs');
module.exports.processSite = function(htmlContent) { module.exports.processSite = function(htmlContent) {
const default_image = this.theme.config.default.image;
return htmlContent.replace(/<img(.*?)src="(.*?)"(.*?)>/gi, function(imgTag) { return htmlContent.replace(/<img(.*?)src="(.*?)"(.*?)>/gi, function(imgTag) {
if (/="data:image(.*?)/gi.test(imgTag)) { if (/="data:image(.*?)/gi.test(imgTag)) {
return imgTag; return imgTag;
@ -18,6 +19,6 @@ module.exports.processSite = function(htmlContent) {
if (imgTag.includes(' no-lazy ') == false) { if (imgTag.includes(' no-lazy ') == false) {
return imgTag; 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);
}); });
}; };

View File

@ -27,7 +27,7 @@
margin-top: 19px margin-top: 19px
margin-bottom: 20px margin-bottom: 20px
.frame .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 width: 329px
height: 658px height: 658px
&[focus='top'] &[focus='top']

View File

@ -77,7 +77,7 @@ $(function () {
cfg.el = el; cfg.el = el;
cfg.api = api; cfg.api = api;
cfg.class = el.getAttribute('class'); 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); friendsjs.layout(cfg);
} }
}); });

View File

@ -80,8 +80,8 @@ $(function () {
cfg.class = el.getAttribute('class'); cfg.class = el.getAttribute('class');
cfg.el = el; cfg.el = el;
cfg.api = api; cfg.api = api;
cfg.avatar = 'https://7.dusays.com/2021/02/20/8f277b4ee0ecd.svg'; cfg.avatar = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg';
cfg.screenshot = 'https://7.dusays.com/2021/02/20/76b86c0226ffd.svg'; cfg.screenshot = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg';
sitesjs.layout(cfg); sitesjs.layout(cfg);
} }
}); });