El siguiente es el código JS cuando Xiaomi se apresura a comprar.
La copia del código es la siguiente:
HDControl ({"STEME": 1381645438, "Estado": {"permitirse": falso, "miphone": {"hdstart": false, "hdstop": false, "hdurl": "", "duración": null} , "mibox": {"hdstart": false, "hdstop": false, "hdurl": "", "duración": null}}})
La copia del código es la siguiente:
función fornum (a) {
devolver 10> a? "0"+A: A
}
function Countdown (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" ,! 0]: h> 0? (Window._timestr = H+"día"+fornum (i [2])+"tiempo"+fornum (i [1 1 ])+"minuto"+fornum (i [0])+"segundo", [h+"<span> day </span>"+fornum (i [2])+"<span> tiempo </span>" +fornum (i [1])+"<span> min </span>"+fornum (i [0])+"<span> segundo </span>" ,! 1]) :( window._timestr = fornum (I [2])+"Tiempo"+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) {
intentar{
if (we && we.trigger)
return "string"! = typeofb && (b = json.stringify (b)), we.rigger (a, b)
} Catch (c) {}
¡RETURN! 1
}
functionIsApp () {
intentar{
if (nosotros) regresar! 0
} catch (a) {}
¡RETURN! 1
}
varquickbuy = {init: function () {
vara = esto;
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. this .config.startdate/1e3,10)? $. Cookie ("xm_hd_so_phone") && $. Cookie ("xm_hd_so_box") || this.getData (! 0, function () {a.gobuy ()}): this. :::::::::::::::::: para::: ::::::::::::::::::::::::::::::: ::::::::::::::: Launch ()): this.getData ())}, getData: function (a, b) {
varc = this, a = a || null;
b && (b = b),
$ .AJAX ({
URL: "http://tc.hd.xiaomi.com/hdget",
Tipo de datos: "JSONP",
JSONPCALLBACK: "HDCONTROL",
Tiempo de espera: 7e3,
befeforesend: function () {
C.Maskload.css ("Display", "Bloque")},
Error: function () {
C.Maskload.css ("Pantalla", "Ninguno"),
alerta ("El servidor está en gran presión, ¡actualice la página!")
},
éxito: función (d) {
if (c.maskload.css ("visualización", "ninguno"), "indefinido" == typeofd)
returnLert ("El servidor está en gran presión, ¡actualice la 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, {
camino:"/",
Dominio: ". Xiaomi.com",
Expira: 1
})
}
if (a) {
c.initialldata ();
para (varfinc.mode)
if (c.config [f] .hdstart ===! 1 && c.config [f] .hdstop ===! 0) {
varg = C.Modecookies [f];
$ .cookie (g, 1, {ruta: "/", dominio: ". Xiaomi.com", expira: 1}),
C.SaleOut ()
} elseb && b.call ()
}
A || C.Launch ()
}})},
initialData: function () {
this.config.how = this.results.status. allow,
this.config.mibox = this.results.status.mibox,
this.config.miphone = this.results.status.miphone
},
Lanzamiento: function () {
this.timeStart (),
this.countdown ()
},
timStart: functer () {
vara = esto,
b = 1e3*a.config.servertime,
C = A.Config.StartDate,
d = C-1e3*60*A.Config.minsigntime;
b> = d && c> b &&! isapp ()?
$ .cookie ("INSOMPLED")?
($ ("#View_Button"). CSS ("Visibilidad", "Hidden"),
$ ("#compra_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> Detalles de la actividad </a>'),
$ ("#compra_btn_2"). html ('<class = "btn_buybtn_02" href = "javascript :;"> login </a>')): a.tologin (): b> = c && a.tobuy ()
},
tologin: function () {
$ ("#View_Button"). CSS ("Visibilidad", "Oculto"),
$ ("#compra_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> Detalles de la actividad </a>'),
$ ("#compra_btn_2"). html ('<aclass = "btn_buybtn_02" href = "javascript :;"> Iniciar sesión por adelantado </a>'),
$ ("#compra_btn_2"). find (". btn_02"). on ("hacer clic", function () {
WebEventTrigger ("Login", Null) || (Window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013&c alback ="+encodeuricomponent (ventana . ubicación.href))}
)},
Countdown: function () {
vara = esto,
b = nulo,
c = A.Config.StartDate;
b = A.Config.Servertime?
vard = C-1e3*60*A.Config.minsigntime,
e = setInterval (function () {
varf = Countdown (b, c);
f [1]? (ClearInterval (E), $ ("#Countdown"). CSS ("Pantalla", "Ninguno"), A.Tobuy ()) :( 1e3*B! = D || isApp () | | ($. Cookie ("Userid")? ($ ("#View_Button"). CSS ("Visibilidad", "Hidden"),
$ ("#compra_btn_1") .html ('<class = "btn_buy" href = "http://bbs.xiaomi.cn/thread-8205768-1-1.html"> Detalles de la actividad </a>'),
$ ("#compra_btn_2"). html ('<aclass = "btn_buy" href = "javascript :;"> login </a>')): a.tologin ()), b ++),
$ ("#Countdown"). Html (f [0])}, 1e3)},
tobUy: functer () {
vara = esto;
a.gobuy ();
varb = a.modemodals [a.config.mode];
$ (b) .find (". Close"). on ("Click", function () {
$ (b) .css ("pantalla", "ninguno"),
Window.ClearTimeOut (A.Timer),
a.timer = null})},
Saleut: 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&op=addcart&product_id = 2505 "},
c = {miphone: "paga 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 (": visible") && $ (this.modemodals [d]). find (". Close"). Click ())},
Localtime: function () {
vara = parseInt (+newdate/1e3,10);
regreso
},
toprocess: function (a) {
varb = esto,
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 :;"> Ingrese la actividad </a>'),
B.Tobuygo (B.Config.Mode),
c && window.cleartimeout (c),
c = nulo) :( E.Html ("("+d+")"),
d--,
b.timer = window.setTimeout (function () {g ()}, 1e3))};
c && window.cleartimeout (c), g ()},
GOBUY: function () {
vara = esto,
b = {miphone: "comprar xiaomi mobile 3", mibox: "comprar 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 (": oculto") && $ (c [d]). css ("pantalla", "bloque"));
$ ("#Open_Button"). Find (". BTN_BUY_GO"). ON ("Click", function () {a.mode [$ (this) .attr ("data-type")] =! 0;
varb = a.config.mode = $ (this) .attr ("data-type");
if ($. cookie ("userId")) a.getData (! 0, function () {
$ (a.modemodals [b]). CSS ("Display", "Bloque"),
$ (a.modemodals [b]). Find (". Close"). ON ("Click", function () {
$ (a.modemodals [b]). CSS ("Pantalla", "Ninguno"), Window.ClearTimeOut (A.Timer), A.Timer = Null}), A.Toprocess (b)});
else {if (webEventTrigger ("Login", NULL)) return;
window.location.href = "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013&callback="+codeuricponent (w indow.location.href)})},},
tobuygo: function (a) {
varb = this;
Window.ClearTimeOut (B.Timer),
B.Timer = nulo,
$ (B.Modemodals [a]). Find (". Modal_btn"). Find (". Into_Buy_Btn"). ON ("Haga clic", función (c) {C.PreventDefault (), B.getData (! 0, función(){
if ($ (B.Modemodals [a]). CSS ("Display", "Bloque"), B.Config.Alow) if (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)
}demás{
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.TOPROWS (a)
})})}};