Skip to content

Commit

Permalink
v0.4.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed May 14, 2020
1 parent 2c7c0d1 commit a9d985c
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 33 deletions.
4 changes: 2 additions & 2 deletions _includes/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ function threadedComments($comments, $options)
<?php if($this->user->hasLogin()): ?>
<div class="comment-respond-author">
<a href="<?php $this->options->profileUrl(); ?>" target="_blank" rel="external nofollow">
<img class="avatar shadow" src="https://secure.gravatar.com/avatar/<?php echo md5(strtolower($this->user->mail)) ?>?s=80&r=<?php echo $this->options->commentsAvatarRating ?>&d=mp" alt="<?php echo $this->options->user->name ?>">
<img class="avatar shadow" src="<?php echo Typecho_Common::gravatarUrl($this->user->mail, 80, $this->options->commentsAvatarRating, 'mp', $this->request->isSecure()); ?>">
<?php echo $this->user->screenName ?>
</a>
<span>添加回复</span>
</div>
<?php else: ?>
<div class="comment-respond-author">
<img class="avatar shadow" src="https://secure.gravatar.com/avatar?s=80&r=<?php echo $this->options->commentsAvatarRating ?>&d=mp">
<img class="avatar shadow" src="<?php echo Typecho_Common::gravatarUrl('', 80, $this->options->commentsAvatarRating, 'mp', $this->request->isSecure()); ?>">
<div class="form-row">
<div class="col-6 col-md-4">
<input type="text" name="author" class="form-control form-control-sm"
Expand Down
6 changes: 3 additions & 3 deletions _includes/nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
<div class="profile">
<?php if($this->is('author')): ?>
<img class="shadow"
src="https://secure.gravatar.com/avatar/<?php echo md5(strtolower(get_user($this->_archiveSlug)['mail'])) ?>?s=256&r=<?php echo $this->options->commentsAvatarRating ?>&d=mp"
src="<?php echo Typecho_Common::gravatarUrl(get_user($this->_archiveSlug)['mail'], 256, $this->options->commentsAvatarRating, 'mp', $this->request->isSecure()); ?>"
alt="<?php echo get_user($this->_archiveSlug)['screenName'] ?>">
<?php elseif($this->user->hasLogin()): ?>
<img class="shadow"
src="https://secure.gravatar.com/avatar/<?php echo md5(strtolower($this->user->mail)) ?>?s=256&r=<?php echo $this->options->commentsAvatarRating ?>&d=mp"
src="<?php echo Typecho_Common::gravatarUrl($this->user->mail, 256, $this->options->commentsAvatarRating, 'mp', $this->request->isSecure()); ?>"
alt="<?php echo $this->options->user->name ?>">
<?php elseif($this->is('post')): ?>
<img class="shadow"
src="https://secure.gravatar.com/avatar/<?php echo md5(strtolower($this->author->mail)) ?>?s=256&r=<?php echo $this->options->commentsAvatarRating ?>&d=mp"
src="<?php echo Typecho_Common::gravatarUrl($this->author->mail, 256, $this->options->commentsAvatarRating, 'mp', $this->request->isSecure()); ?>"
alt="<?php echo $this->options->user->name ?>">
<?php elseif($this->options->avatar): ?>
<img class="shadow" src="<?php $this->options->avatar(); ?>">
Expand Down
1 change: 1 addition & 0 deletions _includes/sidebar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="dynamic-hide">
<?php if(!$this->is('author')): ?>
<div class="card card-author-meta">
<div class="title">站点信息</div>
<div class="site-meta row text-center">
<div class="col-4">
<div><?php echo get_post_num(); ?></div>
Expand Down
5 changes: 5 additions & 0 deletions _layouts/default-0.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
</head>

