|
10 anni fa | |
---|---|---|
dist | 10 anni fa | |
examples | 10 anni fa | |
src | 10 anni fa | |
test | 10 anni fa | |
.gitignore | 10 anni fa | |
.travis.yml | 10 anni fa | |
README.md | 10 anni fa | |
bower.json | 10 anni fa | |
gulpfile.js | 10 anni fa | |
package.json | 10 anni fa |
多说作为一个第三方评论功能感觉很不错的样子,而且可定制性很强。
多说在存储评论的时候其实是把User-Agent一起存储的,只是不显示出来,这个插件的作用就是把User-Agent显示出来,同时还可以标记站长的回复。
可以通过bower安装:
$ bower install duoshuo-ua
dist中各文件的说明:
默认将使用duoshuo-ua-parser.min.js和duoshuo-ua.min.css。
duoshuoQuery中可以定义myIds
和getUAString
函数:
myIds: Array
是站长自己的多说数字id,可以有多个,用于区分站长的回复,并可在getUAString
中加上不同的标记,如不定义则不会对站长回复进行区分。
getUAString: function (local)
是对每条留言显示内容进行处理的函数,默认将加上操作系统和浏览器的显示。
参数local是一个object,包括以下属性:
下面是一个简单的例子:
<html>
<head>
<!-- 第1部分:在embed.js之前定义duoshuoQuery和加载duoshuo-ua
两者顺序可以交换-->
<script src="dist/duoshuo-ua-parser-css.min.js"></script>
<script>var duoshuoQuery={short_name:'test',myIds:[1234567]};</script>
<!-- 第2部分:可写成异步加载,必须写在第1部分后面 -->
<script src="http://static.duoshuo.com/embed.js"></script>
<!-- 只需要按以上顺序加载,不一定要写在<head>中 -->
</head>
<body>
<div class="ds-thread" data-thread-key="example"></div>
</body>
</html>
更高级的例子见examples。
更多介绍:http://gerald.top/code/duoshuo-ua