diff --git a/App/App.json b/App/App.json index a897c2b..44ad05f 100644 --- a/App/App.json +++ b/App/App.json @@ -1,4 +1,4 @@ { - "currentProgramVersion": 20220604, + "currentProgramVersion": 20220611, "AppName": "Baiyang-lzy's Blog Generator" } \ No newline at end of file diff --git a/App/blog_source/data/index.english.json b/App/blog_source/data/index.english.json index 5f169ab..dc787ef 100644 --- a/App/blog_source/data/index.english.json +++ b/App/blog_source/data/index.english.json @@ -102,5 +102,8 @@ "自定义JS": "", "文章列表中每页的文章数为": 10, "全站内容授权协议": "reserved", - "不使用全站内容授权协议": false + "不使用全站内容授权协议": false, + "文章页面显示上一篇下一篇文章导航按钮": true, + "提供文章文件下载": false, + "提供复制全文到剪贴板的选项": false } \ No newline at end of file diff --git a/App/blog_source/data/index.zhcn.json b/App/blog_source/data/index.zhcn.json index a647bd2..e8e5e2f 100644 --- a/App/blog_source/data/index.zhcn.json +++ b/App/blog_source/data/index.zhcn.json @@ -102,5 +102,8 @@ "自定义JS": "", "文章列表中每页的文章数为": 10, "全站内容授权协议": "reserved", - "不使用全站内容授权协议": false + "不使用全站内容授权协议": false, + "文章页面显示上一篇下一篇文章导航按钮": true, + "提供文章文件下载": false, + "提供复制全文到剪贴板的选项": false } \ No newline at end of file diff --git a/App/blog_source/index.html b/App/blog_source/index.html index 0cc3968..df69b8f 100644 --- a/App/blog_source/index.html +++ b/App/blog_source/index.html @@ -30,6 +30,14 @@ border-radius: 12px; } + .articlebottomnav{ + background-color: white; + box-shadow: 0 1px 1px -2px rgb(0 0 0 / 20%), + 0 2px 2px 0 rgb(0 0 0 / 36%), 0 1px 5px 0 rgb(0 0 0 / 32%); + opacity: 0.8; + border-radius: 12px; + } + .nav-item-active { border-bottom: 2px solid white; } @@ -568,6 +576,11 @@ } } + function copy_full_article_to_clipboard(){ + navigator.clipboard.writeText(document.querySelector("#article-content-html").innerText); + document.getElementById("copy_to_clipboard_button").innerHTML=` 已复制!`; + } + bootstrap_css_import_finished = false; content_load_finished = false; @@ -876,8 +889,32 @@

${blog["文章列表"][article_id]["文章标题"]}

