1

美国 174.139.114.214
香港 103.30.43.213
台湾 61.220.93.42
中国 218.93.205.136
韩国 103.249.28.89
日本 160.16.76.18
新加坡 103.233.81.251

 

/**
*
* @author LJ
* @date 2015-06-05 17:13:28
* @version
*/

var DialogPopup = function () {
var mask = function () {
var mask_dom = $("#mask");
if (!mask_dom.length) {
mask_dom = $('<div id="mask"></div>');
}
var $body = $("body"),
bodyHeight = $("body").height(),
windowHeight = $(window).height(),
inHeight = null;
(bodyHeight > windowHeight) ? (inHeight = bodyHeight) : (inHeight = windowHeight);
mask_dom.css({
height: inHeight
});
$body.append(mask_dom);
mask_dom.animate({
opacity: 0.5
}, 300);
return mask_dom;
};
var dialog = function (show_cb) {
if (!show_cb) {
show_cb = function () {
}
}
var mask_dom = mask();
var self = this,
bodyScrollTop = null,
windowHeight = $("window").height(),
self_width = self.last().outerWidth(),
self_height = self.last().outerHeight();
($("body").scrollTop() == 0) ? (bodyScrollTop = document.documentElement.scrollTop) : (bodyScrollTop = $("body").scrollTop());
var m_top = bodyScrollTop + (windowHeight - self_height / 2) - 30,
m_left = 0 - self_width / 2;
self.last().css({
marginTop: m_top,
marginLeft: m_left
});
show_cb();
self.find(".lyt_dialog_inside").addClass("lyt_dialog_light");
var selfLen = self.length;
self.dialog_close = function (callback) {
if (selfLen > 1) {
self.last().find(".lyt_dialog_inside").removeClass("lyt_dialog_light");
setTimeout(function () {
self.last().remove();
}, 300);
} else {
mask_dom.animate(
{opacity: 0},
300,
function () {
mask_dom.remove();
}
);
self.find(".lyt_dialog_inside").removeClass("lyt_dialog_light");
setTimeout(function () {
self.remove();
}, 300);
if (typeof callback === 'function') {
callback();
}
return;
}
selfLen--;
};
return self;
};
$(window).resize(function () {
var bodyHeight = $("body").height(),
windowHeight = $(window).height(),
inHeight = null;
(bodyHeight > windowHeight) ? (inHeight = bodyHeight) : (inHeight = windowHeight);
$("#mask").height(inHeight);
});
$.fn.dialog = dialog;
var confirm = function (config) {
var con = {
title: '温馨提示',
html: '',
init_fun: function () {
},
ok_fun: function () {
},
cancel_fun: function () {
},
ok_btn_name: '确 定',
cancel_btn_name: '取 消',
width: "500"
//status: null,
//time: null
}
con = $.extend(con, config || {});
var htmlTwins = '<div class="lyt_dialog" style="width:' + con.width + 'px">' +
'<div class="lyt_dialog_inside">' +
'<div class="lyt_dialog_hd">' +
con.title +
'<span class="lyt_dialog_close"><i></i></span>' +
'</div>' +
'<div class="lyt_dialog_bd">' +
con.html +
'</div>' +
'<div class="lyt_dialog_fd">' +
'<span class="btn_yes">' + con.ok_btn_name + '</span>' +
'<span class="btn_no">' + con.cancel_btn_name + '</span>' +
'</div>' +
'</div>' +
'</div>',
htmlSingle = '<div class="lyt_dialog" style="width:' + con.width + 'px">' +
'<div class="lyt_dialog_inside">' +
'<div class="lyt_dialog_hd">' +
con.title +
'<span class="lyt_dialog_close"><i></i></span>' +
'</div>' +
'<div class="lyt_dialog_bd lyt_dialog_hd_single">' +
con.html +
'</div>' +
'<div class="lyt_dialog_fd">' +
'<span class="btn_yes">' + con.ok_btn_name + '</span>' +
'</div>' +
'</div>' +
'</div>',
htmlNone = '<div class="lyt_dialog" style="width:' + con.width + 'px">' +
'<div class="lyt_dialog_inside">' +
'<span class="lyt_dialog_close"><i></i></span>' +
'<div class="lyt_dialog_bd lyt_dialog_hd_none">' +
con.html +
'</div>' +
'<div class="countdown_text">' +
'弹窗<b>' + con.time + '</b>秒后消失' +
'</div>' +
'</div>' +
'</div>';
if (con.status == 0) {
$('body').append(htmlNone);
} else if (con.status == 1) {
$('body').append(htmlSingle);
} else {
$('body').append(htmlTwins);
}
var confirm_dialog = $('.lyt_dialog').dialog(function () {
con.init_fun(confirm_dialog);
});
confirm_dialog.find('.btn_yes').click(function () {
if (con.ok_fun(confirm_dialog) + '' !== 'false') {
confirm_dialog.dialog_close();
}
})
confirm_dialog.find('.btn_no').click(function () {
if (con.cancel_fun(confirm_dialog) + '' !== 'false') {
confirm_dialog.dialog_close();
}
})
confirm_dialog.find('.lyt_dialog_close').click(function () {
confirm_dialog.dialog_close();
})
if (con.time != null) {
setTimeout(function () {
confirm_dialog.dialog_close();
con.ok_fun(confirm_dialog);
}, con.time * 1000);
setInterval(function () {
var x = confirm_dialog.find('.countdown_text b').text();
x--;
confirm_dialog.find('.countdown_text b').text(x);
}, 1000);
}
}
$.confirm = confirm;

var alertDom = function () {
var alertMask = $(".lyt_alert");
if (!alertMask.length) {
alertMask = $('<div class="lyt_alert"></div>');
}
var $body = $("body"),
height1 = $body.height(),
height2 = $(window).height();
if (height1 > height2) {
alertMask.css({
height: height1
});
} else {
alertMask.css({
height: height2
});
}
$body.append(alertMask);
return alertMask;
}
var alert_fail = function (content, callback) {
alertDom();
var failHtml = '<div class="bg">' +
'</div>' +
'<div class="lyt_alert_inside">' +
'<span class="wrong"></span>' +
'<p>' +
content +
'</p>' +
'</div>';
$(".lyt_alert").append(failHtml);
var pageScrollTop;
( $("body").scrollTop() == 0 ) ? pageScrollTop = document.documentElement.scrollTop : pageScrollTop = $("body").scrollTop();
$(".lyt_alert_inside").css({
"margin-top": (pageScrollTop + ( $(window).height() - $(".lyt_alert_inside").outerHeight() ) / 2 - 30)
});
$(".lyt_alert .bg").animate({
opacity: .6
}, 300);
setTimeout(function () {
$(".lyt_alert").fadeOut()
}, 2000);
setTimeout(function () {
$(".lyt_alert").remove()
}, 2001);
if (typeof callback === "function") {
setTimeout(callback, 2001);
}
}
window.alert_fail = alert_fail;
var alert_success = function (content, callback) {
alertDom();
var failHtml = '<div class="bg">' +
'</div>' +
'<div class="lyt_alert_inside">' +
'<span class="right"></span>' +
'<p>' +
content +
'</p>' +
'</div>';
$(".lyt_alert").append(failHtml);
var pageScrollTop;
( $("body").scrollTop() == 0 ) ? pageScrollTop = document.documentElement.scrollTop : pageScrollTop = $("body").scrollTop();
$(".lyt_alert_inside").css({
"margin-top": (pageScrollTop + ( $(window).height() - $(".lyt_alert_inside").outerHeight() ) / 2 - 30)
});
$(".lyt_alert .bg").animate({
opacity: .6
}, 300);
setTimeout(function () {
$(".lyt_alert").fadeOut()
}, 2000);
setTimeout(function () {
$(".lyt_alert").remove()
}, 2001);
if (typeof callback === "function") {
setTimeout(callback, 2001);
}
}
window.alert_success = alert_success;
// alert弹窗
var alert_confirm = function (content, callback, width) {
$.confirm({
title: '系统提示',
html: '<div class="mod-pop-tips mod-pop-tips-only"><i class="bg"></i>' + content + '</div>',
ok_fun: callback,
cancel_btn_name: '取 消',
confirm_btn_name: '确 定',
width: width ? width : 500
});
}
window.alert_confirm = alert_confirm;
// mobile_alert弹窗
var alert_confirm_m = function (content, callback, width) {
$.confirm({
title: '',
html: content,
ok_fun: callback,
cancel_btn_name: '取 消',
ok_btn_name: '确 定',
width: ''
});
}
window.alert_confirm_m = alert_confirm_m;
};
DialogPopup();

