Xiaomi Domain Transition JS

Source: Internet
Author: User

<script>
JQuery (function ($) {
(function () {
var $bnBar = $ ('),
$topBn = $ (' #J_topBn '),
$topBnBackdrop = $ (' #J_topBackdrop '),
$counter = $ ('. J_counter '),
$closeBnTrigger = $ ('. J_closebn '),
TIMEOUTTOPBN,
Bncounter = 10;

function Countdown () {
Bncounter-= 1;
if (Bncounter < 1) {
CLOSEBN ();
}
else {
$counter. Text (Bncounter + ' seconds later ');
}
}

function Closebn () {
Window.clearinterval (TIMEOUTTOPBN);
$counter. Remove ();
$topBn. Animate ({
' Top ':-$topBn. Height ()
}, the function () {
$topBn. Hide ();
$topBnBackdrop. Hide ();
});

var expiredate;
ExpireDate = new Date (Math.Round (new Date (). GetTime ()) + 1000 * 60 * 60 * 6);

XIAOMI.app.cookie (' Indextopbn ', ' 1 ', {
Expires:expiredate
});
}

$bnBar. InsertBefore ($ ('. Site-topbar '));

if (XIAOMI.app.cookie (' indextopbn ')!== ' 1 ') {
$topBn. Show ();
$topBnBackdrop. Height ($ (document). Height ()). Show ();

TIMEOUTTOPBN = Window.setinterval (function () {
Countdown ();
}, 1000);

$closeBnTrigger. On (' click ', Function (e) {
E.preventdefault ();
CLOSEBN ();
});
}
}());

(function () {
if (!$ ('. Site-bn '). Length) {
if (Window.location.href.split ('? '). Length < 2) {
return false;
}
if (Window.location.href.split ('? ') [1].indexof (' F=xiaomi ')!==-1) {

var timeoutmodalfrom,
Modalfromcounter = 5,
$modalFrom = $ (' <div class= "modal Modal-from-xiaomi" ><div class= "modal-body" ><a class= "Btn-enter J_ Closemodalfrom "href=" javascript:void (0); " ><span class= "J_xmcounter" >10 seconds </span> enter Xiaomi net </a><span class= "Close J_closemodalfrom" Data-dismiss= "modal" ><i class= "Iconfont" >& #xe617;</i></span></div></div> ') ;

function Modalcountdown () {
Modalfromcounter-= 1;

if (Modalfromcounter < 1) {
Closemodalfrom ();
}
else {
$ ('. J_xmcounter '). Text (Modalfromcounter + ' seconds after ');
}
}

function Closemodalfrom () {
Window.clearinterval (Timeoutmodalfrom);
$modalFrom. Modal (' hide ');
var expiredate = new Date (Math.Round (new Date (). GetTime ()) + 1000 * 60 * 60 * 2);
XIAOMI.app.cookie (' Indexfromxiaomi ', ' 1 ', {
Expires:expiredate
});
}

if (XIAOMI.app.cookie (' Indexfromxiaomi ')!== ' 1 ') {
$ (' body '). Append ($modalFrom);
$modalFrom. Modal ({
' Show ': true
});

Timeoutmodalfrom = Window.setinterval (function () {
Modalcountdown ();
}, 1000);

$ ('. J_closemodalfrom '). On (' click ', Function (e) {
E.preventdefault ();
Closemodalfrom ();
});
}
}
}
}());

});
</script>

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.