文章目录
  1. 1. 给博客添加多说评论
    1. 1.1. 前言
    2. 1.2. 正文
      1. 1.2.1. 注册多说账号
      2. 1.2.2. 自定义CSS
      3. 1.2.3. 本地化 embed_ua.js

给博客添加多说评论

前言

多说帮助用户搭建更活跃,更互动的评论平台,功能强大且永久免费。它正在改变网站与用户之间,用户与用户之间的互动方式。这个专门基于社交网络的评论系统,能够轻松的帮网站主搭建自己互动性极强的社区,让留言的用户都有“家”的感觉。

正文

注册多说账号

进入 多说注册 页面,填写相应信息完成注册

自定义CSS

登录多说后台->设置->基本设置->自定义CSS,在里面粘贴如下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*UA Start*/
span.this_ua {
background-color: #ccc!important;
border-radius: 4px;
padding: 0 5px!important;
margin: 0 1px!important;
border: 1px solid #BBB!important;
color: #fff;

/*text-transform: Capitalize!important;
float: right!important;
line-height: 18px!important;*/
}
.this_ua.platform.Windows{
background-color: #39b3d7!important;
border-color: #46b8da!important;
}
.this_ua.platform.Linux {
background-color: #3A3A3A!important;
border-color: #1F1F1F!important;
}
.this_ua.platform.Ubuntu {
background-color: #DD4814!important;
border-color: #DD4814!important;
}
.this_ua.platform.Mac {
background-color: #666666!important;
border-color: #666666!important;
}
.this_ua.platform.Android {
background-color: #98C13D!important;
border-color: #98C13D!important;
}
.this_ua.platform.iOS {
background-color: #666666!important;
border-color: #666666!important;
}
.this_ua.browser.Chrome{
background-color: #EE6252!important;
border-color: #EE6252!important;
}
.this_ua.browser.Chromium{
background-color: #EE6252!important;
border-color: #EE6252!important;
}
.this_ua.browser.Firefox{
background-color: #f0ad4e!important;
border-color: #eea236!important;
}
.this_ua.browser.IE{
background-color: #428bca!important;
border-color: #357ebd!important;
}
.this_ua.browser.Edge{
background-color: #428bca!important;
border-color: #357ebd!important;
}
.this_ua.browser.Opera{
background-color: #d9534f!important;
border-color: #d43f3a!important;
}
.this_ua.browser.Maxthon{
background-color: #7373B9!important;
border-color: #7373B9!important;
}
.this_ua.browser.Safari{
background-color: #666666!important;
border-color: #666666!important;
}
.this_ua.sskadmin {
background-color: #00a67c!important;
border-color: #00a67c!important;
}
/*UA End*/
/*Head Start*/
#ds-thread #ds-reset ul.ds-comments-tabs li.ds-tab a.ds-current {
border: 0px;
color: #6D6D6B;
text-shadow: none;
background: #F3F3F3;
}

#ds-thread #ds-reset .ds-highlight {
font-family: Microsoft YaHei, "Helvetica Neue", Helvetica, Arial, Sans-serif;
;font-size: 100%;
color: #6D6D6B !important;
}

#ds-thread #ds-reset ul.ds-comments-tabs li.ds-tab a.ds-current:hover {
color: #696a52;
background: #F2F2F2;
}

#ds-thread #ds-reset a.ds-highlight:hover {
color: #696a52 !important;
}

#ds-thread {
padding-left: 15px;
}

#ds-thread #ds-reset li.ds-post,#ds-thread #ds-reset #ds-hot-posts {
overflow: visible;
}

#ds-thread #ds-reset .ds-post-self {
padding: 10px 0 10px 10px;
}

#ds-thread #ds-reset li.ds-post,#ds-thread #ds-reset .ds-post-self {
border: 0 !important;
}

#ds-reset .ds-avatar, #ds-thread #ds-reset ul.ds-children .ds-avatar {
top: 15px;
left: -20px;
padding: 5px;
width: 36px;
height: 36px;
box-shadow: -1px 0 1px rgba(0,0,0,.15) inset;
border-radius: 46px;
background: #FAFAFA;
}

#ds-thread .ds-avatar a {
display: inline-block;
padding: 1px;
width: 32px;
height: 32px;
border: 1px solid #b9baa6;
border-radius: 50%;
background-color: #fff !important;
}

#ds-thread .ds-avatar a:hover {
}

#ds-thread .ds-avatar > img {
margin: 2px 0 0 2px;
}

#ds-thread #ds-reset .ds-replybox {
box-shadow: none;
}

