ما يلي هو رمز JS عندما يهرع Xiaomi للشراء.
نسخة الكود كما يلي:
HdControl ({"Stime": 1381645438 ، "الحالة": {"السماح": خطأ ، "miphone": {"hdstart": false ، "hdstop": false ، ، "mibox": {"hdstart": false ، "hdstop": false ، "hdurl": "" ، "المدة": null}}})
نسخة الكود كما يلي:
وظيفة fornum (a) {
إرجاع 10> A؟ "0"+a: a
}
وظيفة العد التنازلي (أ ، ب) {
varc = newDate (b) .getTime ()/1e3 ،
د = كاليفورنيا ،
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+"day"+fornum (i [2])+"time"+fornum (i [1 ])+"دقيقة"+fornum (i [0])+"Second" ، [H+"<span> Day </span>"+fornum (i [2])+"<span> time </span>" +fornum (i [1])+"<span> min </span>"+fornum (i [0])+"<span> Second </span>" ،! 1]) :( window._timestr = fornum (I [2])+"الوقت"+fornum (i [1])+"دقيقة"+fornum (i [0])+"Second" ، [fornum (i [2])+"<span> /span > "+fornum (i [1])+" <span> min </span> "+fornum (i [0])+" <span> Second </span> "،! 1])}
FunctionWebeventTrigger (A ، B) {
يحاول{
إذا (نحن && we.trigger)
إرجاع "سلسلة"! = typeofb && (b = json.stringify (b)) ، we.trigger (a ، b)
} catch (c) {}
العودة! 1
}
functionisApp () {
يحاول{
إذا (نحن) العودة! 0
} catch (a) {}
العودة! 1
}
varquickbuy = {init: function () {
vara = هذا ؛
this.config = {} ،
this.config.hdurl = {miphone: "M3/840410D8656D74E5F334591BD8A408A726799AC13477D90B5E48DAD36547351/4334F49A1EE391261005E8AC5E8AC5E8AC5A0C5A0C5A0C5A0C5A0C5A0C5A0C5A0C5E8AC 20ab3f58343496fd4983d/tip_saledoverall.html "، mibox:" tv/b1cf7b57bfeae1ebc37700694c123d894c668bf11f6f25d59311fd369 42b3d6a 24e926c5a9b7676e57be3d47959d6557545e8a339/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") ،
this.maskload = $ ("#maskload") ،
this.config.minsigntime = 120 ،
هذا.
this.timer = null ،
this.timeCount = Math.Floor (Math.abs (10*Math.Random ()-5))+5 ؛
varb =! 0 ؛
ل (varcinthis.mode)
$ .cookie (this.modecookies [c]) || (b =! 1) ، $. cookie (this.modecookies [c]) && this.saleout () ؛
B || ($. cookie ("xm_diff_hd")؟ (this.config.servertime = this.localtime ()+parseint ($. cookie (" .config.startdate/1e3،10)؟ $. cookie ("xm_hd_so_phone") && $. cookie ("xm_hd_so_box") || this.getData (! 0 ، function () {a.gobuy ()}): هذا. ::::::::::::::::::::::::: :::::::::::::::::::::: ::::::::::::::ا ()): this.getData ())} ، getData: function (a ، b) {
varc = this ، a = a || null ؛
b && (b = b) ،
$ .ajax ({
URL: "http://tc.hd.xiaomi.com/hdget" ،
نوع البيانات: "JSONP" ،
jsonpcallback: "HDControl" ،
مهلة: 7e3 ،
Be Forresend: Function () {
c.maskload.css ("Display" ، "Block")} ،
خطأ: function () {
c.maskload.css ("Display" ، "None") ،
التنبيه ("الخادم تحت ضغط كبير ، يرجى تحديث الصفحة!")
} ،
النجاح: وظيفة (د) {
if (c.maskload.css ("Display" ، "None") ، "غير محدد" == typeofd)
Returnlert ("الخادم تحت ضغط كبير ، يرجى تحديث الصفحة!") ،
void0 ؛
if (c.results = d ، a || (c.config.servertime = c.results.stime) ،! $. cookie ("xm_diff_hd")) {
vare = parseint (c.config.servertime-c.localtime () ، 10) ؛
$ .cookie ("xm_diff_hd" ، e ، {
طريق:"/"،
المجال: ". xiaomi.com" ،
تنتهي: 1
})
}
إذا (أ) {
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 ()
} ايليب و 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 ()
} ،
الطابع الطابع: وظيفة () {
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 ("الرؤية" ، "Hidden") ،
$ ("#purchain_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> تفاصيل النشاط </a>)
$ ("#purchaf_btn_2"). html ('<class = "btn_buybtn_02" href = "javaScript: ؛"> login </a>)): a.tologin (): b> = c && a.tobuy ()
} ،
تطور: وظيفة () {
$ ("#view_button"). CSS ("الرؤية" ، "Hidden") ،
$ ("#purchain_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> تفاصيل النشاط </a>)
$ ("#purchain_btn_2"). html ('<aclass = "btn_buybtn_02" href = "javaScript: ؛"> تسجيل الدخول مسبقًا </a>') ،
$ ("#buy_btn_2"). البحث (". btn_02").
WebeventTrigger ("Login" ، NULL) || (window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso؟client_id=180100031013&c allback =" موقع
)} ،
العد التنازلي: وظيفة () {
vara = هذا ،
ب = خالية ،
C = A.Config.StartDate ؛
B = A.Config.Servertime؟ A.Config.Servertime: parseint (+newDate/1e3،10) ؛
vard = c-1e3*60*a.config.minsigntime ،
e = setInterval (function () {
varf = العد التنازلي (b ، c) ؛
f [1]؟ (ClearInterval (e) ، $ ("#countdown") | ($. cookie ("userId")؟ ($ ("#view_button"). css ("الرؤية" ، "Hidden") ،
$ ("#purchain_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> تفاصيل النشاط </a>)
$ ("#purchaf_btn_2").
$ ("#countdown"). html (f [0])} ، 1e3)} ،
tobuy: function () {
vara = هذا ؛
A.Gobuy () ؛
varb = a.modemodals [a.config.mode] ؛
$ (b) .find (". close"). on ("click" ، function () {
$ (b) .css ("Display" ، "None") ،
window.cleartimeout (A.Timer) ،
A.Timer = null})} ،
SELEOUT: Function () {
vara = {miphone: "#purchaf_btn_2" ، mibox: "#purchain_btn_1"} ،
b = {miphone: "http://t.hd.xiaomi.com/r/؟_a=payment_check&_m=1" ، mibox: "http://m.xiaomi.com/index.html#ac=home&p=addcart&product_id = 2505 "} ،
C = {miphone: "Pay Xiaomi Mobile 3" ، Mibox: "Pay Xiaomi TV"} ؛
ل (vardintthis.mode)
$ .cookie (this.modeCookies [d]) && ($ (a [d]) "</a>") ،
$ (this.modemodals [d]). هو (": مرئي") && $ (this.modemodals [d]).
محلي: وظيفة () {
vara = parseint (+newDate/1e3،10) ؛
عودة
} ،
Toprocess: function (a) {
varb = هذا ،
C = B.Timer ،
D = B.TimeCount || 10 ، E = $ (B.Modemodals [A]).
f = $ (b.modemodals [a]). find (". modal_btn") ،
g = function () {0 == d؟ (f.html ('<aclass = "in_buy_btn" href = "javaScript: ؛"> أدخل النشاط </a>') ،
B.Tobuygo (B.Config.Mode) ،
c && window.cleartimeout (c) ،
C = NULL) :( E.HTML ("("+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: "#buy_btn_2" ، mibox: "#buy_btn_1"} ؛
ل (vardina.mode)
$ .cookie (a.modecookies [d]) || ($ (c [d]). +B [D]+"</a>") ،
$ (c [d]). IS (": Hidden") && $ (c [d]). css ("display" ، "block")) ؛
$ ("#open_button"). find (".
varb = a.config.mode = $ (this) .attr ("نوع البيانات") ؛
if ($. cookie ("userId"))
$ (a.modemodals [b]). CSS ("Display" ، "Block") ،
$ (a.modemodals [b]). find (". close"). on (
$ (a.modemodals [b]).
آخر {if (webeventTrigger ("login" ، null)) return ؛
window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso؟client_id=180100031013&callback="+encodeUricomponent (w indow.location.location.href)})})})
Tobuygo: وظيفة (أ) {
varb = هذا ؛
window.cleartimeout (B.Timer) ،
B.Timer = NULL ،
$ (b.modemodals [a]). find (". modal_btn"). find (". وظيفة(){
if ($ (b.modemodals [a]). css ("display" ، "block") ، b.config.allow) if (
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]). find (". modal_btn").
B.Toprocess (أ)
})})}} ؛