码迷,mamicode.com
首页 > 移动开发 > 详细

小米域名过渡JS

时间:2014-05-19 08:27:35      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:class   c   java   ext   int   a   

<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 + ‘秒后‘);
}
}

function closeBn() {
window.clearInterval(timeoutTopBn);
$counter.remove();
$topBn.animate({
‘top‘: -$topBn.height()
}, 500, 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秒后</span> 进入小米网</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 + ‘秒后‘);
}
}

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>

小米域名过渡JS,布布扣,bubuko.com

小米域名过渡JS

标签:class   c   java   ext   int   a   

原文地址:http://www.cnblogs.com/coolid/p/3732118.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!