csdn新版更新,更新一下自动点赞CSDN博客的JS脚本!

大佬止步,不喜勿喷。

不废话,放代码:

 1 // ==UserScript==
 2 // @name         自动点赞新版
 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 
11 (function() {
12     'use strict';
13     // Your code here...
14     //没有点赞,自动点赞
15 
16     if(document.getElementsByClassName("is-like")[0].innerHTML.search("点赞") != -1){
17     document.getElementsByClassName("is-like")[0].click();
18     }
19 })();

原始没有点赞的网页格式:

【右键查看源代码即可!】


已经点赞的:【这次都是两个字:点赞,已赞。匹配汉字长度行不通啦。那就通过serch函数查找的方法来实现啦!】

​ 

查找未点赞出现的:

1 alert(document.getElementsByClassName("is-like")[0].innerHTML.search("点赞"));


在已经点过赞的页面运行同样的代码:

 

OK。讲解完毕! 

后期,等有空了。会搞一个自动评论的JS脚本!

猜你喜欢

转载自www.cnblogs.com/hwpbetter/p/12724490.html
今日推荐