{"id":16781085,"url":"https://github.com/vanessa219/uvstat","last_synced_at":"2025-03-22T00:31:23.751Z","repository":{"id":36939034,"uuid":"231787907","full_name":"Vanessa219/uvstat","owner":"Vanessa219","description":"📈 B3log 分布式社区的浏览、评论计数组件，欢迎加入下一代社区网络。","archived":false,"fork":false,"pushed_at":"2023-03-02T10:56:12.000Z","size":901,"stargazers_count":6,"open_issues_count":12,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-23T02:51:27.160Z","etag":null,"topics":["b3log","statistics"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vanessa219.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://ld246.com/sponsor","open_collective":"b3log"}},"created_at":"2020-01-04T15:43:56.000Z","updated_at":"2024-08-13T04:32:26.000Z","dependencies_parsed_at":"2024-09-25T16:50:40.262Z","dependency_job_id":"f85407de-7736-45b8-add2-078746614325","html_url":"https://github.com/Vanessa219/uvstat","commit_stats":{"total_commits":38,"total_committers":3,"mean_commits":"12.666666666666666","dds":0.4473684210526315,"last_synced_commit":"1bc02b0c30be20e3b0b18e4ac25d68b95864bd42"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanessa219%2Fuvstat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanessa219%2Fuvstat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanessa219%2Fuvstat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanessa219%2Fuvstat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vanessa219","download_url":"https://codeload.github.com/Vanessa219/uvstat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221820696,"owners_count":16886223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["b3log","statistics"],"created_at":"2024-10-13T07:36:41.094Z","updated_at":"2024-10-28T11:20:04.333Z","avatar_url":"https://github.com/Vanessa219.png","language":"TypeScript","funding_links":["https://ld246.com/sponsor","https://opencollective.com/b3log"],"categories":[],"sub_categories":[],"readme":"## 💡 简介\n\n[uvstat](https://github.com/Vanessa219/uvstat) 📈 B3log 分布式社区的浏览、评论计数组件，欢迎加入下一代社区网络。\n\n## 🛠️ 使用文档\n\n### CommonJS\n\n* 安装依赖\n\n```shell\nnpm install uvstat --save\n```\n\n* 在代码中引入并初始化对象，可参考 [index.js](https://github.com/Vanessa219/uvstat/blob/master/demo/index.js)\n\n```ts\nimport Uvstat from 'uvstat'\n\nconst uvstat = new Uvstat()\nuvstat.renderStat()\nuvstat.renderCmtStat()\nuvstat.getStat(['http://localhost:9219']).then(stats =\u003e {\n  console.log('getStat: ', stats)\n})\nuvstat.addStat()\n```\n\n### HTML script\n\n* 在 HTML 中插入 js\n\n```html\n\u003c!-- ⚠️生产环境请指定版本号，如 https://cdn.jsdelivr.net/npm/uvstat@x.x.x/dist... --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/uvstat/dist/index.min.js\" defer\u003e\u003c/script\u003e\n```\n\n### 示例代码\n\n* [CommonJS](https://github.com/Vanessa219/uvstat/blob/master/demo/index.js)\n\n### API\n\n#### options\n\n||说明|默认值|\n|---|---|---|\n|cache|访问过的页面不再进行统计|true|\n|cacheId|localStorage 名称|'uvstat'|\n|loading|加载中的 svg|-|\n|location|计数 url 配置|-|\n|location.hash|是否统计 hash|false|\n|location.pathname|是否统计 pathname|true|\n|location.search|是否统计 search|false|\n|renderName|浏览计数元素中的 data 属性名称|'uvstaturl'|\n|renderCmtName|评论计数元素中的 data 属性名称|'uvstatcmt'|\n|cmtAPI|评论统计请求地址|'https://ld246.com/apis/vcomment/count'|\n|timeout|请求超时 ms|2000|\n|url|服务端请求地址|'https://ld246.com/uvstat'|\n\n\n#### methods\n\n||说明|\n|---|---|\n|getStat(urls: ICount[], timeout: number = 0)|获取给定 url 的浏览数|\n|getCmtStat(cmts: ICount[], timeout: number = 0)|获取给定帖子 id 的评论数|\n|addStat()|为当前页面添加计数|\n|renderStat()|浏览计数渲染|\n|renderCmtStat(after?: (element: HTMLElement, cnt: number) =\u003e void)|评论计数渲染|\n|clearCache()|清除缓存|\n\n## 欢迎关注 B3log 开源社区微信公众号 `B3log开源`\n\n![image-d3c00d78](https://user-images.githubusercontent.com/873584/71566370-0d312c00-2af2-11ea-8ea1-0d45d6f0db20.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanessa219%2Fuvstat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanessa219%2Fuvstat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanessa219%2Fuvstat/lists"}