本帖最后由 riskstar 于 2015-10-15 14:53 编辑 5 d9 V* _% t5 z4 D: V
# s5 `2 o$ ?2 j( V; q& I
右键,审查元素 点击 Console ,然后复制下面代码在空白处后按回车,即可。如果到时候有优惠的商品,就不用担心了。
; H# i2 H- s" J* u7 N/ X* a- // looping fetch; n( B, v! V5 L2 C- \8 d, O
- var once = function(){( X9 c- r+ G4 M2 W7 R2 n
- // original author: https://v2ex.com/t/228164
% V: E: y, L: p+ n - (function(window, document) {
6 e0 @% o7 n5 @) L) i8 C - var interval = 800;
5 D1 F" Z4 A) u. q& N( h) F - var closeDelay = 200;
# a6 z) ` Z3 P0 b, G& k6 \ - var index = 0;
5 p) ~! q: K6 E$ n7 Q4 k - var couponLinks;' @$ u1 y8 t& F7 z0 `7 O i4 h/ ]
- var getCoupon = function() {
. ~9 l. E) S, c* G$ L - if (index >= couponLinks.length) {& o* \1 g# r- b
- console.log("领取完毕");
# r9 o% A3 \# \, ?, t6 v - window.once();
% M6 h; R8 a* T5 z - return;
" W5 y/ j! L, t% D0 j. L - }* {6 w' W) W# h( x# H- i
- var coponLink = couponLinks[index];
- K0 Q5 `* R# a1 `$ a- O0 j - coponLink.click(); index++;, e6 q; L+ ] \/ A2 d4 Y( j
- console.log("领取 第" + index + " 张");+ s9 i( b, P" ]% U/ t
- setTimeout(getCoupon, interval);/ [; D) Q- }) v1 R
- setTimeout(function() {
# k, D( p C, |4 Q* r. C2 M9 w - var close = document.querySelector('.mui-dialog-close');
; r% F# o# d. V3 b$ N" W - if (close != null) close.click();
" e1 I4 m2 B( l, ]. L - }, closeDelay);
: T- t' q/ f# | - }
! o; d! [& b/ A4 u w, D - var _scrollTop = 0;+ C6 M% O* T/ Y1 g0 r% `
- var _scrollStep = document.documentElement.clientHeight;
: t+ y3 |& n0 { U k5 E/ i: q1 N - var _maxScrollTop = document.body.clientHeight - document.documentElement.clientHeight;
( x9 W5 ^% L, d. S2 |: Z - var autoScrollDown = setInterval(function() {, G3 w$ x2 \8 }
- _scrollTop += _scrollStep;
& Q5 s- [' [- i5 y- X! ^; G( f - if (_scrollTop > _maxScrollTop) {% [2 w5 Q+ E+ |( F7 w: d
- clearInterval(autoScrollDown);' d# v1 z A/ J/ f
- couponLinks = document.querySelectorAll('.mui-act-item-yhqbtn');/ g5 o& l+ L' l9 z/ }
- console.log("总共:" + couponLinks.length + "条张优惠券待领取...");3 `8 h) l/ Q6 Q E5 `2 A+ _) H
- getCoupon();; r E1 B5 n% {: D M& q
- } else {
* H+ K: ^/ o, A4 C1 [' ^8 t7 | - document.body.scrollTop = _scrollTop;0 v9 d/ ?& M: Y0 a5 x! k
- }7 P1 |* X |; _" _
- }, 500);
0 [, d& l; T4 q" |( ?, S: N - }) (window, document);0 z& e Z4 Y2 K! D
- }) O* O0 Z( M7 Y F
- once();
复制代码 / l( E& N2 b* Z# M
然后领光所有优惠卷了! 1 z" h4 o5 {( M- f9 a& u
重要提示:一定要先登录天猫再撸 % P) S9 v0 {& p' Y
|