' . $this->archiveTitle . '') ?>
40 | 41 |-
42 |
43 |
44 |
45 |
├── .gitignore ├── 404.php ├── LICENSE ├── README.md ├── archive.php ├── assets ├── css │ ├── bootstrap.css │ ├── dark-color.scss │ ├── github-dark.min.css │ ├── icon.css │ ├── info-color.scss │ ├── light-color.scss │ ├── options-panel.css │ ├── primary-color.scss │ ├── stackoverflow-light.min.css │ ├── style.css │ ├── style.scss │ ├── success-color.scss │ ├── sunburst.min.css │ └── universal.scss ├── fonts │ ├── icomoon.eot │ ├── icomoon.svg │ ├── icomoon.ttf │ └── icomoon.woff └── js │ ├── app.js │ ├── bootstrap.bundle.min.js │ ├── chart.js │ ├── clipboard.min.js │ ├── highlight.pack.js │ ├── jquery-3.4.1.min.js │ ├── jquery.pjax.js │ ├── jquery.qrcode.min.js │ └── options-panel.js ├── components ├── comment-input.php ├── comments.php ├── footer.php ├── header.php ├── link-editor.php ├── post-list.php └── sidebar.php ├── emoji.php ├── functions.php ├── inc ├── helpers.php ├── theme-config.php └── theme-fields.php ├── index.php ├── languages ├── en.php └── zh.php ├── page-archive.php ├── page-category.php ├── page-data.php ├── page-links.php ├── page-tag.php ├── page.php ├── post.php ├── screenshot.jpg └── screenshot ├── 16043686924621.jpg ├── JetBrains-logo.png ├── all-color.png ├── category-statistics.jpeg ├── comment-calendar.jpeg ├── comment-statistics.jpeg ├── dark-color.png ├── emoji.jpeg ├── home-page.jpeg ├── home.png ├── mini-header-image.png ├── mini-header-image2.png ├── qr-code.jpeg └── statistics.jpeg /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .idea/ 3 | .vscode/ 4 | assets/css/style.css.map 5 | assets/css/style.css.map 6 | -------------------------------------------------------------------------------- /404.php: -------------------------------------------------------------------------------- 1 | options->language); 6 | $this->need('components/header.php'); 7 | ?> 8 | 9 |
32 | need('components/footer.php'); ?> -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 changbin1997 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | 这是一套简洁的 [Typecho](https://typecho.org/) 双栏博客主题,也是 [我的博客](https://www.misterma.com/) 之前使用的主题。 4 | 5 | 我现在使用的主题是 [Facile](https://github.com/changbin1997/Facile) ,有兴趣的话也可以访问 [我的博客](https://www.misterma.com/) 或 [Github](https://github.com/changbin1997/Facile) 查看。 6 | 7 | 主题在线演示地址:[https://changbin1997.github.io/MWordStar/web/](https://changbin1997.github.io/MWordStar/web/) 8 | 9 | 主题演示站的页面都是静态页面,不能发评论和点赞。因为演示站不会随着主题一起更新,所以你在演示站看到的效果可能和最新版本的主题也会有些不一样。 10 | 11 | 主题下载地址:[https://github.com/changbin1997/MWordStar/releases](https://github.com/changbin1997/MWordStar/releases) 12 | 13 | 主题使用说明:[https://mwordstar.misterma.com/](https://mwordstar.misterma.com/) 14 | 15 | 目前主题没有相关的交流群,在使用过程中遇到问题可以直接到 [我的博客](https://www.misterma.com/archives/812/) 留言,也可以到主题 Github 的 [issues](https://github.com/changbin1997/MWordStar/issues) 反馈,我的博客和 Github issues 都有回复邮件通知。 16 | 17 | 下面是主题首页截图: 18 | 19 |  20 | 21 | 主题元素包含圆角和直角两种风格,您可以根据喜好在主题外观设置中切换,下面是直角风格的首页截图: 22 | 23 |  24 | 25 | 小头图模式: 26 | 27 |  28 | 29 | 也可以给文章设置单独的头图样式: 30 | 31 |  32 | 33 | 深色模式: 34 | 35 |  36 | 37 | 主题目前包含 6 种配色: 38 | 39 |  40 | 41 | ## 特点和功能 42 | 43 | * 响应式设计 44 | * 无障碍适配(Accessibility) 45 | * 6 种不同风格的配色 46 | * 两种不同风格的元素 47 | * 多套自定义页面模板 48 | * 代码高亮 49 | * 丰富的设置选项 50 | * 良好的 SEO 优化 51 | * 详细的图表统计 52 | * 自带文章浏览量统计和点赞功能 53 | * 丰富的侧边栏组件 54 | * 评论区自带 Emoji 表情面板 55 | * 支持自动根据文章中的标题生成章节目录 56 | * 支持图片懒加载 57 | * 文章支持分页显示 58 | * 文章列表支持多种排版组合 59 | * 支持 PJAX 无刷新跳转 60 | * 支持多语言 61 | * 长期维护 62 | * 详细的 [使用说明](https://mwordstar.misterma.com/)(必看) 63 | 64 | ## 主题介绍 65 | 66 | ### 外观设计 67 | 68 | 因为我个人比较喜欢两栏布局,所以这个主题也使用了两栏布局的设计。 69 | 70 | ### 主题依赖 71 | 72 | 主题主要用到了一下几个库和框架: 73 | 74 | * [Bootstrap](https://getbootstrap.com/) 外观和布局 75 | * [jQuery](https://jquery.com/) Bootstrap 依赖 76 | * [jquery-qrcode](https://github.com/jeromeetienne/jquery-qrcode) 一个生成二维码的 jQuery 插件 77 | * [highlight.js](https://highlightjs.org/) 代码高亮 78 | * [IcoMoon](https://icomoon.io/) 字体图标 79 | * [ECharts](https://github.com/apache/echarts) 生成和展示统计图表 80 | * [jquery-pjax](https://github.com/defunkt/jquery-pjax) 用于页面无刷新跳转 81 | 82 | 其中 IcoMoon 的字体图标是可定制的,所以只包含了主题中出现的图标,字体图标的文件体积也很小。ECharts 也只包含饼图和日历图,而且只会在统计页面加载。 83 | 84 | 主题的静态文件没有使用任何 CDN 地址,所有文件都放在主题的 `assets` 目录中。主题的生成目录、点赞、快速分享 之类的功能都是自己手动编写的,所以用到的 JS 库也比较少。 85 | 86 | 使用 Webpack 打包的版本前台只需要加载一个 CSS 和 一个 JS 文件,所有 JS 库都打包到了 JS 中,所有 CSS 和字体图标都打包到了 CSS 中。因为用到的库比较少,而且字体图标和部分组件都是按需引入的,所以打包后的 CSS 和 JS 也比较小。 87 | 88 | 如果您没有二次开发需求的话,建议下载 Webpack 打包的版本,也就是后缀包含 `bundle` 的 zip 文件。前台的 JavaScript 使用了 ES6 语法,IE 系列浏览器和一些较老的浏览器可能无法正常运行,Webpack 打包的版本使用 Babel 转换过代码,可以在 IE 和较老的浏览器上运行。 89 | 90 | ### 主题安装 91 | 92 | 把主题上传到 Typecho 的 `usr/themes/` 目录,然后解压,您也可以先解压在上传。 93 | 94 | 解压后需要保证 `themes` 目录下 有一个 `MWordStar` 目录。 95 | 96 | 登录 Typecho 的后台管理,进入 `控制台` -> `外观`,如果看到 **MWordStar** 就点击 `启用`。 97 | 98 | ### 代码高亮 99 | 100 | 代码高亮目前包含三套主题配色,分别是 Stack Overflow(浅色)、Github(深色)、Sunburst(高对比度)。主题支持 30 多种语言的代码高亮,详细的语言支持列表和说明可以查看 [使用说明](https://mwordstar.misterma.com/docs/doc13) 。 101 | 102 | ### 友情链接 103 | 104 | 友情链接分为 `全站友情链接`、`首页友情链接`、`内页友情链接`。`全站友情链接` 会在每个页面的侧边栏显示,`首页友情链接` 会在首页的侧边栏显示,`内页友情链接` 只会在 友情链接 的页面显示。 105 | 106 | 如需查看友情链接的设置说明可以访问:[使用说明](https://www.misterma.com/archives/819/) 。 107 | 108 | ### 文章头图 109 | 110 | 文章头图可以在 首页、文章页、侧边栏 显示,您可以根据需求在主题外观设置中设置。文章头图来源支持自动获取文章的第一张图片和手动输入图片 URL。 111 | 112 | ### 侧边栏 113 | 114 | 下面是目前可以显示在侧边栏的组件: 115 | 116 | * 博客信息 117 | * 搜索 118 | * 最新文章 119 | * 最新评论 120 | * 文章分类 121 | * 标签云 122 | * 日历归档 123 | * 按月份的文章归档 124 | * 登录入口和 RSS 125 | * 友情链接 126 | * 文章章节目录 127 | * 自定义HTML 128 | * 语言选择 129 | 130 | 侧边栏的每个组件您都可以选择开启或关闭,您还可以自定义侧边栏的组件排序顺序。 131 | 132 | ### 无障碍(Accessibility) 133 | 134 | 上网对于大多数人来说是一件再简单不过的事,但是对于一些身体有缺陷的残障人士来说却是一件非常困难的事。 135 | 136 | 目前国内的很多网站都只注重外观,忽略了残障人士的可访问性。但是想要做好网站的用户体验,[无障碍](https://www.misterma.com/archives/264/) 适配肯定是少不了的。 137 | 138 | 主题针对屏幕阅读器做了大量优化,并 在 [NVDA](http://www.nvda-project.org/) 和 [VoiceOver](https://www.apple.com/cn/accessibility/iphone/vision/) 这两款屏幕阅读器上做过测试,无论是 PC 还是移动设备都能完美朗读。主题能准确传达需要朗读的内容和信息,对于视障人群来说,使用标准的屏幕阅读器基本可以无障碍操作。 139 | 140 | 主题可完美支持键盘访问,颜色对比度也符合标准。 141 | 142 | 小提示:如果您是屏幕阅读器用户,为了您的浏览体验,不建议使用 IE 浏览器。 143 | 144 | ### Emoji 表情 145 | 146 | 主题评论区包含一个 Emoji 表情面板,您可以在后台启用或禁用。Emoji 表情面板包含 1466 个表情,这些表情都是按照分类动态加载的,您不用担心性能问题。 147 | 148 | Emoji 表情面板也进行了无障碍适配,可支持键盘访问和屏幕阅读器朗读。 149 | 150 | 下面是 Emoji 表情面板的截图: 151 | 152 |  153 | 154 | ### 统计页 155 | 156 | 主题包含一个统计页模板,您可以在后台创建页面,页面的自定义模板选择 `网站数据`,标题可以随便写,创建完成后就可以在顶部导航栏访问了。 157 | 158 | 统计页包含基本的数据统计、分类文章占比图、文章更新日历图、评论动态日历图、阅读量排名前 5 的文章、评论量排名前 5 的文章。 159 | 160 | 基本数据统计如下: 161 | 162 |  163 | 164 | 分类占比统计图如下: 165 | 166 |  167 | 168 | 下面是评论动态日历图: 169 | 170 |  171 | 172 | 文章动态日历图和评论动态的日历图是差不多的,屏幕尺寸不同显示的月份数量也不同。 173 | 174 | 下面是文章评论排名表格: 175 | 176 |  177 | 178 | 文章阅读量排名表格和评论量排名的表格也是差不多的。 179 | 180 | 统计页面效果可以参考 [https://www.misterma.com/data.html](https://www.misterma.com/data.html) ,也可以直接访问 MWordStar 的静态演示站。 181 | 182 | ### 兼容性 183 | 184 | 主题使用了少量的 CSS3,浏览器需要达到 IE10 才能完美兼容,IE8 和 9 也能使用,但是有些页面的显示 例如代码高亮和时间线显示可能会出现稍微偏移的情况。 185 | 186 | ### 插件适配 187 | 188 | 因为本人很少使用插件,所以目前适配的插件比较少。 189 | 190 | 下面是已适配的插件: 191 | 192 | * [Sticky](https://plugins.typecho.me/plugins/sticky.html) 文章置顶插件 193 | 194 | 已适配的插件不需要到 PHP 文件中添加插件代码,没有适配的插件可能需要按照插件说明到 PHP 文件中添加相应的插件代码。 195 | 196 | ## 其它 197 | 198 | 主题 Github:[https://github.com/changbin1997/MWordStar](https://github.com/changbin1997/MWordStar) 199 | 200 | 主题使用 [MIT License](https://github.com/changbin1997/MWordStar/blob/master/LICENSE) 开源。 201 | 202 | ## 打赏支持 203 | 204 | 如果感觉主题用着还可以的话,也可以扫描下方的二维码打赏,金额随意: 205 | 206 |  207 | 208 | 非常感谢 ❤️ 209 | 210 | 下面是 [MWordStar](https://github.com/changbin1997/MWordStar) 和 [Facile](https://github.com/changbin1997/Facile) 两个主题的打赏记录: 211 | 212 | | 打赏者 | 金额(人民币) | 时间 | 213 | | ------ | -------------- | ------------------- | 214 | | *伟 | 1.00 | 2022 年 8 月 12 日 | 215 | | S*r | 1.00 | 2022 年 11 月 17 日 | 216 | | *玥 | 10.00 | 2022 年 11 月 27 日 | 217 | | 0*7 | 1.00 | 2022 年 12 月 17 日 | 218 | | *U | 20.00 | 2023 年 1 月 18 日 | 219 | | *义 | 16.80 | 2023 年 3 月 29 日 | 220 | | Y*a | 10.00 | 2023 年 4 月 4 日 | 221 | | *行 | 8.88 | 2023 年 5 月 8 日 | 222 | | *华 | 8.88 | 2024 年 10 月 11 日 | 223 | | *王 | 6.66 | 2024 年 12 月 26 日 | 224 | -------------------------------------------------------------------------------- /archive.php: -------------------------------------------------------------------------------- 1 | options->language); 6 | $this->need('components/header.php'); 7 | ?> 8 | 9 |配色预览:
172 | 173 | `; 174 | optionUl[1].parentNode.insertBefore(imgBox, optionUl[3]); 175 | 176 | // 获取配色单选框 177 | const colorRadio = document.getElementsByName('color'); 178 | // 获取预览图 179 | const img = document.querySelector('#preview-img'); 180 | for (let i = 0; i < colorRadio.length; i++) { 181 | // 给配色单选框添加一个索引 182 | colorRadio[i].index = i; 183 | // 根据选中的单选框设置图片 184 | if (colorRadio[i].checked) { 185 | img.style.backgroundPositionY = `-${colorRadio[i].index * 313}px`; 186 | } 187 | // 配色单选框改变 188 | colorRadio[i].addEventListener('change', ev => { 189 | img.style.backgroundPositionY = `-${ev.target.index * 313}px`; 190 | }); 191 | } 192 | 193 | // 创建选项列表 194 | const optionsList = document.querySelector('#options-list'); 195 | // 创建选项列表项 196 | for (let i = 0;i < title.length;i ++) { 197 | const itemLi = document.createElement('li'); 198 | const itemLink = document.createElement('a'); 199 | itemLink.innerHTML = title[i]; 200 | itemLink.href = 'javascript:;'; 201 | itemLink.index = i; 202 | // 给目录链接添加跳转事件 203 | itemLink.addEventListener('click', ev => { 204 | titleEl[ev.target.index].scrollIntoView({behavior: 'smooth'}); 205 | }); 206 | 207 | itemLi.appendChild(itemLink); 208 | optionsList.querySelector('ul').appendChild(itemLi); 209 | } 210 | 211 | // 设置选项列表目录的位置 212 | const left = document.querySelector('.col-tb-offset-2').offsetLeft; 213 | optionsList.style.left = left - optionsList.offsetWidth + 'px'; 214 | 215 | // 窗口大小改变时调整选项目录的位置 216 | window.addEventListener('resize', () => { 217 | if (window.innerWidth < 768) return false; 218 | const left = document.querySelector('.col-tb-offset-2').offsetLeft; 219 | optionsList.style.left = left - optionsList.offsetWidth + 'px'; 220 | }); 221 | 222 | // 目录下方的保存选项按钮提交保存 223 | document.querySelector('.submit-options').addEventListener('click', () => { 224 | document.querySelector('.typecho-page-main form').submit(); 225 | }); 226 | 227 | 228 | // 获取友情链接表格 229 | const linkList = document.querySelector('#link-list table tbody'); 230 | let linkInputName = null; // 存储友链表单的名称 231 | 232 | // 打开链接编辑器 233 | document.querySelectorAll('.show-link-editor').forEach(el => { 234 | el.setAttribute('title', `${el.getAttribute('data-title')}编辑`); 235 | 236 | el.addEventListener('click', ev => { 237 | // 设置链接编辑器标题 238 | document.querySelector('#link-editor-title').innerHTML = `${ev.target.getAttribute('data-title')}编辑`; 239 | // 从链接表单获取 JSON 240 | linkInputName = ev.target.getAttribute('data-name'); 241 | let linkJson = document.querySelector(`textarea[name="${linkInputName}"]`).value; 242 | 243 | // 显示链接编辑器 244 | document.querySelector('#link-editor-box').style.display = 'block'; 245 | // 如果屏幕尺寸较小就调节编辑器尺寸 246 | if (window.innerWidth < 900 || window.innerHeight < 500) { 247 | const linkListHeight = window.innerHeight - document.querySelector('#link-editor-title').offsetHeight - document.querySelector('#link-editor .dialog-actions').offsetHeight; 248 | document.querySelector('#link-list').style.height = linkListHeight + 'px'; 249 | } 250 | // 禁止页面滚动 251 | document.body.classList.add('no-scroll'); 252 | // 清空链接表格 253 | linkList.innerHTML = ''; 254 | // 读取链接 255 | if (linkJson !== '') { 256 | try { 257 | linkJson = JSON.parse(linkJson); 258 | }catch (error) { 259 | alert(`无法解析链接 JSON ${error.message}`); 260 | return false; 261 | } 262 | 263 | // 生成链接表格 264 | linkJson.forEach(link => { 265 | if (link.url === undefined) link.url = ''; 266 | if (link.name === undefined) link.name = ''; 267 | if (link.title === undefined) link.title = ''; 268 | if (link.logoUrl === undefined) link.logoUrl = ''; 269 | 270 | const trEl = document.createElement('tr'); 271 | trEl.innerHTML = ` 272 |