Red rice phone snapped up the JS code _javascript tips

Source: Internet
Author: User
Tags visibility

The following is a millet snapped up the JS code, analysis can be used to achieve a red rice snapping software, everyone according to the code to achieve their desired function!

Copy Code code as follows:

Hdcontrol ({"Stime": 1381645438, "status": {"Allow": false, "Miphone": {"Hdstart": false, "hdstop": false, "Hdurl": "," duration ": null}," Mibox ": {" Hdstart ": false," hdstop ": false," Hdurl ":" "," duration ": null}}})

Copy Code code as follows:

function Fornum (a) {
Return 10>a? " 0 "+a:a
}
function Countdown (a,b) {
Varc=newdate (b). GetTime ()/1e3,
D=c-a,
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 hours, 00 minutes, 00 seconds,!0]:h>0? (window._timestr=h+ "Day" +fornum (i[2]) + "Time" +fornum (i[1]) + "min" +fornum (i[0)) + "seconds", [h+ "<span> Day </span>" + Fornum (i[2]) + "<span> </span>" +fornum (i[1]) + "<span> </span>" +fornum (i[0)) + "<span> SEC </span> ",!1]):(Window._timestr=fornum (i[2]) +" when "+fornum (i[1)) +" Min "+fornum (i[0]) +" seconds ", [Fornum (i[2]) +" < Span> </span> "+fornum (i[1]) + <span> min </span>" +fornum (i[0]) + "<span> sec </span>",!1 ])}
Functionwebeventtrigger (a,b) {
try{
if (We&&we.trigger)
Return "string"!=typeofb&& (b=json.stringify (b)), We.trigger (a,b)
}catch (c) {}
Return!1
}
Functionisapp () {
try{
if (WE) return!0
}catch (a) {}
Return!1
}
Varquickbuy={init:function () {
Vara=this;
this.config={},
This.config.hdurl={miphone: "m3/840410d8656d74e5f334591bd8a408a726799aec13477d90b5e48dad36547351/ 4334f49a1ee391261005e8ac5a0c9d2fda23bb72a2d20ab3f58343496fd4983d/tip_saledoverall.html ", Mibox:" tv/ b1cf7b57bfeae1ebc37700694c123d894c668bf11f6f25d59311fd36942b3d6a/ 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 ("10/15/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;
for (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"), 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.launch ()): 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",
Timeout:7e3,
Beforesend:function () {
C.MASKLOAD.CSS ("Display", "Block")},
Error:function () {
C.MASKLOAD.CSS ("Display", "none"),
Alert ("Server pressure Alexander, please refresh the page!") ")
},
Success:function (d) {
if (C.maskload.css ("Display", "none"), "undefined" ==typeofd)
Returnalert ("Server pressure Alexander, please refresh the page!") "),
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,{
Path: "/",
Domain: ". xiaomi.com",
Expires:1
})
}
if (a) {
C.initialdata ();
for (Varfinc.mode)
if (c.config[f].hdstart===!1&&c.config[f].hdstop===!0) {
VARG=C.MODECOOKIES[F];
$.cookie (G,1,{path: "/", Domain: ". xiaomi.com", expires: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
},
Launch: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 ("visibility", "hidden"),
$ ("#purchase_btn_1"). html (' <aclass= "btn_buy" href= "http://bbs.xiaomi.cn/thread-8205768-1-1.html" > Event Details < /a> '),
$ ("#purchase_btn_2"). html (' <aclass= "btn_buybtn_02" href= "javascript:;" > already signed in </a> '): A.tologin (): B>=c&&a.tobuy ()
},
Tologin:function () {
$ ("#view_button"). CSS ("visibility", "hidden"),
$ ("#purchase_btn_1"). html (' <aclass= "btn_buy" href= "http://bbs.xiaomi.cn/thread-8205768-1-1.html" > Event Details < /a> '),
$ ("#purchase_btn_2"). html (' <aclass= "btn_buybtn_02" href= "javascript:;" > Early Login </a> '),
$ ("#purchase_btn_2"). Find (". btn_02"). On ("click", Function () {
Webeventtrigger ("login", null) | | (window.location.href= "http://m.xiaomi.com/mshopapi/index.php/v1/authorize/sso?client_id=180100031013& callback= "+encodeuricomponent (window.location.href))}
)},
Countdown:function () {
Vara=this,
B=null,
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=countdown (B,C);
F[1]? (Clearinterval (e), $ ("#countdown"). CSS ("display", "none"), A.tobuy ()):(1e3*b!=d| | Isapp () | | ($.cookie ("UserId")? ($ ("#view_button"). CSS ("visibility", "hidden"),
$ ("#purchase_btn_1"). html (' <aclass= "btn_buy" href= "http://bbs.xiaomi.cn/thread-8205768-1-1.html" > Event Details < /a> '),
$ ("#purchase_btn_2"). html (' <aclass= "btn_buy" href= "javascript:;" > Already 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 ("click", Function () {
$ (b). CSS ("display", "none"),
Window.cleartimeout (A.timer),
A.timer=null})},
Saleout:function () {
Vara={miphone: "#purchase_btn_2", Mibox: "#purchase_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 Millet mobile phone 3", Mibox: "Pay Millet TV"};
for (Vardinthis.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);
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:;" > Enter Activity </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: "Buy Millet mobile phone 3", Mibox: "Buy Millet TV"},
C={miphone: "#purchase_btn_2", Mibox: "#purchase_btn_1"};
for (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"). 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", "block"),
$ (a.modemodals[b]). Find ('. Close '). On ("click", Function () {
$ (a.modemodals[b]). CSS ("display", "none"), 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= "+encodeuricomponent (Window.location.href)}}"},
Tobuygo:function (a) {
Varb=this;
Window.cleartimeout (B.timer),
B.timer=null,
$ (B.modemodals[a]). Find (". Modal_btn"). Find (". Into_buy_btn"). On ("click", Function (c) {C.preventdefault (), B.getdata (!0,function () {
if ($ (b.modemodals[a]). CSS ("Display", "block"), B.config.allow) 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)
}else{
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 (' <aclass= ' re_enter ' href= ' javascript:; > Re-entry </a> '),
B.toprocess (a)
})})}};


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.