本帖最后由 riskstar 于 2015-10-15 14:53 编辑 : m+ C/ \) N Y! V6 L8 Q4 M
" v# e& K! T( P1 w/ \/ N
右键,审查元素 点击 Console ,然后复制下面代码在空白处后按回车,即可。如果到时候有优惠的商品,就不用担心了。2 H) P9 I7 A0 t
- // looping fetch
6 B7 a/ k) d* V0 v9 q) K+ c2 [4 g3 O - var once = function(){
' B5 _1 F5 Q$ G2 t - // original author: https://v2ex.com/t/228164
# h% N+ n7 d) [' L4 u - (function(window, document) {
" E% x( F+ L! I: B* F - var interval = 800;+ x4 v" `, k, B1 U. s" ^4 z0 C
- var closeDelay = 200;
c+ L& h8 A" U4 s, i/ p4 f3 ~ - var index = 0;
# z2 z7 C: t/ u5 ?* ~4 `, A; u6 W# a - var couponLinks;
$ Z5 f/ \4 i4 P5 t) u# Z& W - var getCoupon = function() {
/ G6 X% c% l3 `$ t1 h+ `( D* j4 o - if (index >= couponLinks.length) {
- b4 |7 \. ~$ E: c6 X - console.log("领取完毕");5 Y( w2 {# t/ `3 E
- window.once();/ A$ _& J( |# o3 K" b5 p2 O5 Z
- return;
8 L3 r y- |, r e - }
D+ P1 m8 P/ A0 n0 E, x - var coponLink = couponLinks[index];
. a7 c( E4 B* | - coponLink.click(); index++;
+ Y& r2 V3 x( h; r& Y6 X - console.log("领取 第" + index + " 张");
, i, w, @& C9 R# f - setTimeout(getCoupon, interval);
. E3 {) L+ |% \6 H- K" f! ` - setTimeout(function() {
/ p! U8 E3 y' s - var close = document.querySelector('.mui-dialog-close');7 @6 A j2 q+ g6 i
- if (close != null) close.click();
: _9 d6 `( f& Z2 M% ~! E, L - }, closeDelay);
0 Q& n& P/ Y9 B. M$ } - } [, V& ]. K8 I- J4 E8 G$ X: p- }
- var _scrollTop = 0;
3 q/ P, ]) O; C s& x - var _scrollStep = document.documentElement.clientHeight;
! x0 Y$ I! s$ ?1 Q - var _maxScrollTop = document.body.clientHeight - document.documentElement.clientHeight;- Q4 u4 G6 e- d7 p3 a- V
- var autoScrollDown = setInterval(function() {, L) y2 L7 A6 C# u* k& ^+ {5 D
- _scrollTop += _scrollStep;
/ A5 A& C6 t. s: U& f. K - if (_scrollTop > _maxScrollTop) {
/ h; i, P$ Q& V1 W - clearInterval(autoScrollDown);
; E4 y3 g+ @# q0 N+ W' Z - couponLinks = document.querySelectorAll('.mui-act-item-yhqbtn');$ r6 l9 i, M+ |# A, |, G
- console.log("总共:" + couponLinks.length + "条张优惠券待领取...");6 g! M$ A& G$ a
- getCoupon();
: ~* \. `* x. n - } else {* }9 o; ~4 [, Z8 D$ t' q0 \+ e
- document.body.scrollTop = _scrollTop;
6 Z. ]* f. l4 m& h# T. H' B - }
# P. }0 t6 Z# B5 @9 F4 n7 t - }, 500);
$ Z7 G' c6 }8 [ V+ ~6 p: E - }) (window, document);/ _1 q- T; X6 D' I- _& k: o
- }
3 ^3 \$ N2 l2 g$ h3 h3 V - once();
复制代码
4 @* H& Y5 [: c 然后领光所有优惠卷了!
2 u6 q6 F8 e: k4 M5 w" W2 |$ ]$ L) Q重要提示:一定要先登录天猫再撸
. @+ I9 r# }' C9 U& X |