//搜索栏交互效果
var SearchLight = function () {
var search = $("#j-search"),
obj = search.find(".txt"),
defSWidth = search.width(),
defWidth = obj.width();
obj.focus(function () {
var tmpVal = $(this).val();
if (tmpVal == "") {
search.animate({width: "+240px"}, 200).addClass("searchFocus");
$(this).animate({width: "+195px"}, 200);
}
;
});
obj.blur(function () {
var tmpVal = $(this).val();
if (tmpVal == "") {
search.animate({width: "+" + defSWidth}, 150).removeClass("searchFocus");
$(this).animate({width: "+" + defWidth}, 150);
}
;
});
};
SearchLight();

//消息盒子入口交互效果
var mailInfo = function(){
var mail = $("#j-mail");
mail.hover(function(){
$(this).addClass("cur");
$(this).find(".hide-box").show();
},function(){
$(this).removeClass("cur");
$(this).find(".hide-box").hide();
});
};
mailInfo();

//取得时间戳日期格式
Date.prototype.format = function(format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S+": this.getMilliseconds()
};
if (/(y+)/i.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length));
}
for (var k in date) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1
? date[k] : ("00" + date[k]).substr(("" + date[k]).length));
}
}
return format;
}
//console.log(newDate.format('yyyy-MM-dd h:m:s')); 输出格式

