A seguir, o código JS quando o Xiaomi corre para comprar.
A cópia do código é a seguinte:
hdControl ({"stime": 1381645438, "status": {"allow": false, "miphone": {"hdstart": false, "hdstop": false, "hdurl": "," duração ": null} , "Mibox": {"hdstart": false, "hdstop": false, "hdurl": "", "duração": null}}})
A cópia do código é a seguinte:
função fornum (a) {
retornar 10> a? "0"+a: a
}
função contagem regressiva (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 horas 00 minutos 00 segundos" ,! ]))+"minuto"+fornum (i [0])+"segundo", [h+"<span> dia </span>"+fornum (i [2])+"<span> time </span>" +fornum (i [1])+"<span> min </span>"+fornum (i [0])+"</span> segundo </span>",! 1]) :( window._timest = fornum (i [2])+"tempo"+fornum (i [1])+"minuto"+fornum (i [0])+"segundo", [fornum (i [2])+"<span> /span > "+fornum (i [1])+" <span> min </span> "+fornum (i [0])+" <span> segundo </span> ",! 1])}
functionwebeventTrigger (a, b) {
tentar{
if (nós && nós.trigger)
Retorne "String"! = typeofb && (b = json.stringify (b)), nós.trigger (a, b)
} catch (c) {}
Retornar! 1
}
functionIapp () {
tentar{
Se (nós) retornarmos! 0
} catch (a) {}
Retornar! 1
}
varquickbuy = {init: function () {
vara = this;
this.config = {},
this.config.hdurl={miphone:"m3/840410D8656D74E5F334591BD8A408A726799AEC13477D90B5E48DAD36547351/4334F49A1EE391261005E8AC5A0C9 D2FDA23BB72A2D20AB3F58343496FD4983D/tip_SaledOverAll.html",mibox:"tv/B1CF7B57BFEAE1EBC37700694C123D894C668BF11F6F25D59311FD369 42B3D6A/130F1B18D11F53CA1D0147B24E926C5A9B7676E57BE3D47959D6557545E8A339/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 ("15/10/201312: 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;
para (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 ("xm_diff_hd"), 10), this.config.servertime> = parseint (this .config.startdate/1e3,10)? $. Cookie ("xm_hd_so_phone") && $. Cookie ("xm_hd_so_box") || this.getData (! 0, function () {a.gobuy ()}): this. : ::::::::::::::::::::::Here :::::::::::::::::::hee :::::::::::::::::heo the :::::::::::::::: uma ())): this.getData ())}, getData: function (a, b) {
varc = this, a = a || null;
b && (b = b),
$ .ajax ({
URL: "http://tc.hd.xiaomi.com/hdget",
Datatype: "jsonp",
jsonpcallback: "hdcontrol",
Tempo limite: 7e3,
beforesend: function () {
c.MaskLoad.Css ("Display", "Block")},
erro: function () {
C.MaskLoad.css ("Display", "None"),
Alerta ("O servidor está sob grande pressão, atualize a página!")
},
Sucesso: função (d) {
if (c.Maskload.css ("display", "nenhum"), "indefinido" == typeofd)
ReturnLert ("O servidor está sob grande pressão, atualize a página!"),
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, {
caminho:"/",
domínio: ". xiaomi.com",
Expira: 1
})
}
se (a) {
c.initialData ();
para (varfinc.mode)
if (c.config [f] .hdstart ===! 1 && c.config [f] .hdstop ===! 0) {
Varg = C.ModEcookies [F];
$ .cookie (g, 1, {path: "/", domain: ". xiaomi.com", expira: 1}),
C.Saleout ()
} elseb && 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
},
Lançar: function () {
this.timestart (),
this.countdown ()
},
TimeStart: function () {
vara = this,
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 ("visibilidade", "Hidden"),
$ ("#compra_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> detalhes </a>),
$ ("#compra_btn_2"). html ('<class = "btn_buybtn_02" href = "javascript :;"> login </a>')): a.tologin (): b> = c && a.tobuy ()
},
tologin: function () {
$ ("#view_button"). CSS ("visibilidade", "Hidden"),
$ ("#compra_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> detalhes </a>),
$ ("#compra_btn_2"). html ('<aclass = "btn_buybtn_02" href = "javascript :;"> login antecipadamente </a>),
$ ("#compra_btn_2"). find (". btn_02"). on ("clique", function () {
WebEventTrigger ("login", null) || (window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013&c Allback ="+Encodeuricompton Local.href)}}
)},
contagem regressiva: function () {
vara = this,
b = nulo,
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 = contagem regressiva (b, c);
f [1]? (ClearInterval (e), $ ("#Countdown"). CSS ("Display", "None"), A.Tobuy ()) :( 1E3*B! = D || ISApp () | | ($. Cookie ("UserID")? ($ ("#View_button"). CSS ("Visibilidade", "Hidden"),
$ ("#compra_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> detalhes </a>),
$ ("#compra_btn_2"). html ('<aclass = "btn_buy" href = "javascript :;"> login </a>')): a.tologin ()), b ++),
$ ("#Countdown"). html (f [0])}, 1e3)},
Tobuy: function () {
vara = this;
A.Gobuy ();
varb = a.modemodals [a.config.mode];
$ (b) .find (". Close"). on ("clique", function () {
$ (b) .css ("display", "nenhum"),
window.cleartimeout (a.timer),
a.timer = null})},
Venda: function () {
vara = {miphone: "#compra_btn_2", mibox: "#compra_btn_1"},
b = {miphone: "http://t.hd.xiaomi.com/r/?_a=Payment_Check&_M=1", Mibox: "http://m.xiaomi.com/index.html#ac=home&optdcart&product_id = 2505 "},
C = {miphone: "Pay Xiaomi Mobile 3", Mibox: "Pay Xiaomi TV"};
para (vardintthis.mode)
$ .cookie (this.modecookies [d]) && ($ (a [d]). html ('<aclass = "btn_buy" href = "'+b [d]+'">'+c [d]+ "</a>"),
$ (this.modemodals [d]). Is (": visível") && $ (this.modemodals [d]). Find (". Close"). Click ())},
LocalTime: function () {
Vara = parseint (+newDate/1e3,10);
returna
},
Toprocess: function (a) {
varb = this,
C = B.timer,
d = B.timecount || 10, e = $ (B.Modemodals [a]). Find (". Re_CountDown"),
f = $ (B.Modemodals [a]). Find (". Modal_btn"),
g = function () {0 == d? (f.html ('<aclass = "into_buy_btn" href = "javascript:;"> inserir atividade </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 = this,
b = {miphone: "Compre Xiaomi Mobile 3", Mibox: "Compre Xiaomi TV"},
c = {miphone: "#compra_btn_2", mibox: "#compra_btn_1"};
para (vardina.mode)
$ .cookie (a.modecookies [d]) || ($ (c [d]). html ('<aclass = "btn_buybtn_buy_go" data-type = "'+d+'" href = "javascript:;">' +b [d]+"</a>"),
$ (c [d]). Is (": Hidden") && $ (C [D]). CSS ("Display", "Block"));
$ ("#Open_button"). Find (". BTN_BUY_GO").
varb = a.config.mode = $ (this) .attr ("Data-type");
if ($. Cookie ("UserID")) A.GetData (! 0, function () {
$ (a.Modemodals [B]). CSS ("Display", "Block"),
$ (a.Modemodals [b]). Find (". Fechar").
$ (a.Modemodals [B]). CSS ("Display", "None"), Window.ClearTimeout (A.Timer), A.Timer = NULL}), A.Toprocess (B)});
else {if (webEventTrigger ("login", null)) retornar;
window.Location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013&callback="+Encodeuricomponent (w indow.location.href)}})},
Tobuygo: função (a) {
varb = this;
window.cleartimeout (b.timer),
B.timer = null,
$ (B.Modemodals [a]). Find (". Modal_btn"). Find (". IN_BUY_BTN"). função(){
if ($ (B.Modemodals [a]). CSS ("Display", "Block"), B.Config.allow) se (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)
}outro{
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"). html ('<class = "re_enter" href = "javascript:;"> reent </a>'),
B.TOPROCESS (A)
})})}};