码迷,mamicode.com
首页 > 其他好文 > 详细

11.11 双十一 前端教你一键领取天猫千张优惠券 (领前先想想有没有钱花这些优惠券)

时间:2015-10-23 13:31:49      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

0.登录你的淘宝账号

 

1.活动页面

https://www.tmall.com/wow/act/14700/fenqiyushou
https://www.tmall.com/wow/act/14700/ysshuma
https://www.tmall.com/wow/act/14700/jzyshc
https://www.tmall.com/wow/act/14700/jcyshc
https://www.tmall.com/wow/act/14700/jjyshc
https://www.tmall.com/wow/act/14700/zxdzyc
https://www.tmall.com/wow/act/14700/nzysab
https://www.tmall.com/wow/act/14700/cpys
https://www.tmall.com/wow/act/14700/nzys
https://www.tmall.com/wow/act/14700/yxhwys
https://www.tmall.com/wow/act/14700/shoes
https://www.tmall.com/wow/act/14700/nyys
https://www.tmall.com/wow/act/14700/xbfp
https://www.tmall.com/wow/act/14700/mzzs
https://www.tmall.com/wow/act/14700/zbpsys
https://www.tmall.com/wow/act/14700/mzys
https://www.tmall.com/wow/act/14700/jfbyys
https://www.tmall.com/wow/act/14700/jjcfys
https://www.tmall.com/wow/act/14700/shkxyushou
https://www.tmall.com/wow/act/14700/myys
https://www.tmall.com/wow/act/14700/ghjq
https://www.tmall.com/wow/act/14700/spys
https://www.tmall.com/wow/act/14700/yybjys
https://www.tmall.com/wow/act/14700/guojiyushou
https://www.tmall.com/wow/act/14700/tsyq

 

 

2.打开chrome游览器,进入每个活动页面,按下F12,出现

技术分享

 

 

3.贴代码:

(function(window, document, undefined) {

var interval = 800;

var closeDelay = 200;

var index = 0;

var couponLinks;

var getCoupon = function() {

if (index >= couponLinks.length) {

console.log("领取完毕");

return;

}

var coponLink = couponLinks[index];

coponLink.click(); index++;

console.log("领取 第" + index + " 张");

setTimeout(getCoupon, interval);

setTimeout(function() {

var close = document.querySelector(‘.mui-dialog-close‘);

if (close != null) close.click();

}, closeDelay);

}

var _scrollTop = 0;

var _scrollStep = document.documentElement.clientHeight;

var _maxScrollTop = document.body.clientHeight - document.documentElement.clientHeight;

var autoScrollDown = setInterval(function() {

_scrollTop += _scrollStep;

if (_scrollTop > _maxScrollTop) {

clearInterval(autoScrollDown);

couponLinks = document.querySelectorAll(‘.j_ReceiveCoupon‘);

console.log("总共:" + couponLinks.length + "条张优惠券待领取...");

getCoupon();

} else {

document.body.scrollTop = _scrollTop;

}

}, 500);

}) (window, document); 

 

 
 
4.按下回车键坐等吧
 
 
5.进入淘宝,查看领了多少张优惠券
技术分享
 

11.11 双十一 前端教你一键领取天猫千张优惠券 (领前先想想有没有钱花这些优惠券)

标签:

原文地址:http://www.cnblogs.com/cynthia-wuqian/p/4904189.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!