xcss / valine Goto Github PK
View Code? Open in Web Editor NEWA fast, simple & powerful comment system.
Home Page: https://valine.js.org
License: GNU General Public License v2.0
A fast, simple & powerful comment system.
Home Page: https://valine.js.org
License: GNU General Public License v2.0
新版本不显示原来的评论。但是新评论的内容显示正常。
目前 unpkg 在国内的速度实在太慢了。而且官方网站提供的加载方式是阻塞模式的,遇到网络不好的时候会阻塞页面里其他脚本的加载,这个体验是非常不好的。(disqus使用了iframe方式避免了这个问题)。下面我的一个小建议:
window.VALINECONFIG = {
el: '#comment',
notify: false,
verify: false
}
<script src=".../Valine.min.js?config=VALINECONFIG" async></script>
附上一个我目前使用的解决方案:
function loadValine() {
const config = window["VALINECONFIG"];
if (!config) return;
const urls = [`//cdn1.lncld.net/static/js/3.0.4/av-min.js`,`//unpkg.com/valine/dist/Valine.min.js`];
const asyncloader = url =>
new Promise((resolve, reject) => {
const script = document.createElement("script");
script.src = url;
script.addEventListener("load", _ => resolve(), false);
script.addEventListener("error", _ => reject(), false);
document.body.appendChild(script);
});
Promise.all(urls.map(asyncloader))
.then(() => new window["Valine"](config))
.catch(e => U.log("load Valine Failed,", e));
}
第一次调用valine.init 是ok的,后面都不行了
Hi,我在 _config.yml
里使用了下面的配置,发现当 blog 里有新的 comment 时并未收到邮件提醒。
valine:
enable: true ## if you want to use Valine comment system, please set the value to true
appid: myappid ## your leancloud application appid
appkey: myappkey ## your leancloud application appkey
notify: true ## mail notifier , https://github.com/xCss/Valine/wiki
verify: true ## Verification code
placeholder: Just go go ## comment input placeholder text
avatar: 'wavatar' ## header image https://github.com/xCss/Valine/wiki
pageSize: 10 ##
guest_info: nick,mail
Thanks!
加一个自定义最大字数的设置项
如题,如果也需要同步更新的话还请告知。
如题。
环境Chrome 57.0.2987.133
系统Ubuntu 17.04
在https://valine.js.org/try.html中测试,不能输入空格还有回车,是过滤掉了么,还是什么原因,不知道是不是我自身浏览器的原因,换了同事的win7 chrome也是不能键入空格和回车。
版本信息: hexo-theme-next | Merged v1.1.7-rc3
因为邮箱提醒还在内测中,并没有将此功能加入我的博客系统,但自己用了一下之后,有几点体验问题想跟作者提一下醒。
在邮件提醒中就是 leancloud 那边的邮件模板设置中能够提供几个变量来获取相应的内容。
当前 Valine 没有配置项导致 nick,mail,website 三者全为空也可以提交,希望增加对必输项的检测配置。
{% if page.comments and theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//cdn.jsdelivr.net/gh/xcss/[email protected]/dist/Valine.min.js"></script>
<script type="text/javascript">
new Valine({
av: AV,
el: '#comments' ,
verify: {{ theme.valine.verify }},
notify: {{ theme.valine.notify }},
app_id: '{{ theme.valine.appid }}',
app_key: '{{ theme.valine.appkey }}',
placeholder: '{{ theme.valine.placeholder }}'
});
</script>
{% endif %}
这边的配置项少了几个,比如 avatar
, path
Thanks for your excellent work and I love it so much. However I can't apply this to my hexo-site.
I am using hexo-material-theme and I had tried to ported it by myself but I failed.
Thought I do konw nothing about WebDev, I tried to followed your guide and hexo-material-theme comment adaptation guide but get some worng:
ERROR Script load failed: themes/Material/scripts/lib/Valine.min.js
ReferenceError: window is not defined
at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:19484
at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:19439
at n.exports (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:19939)
at Object.<anonymous> (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:2732)
at e (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:390)
at Object.<anonymous> (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:3204)
at e (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:390)
at Object.defineProperty.value (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:773)
at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:782
at t (/mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:146)
at /mnt/d/Documents/Blog/themes/Material/scripts/lib/Valine.min.js:1:267
at /mnt/d/Documents/Blog/node_modules/hexo/lib/hexo/index.js:232:12
at tryCatcher (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._resolveCallback (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:432:57)
at Promise._settlePromiseFromHandler (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:524:17)
at Promise._settlePromise (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/mnt/d/Documents/Blog/node_modules/bluebird/js/release/promise.js:614:10)
Here is my environment Info:
hexo: 3.3.8
hexo-cli: 1.0.3
os: Linux 4.4.0-43-Microsoft linux x64
http_parser: 2.7.0
node: 8.1.4
v8: 5.8.283.41
uv: 1.12.0
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
openssl: 1.0.2l
icu: 59.1
unicode: 9.0
cldr: 31.0.1
tz: 2017b
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
May be you can give me some suggestion or do it by yourself out of kindness.
My English is poor and I can provide Chinese version if you want.
Thanks again.
<!--
会自动查找网页中class值为valine-comment-count的元素并自动填充查询结果
pathname = /2017/add-valine-comments-to-your-blog/
-->
<span class="valine-comment-count" data-xid="pathname"></span>
pathname已经成功获取了,但是在index页依然无效。
如题。。。
Demo(依然是这个):https://www.acgfclub.win
版本:v1.1.8-rc3
网站需要保证邮箱保密其实是因为WP和TE下自带评论习惯了。
可否对输出评论者的网站链接进行自定义,如果没有输入网站链接就直接取消超链接。
TypeError: Cannot read property 'slice' of undefined
Valine:1.1.6
Uncaught TypeError: Cannot redefine property: applicationId
at Function.defineProperty (<anonymous>)
at av-min.js:1
at Array.forEach (<anonymous>)
at Object.<anonymous> (av-min.js:1)
at e (av-min.js:1)
at Object.t.exports (av-min.js:8)
at e (av-min.js:1)
at u (av-min.js:1)
at av-min.js:1
at av-min.js:1
正常访问和评论没有问题,但刷新页面评论区就显示undefined。
什么时候评论能接入QQ 微信 微博 谷歌 等账号吗
report a error in chrome55.
file: Valine.min.js:1
error:
The target element was not found.
Valine1.1.4 https://github.com/xCss/Valine/issues
无意中看到了一个这么好的评论系统:heart_eyes:,可是到官网看教程只有Hexo的安装教程,Jekyll怎么装呢?也是类似的吗?:bowtie:
顺便反馈一个小Bug,就是评论框IE11内核无法输入中文:see_no_evil:
{
"name": "valine",
"version": "1.1.8",
"description": "A simple comment system based on Leancloud.",
"main": "/src/Valine.js",
"author": "xCss <[email protected]> (https://github.com/xCss)",
"scripts": {
"test": "webpack",
"build": "webpack",
"dev": "webpack-dev-server --env.dev",
"clear": "rm -rf dist/* "
}
...
}
上述package.json里面把main指向了src/Valine.js
,然而整个安装目录里面并没有src
这个文件夹.
主题使用pjax,切换页面时不刷新整个页面。会出现下面的问题:
第一次加载页面,评论框可以正常使用,但是切换其他页面后(没有刷新整个页面),评论框下就显示TypeError: Cannot read property 'Query' of undefined
,需要刷新整个页面才能使用。
这个 _root 中没有 v 这个属性。
刷新整个页面时,第一次执行到这句话是有 v 这个属性。
但是异步加载第二个页面后,第二次执行到这句话是没有 v 这个属性的。
博客系统:hexo
主题:hexo-theme-3-hexo
valine版本:v1.1.9-beta4
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
<div id="comments"></div>
<script>
var notify = '<%= theme.valine.notify %>' == true ? true : false;
var verify = '<%= theme.valine.verify %>' == true ? true : false;
new Valine({
el: '#comments',
notify: notify,
verify: verify,
app_id: "<%= theme.valine.appid %>",
app_key: "<%= theme.valine.appkey %>",
placeholder: "<%= theme.valine.placeholder %>",
avatar:"<%= theme.valine.avatar %>",
path: '<%=url%>'
});
</script>
我想了解下头像是怎么实现的,有的人在给文章评论时候,他的头像是特殊的,和默认的不一致,这个是怎么实现的呢?是根据邮箱匹配头像的吗?
Valine版本v1.1.8-rc4
我使用的是 hexo-theme-material,有关配置如下
comment:
use: valine
valine_leancloud_appId: ***********
valine_leancloud_appKey: ***********
valine_notify: true # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
valine_verify: true # valine verify code (true/false)
valine_pageSize: 10 # comment list page size
valine_avatar: identicon # gravatar style https://valine.js.org/#/avatar
valine_lang: zh-cn # i18n
valine_placeholder: 评论啊,快活啊! # valine comment input placeholder(like: Please leave your footprints )
valine_guest_info: nick,mail,link #valine comment header info
目前评论可以正常工作,但是无法收到邮件提醒(评论已有评论)
https://jakting.com
版本信息: hexo-theme-next | Merged v1.1.7-rc3
在实际使用中,有些用户并没有想填写网址的意愿,怎么设置
无论何种配置 <script ... /> 前缀,老是报这个
请问这个评论系统与 leancloud.cn
上的应用有什么关系
请原谅我不是一个程序员。希望得到一个解答
“暂时没有评论,快来抢沙发”有时与博客的氛围很不搭啊23333,希望可以自定义这个字段
评论框和评论在firefox和edge中字体太小了,在chrome中显示正常
需求和 #53 类似, 建议添加获取最近 x 条评论的接口 (可以做限制)。 以便实现和 WordPress 最近回复的类似功能。
小意见:
<script async="async"
or <script defer="defer"
Valine:1.1.7-rc3
部署后,打开主页,评论框下面出现这个问题,appid和appkey均检查了几遍无误。另外,在评论框输入内容,点击回复时,无反应,也无法评论。请教一下,谢谢。
NickName的placeholder如何设置?
似乎和 Markdown 冲突了
在next中配置valine后,首页报错The target element was not found.
另外希望在首页中能加入评论显示数量
(。・∀・)ノ゙嗨,这个项目很棒。
理念上 Leancloud 和 Firebase 的后端是一致的,我想是否可以添加 Firebase 后端支持,现在 Firebase 在大陆访问速度也是可以的。
If you want to report a bug, please provide the following information:
为了快速预览留言,根据hexo的阅读排行榜做了个留言板。通过REST API访问
这个我也不懂,求助
CTRL+F5
强制刷新才出得来返回值已修改了二级服务器还是没有用
<p align="justfly" id="heheda"><br></font></p>
<script src="/static/js/av-core-mini-0.6.4.js"></script>
<script>AV.initialize("uIrzS1i60S024CvU6ATzr4y7-gzGzoHsz", "9o0rnB856nyqXPURwBBncFkR");</script>
<script type="text/javascript">
var num=50
var comment=""
var url=""
var nick=""
var query = new AV.Query('Comment');
query.notEqualTo('id',0);
query.descending('createdAt')
query.limit(num);
query.find().then(function (todo) {
for (var i=0;i<num;i++){
var result=todo[i].attributes;
comment=result.comment;
url=result.url;
nick=result.nick;
var updatedAt = todo[i].updatedAt;
var content="<blockquote>"+"<font size=2>"+"<a href='"+"https://sli1989.github.io"+url+"#comments"+"'>"+"<font color='#9932CC'>"+nick+"</font>"+"</a>"+" commented on "+updatedAt+":"+"<br>"+comment+"</font>"+"<blockquote>";
document.getElementById("heheda").innerHTML+=content
}
}, function (error) {
console.log("error");
});
</script>
已经完美融入我的主题了,但是我想在首页每个文章摘要中显示,没找到相应接口。
是我没找到,还是?
求建议。
_config.yml
valine:
notify: true
verify: false
我的配置如上,只开启了邮箱提醒不开启验证码验证,然后会默认开启验证码,嗯~ o( ̄▽ ̄)o,对于算术验证这种反人类的验证我是不喜欢的,楼主可以添加其他验证方法,比如滑块的验证,字母数字组合验证
特别喜欢,如果验证码正常点就好了,两位数相乘就过分了,因为既然只是过滤垃圾,那么复杂性恰是不必要的,换成十以内两个数之间计算也好啊。还有如果可以过滤整合akismet,验证码也能省去了,还有gravator头像的支持?
移动端头像无法显示
这个东西怎么在hexo搞
Markdown is "Supported
".
NOT "Support".
Right?
找了一圈没找到
不知道是没有这个API还是忘了写233
您好,这个评论系统很赞,有考虑支持新浪微博登录吗?
显示错误:
ReferenceError: AV is not defined
Valine:1.1.7
反馈:https://github.com/xCss/Valine/issues
然后修改 code 为
var valine = new Valine({
av: AV,
el:'#vcomments',
...
})
然后评论框消失
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.