diff --git a/_config.yml b/_config.yml index 75a7fba..7d13217 100644 --- a/_config.yml +++ b/_config.yml @@ -121,7 +121,6 @@ cdn: css: fontawesome: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css # fontawesomeV5: https://use.fontawesome.com/releases/v5.8.1/css/all.css - googlefont: https://fonts.googleapis.com/css?family=Titillium+Web fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css js: jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js @@ -241,7 +240,7 @@ valine: verify: false # valine verify code (true/false) pageSize: 10 # comment list page size avatar: monsterid # gravatar style https://valine.js.org/#/avatar - lang: en # i18n: zh-cn/en/tw + lang: en # i18n: zh-cn/en placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints ) guest_info: nick,mail,link #valine comment header inf @@ -329,7 +328,7 @@ related_post: # canvas_ribbon # See: https://github.com/hustcc/ribbon.js canvas_ribbon: - enable: false + enable: true size: 150 alpha: 0.6 zIndex: -1 @@ -337,7 +336,7 @@ canvas_ribbon: canvas_ribbon_piao: - enable: true + enable: false # 避免重複網址分散seo @@ -353,11 +352,18 @@ Open_Graph_meta: true readmode: enable: true +#全局字體 font: enable: false font-family: Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB,"Microsoft JhengHei", "MicrMicrosoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif code-font: consolas, Menlo, "PingFang SC", "Microsoft JhengHei","Microsoft YaHei", monospace, Helvetica Neue For Number +#網站名字字體 +#左上角網站名字 主頁居中網站名字 +blog_title_font: + #字體鏈接 + font_link: https://fonts.googleapis.com/css?family=Titillium+Web + font-family: Titillium Web, PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif #水平分隔綫 hr: @@ -387,13 +393,13 @@ aside: translate: enable: true # 默認按鈕顯示文字 - default: 簡 + default: 繁 #网站默认语言,1: 繁體中文, 2: 简体中文 - defaultEncoding: 1 + defaultEncoding: 2 #延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0 translateDelay: 0 #博客网址 - cookieDomain: "https://jerryc.me/" + cookieDomain: "https://xxx/" #當文字是簡體時,按鈕顯示的文字 msgToTraditionalChinese: "繁" #當文字是繁體時,按鈕顯示的文字 @@ -406,4 +412,9 @@ fireworks: #百度推送 baidu_push: - enable: false \ No newline at end of file + enable: false + +#https://instant.page/ +#prefetch預加載 +instantpage: + enable: true \ No newline at end of file diff --git a/layout/flink.pug b/layout/flink.pug index 6b4eb1a..4b39f62 100644 --- a/layout/flink.pug +++ b/layout/flink.pug @@ -6,7 +6,7 @@ each item in i.link_list li.md-links-item a(href=item.link title=item.name target="_blank") - img.lozad(data-src=item.avatar alt=item.name onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px") + img.lozad(data-src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px") div(class="md-links-title")= item.name
div(class="md-links-des")=item.descr diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 41814f5..a9020e2 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -87,5 +87,6 @@ if is_home() if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv script(async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js") - -script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module") + +if theme.instantpage.enable + script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module") diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 38cc963..e732157 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -113,3 +113,6 @@ if (is_archive() && preload_archive_img) link(rel="preload" href=url_for(preload_archive_img) as="image" ) else if (!is_post() && preload_img) link(rel="preload" href=url_for(preload_img) as="image" ) + +if theme.blog_title_font.font_link + link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link)) \ No newline at end of file diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index 12a0ce6..765e99d 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -7,12 +7,15 @@ - if (is_year()) pageTitle += ': ' + page.year - var pageTitle_saved //- 暫時存儲pageTitle - var pageTitle_no_include_blog_name //- 存儲pageTitle, 不帶 " | ",meta用 +- var home_subtitle_true //有subtitle //- home時顯示config.title (JerryC),其他顯示 pageTitle。meta用 - is_home() ? pageTitle_no_include_blog_name = config.title : pageTitle_no_include_blog_name = pageTitle //- 暫時存儲pageTitle - pageTitle ? pageTitle_saved = pageTitle + ' | ' + config.title : pageTitle_saved = config.title +//- 是否有 config.subtitle 是各自显示 +- config.subtitle ? home_subtitle_true = ' - ' + config.subtitle : home_subtitle_true = '' //- home時pageTitle顯示 JerryC - subtitle,其他顯示 pageTitle | JerryC -- is_home() ? pageTitle = config.title + ' - ' + config.subtitle : pageTitle = pageTitle_saved +- is_home() ? pageTitle = config.title + home_subtitle_true : pageTitle = pageTitle_saved - var pageDescription = page.description || page.title || config.description || '' - var pageKeywords = (config.keywords || []).join(',') diff --git a/layout/includes/pagination.pug b/layout/includes/pagination.pug index 2edf7bf..bfd5628 100644 --- a/layout/includes/pagination.pug +++ b/layout/includes/pagination.pug @@ -14,21 +14,19 @@ else if(page.prev) if(page.next) .prev-post.pull-left - - var pagination_cover = page.prev.cover || theme.default_cover + - var pagination_cover = page.prev.cover || random_cover() a(href=url_for(page.prev.path)) img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` ) .label=_p('pagination.prev') .prev_info - //- i.fa.fa-chevron-left span=page.prev.title else .prev-post.pull-full - - var pagination_cover = page.prev.cover || theme.default_cover + - var pagination_cover = page.prev.cover || random_cover() a(href=url_for(page.prev.path)) img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) .label=_p('pagination.prev') .prev_info - //- i.fa.fa-chevron-left span=page.prev.title @@ -36,21 +34,18 @@ else if(page.next) if(page.prev) .next-post.pull-right - - var pagination_cover = page.next.cover || theme.default_cover + - var pagination_cover = page.next.cover || random_cover() a(href=url_for(page.next.path)) img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) .label=_p('pagination.next') .next_info span=page.next.title - //- i.fa.fa-chevron-right else .next-post.pull-full - - var pagination_cover = page.next.cover || theme.default_cover + - var pagination_cover = page.next.cover || random_cover() a(href=url_for(page.next.path)) img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) .label=_p('pagination.next') .next_info - span=page.next.title - //- i.fa.fa-chevron-right - + span=page.next.title diff --git a/layout/page.pug b/layout/page.pug index dce18ca..0700295 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -6,7 +6,7 @@ block content .tag-cloud__title= _p('page.tag') | - span.tag-cloud__amount= site.tags.length - .tag-cloud-tags!= tagcloud({min_font: 20, max_font: 43, amount: 200, color: true, start_color: '#A4D8FA', end_color: '#0790E8'}) + .tag-cloud-tags!= tags(site.tags) if page.comments !== false include includes/comments/index.pug #aside_content.aside_content diff --git a/scripts/tags.js b/scripts/tags.js new file mode 100644 index 0000000..a9d24be --- /dev/null +++ b/scripts/tags.js @@ -0,0 +1,16 @@ +hexo.extend.helper.register('tags', function (site_tags) { + var result = ""; + site_tags.sort('path').each(function (tags) { + var fontSize = Math.floor(Math.random() * 15 + 15) + "px"; //15 ~ 30 + var color = + "rgb(" + + Math.floor(Math.random() * 201) + + ", " + + Math.floor(Math.random() * 201) + + ", " + + Math.floor(Math.random() * 201) + + ")"; // 0,0,0 -> 200,200,200 + result += '' + tags.name + '' + }) + return result; +}) diff --git a/source/css/_global/index.styl b/source/css/_global/index.styl index 164171c..4ca4b46 100644 --- a/source/css/_global/index.styl +++ b/source/css/_global/index.styl @@ -206,7 +206,7 @@ table #site-name, #aside_content .author-info__name, #aside_content .author-info__description - font-family: 'Titillium Web',Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif + font-family: $site-name-font diff --git a/source/css/var.styl b/source/css/var.styl index 156cce1..3b33688 100644 --- a/source/css/var.styl +++ b/source/css/var.styl @@ -9,6 +9,7 @@ $theme-hr-color = #A4D8FA $theme-read-mode-bg-color = #FAF9DE $font-family= Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif $code-font = consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number +$site-name-font = "Titillium Web", Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif //hr icon $hr-icon = '\f0c4' $hr-icon-top = -10px @@ -27,6 +28,10 @@ if hexo-config("font") && hexo-config("font.enable") $font-family = convert(hexo-config("font.font-family")) || 'Lato, Helvetica Neue For Number, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, PingFang SC, Hiragino Sans GB, "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif' $code-font = convert(hexo-config("font.code-font")) || 'consolas, Menlo, "PingFang SC", "Microsoft YaHei", monospace, Helvetica Neue For Number' +if hexo-config("blog_title_font.font-family") + $site-name-font = convert(hexo-config("blog_title_font.font-family")) || '"Titillium Web",Lato,PingFang SC, Hiragino Sans GB, "Microsoft JhengHei", "Microsoft YaHei", Helvetica Neue, Helvetica, Arial, sans-serif' + + if hexo-config("hr") && hexo-config("hr.enable") $hr-icon = hexo-config("hr.icon") || '\f0c4' $hr-icon-top = convert(hexo-config("hr.icon-top")) || -10px @@ -38,6 +43,7 @@ $font-color = #1F2D3D $rem = 20px $font-family = $font-family $code-font = $code-font +$site-name-font = $site-name-font $text-line-height = 2 $sm = 768px $bg = 1024px diff --git a/source/js/main.js b/source/js/main.js index 097a11c..9dc9c14 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -94,37 +94,6 @@ $(function () { }); - //-------------------------------------------------------------------------------------------------------- - // tags 隨機大小 顔色 - var list = document.querySelectorAll(".tag-cloud .tag-cloud-tags a"); - - if ($(window).width() > 768) { - Array.prototype.forEach.call(list, (item, index) => { - item.style.fontSize = Math.floor(Math.random() * 20 + 15) + "px"; //15 ~ 35 - item.style.color = - "rgb(" + - Math.floor(Math.random() * 201) + - ", " + - Math.floor(Math.random() * 201) + - ", " + - Math.floor(Math.random() * 201) + - ")"; // 0,0,0 -> 200,200,200 - }); - } else { - Array.prototype.forEach.call(list, (item, index) => { - item.style.fontSize = Math.floor(Math.random() * 13 + 15) + "px"; //15 ~ 28 - item.style.color = - "rgb(" + - Math.floor(Math.random() * 201) + - ", " + - Math.floor(Math.random() * 201) + - ", " + - Math.floor(Math.random() * 201) + - ")"; // 0,0,0 -> 200,200,200 - }); - } - - //-------------------------------------------------------------------------------------------------------- // bookmark $.fancyConfirm = function (opts) {