Advertisement
hivefans

sellxm

May 26th, 2014
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function() {
  2.     var FuckXiaoMi = {
  3.         // 2135100018 红米手機
  4.         // 2130100011 行動電源 10400
  5.         // 2141300041 行動電源 5200
  6.         product: ['2141300041'],
  7.         timer: null,
  8.         speed: 500,
  9.         count: 2,    // 單品購買數量
  10.         delay: 4000, // 跳轉延遲
  11.         start: function() {
  12.             var products = FuckXiaoMi.product;
  13.             this.timer = window.setInterval(FuckXiaoMi.send, FuckXiaoMi.speed);
  14.         },
  15.  
  16.         send: function() {
  17.             var products = FuckXiaoMi.product;
  18.             var count = FuckXiaoMi.count;
  19.             var delay = FuckXiaoMi.delay;
  20.             $.each(products, function(index, product) {
  21.                 $.ajax({
  22.                     url: "http://tp.hd.mi.com/hdget/tw?product=" + product + "&addcart=" + count + "&m=1",
  23.                     type: "get",
  24.                     dataType: "jsonp",
  25.                     jsonp: "callback",
  26.                     jsonpCallback: "hdcontrol",
  27.                     success: function(jsonObject) {
  28.                         var status = jsonObject.status[product];
  29.                         var hdurl = status.hdurl;
  30.                         var hdstart = status.hdstart;
  31.                         var hdstop = status.hdstop;
  32.                         if ((hdstart = 'true') && (hdstop = 'false')) {
  33.                             if (status && hdurl != '') {
  34.                                 window.clearInterval(FuckXiaoMi.timer);
  35.                                 /*$.ajax({
  36.                                     url: 'http://buy.mi.com/tw/cart/add/' + product + '-0-2?source=bigtap&token=' + hdurl,
  37.                                     dataType: 'jsonp'
  38.                                 });*/
  39.                                 console.table('購物車網址 : ' + 'http://buy.mi.com/tw/cart/add/' + product + '-0-' + count + '?source=bigtap&token=' + hdurl);
  40.                                 console.table(delay/1000 + '秒後跳轉 ...');
  41.                                 setTimeout(location.replace('http://buy.mi.com/tw/cart/add/' + product + '-0-2?source=bigtap&token=' + hdurl), delay);
  42.                                 return false;
  43.                             }
  44.                         }
  45.                         var login = jsonObject.login;
  46.                         console.table("[login:" + login + ",hdstart:" + hdstart + ",hdstop:" + hdstop + ",hdurl:" + hdurl + "]");
  47.                     },
  48.                     error: function() {
  49.                         console.table("連線超時");
  50.                     }
  51.                 });
  52.             });
  53.  
  54.         }
  55.  
  56.     };
  57.     FuckXiaoMi.start();
  58. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement