本帖最后由 riskstar 于 2015-10-15 14:53 编辑 / ]1 U% c% i( _& v3 V
% B, L/ ~" q7 E# y6 ^右键,审查元素 点击 Console ,然后复制下面代码在空白处后按回车,即可。如果到时候有优惠的商品,就不用担心了。
4 T, ]6 z" F8 z- // looping fetch
1 W, T: q3 K+ x) _- W/ B K - var once = function(){+ \1 F, ?2 _' z( F4 l
- // original author: https://v2ex.com/t/228164
$ j( G6 \! \6 j. ^7 r - (function(window, document) {
4 E9 y o ]% @* F! I - var interval = 800;
* H8 o5 P0 `) Z& } - var closeDelay = 200;: W- P4 B- G6 T0 H, ^% }
- var index = 0;6 {& d3 i2 S8 R K
- var couponLinks;% l/ T+ }0 M* k4 q# S3 w
- var getCoupon = function() {
' S3 N* Z* X4 l; B' H - if (index >= couponLinks.length) {& j4 b0 ~% ]) m; q& A; o, I* \
- console.log("领取完毕");
9 k2 g& }1 t- N V3 p - window.once();
. ?- v3 u9 E* T- G( F - return;
+ g4 z3 ]* n8 n) p- U - }
; B" O! z- y) e5 S4 i- V - var coponLink = couponLinks[index];& O! y$ {) v; r0 `* x
- coponLink.click(); index++;$ J% P2 `* @# W* f
- console.log("领取 第" + index + " 张");, H" l! ^6 I, A0 m
- setTimeout(getCoupon, interval);, R7 s g* j8 i5 \9 _
- setTimeout(function() {9 {# Z$ t+ @' S) U' U& s$ E
- var close = document.querySelector('.mui-dialog-close');
1 n% Y# k9 f" m) @4 E. | - if (close != null) close.click();% _1 H" Z; _5 Y0 E4 v0 k' M
- }, closeDelay);
0 K! t& t% a$ A& l1 R( Y - }! u2 I. I& V# h, B) K' T! L' r* @
- var _scrollTop = 0;
$ N6 N' d; g3 s4 u# u8 D" e0 k$ { - var _scrollStep = document.documentElement.clientHeight;
, w/ U( \* P: j+ T8 M1 h$ H - var _maxScrollTop = document.body.clientHeight - document.documentElement.clientHeight; l, A9 W6 ~% F
- var autoScrollDown = setInterval(function() {5 Y6 r/ N4 ?8 c k% q
- _scrollTop += _scrollStep; i5 ^* Z! g, }! s: P# S
- if (_scrollTop > _maxScrollTop) {: {6 G4 R( F& n- w9 Q5 ~
- clearInterval(autoScrollDown);
6 n% b% T! o5 P% Q q! C2 Z - couponLinks = document.querySelectorAll('.mui-act-item-yhqbtn');) b0 f& w' J4 |" a) t7 g, N/ I7 \
- console.log("总共:" + couponLinks.length + "条张优惠券待领取...");
* g" L) ~0 i2 u2 N. w - getCoupon();
1 J+ {6 o1 R7 E" P$ a% C1 q - } else {. B3 E7 g0 z$ ]+ J4 q, s1 a, J) w
- document.body.scrollTop = _scrollTop;5 k/ }" G4 `5 }; m# `5 L/ m+ K
- }
6 j- J9 S7 W$ m4 |3 c - }, 500);3 V+ W# h3 [$ z% [/ c7 j( e
- }) (window, document);" i/ `, B& ~* J0 a7 k1 {0 U
- }" y, s- k+ ^- f- A
- once();
复制代码
1 J# t5 f- L1 `1 T9 @/ @2 A% b 然后领光所有优惠卷了! ) e" k4 G/ V& x q
重要提示:一定要先登录天猫再撸 + K( S1 a) c: g: Z; K2 Y! q( ]
|