Date.parse(new Date()) ) .then(function (response) { - document.querySelector("#article-content").innerHTML += - marked.parse(response.data); + document.querySelector("#article-content").innerHTML +=` +
${marked.parse(response.data)}
`; + + if(blog["提供文章文件下载"] || blog["提供复制全文到剪贴板的选项"]){ + document.getElementById("article-content").innerHTML+=` +
+
+ +

+ ` + } + + + + if(blog["提供文章文件下载"]){ + document.getElementById("article-bottom-bar").innerHTML+=` + 将该文章下载到你的计算机上 + `; + } + + if(blog["提供复制全文到剪贴板的选项"]){ + document.getElementById("article-bottom-bar").innerHTML+=` + 复制全文到剪贴板 + `; + } + if (blog["不使用全站内容授权协议"] === false) { document.querySelector( "#article-content" @@ -890,7 +927,108 @@
版权声明
`; } + if(blog["文章页面显示上一篇下一篇文章导航按钮"]){ + + + if(article_id === 0 && blog["文章列表"][article_id+1] != undefined && blog["文章列表"][article_id+1]["是否隐藏"] !== true){ + document.getElementById("container").innerHTML += ` +
+
+ +
+
+
+
+
下一篇文章
+
没有了
+
+
+
+
+ + ` + } + + if(article_id === 0 && blog["文章列表"][article_id+1] == undefined){ + document.getElementById("container").innerHTML += ` +
+
+
+
+
上一篇文章
+
没有了
+
+
+
+
+
+
+
下一篇文章
+
没有了
+
+
+
+
+ + ` + } + + if(article_id !== 0 && blog["文章列表"][article_id+1] == undefined && blog["文章列表"][article_id-1]["是否隐藏"] !== true){ + document.getElementById("container").innerHTML += ` +
+
+
+
+
上一篇文章
+
没有了
+
+
+
+
+ +
+
+ + ` + } + + if(article_id !== 0 && blog["文章列表"][article_id+1] != undefined && blog["文章列表"][article_id+1]["是否隐藏"] !== true && blog["文章列表"][article_id-1]["是否隐藏"] !== true){ + document.getElementById("container").innerHTML += ` +
+
+ +
+
+ +
+
+ + ` + } + + } + if ( diff --git a/App/check_migrate.js b/App/check_migrate.js index b9f700b..f1016af 100644 --- a/App/check_migrate.js +++ b/App/check_migrate.js @@ -93,6 +93,12 @@ function addSupportForContentLicense() { blog["不使用全站内容授权协议"] = false; } +function addSupportForArticleBottomExternalOptions(){ + blog["文章页面显示上一篇下一篇文章导航按钮"] = true; + blog["提供文章文件下载"] = false; + blog["提供复制全文到剪贴板的选项"] = false; +} + module.exports = function () { let currentBlogVersion = parseInt( blog["博客程序版本(禁止修改此值,否则会导致跨版本升级异常)"], @@ -128,7 +134,6 @@ module.exports = function () { if (currentBlogVersion <= 20210812) { thirdPartyThemeReset(); - updateBlogIndexHtml(); cleanStaticRes(); addSupportForPublicCommentService(); addSupportOfMultiLanguage(); @@ -138,11 +143,11 @@ module.exports = function () { addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion <= 20210817 && currentBlogVersion >= 20210813) { thirdPartyThemeReset(); - updateBlogIndexHtml(); cleanStaticRes(); addSupportForPublicCommentService(); @@ -153,6 +158,7 @@ module.exports = function () { addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if ( @@ -163,7 +169,6 @@ module.exports = function () { currentBlogVersion === 20210828 ) { thirdPartyThemeReset(); - updateBlogIndexHtml(); addSupportForPublicCommentService(); addSupportOfMultiLanguage(); addSupportForAnnouncementBoard(); @@ -172,11 +177,11 @@ module.exports = function () { addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20210925) { thirdPartyThemeReset(); - updateBlogIndexHtml(); addSupportOfMultiLanguage(); addSupportForAnnouncementBoard(); addSupportOfFriendBook(); @@ -184,11 +189,11 @@ module.exports = function () { addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20211002 || currentBlogVersion === 20211003 || currentBlogVersion === 20211016 || currentBlogVersion === 20211022 || currentBlogVersion === 20211106) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportOfMultiLanguage(); addSupportForAnnouncementBoard(); addSupportOfFriendBook(); @@ -196,11 +201,11 @@ module.exports = function () { addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20211205) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportOfMultiLanguage(); addSupportForAnnouncementBoard(); addSupportOfFriendBook(); @@ -208,66 +213,67 @@ module.exports = function () { addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220119) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportForAnnouncementBoard(); addSupportOfFriendBook(); addSupportForCDNSetting(); addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220123) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportOfFriendBook(); addSupportForCDNSetting(); addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220202) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportForCDNSetting(); addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220210) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportForCustomCJ(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220211 || currentBlogVersion === 20220212) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220213) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportOfArticlePageOrder(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } if (currentBlogVersion === 20220304) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); addSupportForContentLicense(); + addSupportForArticleBottomExternalOptions(); } - if (currentBlogVersion === 20220314 || currentBlogVersion === 20220315 || currentBlogVersion === 20220427 || currentBlogVersion === 20220507 || currentBlogVersion === 20220514 || currentBlogVersion === 20220515) { + if (currentBlogVersion >= 20220314 && currentBlogVersion <= 20220604) { check_third_party_theme_compatiblity(); - updateBlogIndexHtml(); + addSupportForArticleBottomExternalOptions(); } check_third_party_theme_compatiblity(); diff --git a/App/render_article_manager.js b/App/render_article_manager.js index 0ae847b..f0e8a07 100644 --- a/App/render_article_manager.js +++ b/App/render_article_manager.js @@ -62,8 +62,8 @@ module.exports = function () {

- - + + `; } diff --git a/App/render_blog_settings.js b/App/render_blog_settings.js index a33b774..f72c637 100644 --- a/App/render_blog_settings.js +++ b/App/render_blog_settings.js @@ -72,6 +72,18 @@ module.exports = function () { document.getElementById("blog_settings_enable_custom_js").checked = true; } + if (blog["文章页面显示上一篇下一篇文章导航按钮"] === true) { + document.getElementById("enable_article_bottom_nav").checked = true; + } + + if (blog["提供文章文件下载"] === true) { + document.getElementById("enable_article_file_download").checked = true; + } + + if (blog["提供复制全文到剪贴板的选项"] === true) { + document.getElementById("enable_copy_full_article_to_clipboard").checked = true; + } + if (blog["CDN选择"] === 1) { // 从列表中选择cdn地址 document.getElementById("cdn_cho_1").checked = true; diff --git a/App/save_blog_settings.js b/App/save_blog_settings.js index 7a453a8..109caee 100644 --- a/App/save_blog_settings.js +++ b/App/save_blog_settings.js @@ -29,6 +29,11 @@ module.exports = function () { let blog_settings_content_license = document.getElementById("blog_settings_content_license").value; let blog_content_license_enabled = document.getElementById("blog_content_license_enabled").checked; + let enable_article_bottom_nav = document.getElementById("enable_article_bottom_nav").checked; + let enable_article_file_download = document.getElementById("enable_article_file_download").checked; + let enable_copy_full_article_to_clipboard = document.getElementById("enable_copy_full_article_to_clipboard").checked; + + if (document.getElementById("cdn_cho_1").checked === true) { blog_settings_cdn_path = document.getElementById("blog_setting_cdn_frm_1").value; blog_settings_cdn_mode = 1; @@ -44,6 +49,9 @@ module.exports = function () { blog["文章列表中每页的文章数为"] = blog_settings_howmany_article_in_a_page; blog["全站内容授权协议"] = blog_settings_content_license; blog["不使用全站内容授权协议"] = blog_content_license_enabled; + blog["文章页面显示上一篇下一篇文章导航按钮"] = enable_article_bottom_nav; + blog["提供文章文件下载"] = enable_article_file_download; + blog["提供复制全文到剪贴板的选项"] = enable_copy_full_article_to_clipboard; blog["底部信息(格式为markdown)"] = blog_settings_bottom_information; diff --git a/App/ui/blog_settings_ui.html b/App/ui/blog_settings_ui.html index 91d7f78..7e0723e 100644 --- a/App/ui/blog_settings_ui.html +++ b/App/ui/blog_settings_ui.html @@ -109,6 +109,39 @@

+
+ + +
+ +
+ + +
+ +
+ + +
+
diff --git a/App/ui/edit_article_meta_dialog_footer_ui.html b/App/ui/edit_article_meta_dialog_footer_ui.html index d5dc8e1..bd49387 100644 --- a/App/ui/edit_article_meta_dialog_footer_ui.html +++ b/App/ui/edit_article_meta_dialog_footer_ui.html @@ -1,2 +1,10 @@ - - + + diff --git a/package.json b/package.json index 1fc22cd..a810be4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbg", - "version": "20220604.0.0", + "version": "20220611.0.0", "description": "A static blog generator based on Electron Technology.", "main": "main.js", "scripts": {