CSDN实现自动评论之后还能回到最上面

JS共两个

1,自动评论旧版本CSDN 秒数为4整数倍的评论!

2,自动评论旧版本CSDN

第一个JS:

 1 // ==UserScript==
 2 // @name         自动评论旧版本CSDN 秒数为4整数倍的评论!
 3 // @namespace    http://tampermonkey.net/
 4 // @version      0.1
 5 // @description  try to take over the world!
 6 // @author       You
 7 // @match        https://blog.csdn.net/*
 8 // @grant        none
 9 // ==/UserScript==
10 (function() {
11     // 等待两秒钟再进行评论
12     setTimeout(function(){
13 
14         var c=["本条消息自动评论。","别看啦,程序自己写的评论","喧闹的世界,收下这条来自机器的评论吧!","花不凋零,水不流!","890"];
15         var n = -1;
16         var m = 5;
17         var temp_count = Math.floor(Math.random()*(n-m+1))+m;//取m-n之间的随机数 [m,n]
18 
19                 //document.getElementsByClassName("btn-comments")[1].click();//能够滑到旧版评论区啦
20 
21         //document.getElementById("comment_content").value = c[temp_count];//能够赋值啦
22 
23         var time = new Date();
24 var name = document.getElementsByClassName("follow-nickName")[0].text;
25 
26         document.getElementById("comment_content").value ="我在: " +time.getFullYear()+"年 "+(time.getMonth()+1)+"月 "+time.getDate()+"日   "+time.getHours()+":"+time.getMinutes()+":"+time.getSeconds()+"  看过本篇博客!";//评论时间
27         if ((time.getSeconds()%4) == 0){
28             if(name != "dream_uping"){
29                                     document.getElementsByClassName("btn-comment")[0].click();//发表评论成功!
30                         alert(name);
31             }
32         }
33             document.documentElement.scrollTop=0;
34 
35 
36 
37 },2000);//ajax do something
38 
39 
40 })();

第二个JS:自动评论旧版本CSDN

 1 // ==UserScript==
 2 // @name         自动评论旧版本CSDN
 3 // @namespace    http://tampermonkey.net/
 4 // @version      0.1
 5 // @description  try to take over the world!
 6 // @author       You
 7 // @match        https://blog.csdn.net/weixin_42859280/*
 8 // @grant        none
 9 // ==/UserScript==
10 function click1() {
11 
12     // 等待两秒钟再进行评论
13         var time = new Date();
14         document.getElementById("comment_content").value ="我在: " +time.getFullYear()+"年 "+(time.getMonth()+1)+"月 "+time.getDate()+"日   "+time.getHours()+":"+time.getMinutes()+":"+time.getSeconds()+"  看过本篇博客!";//评论时间
15         document.getElementsByClassName("btn-comment")[0].click();//发表评论成功!
16 }
17 function totop() {
18 
19     // 等待两秒钟再进行评论
20      //document.documentElement.scrollTop=0;
21     window.scrollTo( 0, 0 );
22         alert('888');
23 }
24 
25     setTimeout(click1(),2000);//ajax do something
26     //setTimeout(totop(),5000);//ajax do something
原文地址:https://www.cnblogs.com/hwpbetter/p/12925868.html