<body class="theme-front-none">
<div class="background"></div>
<style><?php
if($this->options->backgroundlg) echo '.background{background-image:url('.$this->options->backgroundlg.');}';
if($this->options->backgroundsm) echo '@media (max-width: 767px) {.background{background-image:url('.$this->options->backgroundsm.');}';
?>"</style>
<div class="sidebar">
<div class="container">
<div class="row row-nav">
Expand Down
21 changes: 18 additions & 3 deletions asserts/js/article.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
window.article = function ($){
$('article h1,article h2,article h3,article h4').each(function(){
if($(this).attr('id')!=undefined) return;
$(this).attr('id', $(this).text().replace(' ', '-'));
var headers = [];
$('article h1,article h2,article h3,article h4,article h5').each(function(){
if($(this).attr('id')===undefined)
$(this).attr('id', $(this).text().replace(' ', '-'));
headers.push($(this).attr('id'));
});
$('article h1,article h2,article h3,article h4,article h5').each(function(){
var repeatHeaders = [];
headers.sort().sort(function (a,b) {
if(a === b && repeatHeaders.indexOf(a) === -1){
repeatHeaders.push(a);
}
})
repeatHeaders.forEach(function(v){
$('article #'+v).each(function(i){
$(this).attr('id', v+'-'+(i+1));
})
})
})
$('article pre code').each(function(){
$(this).html(hljs.highlightAuto($(this).text()).value);
$(this).addClass('hljs')
Expand Down
14 changes: 14 additions & 0 deletions docs/Q&A.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@

目前主要支持 Chrome Firefox Safari,其他浏览器bug随缘修复,IE浏览器bug不予修复(懒

## 如何更换头像源

在Typecho根目录下的config.inc.php文件中添加下面内容。你会在文件中发现类似于下面这行的内容,添加到它们前后就可以了
```
//更换头像源
define('__TYPECHO_GRAVATAR_PREFIX__', '这里替换成地址');
```
下面几个源都是可用的,如果你知道其他源也可以自己尝试

- http://gravatar.ihuan.me/avatar/
- https://gravatar.proxy.ustclug.org/
- https://cdn.v2ex.com/gravatar/
- http://dn-qiniu-avatar.qbox.me/avatar

## 其他问题

欢迎提问 [GitHub issue](https://github.com/MuZhou233/Morecho-Typecho/issues) [主题发布页](https://mosarin.tech/morecho.html)
2 changes: 1 addition & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
* 起步
* [开始使用](/start.md)
* 配置
* [主题配置](/theme.md)
* [插件配置](/plugins.md)
* [常见问题](/Q&A.md)
* 使用
* [Markdown语法](/markdown.md)
* [表情与图标](/icon.md)
* [额外页面](/page.md)
* 记录
* [更新记录](/logs.md)
* [开发进度](/progress.md)
5 changes: 5 additions & 0 deletions docs/logs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# 版本更新日志

## v0.4.4.2 稳定版

1. 添加了显示背景图片的功能
1. 修复了一些bug

## v0.4.4.1 稳定版

**此版本修改了插件结构,请在更新前禁用Morecho插件**
Expand Down
17 changes: 0 additions & 17 deletions docs/page.md

This file was deleted.

6 changes: 2 additions & 4 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@

### MorechoCore

包含各种基本的零碎的功能,比如:
主要目的是在后台界面提供与前台一样的体验,也会放置一些零碎功能,比如:

1. 修改了后台外观,使后台预览支持主题增加的 markdown 功能(不完善),修复了移动端的 bug
1. 修改了 markdown 解析器和编辑器,在服务端支持了主题增加的 markdown 功能
1. 增加了全部文章归档的页面

主要目的是在后台界面提供与前台一样的体验,也会放置一些零碎功能

### MorechoFriends

增强友链体验

1. 在数据库`user`表中增加`introduction`字段,可以被任何主题正常读取
1. 在数据库`users`表中增加`introduction`字段,可以被任何主题正常读取
1. 增加`/link/`友链页面,依赖于注册用户信息,根据用户组对友链类型进行分类
29 changes: 29 additions & 0 deletions docs/theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
主题设置中的项目都包含了比较清晰的介绍,此处不再赘述

## 额外字段

1. 副标题
就是副标题,但是目前还没有想到比较好的显示方式
1. 首行缩进
建议在长文本文章中启用,无脑将所有行首行缩进两个全角字符,实现方式比较粗暴

## 额外页面

### 全部文章归档

*由 MorechoCore 插件提供*

链接为`/archive/`,内容模板与`/{category}/`相同,但会显示全部文章
值得注意的是,任何一个使用了时间线的页面(通过各种分类方式查看文章列表)都忽略了typecho设置中的分页设置显示全部内容了,这在文章量较大的网站会出现加载缓慢的问题。

### 友链页面

*由 MorechoFriends 插件提供*

链接为`/link/`,根据用户组分类显示用户卡片,相关配置项在插件设置中,推荐用法是隐藏管理员和编辑的链接,将需要置顶的用户设置为贡献者,一般用户保持默认的关注者。

### 用户页面

*在启用 MorechoFriends 插件时显示*

链接为`/author/ID`,在通过插件增加了`个人介绍`之后,默认的用户页面会显示用户的相关信息和个人介绍,而原本的`TA发布的文章`移动到了`/author/ID?articles`
7 changes: 5 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

define('__TYPECHO_DEBUG__',true);

function themeInit($data)
{
if($data->is('category')||$data->is('search')||$data->is('tag')||$data->is('author')||$data->parameter->type == 'Morecho_archive_page')
Expand Down Expand Up @@ -35,6 +33,11 @@ function themeConfig($form)
// 自定义页脚
$footerCopyright = new Typecho_Widget_Helper_Form_Element_Textarea('footerCopyright', NULL, NULL, _t('自定义页脚'), _t('默认为<code>&lt;div&gt;&amp;copy; [当前年份] · Powered by Typecho · Theme by &lt;a href=&quot;https://github.com/muzhou233/Morecho-Typecho&quot;&gt;Morecho&lt;/a&gt;&lt;/div&gt;</code></br>如果需要添加备案号,复制前面的内容,修改年份,并在后面添加<code>&lt;div&gt;备案号内容&lt;/div&gt;</code><br/>你也可以选择不保留原有的版权声明</br>留空则使用默认'));
$form->addInput($footerCopyright);
// 自定义背景图
$backgroundlg = new Typecho_Widget_Helper_Form_Element_Text('backgroundlg', NULL, NULL, _t('背景图片地址'));
$form->addInput($backgroundlg->addRule('xssCheck', _t('请不要使用特殊字符')));
$backgroundsm = new Typecho_Widget_Helper_Form_Element_Text('backgroundsm', NULL, NULL, _t('移动端背景图片地址'), _t('在移动端使用长图替换宽图体验更好'));
$form->addInput($backgroundsm->addRule('xssCheck', _t('请不要使用特殊字符')));

$title2 = new Typecho_Widget_Helper_Layout('div', array('class=' => 'typecho-page-title'));
$title2->html('<h2>头衔</h2>
Expand Down
2 changes: 1 addition & 1 deletion link.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function linkCard($user, $avatarRating){
$url = $user['url'];
$name = $user['screenName'];
$intro = $user['introduction'];
$avatar = 'https://secure.gravatar.com/avatar/'.md5(strtolower($user['mail'])).'?s=144&r='.$avatarRating.'&d=mp';
$avatar = Typecho_Common::gravatarUrl($user['mail'], 144, $this->options->commentsAvatarRating, 'mp', $this->request->isSecure());;
echo '
<a href="'.$url.'">
<blockquote class="card-meta">
Expand Down
11 changes: 11 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
console.log("%c%s%c%s",
"color: white; background: #007bff; border: solid 1px #007bff; font-weight: bold; line-height: 1em; padding: .5em; border-top-left-radius: .5em; border-bottom-left-radius: .5em;",
"Morecho",
"color: #007bff; background: white; border: solid 1px #777; font-weight: bold; line-height: 1em; padding: .5em; border-top-right-radius: .5em; border-bottom-right-radius: .5em;",
"by 沐雨橙舟");
console.log("%c%s%c%s",
"color: white; background: #007bff; border: solid 1px #007bff; font-weight: bold; line-height: 1em; padding: .5em; border-top-left-radius: .5em; border-bottom-left-radius: .5em;",
"访问",
"color: #007bff; background: white; border: solid 1px #777; font-weight: bold; line-height: 1em; padding: .5em; border-top-right-radius: .5em; border-bottom-right-radius: .5em;",
"typecho.mosar.in");

$(function(){
$('body').attr('class', localStorage.getItem('theme'))
$('.theme-control .col div').click(function(){
Expand Down
11 changes: 11 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ a:hover {
text-decoration: unset;
}

.background{
background-repeat: no-repeat;
background-size: cover;
position: fixed;
height: 100%;
width: 100%;
}

/* sidebar */
.sidebar {
position: fixed;
Expand Down Expand Up @@ -565,6 +573,9 @@ a.toc-link:hover {
line-height: 1.2rem;
color: #555;
}
.comment-list .comment-list .comment-list{
padding-left: 0;
}
.comment-list a,
.comment-respond a{
font-style: normal;
Expand Down

0 comments on commit a9d985c

Please sign in to comment.