ต่อไปนี้เป็นรหัส JS เมื่อ Xiaomi รีบซื้อ
การคัดลอกรหัสมีดังนี้:
hdControl ({"stime": 1381645438, "สถานะ": {"อนุญาต": false, "miphone": {"hdstart": false, "hdstop": false, "hdurl": "", "Duration": null} , "mibox": {"hdstart": false, "hdstop": false, "hdurl": "", "ระยะเวลา": null}}})
การคัดลอกรหัสมีดังนี้:
ฟังก์ชั่น fornum (a) {
return 10> a? "0"+a: a
-
ฟังก์ชั่นนับถอยหลัง (a, b) {
varc = newDate (b) .getTime ()/1E3
d = ca,
e = parseint (d%60)
f = parseint (d/60%60), g = parseint (d/3600%24),
H = ParseInt (D/3600/24)
i = [e.toString ()
F.ToString ()
G.ToString ()];
return0> = d? ["00 ชั่วโมง 00 นาที 00 วินาที" ,! 0]: h> 0? (window._timestr = h+"วัน"+fornum (i [2])+"เวลา"+fornum (i [1 ])+"นาที"+fornum (i [0])+"วินาที", [h+"<pan> วัน </span>"+fornum (i [2])+"<pan> เวลา </span>" +fornum (i [1])+"<span> min </span>"+fornum (i [0])+"<span> วินาที </span>" ,! 1]) :( window._timestr = fornum (i [2])+"เวลา"+fornum (i [1])+"นาที"+fornum (i [0])+"วินาที", [fornum (i [2])+"<span> /span > "+fornum (i [1])+" <span> min </span> "+fornum (i [0])+" <span> วินาที </span> ",! 1])}
functionWebeVentTrigger (a, b) {
พยายาม{
ถ้า (เรา && we.trigger)
return "string"! = typeofb && (b = json.stringify (b)), we.trigger (a, b)
} catch (c) {}
กลับมา! 1
-
functionisapp () {
พยายาม{
ถ้า (เรา) กลับมา! 0
} catch (a) {}
กลับมา! 1
-
varquickBuy = {init: function () {
vara = this;
this.config = {}
this.config.hdurl = {Miphone: "M3/840410D8656D74E5F334591BD8A408A7267999AEC13477D90B5E48DAD36547351/4334F49AEE39 20AB3F58343496FD4983D/TIP_SALEDOVERALL.HTML ", MIBOX:" TV/B1CF7B57BFEAE1EBC37700694C123D894C668BF11F6F25D59311 4E926C5A9B7676E57BE3D47959D6557545E8A339/TIP_SALEDOVERALL.html "
-
this.config.mode = ""
this.mode = {miphone :! 1, mibox :! 1},
this.modemodals = {miphone: "#modal_miphone", mibox: "#modal_mibox"},
this.modecookies = {miphone: "xm_hd_so_phone", mibox: "xm_hd_so_box"},
this.config.startdate =+newdate ("10/15/201312: 00: 00: 00"
this.maskload = $ ("#maskload")
this.config.minsigntime = 120
this.results = null
this.timer = null
this.timecount = math.floor (math.abs (10*math.random ()-5))+5;
varb =! 0;
สำหรับ (varcinthis.mode)
$ .Cookie (this.modecookies [c]) || (b =! 1), $. คุกกี้ (this.modecookies [c]) && this.saleout ();
b || ($. คุกกี้ ("xm_diff_hd")? (this.config.servertime = this.localtime ()+parseint ($. คุกกี้ ("xm_diff_hd"), 10), this.config.servertime> = parseint .Config.StartDate/1E3,10)? $. คุกกี้ ("XM_HD_SO_POHNE") && $. คุกกี้ ("XM_HD_SO_BOX") || this.getData (! 0, ฟังก์ชั่น () {a.gobuy ()}): ::::::::::::::::::::::: กระทาน ::::::::::::::::::::::::LSUARD ()): this.getData ())}, getData: ฟังก์ชั่น (a, b) {
varc = this, a = a || null;
b && (b = b)
$ .ajax ({
URL: "http://tc.hd.xiaomi.com/hdget"
ข้อมูล: "JSONP",
JSONPCALLBACK: "HDCONTROL"
หมดเวลา: 7e3,
beforesend: function () {
c.maskload.css ("แสดง", "block")},
ข้อผิดพลาด: function () {
c.maskload.css ("แสดง", "ไม่มี")
การแจ้งเตือน ("เซิร์ฟเวอร์อยู่ภายใต้แรงกดดันอย่างมากโปรดรีเฟรชหน้า!")
-
ความสำเร็จ: ฟังก์ชั่น (d) {
if (c.maskload.css ("แสดง", "ไม่มี"), "undefined" == typeofd)
returnlert ("เซิร์ฟเวอร์อยู่ภายใต้แรงกดดันอย่างมากโปรดรีเฟรชหน้า!")
เป็นโมฆะ 0;
if (c.results = d, a || (c.config.servertime = c.results.stime) ,! $. คุกกี้ ("xm_diff_hd"))) {
vare = parseint (c.config.servertime-c.localtime (), 10);
$ .COOKIE ("XM_DIFF_HD", E, {
เส้นทาง:"/",
โดเมน: ". xiaomi.com",
หมดอายุ: 1
-
-
ถ้า (a) {
c.initialdata ();
สำหรับ (varfinc.mode)
if (c.config [f] .hdstart ===! 1 && c.config [f] .hdstop ===! 0) {
varg = c.modecookies [f];
$ .Cookie (g, 1, {path: "/", โดเมน: ". xiaomi.com", หมดอายุ: 1}),
C.Saleout ()
} ELESSB && B.CALL ()
-
a || c.launch ()
-
initialdata: function () {
this.config.allow = this.results.status.allow,
this.config.mibox = this.results.status.mibox,
this.config.miphone = this.results.status.miphone
-
เปิดตัว: function () {
this.timestart ()
this.countdown ()
-
Timestart: function () {
vara = สิ่งนี้
B = 1E3*A.Config.Servertime
c = a.config.startdate
d = c-1e3*60*A.Config.minSigntime;
b> = d && c> b &&! isapp ()?
$ .COOKIE ("USERID")?
($ ("#view_button"). CSS ("การมองเห็น", "ซ่อน"),
$ ("#purching_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> รายละเอียดกิจกรรม </a>')
$ ("#purching_btn_2"). html ('<class = "btn_buybtn_02" href = "javascript:;"> เข้าสู่ระบบ </a>')): a.tologin (): b> = c && a.tobuy ()
-
tologin: function () {
$ ("#view_button"). CSS ("การมองเห็น", "ซ่อน"),
$ ("#purching_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> รายละเอียดกิจกรรม </a>')
$ ("#purching_btn_2"). html ('<aclass = "btn_buybtn_02" href = "javascript :;"> เข้าสู่ระบบล่วงหน้า </a>')
$ ("#purching_btn_2") ค้นหา (". btn_02") บน ("คลิก", function () {
WebEventTrigger ("เข้าสู่ระบบ", null) || (window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013&c allback =" . location.href))}
-
นับถอยหลัง: function () {
vara = สิ่งนี้
b = null
C = A.Config.StartDate;
B = A.Config.servertime?
vard = c-1e3*60*a.config.minsigntime
e = setInterval (ฟังก์ชัน () {
varf = การนับถอยหลัง (b, c);
f [1]? (ClearInterval (e), $ ("#countdown"). css ("แสดง", "ไม่มี"), a.tobuy ()) :( 1e3*b! = d || isapp () | | ($. คุกกี้ ("userId")? ($ ("#view_button"). CSS ("การมองเห็น", "ซ่อน"),
$ ("#purching_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> รายละเอียดกิจกรรม </a>')
$ ("#purching_btn_2"). html ('<aclass = "btn_buy" href = "javascript:;"> เข้าสู่ระบบ </a>')): a.tologin ()), b ++)
$ ("#countdown"). html (f [0])}, 1e3)},
tobuy: function () {
vara = this;
a.gobuy ();
varb = a.modemodals [a.config.mode];
$ (b) .find (". ปิด") บน ("คลิก" ฟังก์ชัน () {
$ (b) .css ("แสดง", "ไม่มี")
window.cleartimeout (a.timer),
a.timer = null})}
Saleout: function () {
vara = {miphone: "#purching_btn_2", mibox: "#purching_btn_1"},
b = {miphone: "http://t.hd.xiaomi.com/r/?_a=payment_check&_m=1", mibox: "http://m.xiaomi.com/index.html#ac=home&op=addcart&product_id = 2505 "}
C = {Miphone: "Pay Xiaomi Mobile 3", Mibox: "Pay Xiaomi TV"};
สำหรับ (vardintthis.mode)
$ .Cookie (this.modecookies [d]) && ($ (a [d]). html ('<aclass = "btn_buy" href = "'+b [d]+'">'+c [d]+ "</a>"),
$ (this.modemodals [d]) คือ (": มองเห็นได้") && $ (this.modemodals [d]) ค้นหา ("ปิด") คลิก ())},
LocalTime: function () {
VARA = PARSEINT (+newDate/1E3,10);
returna
-
toprocess: ฟังก์ชั่น (a) {
varb = สิ่งนี้
c = b.timer,
d = b.timecount || 10, e = $ (b.modemodals [a]). ค้นหา (". re_countdown"),
f = $ (b.modemodals [a]) ค้นหา (". modal_btn")
g = function () {0 == d? (f.html ('<aclass = "into_buy_btn" href = "javascript :;"> ป้อนกิจกรรม </a>')
b.tobuygo (b.config.mode),
c && window.cleartimeout (c)
c = null) :( e.html ("("+d+")"
D--,
b.timer = window.settimeout (function () {g ()}, 1e3))};
c && window.cleartimeout (c), g ()}
gobuy: function () {
vara = สิ่งนี้
b = {miphone: "ซื้อ Xiaomi Mobile 3", Mibox: "ซื้อ Xiaomi TV"},
c = {miphone: "#purchit_btn_2", mibox: "#purch_btn_1"};
สำหรับ (vardina.mode)
$ .Cookie (A.Modecookies [D]) || ($ (C [D]). html ('<aclass = "BTN_BUYBTN_BUY_GO" data-type = "'+d+'" href = "JavaScript:;">'> '>'> '>'> '>'> '>'> '> +b [d]+"</a>")
$ (c [d]). คือ (": hidden") && $ (c [d]). css ("แสดง", "block"));
$ ("#open_button") ค้นหา (". btn_buy_go"). on ("คลิก", function () {a.mode [$ (นี่) .attr ("data-type")] =! 0;
varb = a.config.mode = $ (this) .attr ("data-type");
ถ้า ($. คุกกี้ ("userId")) a.getData (! 0, function () {
$ (a.modemodals [b]). CSS ("แสดง", "block"),
$ (a.modemodals [b]) ค้นหา (". ปิด") on ("คลิก", function () {
$ (a.modemodals [b]). css ("แสดง", "ไม่มี"), window.cleartimeout (a.timer), a.timer = null}), a.toprocess (b)});
else {ถ้า (webEventTrigger ("เข้าสู่ระบบ", null)) กลับ;
window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013&callback="
Tobuygo: ฟังก์ชั่น (a) {
varb = สิ่งนี้;
window.cleartimeout (b.timer),
b.timer = null
$ (b.modemodals [a]) ค้นหา (". modal_btn") ค้นหา (". into_buy_btn") บน ("คลิก", ฟังก์ชั่น (c) {c.preventdefault (), b.getData (! 0, การทำงาน(){
if ($ (b.modemodals [a]). css ("แสดง", "block"), b.config.allow) ถ้า (b.config [a] .hdurl) {
varc = "http://t.hd.xiaomi.com/s/"+b.config [a] .hdurl+"& _m = 1";
window.settimeout (function () {window.location.href = c}, 500)
}อื่น{
vard = "http://p.www.xiaomi.com/m/activities/open/"+b.config.hdurl [a];
window.settimeout (function () {window.location.href = d}, 500)
} elseif (
b.config [a] .hdstart ===! 1 && b.config [a] .hdstop ===! 0) {
vard = "http://p.www.xiaomi.com/m/activities/open/"+b.config.hdurl [a];
window.settimeout (function () {window.location.href = d}, 500)
} else $ (b.modemodals [a]). ค้นหา (". modal_btn"). html ('<class = "re_enter" href = "javascript :;"> reent </a>')
B.Toprocess (A)
-