From b34eeb042518701d9bc7c081f68c887a632a72aa Mon Sep 17 00:00:00 2001 From: LittleNyima Date: Tue, 28 Mar 2023 14:14:15 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81abcjs=E4=B9=90?= =?UTF-8?q?=E8=B0=B1=E6=B8=B2=E6=9F=93=20=20-=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=8F=AF=E9=85=8D=E7=BD=AE=E9=80=89=E9=A1=B9?= =?UTF-8?q?=20=20-=20=E6=B7=BB=E5=8A=A0=E6=B8=B2=E6=9F=93=E4=B8=8E?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=B3=A8=E5=86=8C=E7=9B=B8=E5=85=B3=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=20=20-=20=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4cdn?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 7 +++++++ layout/includes/additional-js.pug | 9 +++++++++ layout/includes/third-party/abcjs.pug | 18 ++++++++++++++++++ plugins.yml | 5 +++++ scripts/tag/score.js | 22 ++++++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 layout/includes/third-party/abcjs.pug create mode 100644 scripts/tag/score.js diff --git a/_config.yml b/_config.yml index db17670..2a59a95 100644 --- a/_config.yml +++ b/_config.yml @@ -862,6 +862,13 @@ lazyload: # favicon_16_16: /pwa/16.png # mask_icon: /pwa/safari-pinned-tab.svg +# abcjs (樂譜渲染) +# See https://github.com/paulrosen/abcjs +# --------------- +abcjs: + enable: false + per_page: false + # Open graph meta tags # https://developers.facebook.com/docs/sharing/webmasters/ Open_Graph_meta: diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 3cb29f4..60646ae 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -59,3 +59,12 @@ div if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv script(async data-pjax src= theme.asset.busuanzi || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js') + + if theme.abcjs.enable + if theme.abcjs.per_page + if is_post() || is_page() + script(src=url_for(theme.asset.abcjs_basic_js)) + include ./third-party/abcjs.pug + else if page.abcjs + script(src=url_for(theme.asset.abcjs_basic_js)) + include ./third-party/abcjs.pug diff --git a/layout/includes/third-party/abcjs.pug b/layout/includes/third-party/abcjs.pug new file mode 100644 index 0000000..c8a1c06 --- /dev/null +++ b/layout/includes/third-party/abcjs.pug @@ -0,0 +1,18 @@ +script. + function abcjsInit() { + function abcjsFn() { + for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) { + ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'}); + } + } + if (typeof ABCJS === 'object') { + abcjsFn(); + } else { + getScript('!{url_for(theme.asset.abcjs_basic_js)}') + .then(() => { + abcjsFn(); + }); + } + } + + document.addEventListener('DOMContentLoaded', abcjsInit); \ No newline at end of file diff --git a/plugins.yml b/plugins.yml index b672299..2e25388 100644 --- a/plugins.yml +++ b/plugins.yml @@ -208,3 +208,8 @@ docsearch_css: other_name: docsearch-css file: dist/style.css version: 3.3.3 +abcjs_basic_js: + name: abcjs + other_name: abcjs-basic + file: dist/abcjs-basic-min.js + version: 6.1.9 \ No newline at end of file diff --git a/scripts/tag/score.js b/scripts/tag/score.js new file mode 100644 index 0000000..3157245 --- /dev/null +++ b/scripts/tag/score.js @@ -0,0 +1,22 @@ +/** + * Music Score + * {% score %} + */ + +'use strict'; + +function score(args, content) { + function escapeHtmlTags(s) { + let lookup = { + '&': "&", + '"': """, + '\'': "'", + '<': "<", + '>': ">" + }; + return s.replace(/[&"'<>]/g, c => lookup[c]); + } + return `
${escapeHtmlTags(content)}
`; +} + +hexo.extend.tag.register('score', score, {ends: true}); From 247e62a41871691a4a08d9ef401dea5e8663c904 Mon Sep 17 00:00:00 2001 From: LittleNyima Date: Thu, 30 Mar 2023 10:16:23 +0800 Subject: [PATCH 2/9] resolve conflicts with dev branch --- layout/includes/additional-js.pug | 2 ++ 1 file changed, 2 insertions(+) diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 60646ae..a149f37 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -60,6 +60,8 @@ div if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv script(async data-pjax src= theme.asset.busuanzi || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js') + !=partial('includes/third-party/search/index', {}, {cache: true}) + if theme.abcjs.enable if theme.abcjs.per_page if is_post() || is_page() From 841fbb0c5ed261653214ba6846dcff4d8dcb46ee Mon Sep 17 00:00:00 2001 From: JamesYao <754433989@qq.com> Date: Thu, 30 Mar 2023 17:11:59 +0800 Subject: [PATCH 3/9] Add social config style --- _config.yml | 6 +++--- layout/includes/header/social.pug | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_config.yml b/_config.yml index 72373bc..4012ed3 100644 --- a/_config.yml +++ b/_config.yml @@ -38,10 +38,10 @@ copy: # social settings (社交圖標設置) # formal: -# icon: link || the description +# icon: link || the description || style social: - # fab fa-github: https://github.com/xxxxx || Github - # fas fa-envelope: mailto:xxxxxx@gmail.com || Email + # fab fa-github: https://github.com/xxxxx || Github || color:#24292e + # fas fa-envelope: mailto:xxxxxx@gmail.com || Email || color:#4a7dbe # search (搜索) # see https://butterfly.js.org/posts/ceeb73f/#搜索系統 diff --git a/layout/includes/header/social.pug b/layout/includes/header/social.pug index 80adfe9..047aa73 100644 --- a/layout/includes/header/social.pug +++ b/layout/includes/header/social.pug @@ -1,4 +1,4 @@ each url, icon in theme.social a.social-icon(href=url_for(trim(url.split('||')[0])) target="_blank" title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1])) - i(class=icon) \ No newline at end of file + i(class=icon style=url_for(trim(url.split('||')[2]) === undefined ? '' : trim(url.split('||')[2]))) \ No newline at end of file From 93f7461d2815a03f5e6c8d539c04fa159ef51fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E7=AB=B9?= Date: Mon, 3 Apr 2023 10:43:55 +0800 Subject: [PATCH 4/9] =?UTF-8?q?chore:=20=E5=AE=BD=E5=B1=8F=201500px=20?= =?UTF-8?q?=E6=9C=89=E4=BA=9B=E6=B5=AA=E8=B4=B9=E7=A9=BA=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B0=201700px?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/css/_page/common.styl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/css/_page/common.styl b/source/css/_page/common.styl index 3356d17..0be8e49 100644 --- a/source/css/_page/common.styl +++ b/source/css/_page/common.styl @@ -18,7 +18,7 @@ padding: 20px 5px +minWidth2000() - max-width: 1500px + max-width: 1700px & > div:first-child:not(.recent-posts) @extend .cardHover From f4d06877506773f8b58f70cf183f98ba181ac9fe Mon Sep 17 00:00:00 2001 From: LittleNyima Date: Mon, 3 Apr 2023 16:23:02 +0800 Subject: [PATCH 5/9] minor adjustments --- _config.yml | 14 +++++++------- layout/includes/additional-js.pug | 4 +--- plugins.yml | 1 - 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/_config.yml b/_config.yml index 2a59a95..a2b84a9 100644 --- a/_config.yml +++ b/_config.yml @@ -783,6 +783,13 @@ fancybox: true # Tag Plugins settings (標籤外掛) # -------------------------------------- +# abcjs (樂譜渲染) +# See https://github.com/paulrosen/abcjs +# --------------- +abcjs: + enable: false + per_page: false + # mermaid # see https://github.com/mermaid-js/mermaid mermaid: @@ -862,13 +869,6 @@ lazyload: # favicon_16_16: /pwa/16.png # mask_icon: /pwa/safari-pinned-tab.svg -# abcjs (樂譜渲染) -# See https://github.com/paulrosen/abcjs -# --------------- -abcjs: - enable: false - per_page: false - # Open graph meta tags # https://developers.facebook.com/docs/sharing/webmasters/ Open_Graph_meta: diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index a149f37..5e46f18 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -62,11 +62,9 @@ div !=partial('includes/third-party/search/index', {}, {cache: true}) - if theme.abcjs.enable + if theme.abcjs && theme.abcjs.enable if theme.abcjs.per_page if is_post() || is_page() - script(src=url_for(theme.asset.abcjs_basic_js)) include ./third-party/abcjs.pug else if page.abcjs - script(src=url_for(theme.asset.abcjs_basic_js)) include ./third-party/abcjs.pug diff --git a/plugins.yml b/plugins.yml index 2e25388..4e0d749 100644 --- a/plugins.yml +++ b/plugins.yml @@ -210,6 +210,5 @@ docsearch_css: version: 3.3.3 abcjs_basic_js: name: abcjs - other_name: abcjs-basic file: dist/abcjs-basic-min.js version: 6.1.9 \ No newline at end of file From 4c9395666d916454ecf9c23f5cca72bf4781d7a3 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 3 Apr 2023 18:51:42 +0800 Subject: [PATCH 6/9] update --- _config.yml | 3 ++- layout/includes/additional-js.pug | 11 +++-------- layout/includes/third-party/abcjs.pug | 18 ------------------ layout/includes/third-party/abcjs/abcjs.pug | 15 +++++++++++++++ layout/includes/third-party/abcjs/index.pug | 6 ++++++ source/css/_layout/third-party.styl | 10 +++++++++- 6 files changed, 35 insertions(+), 28 deletions(-) delete mode 100644 layout/includes/third-party/abcjs.pug create mode 100644 layout/includes/third-party/abcjs/abcjs.pug create mode 100644 layout/includes/third-party/abcjs/index.pug diff --git a/_config.yml b/_config.yml index a2b84a9..fd637a6 100644 --- a/_config.yml +++ b/_config.yml @@ -788,7 +788,7 @@ fancybox: true # --------------- abcjs: enable: false - per_page: false + per_page: true # mermaid # see https://github.com/mermaid-js/mermaid @@ -970,3 +970,4 @@ CDN: # artalk_js: # artalk_css: # busuanzi: + # abcjs_basic_js: diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 5e46f18..f37d860 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -31,6 +31,8 @@ div include ./third-party/math/index.pug + include ./third-party/abcjs/index.pug + if commentsJsLoad include ./third-party/comments/js.pug @@ -60,11 +62,4 @@ div if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv script(async data-pjax src= theme.asset.busuanzi || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js') - !=partial('includes/third-party/search/index', {}, {cache: true}) - - if theme.abcjs && theme.abcjs.enable - if theme.abcjs.per_page - if is_post() || is_page() - include ./third-party/abcjs.pug - else if page.abcjs - include ./third-party/abcjs.pug + !=partial('includes/third-party/search/index', {}, {cache: true}) \ No newline at end of file diff --git a/layout/includes/third-party/abcjs.pug b/layout/includes/third-party/abcjs.pug deleted file mode 100644 index c8a1c06..0000000 --- a/layout/includes/third-party/abcjs.pug +++ /dev/null @@ -1,18 +0,0 @@ -script. - function abcjsInit() { - function abcjsFn() { - for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) { - ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'}); - } - } - if (typeof ABCJS === 'object') { - abcjsFn(); - } else { - getScript('!{url_for(theme.asset.abcjs_basic_js)}') - .then(() => { - abcjsFn(); - }); - } - } - - document.addEventListener('DOMContentLoaded', abcjsInit); \ No newline at end of file diff --git a/layout/includes/third-party/abcjs/abcjs.pug b/layout/includes/third-party/abcjs/abcjs.pug new file mode 100644 index 0000000..dc02aea --- /dev/null +++ b/layout/includes/third-party/abcjs/abcjs.pug @@ -0,0 +1,15 @@ +script. + (() => { + function abcjsInit() { + function abcjsFn() { + for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) { + ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'}) + } + } + + typeof ABCJS === 'object' ? abcjsFn() + : getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn) + } + + window.pjax ? abcjsInit() : document.addEventListener('DOMContentLoaded', abcjsInit) + })() \ No newline at end of file diff --git a/layout/includes/third-party/abcjs/index.pug b/layout/includes/third-party/abcjs/index.pug new file mode 100644 index 0000000..12d1478 --- /dev/null +++ b/layout/includes/third-party/abcjs/index.pug @@ -0,0 +1,6 @@ +if theme.abcjs.enable + if theme.abcjs.per_page + if is_post() || is_page() + include ./abcjs.pug + else if page.abcjs + include ./abcjs.pug diff --git a/source/css/_layout/third-party.styl b/source/css/_layout/third-party.styl index bc2bd51..2c8503c 100644 --- a/source/css/_layout/third-party.styl +++ b/source/css/_layout/third-party.styl @@ -113,4 +113,12 @@ span.mathjax-overflow content: none .snackbar-css - border-radius: 5px !important \ No newline at end of file + border-radius: 5px !important + +.abc-music-sheet + margin: 0 0 20px + opacity: 0 + transition: opacity .3s + + &.abcjs-container + opacity: 1 \ No newline at end of file From 47214b5a7c7281243f024716d3aae328562ab8b6 Mon Sep 17 00:00:00 2001 From: JamesYao <754433989@qq.com> Date: Tue, 4 Apr 2023 15:37:55 +0800 Subject: [PATCH 7/9] feat: add social icon color config --- _config.yml | 6 +++--- layout/includes/header/social.pug | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_config.yml b/_config.yml index 4012ed3..a76bf97 100644 --- a/_config.yml +++ b/_config.yml @@ -38,10 +38,10 @@ copy: # social settings (社交圖標設置) # formal: -# icon: link || the description || style +# icon: link || the description || color social: - # fab fa-github: https://github.com/xxxxx || Github || color:#24292e - # fas fa-envelope: mailto:xxxxxx@gmail.com || Email || color:#4a7dbe + fab fa-github: https://github.com/xxxxx || Github || '#24292e' + fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe' # search (搜索) # see https://butterfly.js.org/posts/ceeb73f/#搜索系統 diff --git a/layout/includes/header/social.pug b/layout/includes/header/social.pug index 047aa73..b7b586e 100644 --- a/layout/includes/header/social.pug +++ b/layout/includes/header/social.pug @@ -1,4 +1,4 @@ each url, icon in theme.social a.social-icon(href=url_for(trim(url.split('||')[0])) target="_blank" title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1])) - i(class=icon style=url_for(trim(url.split('||')[2]) === undefined ? '' : trim(url.split('||')[2]))) \ No newline at end of file + i(class=icon style=url.split('||')[2] === undefined ? '' : `color: ${trim(url.split('||')[2]).replace(/[\'\"]/g, '')};`) \ No newline at end of file From 1e24c62f703a726990d2a0a3ee3400c832fa6af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E7=AB=B9?= Date: Tue, 4 Apr 2023 18:38:55 +0800 Subject: [PATCH 8/9] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=20viewport=20se?= =?UTF-8?q?o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.omiod.com/meta-seo-inspector/meta-info.php?meta=viewport&utm_source=MSI_app&utm_medium=info_link&utm_term=viewport --- layout/includes/head.pug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 5748040..4d30c4a 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -15,7 +15,7 @@ meta(charset='UTF-8') meta(http-equiv="X-UA-Compatible" content="IE=edge") -meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,viewport-fit=cover") +meta(name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover") title= tabTitle meta(name="author" content=pageAuthor) meta(name="copyright" content=pageCopyright) @@ -66,4 +66,4 @@ include ./head/noscript.pug !=fragment_cache('injectHeadJs', function(){return inject_head_js()}) -!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) \ No newline at end of file +!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) From 49b6c7436cfee64637a8d1f8802f30bea88e8d89 Mon Sep 17 00:00:00 2001 From: Jerry Wong Date: Sat, 8 Apr 2023 15:10:56 +0800 Subject: [PATCH 9/9] Update _config.yml --- _config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index f15f55c..57d523a 100644 --- a/_config.yml +++ b/_config.yml @@ -40,8 +40,8 @@ copy: # formal: # icon: link || the description || color social: - fab fa-github: https://github.com/xxxxx || Github || '#24292e' - fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe' + # fab fa-github: https://github.com/xxxxx || Github || '#24292e' + # fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe' # search (搜索) # see https://butterfly.js.org/posts/ceeb73f/#搜索系統