多说评论实现和UA样式分享

2018年12月更新:多说已挂,没有用了。

倒腾了一晚上,各种更改,基本上也是OK了!

JS代码
先本地化embed.js,这个我就不赘述了,然后在embed的头部贴入以下代码
注意以下的

e.user_id == ‘123456’

//*123456改为自己的多说ID

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
function sskadmin(e) {
var ssk = '';
if(e.user_id == '123456' ){
ssk = ' sskadmin '
}
return ssk;
}

//UA detect start
function ua(e) {
var r = new Array;
var outputer = '';
if (r = e.match(/MSIE\s([^\s|;]+)/gi)) {
outputer = '<span class="ua_ie">Internet Explorer ' + r[0].replace('MSIE', '')
} else if (r = e.match(/Edge\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_ie">Mcirosoft Edge ' + r1[1]
} else if (r = e.match(/FireFox\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_firefox">Mozilla Firefox ' + r1[1]
} else if (r = e.match(/Maxthon([\d]*)\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_maxthon">傲游浏览器 ' + r1[1]
} else if (r = e.match(/UBrowser([\d]*)\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_ucweb">UC浏览器 ' + r1[1]
} else if (r = e.match(/MetaSr/ig)) {
outputer = '<span class="ua_sogou">搜狗高速浏览器'
} else if (r = e.match(/MicroMessenger\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_qq">WeChat ' + r1[1]
} else if (r = e.match(/QQBrowser\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_qq">QQ浏览器 ' + r1[1]
} else if (r = e.match(/QQ\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_qq">手机QQ ' + r1[1]
} else if (r = e.match(/MiuiBrowser\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_mi">MIUI浏览器 ' + r1[1]
} else if (r = e.match(/Chrome([\d]*)\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_chrome">Google Chrome ' + r1[1]
} else if (r = e.match(/safari\/([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_apple">Apple Safari ' + r1[1]
} else if (r = e.match(/Opera[\s|\/]([^\s]+)/ig)) {
var r1 = r[0].split("/");
outputer = '<span class="ua_opera">Opera Browser ' + r1[1]
} else if (r = e.match(/Trident\/7.0/gi)) {
outputer = '<span class="ua_ie">Internet Explorer 11 '
} else if (r = e.match(/weibo__([^\s]+)/ig)) {
var r1 = r[0].split("__");
outputer = '<span class="ua_qq">新浪微博 ' + r1[1]
} else if (r = e.match(/LBBROWSER/ig)) {
outputer = '<span class="ua_lbbrowser">猎豹安全浏览器'
}else {
outputer = '<span class="ua_other">Unknown Browser'
}
return outputer+"</span> ";
}
function os(e) {
var r = new Array;
var os = '';
if (e.match(/Windows/ig)) {
if (e.match(/NT 5.1/ig)) {
os = '<span class="os_xp">Windows XP'
} else if (e.match(/NT 6.1/ig)) {
os = '<span class="os_7">Windows 7'
} else if (e.match(/NT 6.2/ig)) {
os = '<span class="os_8">Windows 8'
} else if (e.match(/NT 6.3/ig)) {
os = '<span class="os_8_1">Windows 8.1'
} else if (e.match(/NT 10.0/ig)) {
os = '<span class="os_8_1">Windows 10'
} else if (e.match(/NT 6.0/ig)) {
os = '<span class="os_vista">Windows Vista'
} else if (e.match(/NT 5/ig)) {
os = '<span class="os_2000">Windows 2000'
} else if (r = e.match(/Phone OS ([^\s]+)/ig)) {
//WP7-7.5
os = '<span class="os_windows">Windows ' + r[0].split(';')[0]
} else if (r = e.match(/Phone ([^\s]+)/ig)) {
//WP8+
os = '<span class="os_windows">Windows ' + r[0].split(';')[0]
} else {
os = '<span class="os_windows">Windows OS'
}
} else if (r = e.match(/android ([^\s]+)/ig)) {
os = '<span class="os_android">' + r[0].split(';')[0]
} else if (r = e.match(/iPhone OS ([^\s]+)/ig)) {
os = '<span class="os_ios">' + r[0].replace('iPhone OS', 'iOS').replace('_', '.').replace('_', '.') + '<span class="os_ios">for iPhone'
} else if (r = e.match(/CPU OS ([^\s]+)/ig)) {
os = '<span class="os_ios">' + r[0].replace('CPU OS', 'iOS').replace('_', '.').replace('_', '.') + '<span class="os_ios">for iPad'
} else if (e.match(/ubuntu/ig)) {
os = '<span class="os_ubuntu">Ubuntu '
} else if (e.match(/linux/ig)) {
os = '<span class="os_linux">Linux '
} else if (r = e.match(/Mac OS X ([^\s]+)/ig)) {
os = '<span class="os_mac">' + r[0].split(')')[0].replace('_','.').replace('_', '.')
} else if (e.match(/unix/ig)) {
os = '<span class="os_unix">Unix '
} else if (e.match(/symbian/ig)) {
os = '<span class="os_nokia">Symbian'
} else if (e.match(/meego/ig)) {
os = '<span class="os_nokia">MeeGo'
} else {
os = '<span class="os_other">Unknown OS '
}
return os+"</span>" ;
}


以下是CSS样式,也是从别人那里copy过来稍微改了一下,自己反正蛮喜欢的~

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
/*多说UA开始*/
span.ua{
margin: 0 1px!important;
color:#FFFFFF!important;
/*text-transform: Capitalize!important;
float: right!important;
line-height: 18px!important;*/
}
.ua_ie{
background-color: #428bca!important;
border-color: #357ebd!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_firefox{
background-color: #f0ad4e!important;
border-color: #eea236!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_maxthon{
background-color: #7373B9!important;
border-color: #7373B9!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_ucweb{
background-color: #FF740F!important;
border-color: #d43f3a!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_sogou{
background-color: #78ACE9!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_2345explorer{
background-color: #2478B8!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_2345chrome{
background-color: #F9D024!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_mi{
background-color: #FF4A00!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_lbbrowser{
background-color: #FC9D2E!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_chrome{
background-color: #EE6252!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_qq{
background-color: #3D88A8!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_apple{
background-color: #E95620!important;
border-color: #4cae4c!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_opera{
background-color: #d9534f!important;
border-color: #d43f3a!important;
border-radius: 4px;
padding: 0 5px!important;
}
.ua_other{
background-color: #8B8B7A!important;
border-color: #01B171!important;
border-radius: 4px;
padding: 0 5px!important;
}

.os_vista,.os_2000,.os_windows,.os_xp,.os_7,.os_8,.os_8_1 {
background-color: #39b3d7!important;
border-color: #46b8da!important;
border-radius: 4px;
padding: 0 5px!important;
}

.os_android {
background-color: #98C13D!important;
border-color: #01B171!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_ubuntu{
background-color: #DD4814!important;
border-color: #01B171!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_linux {
background-color: #3A3A3A!important;
border-color: #1F1F1F!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_mac{
background-color: #666666!important;
border-color: #1F1F1F!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_ios{
background-color: #D1D1D1!important;
color:#000000!important;
border-color: #1F1F1F!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_unix{
background-color: #006600!important;
border-color: #1F1F1F!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_nokia{
background-color: #014485!important;
border-color: #1F1F1F!important;
border-radius: 4px;
padding: 0 5px!important;
}
.os_other{
background-color: #8B8B7A!important;
border-color: #01B171!important;
border-radius: 4px;
padding: 0 5px!important;
}
.sskadmin{
background-color: #D4D4D4!important;
color:#000000!important;
border-radius: 4px;
padding: 0 5px!important;
}
/*多说UA结束*/

多说评论实现和UA样式分享

https://jetyu.me/post/duoshuo-comment-style.html

作者

Jet Yu

发布于

2014-04-24

更新于

2018-12-10

许可协议

评论