//检测url地址后的参数函数
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)return unescape(r[2]);
return null;
}

//弹窗选项卡组件
function popTab(){
$(".j-pop-tab").find("span").each(function(i){
$(this).click(function(){
$(this).siblings().removeClass("cur").end().addClass("cur");
$(".j-pop-bd-area").find(".bd").eq(i).siblings().hide().removeClass("bdcur").end().show().addClass("bdcur");
});
});
//相关的全选反选功能
$("body").on("click",".j-checkall",function(){
$(this).parents(".mod-pop-tabbox").find(".bdcur input").attr("checked",true);
});
$("body").on("click",".j-uncheckall",function(){
$(this).parents(".mod-pop-tabbox").find(".bdcur input").attr("checked",false);
});
$("body").on("click",".j-checklistall",function(){
if($(this).prop("checked") == true){
$(this).parents(".inside").find(".j-single-checkbox").attr("checked",true);
}else{
$(this).parents(".inside").find(".j-single-checkbox").attr("checked",false);
}
});
$("body").on("click",".j-single-checkbox",function(){
var tmp = 0;
$(this).parents(".inside").find(".j-single-checkbox").each(function(){
if(this.checked){
tmp++;
}
});
if(tmp != 0){
$(this).parents(".inside").find(".j-checklistall").attr("checked",true);
}else{
$(this).parents(".inside").find(".j-checklistall").attr("checked",false);
}
});
};
$(function(){
popTab();
});
$(function(){
var minHei = $(window).height() - 67 - 135;
$(".main").css("minHeight",minHei);
});

//jquery.cookie
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

function boardcast(obj,category,intervalTime,animateSpeed){
this.Ul = obj;
this.Timer = intervalTime;//计时器间隔时间
var handId;//计时器id
var self = this;
this.Start = function () {
if (self.Ul.children().length < this.maxLength) {
self.Ul.append(self.Ul.children().clone());
}
handId = setInterval(self.Play, self.Timer);
};
this.Play = function () {
var img = self.Ul.children().eq(0);
//水平
if(category == 0){
var left = img.children().eq(0).width();
img.animate({ "marginLeft": (-1 * left) + "px" }, animateSpeed, function () {
$(this).css("margin-left", "auto").appendTo(self.Ul);
});
// 垂直
}else if(category == 1){
var top = img.children().eq(0).height();
img.animate({ "marginTop": (-1 * top) + "px" }, animateSpeed, function () {
$(this).css("margin-top", "auto").appendTo(self.Ul);
});
}
};
};

(function(){
var sys = {};
var ua = navigator.userAgent.toLowerCase();
var e;
(e = ua.match(/msie ([\d.]+)/)) ? sys.ie = e[1] :
(e = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = e[1] :
(e = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = e[1] :
(e = ua.match(/opera.([\d.]+)/)) ? sys.opera = e[1] :
(e = ua.match(/version\/([\d.]+).*safari/)) ? sys.safari = s[1] : 0;
if(sys.ie == 8.0 || sys.ie == 7.0 || sys.ie == 6.0){
var html = '<div class="explorer">您现在使用的是低版本的IE浏览器,为了保证浏览效果,请升级至IE9及以上或者推荐使用谷歌浏览器/火狐浏览器打开浏览</div>';
$(".system_frame").before(html);
$("body").addClass("explorer_status");
};
})();

posted @ 2015-09-08 15:46  Joerias  阅读(283)  评论(0编辑  收藏  举报