-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
防止多次点击刷屏操作 #52
base: master
Are you sure you want to change the base?
The head ref may contain hidden characters: "hwx-2018319903003-\u9632\u6B62\u5237\u5C4F"
防止多次点击刷屏操作 #52
Conversation
多次点击发表评论,系统提示请勿刷屏
templates/article.html
Outdated
@@ -130,8 +131,21 @@ <h2 class="card-title">{{ article.title }}</h2><!--title--> | |||
<textarea class="form-control" rows="3" name="body" placeholder="write something here..." required="required"></textarea> | |||
</div> | |||
|
|||
<button class="btn btn-primary" type="submit" style="float:right">comment</button> | |||
<button id="btn" class="btn btn-primary" type="submit" style="float:right" onClick="prevent()">comment</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you have the prevent()
method, which is not defined anywhere?
Could you remove onClick="prevent()
if it is no longer needed?
-Hui
// 第一种 通过点击事件 | ||
var clicktag = 1; | ||
btn.onclick = function () { | ||
if (clicktag == 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
templates/article.html
Outdated
btn.onclick = function () { | ||
if (clicktag == 3) { | ||
alert("请勿频繁点击!"); | ||
setTimeout(function () { clicktag = 0 }, 5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you show that your changes work when the software is running. -Hui |
------------------ 原始邮件 ------------------
发件人: "lanlab-org/OAPS-TreeLib" <notifications@github.com>;
发送时间: 2021年1月5日(星期二) 下午2:35
收件人: "lanlab-org/OAPS-TreeLib"<OAPS-TreeLib@noreply.github.com>;
抄送: "1020193782"<1020193782@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [lanlab-org/OAPS-TreeLib] 防止多次点击刷屏操作 (#52)
@1500h
Could you show that your changes work when the software is running.
…-Hui
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I was going to write a function of prevent (). Later, I found that I just need to add an ID instead of onclick = "prevent ()", and I forgot to delete it
…------------------ 原始邮件 ------------------
发件人: "lanlab-org/OAPS-TreeLib" <notifications@github.com>;
发送时间: 2021年1月5日(星期二) 下午2:27
收件人: "lanlab-org/OAPS-TreeLib"<OAPS-TreeLib@noreply.github.com>;
抄送: "1020193782"<1020193782@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [lanlab-org/OAPS-TreeLib] 防止多次点击刷屏操作 (#52)
@spm2020spring commented on this pull request.
In templates/article.html:
> @@ -130,8 +131,21 @@ <h2 class="card-title">{{ article.title }}</h2><!--title--> <textarea class="form-control" rows="3" name="body" placeholder="write something here..." required="required"></textarea> </div> - <button class="btn btn-primary" type="submit" style="float:right">comment</button> + <button id="btn" class="btn btn-primary" type="submit" style="float:right" onClick="prevent()">comment</button>
@1500h
Why do you have the prevent() method, which is not defined anywhere?
-Hui
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
It can be set to one minute,change 5000 to 5000*60
…------------------ 原始邮件 ------------------
发件人: "lanlab-org/OAPS-TreeLib" <notifications@github.com>;
发送时间: 2021年1月5日(星期二) 下午2:30
收件人: "lanlab-org/OAPS-TreeLib"<OAPS-TreeLib@noreply.github.com>;
抄送: "1020193782"<1020193782@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [lanlab-org/OAPS-TreeLib] 防止多次点击刷屏操作 (#52)
@spm2020spring commented on this pull request.
In templates/article.html:
> </form> + <script type="text/javascript"> + // 第一种 通过点击事件 + var clicktag = 1; + btn.onclick = function () { + if (clicktag == 3) { + alert("请勿频繁点击!"); + setTimeout(function () { clicktag = 0 }, 5000);
@1500h
Probably you want to use a bigger number than 5000, as a more serious warning.
-Hui
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
4 and 5 are also OK. It mainly depends on the requirements for creating this project. It has been operated frequently for three times
…------------------ 原始邮件 ------------------
发件人: "lanlab-org/OAPS-TreeLib" <notifications@github.com>;
发送时间: 2021年1月5日(星期二) 下午2:28
收件人: "lanlab-org/OAPS-TreeLib"<OAPS-TreeLib@noreply.github.com>;
抄送: "1020193782"<1020193782@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [lanlab-org/OAPS-TreeLib] 防止多次点击刷屏操作 (#52)
@spm2020spring commented on this pull request.
In templates/article.html:
> </form> + <script type="text/javascript"> + // 第一种 通过点击事件 + var clicktag = 1; + btn.onclick = function () { + if (clicktag == 3) {
@1500h
Why do you choose 3, instead of 4 or 5?
-Hui
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Thanks. Could you delete -Hui |
Push a new commit already
…------------------ 原始邮件 ------------------
发件人: "lanlab-org/OAPS-TreeLib" <notifications@github.com>;
发送时间: 2021年1月6日(星期三) 晚上9:36
收件人: "lanlab-org/OAPS-TreeLib"<OAPS-TreeLib@noreply.github.com>;
抄送: "1020193782"<1020193782@qq.com>;"Mention"<mention@noreply.github.com>;
主题: Re: [lanlab-org/OAPS-TreeLib] 防止多次点击刷屏操作 (#52)
@1500h
Thanks. Could you delete onClick="prevent()" and change to 5000 to 60000? Push a new commit after you made these changes.
-Hui
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
多次点击发表评论,系统提示请勿刷屏
By