├── screenshot.png ├── README.md ├── sidebar.php ├── page.php ├── 404.php ├── header.php ├── archive.php ├── index.php ├── navbar.php ├── post.php ├── footer.php ├── functions.php ├── comments.php └── style.css /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benzBrake/Less/HEAD/screenshot.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Less 2 | 3 | 一个完全扒回来的自适应Typecho主题,极简,没几行JS。 4 | 5 | 适合做文本记录类。 6 | 7 | ## 使用说明 8 | 9 | 1、直接下载压缩包解压到 `/usr/themes` 目录下,确保目录名为 Less; 10 | 11 | 2、启用主题。 12 | 13 | 3、建议设置文章列表数量为 2 和 3 的公倍数。 14 | 15 | ## 预览 16 | 17 | [https://xiamp.net/Less/](https://apply.free.hr/?theme=Less) 18 | -------------------------------------------------------------------------------- /sidebar.php: -------------------------------------------------------------------------------- 1 | 2 |
6 |themeInit函数中添加代码
68 | * if($archive->is('single') || $archive->is('page')){ viewsCounter($archive);}
69 | *
70 | * @param Widget_Archive $widget
71 | * @return boolean
72 | */
73 | function viewsCounter($widget, $field = 'views')
74 | {
75 | if (!$widget instanceof Widget_Archive) {
76 | return false;
77 | }
78 |
79 | $fieldValue = getPostViews($widget, "%d", "%d", "%d", true, $field);
80 | $fieldRecords = Typecho_Cookie::get('__typecho_' . $field);
81 | if (empty($fieldRecords)) {
82 | $fieldRecords = array();
83 | } else {
84 | $fieldRecords = explode(',', $fieldRecords);
85 | }
86 |
87 | if (!in_array($widget->cid, $fieldRecords)) {
88 | $fieldValue = $fieldValue + 1;
89 | $widget->setField($field, 'str', strval($fieldValue), $widget->cid);
90 | $fieldRecords[] = $widget->cid;
91 | $fieldRecords = implode(',', $fieldRecords);
92 | Typecho_Cookie::set('__typecho_' . $field, $fieldRecords);
93 | return true;
94 | }
95 | return false;
96 | }
97 |
--------------------------------------------------------------------------------
/comments.php:
--------------------------------------------------------------------------------
1 |
2 |
60 | authorId) {
64 | if ($comments->authorId == $comments->ownerId) {
65 | $commentClass .= ' comment-by-author';
66 | } else {
67 | $commentClass .= ' comment-by-user';
68 | }
69 | }
70 |
71 | $commentLevelClass = $comments->levels > 0 ? ' comment-child' : ' comment-parent';
72 |
73 | if ($comments->url) {
74 | $author = '' . $comments->author . '';
75 | } else {
76 | $author = $comments->author;
77 | }
78 | ?>
79 |
80 |