通过Chrome扩展来批量复制知乎好友

.follow_them_box{
position: fixed;
right: 200px;
top: 200px;
background-color: #fff;
width: 80px;
height: 30px;
line-height: 30px;
text-align: center;
cursor: pointer;
background: #8ab923;
background-color: #9dcc4a;
background-image: linear-gradient(top,#adda4d,#86b846);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#adda4d', endColorstr='#86b846', GradientType=0);
text-shadow: 0 1px 0 rgba(255,255,255,.3);
border: 1px solid #6d8f29;
color: #3e5e00!important;
border-radius: 5px;
box-shadow: 0 1px 0 rgba(255,255,255,.5) inset,0 1px 0 rgba(0,0,0,.2);
}
.remove_box{
top: 260px;
}
{
"background": {
"persistent": false,
"scripts": [ "background.js" ]
},
"content_scripts": [ {
"css": [ "show_follow.css" ],
"exclude_matches": [ "http://www.zhihu.com/read" ],
"js": [ "jquery-2.1.1.min.js","show_follow.js"],
"matches": [ "http://www.zhihu.com/*" ]
} ],
"description": "批量收听指定用户的好友",
"icons": {
"128": "128.png",
"16": "16.png",
"48": "48.png"
},
"manifest_version": 2,
"name": "「批量+」",
"permissions": [ "storage" ],
"short_name": "批量+",
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "1.0"
}
jQuery(document).ready(function($) {
var z_url = "www.zhihu.com";
var follow = {
uchk_obj : $('.zm-profile-header-info-title'),
flink : $('.zm-profile-side-following>a').attr('href'),
fl_btn_obj : $('.zg-btn-follow'),
fl_them_div : '<div class="follow_them_box" id="follow_them_box" title="本按钮只在用户好友页有效,收听当前所有新人">follow them</div>',
remove_div : '<div class="follow_them_box remove_box" id="remove_box" title="清除页面中已经收听过的人">remove</div>',
hash_array : new Array(),
uchk : function(){
if (follow.uchk_obj.html() == '获得'){
return true;
}else{
console.info('uchk');
return false;
}
},
show_fl_btn : function(){
$('body').append(follow.fl_them_div);
$('body').append(follow.remove_div);
},
follow_user : function(uid,xsrf){
$.ajax({
url: '/node/MemberFollowBaseV2',
data: {method:'follow_member',
params:'{"hash_id":"'+uid+'"}',
_xsrf:xsrf
},
dataType: "text",
type: "POST",
success: function(response) {
}
});
},
//删除已收听过的人
remove_followed : function(){
$('#remove_box').on("click", function(){
var temp = '';
var uid = '' ;
//清空已收听
$('.zg-btn-unfollow').each(function(index, el) {
temp = $(this).html();
switch(temp){
case '取消关注':
$(this).parents('.zm-profile-section-item').css('display', 'none');
break;
default:
break;
}
});
});
},
follow_them : function(){
$('#follow_them_box').on("click", function(){
var xsrf = $("input[name='_xsrf']").val();
$('.zg-btn-follow').each(function(index, el) {
uid = $(this).attr('data-id');
$(this).parents('.zm-profile-section-item').css('display', 'none');
follow.hash_array.push(uid);
});
var times = 0;
var max_num = 0;
if (follow.hash_array.length < 50){
max_num = follow.hash_array.length;
}else{
max_num = 50;
}
var int=self.setInterval(function(){
follow.follow_user(follow.hash_array[times],xsrf);
times++;
if (times == max_num){
follow.hash_array = [];
int=window.clearInterval(int);
}
},1000);
});
}
};
if ( follow.uchk() ){
follow.show_fl_btn();
follow.remove_followed();
follow.follow_them();
}
});



收听完毕。
源文件 下载地址: https://github.com/Martin-Tan/zhi-follow
通过Chrome扩展来批量复制知乎好友的更多相关文章
- Chrome扩展程序——TabCopy:一键复制网页标题和网址
Chrome扩展程序——TabCopy:一键复制网页标题和网址 - Erik_ly的博客 - CSDN博客 https://blog.csdn.net/u012318074/article/detai ...
- 前端程序员必知的30个Chrome扩展-[转载]
谷歌Chrome浏览器是网络上可用的最好浏览器之一,并且自2011年11月超越了Firefox浏览器之后,已经成为了互联网上占主导地位的浏览器.今天,HTML5中国与大家分享一些实用的谷歌Chrome ...
- 分享一些好用的 Chrome 扩展
阅读本文大概需要 2.8 分钟. 前言 使用浏览器扩展程序可以使你的工作效率提高数倍不止,那么下面我就向大家分享一下我日常使用的扩展,可能大多数扩展大家都已经在使用了,不过也难免有一两个是你不知道的. ...
- Web 开发人员必备的12款 Chrome 扩展程序
之前已经分享过一些帮助 Web 开发人员和设计师的 Chrome 扩展,这次我们继续展示一组很有用的 Chrome 应用程序.这些免费的 Chrome 应用程序可以简化您的工作流程,为了加快您的工作流 ...
- Google Chrome 扩展程序开发
根据公司的规定,每月八小时,弹性工作制.所以大家平时来的不太准时,如果有事,下班也就早些回去了.所以一个月下来工作时间可能不够,但是公司的考勤日历是这样的: 除了请假和法定节假日外,其他样式显示都是一 ...
- 实现chrome扩展启动本地进程 - 补充
实现chrome扩展启动本地进程 - 补充 标签: chrome扩展启动本地程序访问本地磁盘 2014-10-17 11:42 6753人阅读 评论(17) 收藏 举报 分类: Chrome Plu ...
- Chrome扩展开发(Gmail附件管理助手)系列之〇——概述
目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...
- Chrome扩展开发之一——Chrome扩展的文件结构
目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...
- Chrome扩展开发之三——Chrome扩展中的数据本地存储和下载
目录: 0.Chrome扩展开发(Gmail附件管理助手)系列之〇——概述 1.Chrome扩展开发之一——Chrome扩展的文件结构 2.Chrome扩展开发之二——Chrome扩展中脚本的运行机制 ...
随机推荐
- [WPF]VS2019打包WPF程序
原文:[WPF]VS2019打包WPF程序 版权声明:本文为本人原创文章,未经博主允许不得转载. https://blog.csdn.net/m0_37316917/article/details/8 ...
- 后台返回的HTML整个页面代码打开方法
后台返回的html代码片段,需要插入html标签中,而返回的整个html文档,则需要重写整个页面. 解决方法: 需要一个中转页面,用document.write()方法重写整个页面: // POST任 ...
- hdfs的基本原理和基本操作总结
hdfs基本原理 Hadoop分布式文件系统(HDFS)被设计成适合执行在通用硬件(commodity hardware)上的分布式文件系统.它和现有的分布式文件系统有非常多共同点. 但同一时候,它和 ...
- jdk 8 lambda表达式以及Predicate接口
了解lambda之前先了解下什么是函数式接口,函数式接口即接口里必须有一个抽象方法(抽象的方法只能有一个,可以有其他的用default修饰的方法) jdk8里新增了一个@FunctionalInter ...
- Green the world :使用monkey_patch
eventlet的monkey_patch 用于绿化一些python的模块,看看以下的样例就明确了 urls = ["http://www.haha.mx/joke/1292935" ...
- java读取Properties文件及赋值
懒得整理了,直接复制我工程里的代码: 第一个读取文件的类可以直接复制, 不复制的话,在下面取值和赋值部分的代码new EmailProperRead(systemType).properties根据自 ...
- 浅谈Linux下各种压缩 解压命令和压缩比率对比
Linux下压缩.解压命令五花八门,不像在windows下一个winrar打遍天下无敌手,清一色的.rar .zip格式. 比如,Linux下常用的tar tar.gz tar.bz2 .Z等等不一而 ...
- Linux开关命令(shutdown,reboot,halt,init)
命令简短 shutdown,poweroff,reboot,halt,init都能够进行关机,大致使用方法. /sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] ...
- UVA 1347(POJ 2677) Tour(双色欧几里德旅行商问题)
Description John Doe, a skilled pilot, enjoys traveling. While on vacation, he rents a small plane a ...
- 2 WCF里面配置的含义
1 首先介绍所谓的a,b,c. a就是address 地址: b binding 绑定的协议 譬如http tcp udp 利用这些协议方式请求address: c contract 代表请求的规 ...