#ds-thread #ds-reset ul.ds-children .ds-replybox.ds-inline-replybox a.ds-avatar,
#ds-reset .ds-replybox.ds-inline-replybox a.ds-avatar {
left: 0;
top: 0;
padding: 0;
width: 32px !important;
height: 32px !important;
background: none;
box-shadow: none;
}

#ds-reset .ds-replybox.ds-inline-replybox a.ds-avatar img {
width: 32px !important;
height: 32px !important;
border-radius: 50%;
}

#ds-reset .ds-replybox a.ds-avatar,
#ds-reset .ds-replybox .ds-avatar img {
padding: 0;
width: 32px !important;
height: 32px !important;
border-radius: 5px;
}

#ds-reset .ds-avatar img {
width: 32px !important;
height: 32px !important;
border-radius: 32px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
-webkit-transition: .8s all ease-in-out;
-moz-transition: .4s all ease-in-out;
-o-transition: .4s all ease-in-out;
-ms-transition: .4s all ease-in-out;
transition: .4s all ease-in-out;
}

.ds-post-self:hover .ds-avatar img {
-webkit-transform: rotateX(360deg);
-moz-transform: rotate(360deg);
-o-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}

#ds-thread #ds-reset .ds-comment-body {
-webkit-transition-delay: initial;
-webkit-transition-duration: 0.4s;
-webkit-transition-property: all;
-webkit-transition-timing-function: initial;
background: #F7F7F7;
padding: 15px 15px 15px 47px;
border-radius: 5px;
box-shadow: #B8B9B9 0 1px 3px;
border: white 1px solid;
}

#ds-thread #ds-reset ul.ds-children .ds-comment-body {
padding-left: 15px;
}

#ds-thread #ds-reset .ds-comment-body p {
color: #787968;
}

#ds-thread #ds-reset .ds-comments {
border-bottom: 0px;
}

#ds-thread #ds-reset .ds-powered-by {
display: none;
}

#ds-thread #ds-reset .ds-comments a.ds-user-name {
font-weight: normal;
color: #3D3D3D !important;
}

#ds-thread #ds-reset .ds-comments a.ds-user-name:hover {
color: #D32 !important;
}

#ds-thread #ds-reset #ds-bubble {
display: none !important;
}

#ds-thread #ds-reset #ds-hot-posts {
border: 0;
}

#ds-reset #ds-hot-posts .ds-gradient-bg {
background: none;
}

#ds-thread #ds-reset .ds-comment-body:hover {
background-color: #F1F1F1;
-webkit-transition-delay: initial;
-webkit-transition-duration: 0.4s;
-webkit-transition-property: all;
-webkit-transition-timing-function: initial;
}
/*Head End*/

本地化 embed_ua.js

  1. 下载 embed_ua.jsua-parser.js 文件
  2. 把下载好的embed_ua.jsua-parser.js文件放到hexo\themes\jacman\source\js目录下
  3. 获取多说ID
    访问多说后台,http://duoshuo.com/settings/ ,点击你的用户名,地址栏中会出现如如下的ID地址
    http://duoshuo.com/profile/6245961960609809153/
  4. 修改embed_ua.js文件
    把如下代码中的e.user_id改成自己的ID

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    function sskadmin(e) {
    var ssk = '';
    if (e.user_id == 6245961960609809153) {
    if (checkMobile()) {
    ssk = '<span class="this_ua sskadmin">博主</span><br><br>';
    } else {
    ssk = '<span class="this_ua sskadmin">博主</span>';
    }
    } else {
    if (checkMobile()) {
    ssk = '<br><br>';
    }
    }
    return ssk;
    }
  5. 上传embed_ua.jsua-parser.jsGitHub

    1
    2
    hexo g
    hexo d
  6. 修改多说调用地址
    打开hexo\themes\jacman\layout\_partial\after_footer.ejs文件找到如下代码

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
       <% if (theme.duoshuo_shortname && page.comments){ %>
    <script type="text/javascript">
    var duoshuoQuery = {short_name:"<%= theme.duoshuo_shortname %>"};
    (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = '//leeguoren.github.io/js/embed_ua.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0]
    || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
    </script>

    <% } %>

    ds.src = '//leeguoren.github.io/js/embed_ua.js'改成自己的上传空间

  7. 启用多说
    打开hexo\themes\jacman\_config.yml 找到如下代码并填入注册的多说用户名
    1
    2
    #### Comment
    duoshuo_shortname: leeguoren
文章目录
  1. 1. 给博客添加多说评论
    1. 1.1. 前言
    2. 1.2. 正文
      1. 1.2.1. 注册多说账号
      2. 1.2.2. 自定义CSS
      3. 1.2.3. 本地化 embed_ua.js