Skip to content

Commit

Permalink
🐞 fix(meting): 官方API 跨域导致数据获取失败
Browse files Browse the repository at this point in the history
  • Loading branch information
CCKNBC committed Jun 9, 2023
1 parent 05a31b9 commit 9ebe6c1
Show file tree
Hide file tree
Showing 49 changed files with 673 additions and 524 deletions.
5 changes: 5 additions & 0 deletions _config.butterfly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@ background: "linear-gradient(45deg,#fff1eb,#ace0f9)"
# Footer Background
footer_bg: "linear-gradient(135deg,#fff1eb,#ace0f9)"

# Add mask to header or footer (为 header 或 footer 添加黑色半透遮罩)
mask:
header: true
footer: true

# the position of bottom right button/default unit: px (右下角按鈕距離底部的距離/默認單位為px)
rightside-bottom:

Expand Down
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,10 @@ mmedia:
lrcType: 3
meting:
js: https://cdn1.tianli0.top/npm/meting/dist/Meting.min.js
api:
api: https://music.startly.cn/ # https://meting.ccknbc.cc/api (备用,支持 YouTube Spotify)
default:
theme: '#8fbc8f'
list-folded: true
dplayer:
js: https://cdn1.tianli0.top/npm/dplayer/dist/DPlayer.min.js
hls_js: https://cdn1.tianli0.top/npm/hls.js/dist/hls.min.js
Expand Down
222 changes: 111 additions & 111 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"hexo-wordcount": "6.0.1",
"hexo-yam": "8.0.0",
"markdown-it-task-lists": "2.1.1",
"workbox-build": "6.6.1"
"workbox-build": "7.0.0"
}
}
71 changes: 71 additions & 0 deletions source/blogroll/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,77 @@ xkFriend.init({
{% btn '#post-comment',给 CC 留言,fa-solid fa-comments,outline green smaller %}
或再次 PR {% endnote %}

<p style="padding:0 0 0 .8rem">
请<strong>勾选</strong>你符合的条件,满足所有条件才可评论申请:
</p>
<div id="friendlink_checkboxs" style="padding:0 0 0 1.6rem">
<p>
<label class="checkbox">
<input type="checkbox" id="checkbox1" onclick="checkForm()">
我已添加 <b>CC的部落格</b>的友情链接
</label>
</p>
<p>
<label class="checkbox">
<input type="checkbox" id="checkbox2" onclick="checkForm()">
我的链接主体为<b>个人</b>,网站类型为<b>博客</b>
</label>
</p>
<p>
<label class="checkbox">
<input type="checkbox" id="checkbox3" onclick="checkForm()">我的网站现在可以在中国大陆区域正常访问
</label>
</p>
<p>
<label class="checkbox">
<input type="checkbox" id="checkbox4" onclick="checkForm()">网站内容符合中国大陆法律法规
</label>
</p>
<p>
<label class="checkbox">
<input type="checkbox" id="checkbox5" onclick="checkForm()">我的网站可以在1分钟内加载完成首屏
</label>
</p>
</div>

<script>
var walineSubmit = document.getElementsByClassName("wl-comment")[0];
if (walineSubmit) {
walineSubmit.style.opacity = "0";
}
function checkForm() {
var checkbox1 = document.getElementById("checkbox1");
var checkbox2 = document.getElementById("checkbox2");
var checkbox3 = document.getElementById("checkbox3");
var checkbox4 = document.getElementById("checkbox4");
var checkbox5 = document.getElementById("checkbox5");
var walineSubmit = document.getElementsByClassName("wl-comment")[0];
if (checkbox1.checked && checkbox2.checked && checkbox3.checked && checkbox4.checked && checkbox5.checked) {
walineSubmit.style.opacity = "1";
walineSubmit.style.height = "auto";
walineSubmit.style.overflow = "auto";
var input = document.getElementsByClassName("wl-editor")[0];
let evt = new Event('input');
input.dispatchEvent(evt);
input.value = '昵称: \n博客链接: \n头像链接: \n描述: \n';
input.setSelectionRange(-1, -1);
} else {
walineSubmit.style.opacity = "0";
walineSubmit.style.height = "0";
walineSubmit.style.overflow = "hidden";
}
}
</script>

<style>
.wl-comment {
opacity: 0;
height: 0;
transition: opacity .5s, height .5s;
overflow: hidden;
}
</style>

<!-- {% link 顺便看看友链截图列表,您可复制使用啦, https://cdn1.tianli0.top/gh/ccknbc-actions/blogroll@webp/, https://cdn1.tianli0.top/www.jsdelivr.com/c903573129ce0afdbc8b006baf86dba514615495/img/logo-horizontal.svg %} -->

<!-- {% ghcard ccknbc-actions/blogroll, theme=vue %} -->
Expand Down
23 changes: 19 additions & 4 deletions source/music/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,23 @@ comments: false
translate_title: music
subtitle: Music
date: 2020-11-08 15:29:33
updated: 2023-02-19 13:12:58
updated: 2023-06-09 23:13:42
---
{% note green 'fa-solid fa-dice-three' simple %}Three Man Down{% endnote %}
{% mmedia "meting" "auto=https://music.163.com/#/artist?id=12838890" "theme:#8fbc8f" %}
{% note info simple %}2022年8月22日 Ohm宣布因个人原因退出乐队,"TMD"因此也成为了缺少贝斯手的乐队{% endnote %}
<link rel="stylesheet" href="https://cdn1.tianli0.top/npm/aplayer/dist/APlayer.min.css">
<script src="https://cdn1.tianli0.top/npm/aplayer/dist/APlayer.min.js"></script>
<script src="https://cdn1.tianli0.top/npm/meting/dist/Meting.min.js"></script>
<script>var meting_api="https://music.startly.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r"</script>

{% folding green open, Three Man Down × Tilly Birds %}
<!-- {% note green 'fa-solid fa-dice-three' simple %}Three Man Down × Tilly Birds{% endnote %} -->
<meting-js metin="meting" server="netease" type="playlist" id="5457110860" list-folded="true" theme="#8fbc8f">
{% note info simple %}2022年8月22日 Ohm宣布因个人原因退出乐队,"TMD"因此也成为了缺少贝斯手的乐队{% endnote %}
{% endfolding %}

{% folding blue, 王铮亮 | 遇见才是最美的邂逅 %}
<meting-js metin="meting" server="netease" type="playlist" id="7681620447" list-folded="true" theme="#8fbc8f">
{% endfolding %}

{% folding blue, 王铮亮2023“还是爱着”全国巡演 %}
<meting-js metin="meting" server="netease" type="playlist" id="8448821577" list-folded="true" theme="#8fbc8f">
{% endfolding %}
12 changes: 5 additions & 7 deletions themes/butterfly/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div align="right">
Language:
🇺🇸
<a title="Chinese" href="/README_CN.md">🇨🇳</a>
<a title="Chinese" href="/README_CN.md">中文</a>
</div>

# hexo-theme-butterfly
Expand All @@ -14,7 +12,7 @@

![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)

Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://crazywong.com/)
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://blog.crazywong.com/)

Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)

Expand Down Expand Up @@ -62,17 +60,17 @@ npm i hexo-theme-butterfly

- [x] Card UI Design
- [X] Support sub-menu
- [x] Two Column designs
- [x] Two-column layout
- [x] Responsive Web Design
- [x] Dark Mode
- [x] Pjax
- [x] Read Mode
- [x] Conversion between Traditional and Simplified Chinese
- [X] TOC catalog is available for both computers and mobile phones
- [X] Color themes (darker/pale night/light/ocean/mac/mac light), support custom colors
- [X] Built-in Syntax Highlighting Themes (darker/pale night/light/ocean/mac/mac light), also support customization
- [X] Code Blocks (Display code language/close or expand Code Blocks/Copy Button/word wrap)
- [X] Disable copy/Add a Copyright Notice to the Copied Text
- [X] Search (Algolia SearchZ/Local Search)
- [X] Search (Algolia Search/Local Search)
- [x] Mathjax and Katex
- [x] Built-in 404 page
- [x] WordCount
Expand Down
8 changes: 3 additions & 5 deletions themes/butterfly/README_CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div align="right">
語言:
中文
<a title="English" href="/README.md">英文</a>
<a title="English" href="/README.md">English</a>
</div>

# hexo-theme-butterfly
Expand All @@ -14,7 +12,7 @@

![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)

預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://crazywong.com/)
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://blog.crazywong.com/)

文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)

Expand Down Expand Up @@ -72,7 +70,7 @@ theme: butterfly
- [X] 內置多種代碼配色(darker/pale night/light/ocean/mac/mac light),可自定義代碼配色
- [X] 代碼塊顯示代碼語言/關閉或展開代碼塊/代碼複製/代碼自動換行
- [X] 可關閉文字複製/可開啟內容複製增加版權信息)
- [X] 兩種搜索(Algolia搜索和本地搜索
- [X] 兩種搜索( Algolia 搜索和本地搜索
- [x] Mathjax 和 Katex
- [x] 內置404頁面
- [x] 顯示字數統計
Expand Down
5 changes: 5 additions & 0 deletions themes/butterfly/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,11 @@ background:
# Footer Background
footer_bg: false

# Add mask to header or footer (为 header 或 footer 添加黑色半透遮罩)
mask:
header: true
footer: true

# the position of bottom right button/default unit: px (右下角按鈕距離底部的距離/默認單位為px)
rightside-bottom:

Expand Down
2 changes: 1 addition & 1 deletion themes/butterfly/layout/includes/header/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ header#page-header(class=`${isHomeClass+isFixedClass}` style=bg_img)
span#subtitle
if(theme.social)
#site_social_icons
!=fragment_cache('social', function(){return partial('includes/header/social')})
!=partial('includes/header/social', {}, {cache: true})
#scroll-down
i.fa-solid.fa-angle-down.scroll-down-effects
else
Expand Down
34 changes: 19 additions & 15 deletions themes/butterfly/layout/includes/loading/fullpage-loading.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@
.loading-word= _p('loading')

script.
const preloader = {
endLoading: () => {
document.body.style.overflow = '';
document.getElementById('loading-box').classList.add("loaded")
},
initLoading: () => {
document.body.style.overflow = 'hidden';
document.getElementById('loading-box').classList.remove("loaded")
(()=>{
const $loadingBox = document.getElementById('loading-box')
const $body = document.body
const preloader = {
endLoading: () => {
$body.style.overflow = ''
$loadingBox.classList.add('loaded')
},
initLoading: () => {
$body.style.overflow = 'hidden'
$loadingBox.classList.remove('loaded')
}
}
}

preloader.initLoading()
window.addEventListener('load',()=> { preloader.endLoading() })
preloader.initLoading()
window.addEventListener('load',() => { preloader.endLoading() })

if (!{theme.pjax && theme.pjax.enable}) {
document.addEventListener('pjax:send', () => { preloader.initLoading() })
document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}
if (!{theme.pjax && theme.pjax.enable}) {
document.addEventListener('pjax:send', () => { preloader.initLoading() })
document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}
})()
4 changes: 2 additions & 2 deletions themes/butterfly/layout/includes/mixins/post-ui.pug
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ mixin postUI(posts)
block
span.article-meta-label= ' ' + _p('card_post_count')

if theme.comments.card_post_count
if theme.comments.card_post_count && theme.comments.use
case theme.comments.use[0]
when 'Disqus'
+countBlockInIndex
Expand All @@ -89,7 +89,7 @@ mixin postUI(posts)
when 'Waline'
+countBlockInIndex
a(href=url_for(link) + '#post-comment')
span.waline-comment-count(id=url_for(link))
span.waline-comment-count(data-path=url_for(link))
i.fa-solid.fa-spinner.fa-spin
when 'Twikoo'
+countBlockInIndex
Expand Down
70 changes: 41 additions & 29 deletions themes/butterfly/layout/includes/page/flink.pug
Original file line number Diff line number Diff line change
@@ -1,43 +1,56 @@
#article-container
.flink
- let pageContent = page.content
if page.flink_url
- let { content, random, flink_url } = page
- let pageContent = content

if flink_url || random
- const linkData = flink_url ? false : site.data.link || false
script.
(()=>{
const replaceSymbol = (str) => {
return str.replace(/[\p{P}\p{S}]/gu, "-")
}

let result = ""
fetch("!{url_for(page.flink_url)}")
.then(response => response.json())
.then(str => {
for(let i = 0; i < str.length; i++){
const replaceClassName = replaceSymbol(str[i].class_name)
const className = str[i].class_name ? `<h2 id="${replaceClassName}"><a href="#${replaceClassName}" class="headerlink" title="${str[i].class_name}"></a>${str[i].class_name}</h2>` : ""
const classDesc = str[i].class_desc ? `<div class="flink-desc">${str[i].class_desc}</div>` : ""

let listResult = ""
const lists = str[i].link_list
for(let j = 0; j < lists.length; j++){
listResult += `
<div class="flink-list-item">
<a href="${lists[j].link}" title="${lists[j].name}" target="_blank">
<div class="flink-item-icon">
<img class="no-lightbox" src="${lists[j].avatar}" onerror='this.onerror=null;this.src="!{url_for(theme.error_img.flink)}"' alt="${lists[j].name}" />
</div>
<div class="flink-item-name">${lists[j].name}</div>
<div class="flink-item-desc" title="${lists[j].descr}">${lists[j].descr}</div>
</a>
</div>`
}
const add = (str) => {
for(let i = 0; i < str.length; i++){
const replaceClassName = replaceSymbol(str[i].class_name)
const className = str[i].class_name ? `<h2 id="${replaceClassName}"><a href="#${replaceClassName}" class="headerlink" title="${str[i].class_name}"></a>${str[i].class_name}</h2>` : ""
const classDesc = str[i].class_desc ? `<div class="flink-desc">${str[i].class_desc}</div>` : ""

result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
let listResult = ""
const lists = str[i].link_list
if (!{random === true}) {
lists.sort(() => Math.random() - 0.5)
}
for(let j = 0; j < lists.length; j++){
listResult += `
<div class="flink-list-item">
<a href="${lists[j].link}" title="${lists[j].name}" target="_blank">
<div class="flink-item-icon">
<img class="no-lightbox" src="${lists[j].avatar}" onerror='this.onerror=null;this.src="!{url_for(theme.error_img.flink)}"' alt="${lists[j].name}" />
</div>
<div class="flink-item-name">${lists[j].name}</div>
<div class="flink-item-desc" title="${lists[j].descr}">${lists[j].descr}</div>
</a>
</div>`
}

document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
window.lazyLoadInstance && window.lazyLoadInstance.update()
})
result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
}

document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
window.lazyLoadInstance && window.lazyLoadInstance.update()
}

const linkData = !{JSON.stringify(linkData)}
if (!{Boolean(flink_url)}) {
fetch("!{url_for(flink_url)}")
.then(response => response.json())
.then(add)
} else if (linkData) {
add(linkData)
}
})()

else
Expand Down Expand Up @@ -67,4 +80,3 @@

- pageContent = result + pageContent
!= pageContent

2 changes: 1 addition & 1 deletion themes/butterfly/layout/includes/sidebar.pug
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
.headline= _p('aside.categories')
.length-num= site.categories.length

hr
hr.custom-hr
!=partial('includes/header/menu_item', {}, {cache: true})
Loading

0 comments on commit 9ebe6c1

Please sign in to comment.