Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jokinkuang/jquery.duoshuo.js

a jQuery plugin to load duoshuo comments、likes、reposts、views and so on
https://github.com/jokinkuang/jquery.duoshuo.js

Last synced: 18 days ago
JSON representation

a jQuery plugin to load duoshuo comments、likes、reposts、views and so on

Awesome Lists containing this project

README

        

# jquery.duoshuo.js
a jQuery plugin to load duoshuo comments、likes、reposts、views and so on

## Dependence

* [jquery.js](https://jquery.com/)
* [pagecache.js](https://github.com/jokinkuang/pagecache.js)

## Usage

### use data-attr
\ · 评论 0\
\ · 转发 0\

\\
\\
\\
```javascript

$(".post-data").duoshuo();

```

### use settings
\ · 评论 0\
\ · 转发 0\

\\
\\
\\
```javascript

$.Duoshuo.settings = { shortName: "jokin", threadKey: "index"};
$(".post-comments").duoshuo("comments", " · 评论 %s");
$(".post-reposts").duoshuo("reposts", " · 转发 %s");

```

### use parameter
\ · 评论 0\
\ · 转发 0\

\\
\\
\\
```javascript

$(".post-comments").duoshuo("comments", " · 评论 %s", "index", "jokin");
$(".post-reposts").duoshuo("reposts", " · 转发 %s", "index", "jokin");

```

### priority
data-attr < settings < parameter
> parameter override the settings, settings override the data-attr

### default settings object
```javascript
{
attrText: "data-text",
attrKey: "data-thread-key",
attrName: "data-short-name",
defaultSymbol: "%s",
domain: "http://api.duoshuo.com",
shortName: "",
}
```
> you can override the settings by `$.Duoshuo.settings = {}`

### function call
> $(selector).duoshuo([[[["method"], "text"], "thread_key"], "short_name"])

## License

Under The [MIT](https://tldrlegal.com/license/mit-license) License