Skip to content

Commit

Permalink
Beta 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
DellZHackintosh committed Jul 31, 2023
1 parent 52b9c9c commit ef70a79
Show file tree
Hide file tree
Showing 11 changed files with 842 additions and 112 deletions.
84 changes: 61 additions & 23 deletions Bloggie/Core/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ var bloggie = (function () {
}
}

if (!localStorage.getItem("bloggie-base")) {
base = JSON.parse(get('./Bloggie/Core/base.json'));
localStorage.setItem("bloggie-base", JSON.stringify(base));
} else {
base = JSON.parse(localStorage.getItem("bloggie-base"));
}
base = bloggie_init;
delete window.bloggie_init;

window.onerror = function (message, source, lineno, colno, error) {
Err('Message:' + message + '\nSource:' + source + '\nLineno:' + lineno + '\nColno:' + colno + '\nError:' + error);
Expand All @@ -69,7 +65,6 @@ var bloggie = (function () {
var html = document.documentElement;
html.lang = base.lang || 'en-US';
html.dir = base.dir || 'ltr';
swloader();
if (jslist.loading) {
var scripts = Object.keys(jslist.loading).length;
for (var n = 1; n <= scripts; n++) {
Expand Down Expand Up @@ -246,14 +241,69 @@ var bloggie = (function () {
document.getElementById('bloggie-main').appendChild(aie);
};

function loadlist() {
function loadlist(filter = bloggie.custom.listfilter, rest = bloggie.custom.listfilter_rest) {
document.getElementById('bloggie-main').innerHTML = '';
var div = document.createElement('div');
div.id = 'bloggie-list';
var art = Object.keys(articlelist);
var lc = JSON.parse(JSON.stringify(articlelist));
var art = Object.keys(lc);
var n = art.length;
while (n--) {
div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
if (typeof(filter) === 'string') {
while (n--) {
if (articlelist[n + 1][filter]) {
lc[n + 1].used = true;
div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
if (rest) {
n = art.length;
while (n--) {
if (!lc[n + 1].used) div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
} else if (typeof(filter) === 'function') {
while (n--) {
if (filter(articlelist[n + 1])) {
lc[n + 1].used = true;
div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
if (rest) {
n = art.length;
while (n--) {
if (!lc[n + 1].used) div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
} else if (Array.isArray(filter)) {
filter.forEach((checker, index) => {
var n = art.length;
if (typeof(checker) === 'string') {
while (n--) {
if (articlelist[n + 1][checker]) {
lc[n + 1].used = true;
div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
} else if (typeof(checker) === 'function') {
while (n--) {
if (checker(articlelist[n + 1])) {
lc[n + 1].used = true;
div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
} else console.warn(`传入的数组中第${index}个元素的格式不受支持,已自动忽略。`);
if (rest) {
n = art.length;
while (n--) {
if (!lc[n + 1].used) div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
});
} else {
if (filter) console.warn(`传入的参数格式不受支持,已自动回退到默认处理。`);
while (n--) {
div.appendChild((bloggie.custom.command.listmaker || listmaker)(articlelist[n + 1], art[n]));
}
}
document.getElementById('bloggie-main').appendChild(div);
}
Expand All @@ -265,18 +315,6 @@ var bloggie = (function () {
return div;
}

async function swloader() {
if (navigator.serviceWorker && base.sw.Supported) {
try {
await navigator.serviceWorker.register(base.sw.path, base.sw.options);
await navigator.serviceWorker.ready;
}
catch (e) {
Err(e);
}
}
}

return bloggie;

}());
199 changes: 199 additions & 0 deletions Bloggie/Core/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
'use strict';
window.bloggie_init = {
"name": "DaleZ 的 Blog",
"lang": "zh-CN",
"dir": "ltr",
"jslist": {
"loading": {
"1": {
"path": "./Bloggie/js/init-helper.js",
"options": null
},
"2": {
"path": "./Bloggie/js/PWAify.js",
"options": null
},
"3": {
"path": "./Bloggie/js/CSS.js",
"options": null
},
"4": {
"path": "./Bloggie/js/customloading.js",
"options": null
}
},
"loaded": {
"1": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/marked/5.0.2/marked.min.js?ServiceWorker=cachefirst",
"options": {
"crossorigin": "anonymous"
},
"JoinWaitlist": true
},
"2": {
"path": "./Bloggie/js/HighLight/highlight.min.js?ServiceWorker=cachefirst",
"options": null,
"JoinWaitlist": true
},
"3": {
"path": "https://cdn.jsdelivr.net/npm/[email protected]/lib/index.umd.min.js?ServiceWorker=cachefirst",
"options": {
"crossorigin": "anonymous"
},
"JoinWaitlist": true
},
"4": {
"path": "https://cdn.jsdelivr.net/npm/[email protected]/lib/index.umd.min.js?ServiceWorker=cachefirst",
"options": {
"crossorigin": "anonymous"
},
"JoinWaitlist": true
},
"5": {
"path": "https://cdn.jsdelivr.net/npm/[email protected]/lib/index.umd.min.js?ServiceWorker=cachefirst",
"options": {
"crossorigin": "anonymous"
},
"JoinWaitlist": true
},
"6": {
"path": "./Bloggie/js/marked-init.js?ServiceWorker=cachefirst",
"options": null,
"JoinWaitlist": true
},
"7": {
"path": "./Bloggie/js/custom.js",
"options": null,
"JoinWaitlist": true
},
"8": {
"path": "./Bloggie/js/titlebar.js",
"options": null,
"JoinWaitlist": true
},
"9": {
"path": "https://cdn.jsdelivr.net/npm/[email protected]/dist/msemoji.min.js?ServiceWorker=cachefirst",
"options": {
"crossorigin": "anonymous"
},
"JoinWaitlist": true
},
"10": {
"path": "https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/fancybox/fancybox.umd.js?ServiceWorker=cachefirst",
"options": {
"crossorigin": "anonymous"
},
"JoinWaitlist": true
},
"11": {
"path": "https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.12.0/lottie.min.js?ServiceWorker=cachefirst",
"options": {
"defer": true,
"crossorigin": "anonymous"
}
},
"12": {
"path": "./Bloggie/js/component.js",
"options": null,
"JoinWaitlist": true
},
"13": {
"path": "./Bloggie/js/swloader.js",
"options": null,
}
}
},
"articlelist": {
"1": {
"Title": "Test",
"File": "./Bloggie/article/Test.md",
"Comment": true,
"icon": "",
"tags": ['Test1','Test2','Test3'],
"create": "2023-6-14",
"edit": "2023-6-28"
},
"2": {
"Title": "[测试]Windows 12 是怎么出现的?你知道多少?",
"File": "./Bloggie/article/uselesstext1.md",
"Comment": false,
"tags": ['Test1']
},
"3": {
"Title": "[测试]论使用 Windows 的意义",
"File": "./Bloggie/article/uselesstext2.md",
"Comment": false,
"tags": ['Test2']
},
"4": {
"Title": "[测试]全面讲解微软战略",
"File": "./Bloggie/article/uselesstext3.md",
"Comment": false,
"tags": ['Test3']
},
"5": {
"Title": "微软风音乐不完全集合",
"File": "./Bloggie/article/MSMusic.md",
"Comment": true,
"tags": ['Test1','Test2']
},
"6": {
"Title": "本站介绍(尚在编写)",
"File": "./Bloggie/article/Introduce.md",
"Comment": true,
"tags": ['Test2','Test3'],
"Top": true
},
"7": {
"Title": "Blog Beta 1 更新日志",
"File": "./Bloggie/article/beta1update.md",
"Comment": true,
"tags": ['Test1','Test3'],
"desp": "了解本 Blog 在 Beta 1 的更新内容。",
"icon": "",
"create": "2023-6-28",
"edit": "2023-6-30"
},
"8": {
"Title": "Blog Beta 2 更新日志",
"File": "./Bloggie/article/beta2update.md",
"Comment": true,
"tags": ['Test1','Test3'],
"desp": "了解本 Blog 在 Beta 2 的更新内容。",
"icon": "",
"create": "2023-7-31"
}
},
"wait": {
"type": "function",
"content": "(function() {return bloggie.custom.command.customLoadingAnimation();})"
},
"nav": {
"主页": {
"action": "bloggie.LoadArticle()",
"icon": "./Bloggie/skin/Res/Home.svg"
},
"目录": {
"action": "bloggie.LoadArticle('list')",
"icon": "./Bloggie/skin/Res/List.svg"
},
"设置": {
"action": "bloggie.LoadArticle('Settings')",
"icon": "./Bloggie/skin/Res/Setting.svg"
}
},
"SpecialPage": {
"list": {
"action": "loadlist()",
"Title": "目录"
},
"Settings": {
"action": "bloggie.custom.command.loadSettings()",
"Title": "设置"
},
"Main": {
"file": "./Bloggie/article/Main.md",
"Title": "DaleZ 的 Blog"
}
}
};
20 changes: 20 additions & 0 deletions Bloggie/article/beta2update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
您好!感谢您参与本博客的测试!本次我们从 Beta 1 版更新到了 Beta 2 版,以下是本次更新内容。
### 新功能与改进

- **_新增功能!_** 目录与查看文章页面现已设计完成,界面已经高度符合 Windows 11 设计原则。
- **_新增功能!_** 现在本博客引入了标签功能,可通过标签筛选文章,并在目录中查看所有标签。(**注意:** 标签类别尚未完善。)
- **_新增功能!_** 文章现在可查看相关的信息。(**注意:** 并非所有文章都带有信息。)
- **_新增功能!_** 文章现可置顶。
- 页脚现已更新为符合 Windows 11 设计原则的样式。
- 当 Service Worker 收到更新时,您现在会收到通知。(**注意:** 在此版本中您可能不会收到消息,但在下一个版本更新时您将看到效果。)

### 已知问题

- 对于某些浏览器的网络策略,加载时间偶尔可能比预期更长,而并非加载失败。继续等待或刷新以完成加载。
- 同时点击多个导航栏项将导致指示灯错乱。再次点击**一个**导航栏项将恢复指示灯。
- 较旧的浏览器可能会在多次操作导航栏后使指示灯陷入完全错乱的状态。若发生此情况,请更新您的浏览器。
- 如果有图片等可能不会立即加载完成的内容,锚点跳转可能无法完全跳转到指定的位置。如果跳转后无法找到内容,尝试略向下移动以找到内容。
- 查看某些文章时,沉浸式阅读模式可能不可用。

**注意:** 建议刷新一遍以便完全升级到 Beta 2。
我们期待听到您的反馈。向我们报告问题以便本博客变得更好!
Loading

0 comments on commit ef70a79

Please sign in to comment.