...
|
...
|
@@ -61,8 +61,7 @@ if ($(".swiper-container").find(".swiper-slide").length > 1) { |
|
|
}
|
|
|
//==============================================================================================================
|
|
|
//centerbanner=============================================================================
|
|
|
if($(".swiper-container2")[0]!=null)
|
|
|
{
|
|
|
if ($(".swiper-container2")[0] != null) {
|
|
|
var bannerSwiper = new Swiper('.swiper-container2', {
|
|
|
pagination: '.pagination-adv',
|
|
|
loop: true,
|
...
|
...
|
@@ -261,7 +260,7 @@ function getBrowType() { |
|
|
//分享按钮位置
|
|
|
if (!isIpad && $(".share").size() > 0) {
|
|
|
var shareOffsetTop = $(".share").offset().top;
|
|
|
var navHeight = $("#minEnterprise").outerHeight();
|
|
|
var navHeight = $("#minEnterprise").outerHeight() + 10;
|
|
|
$(window).scroll(function() {
|
|
|
scrollTop = $(window).scrollTop();
|
|
|
if (shareOffsetTop - scrollTop - navHeight <= 0) {
|
...
|
...
|
@@ -381,50 +380,46 @@ jsonp({ |
|
|
//====================================================================================
|
|
|
//格式化碎片发布时间==================================================================
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* 设置并格式化时间
|
|
|
*/
|
|
|
function setTime()
|
|
|
{
|
|
|
function setTime() {
|
|
|
// 获取客户端的当前时间戳(秒)
|
|
|
var nowTime = Date.parse(new Date()) / 1000;
|
|
|
var sendTime = 0, differTime = 0;
|
|
|
var sendTime = 0,
|
|
|
differTime = 0;
|
|
|
var formattedTime = '';
|
|
|
|
|
|
|
|
|
var homeTime = $(".item-date"),
|
|
|
channelTime = $(".content-item-detail-subchannle"),
|
|
|
pageTime=null;
|
|
|
pageTime = null;
|
|
|
if (homeTime.length === 0 && channelTime.length > 0) {
|
|
|
pageTime=channelTime;
|
|
|
pageTime = channelTime;
|
|
|
|
|
|
} else if (homeTime.length > 0 && channelTime.length === 0) {
|
|
|
pageTime=homeTime;
|
|
|
}
|
|
|
else{
|
|
|
pageTime = homeTime;
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pageTime.each(function()
|
|
|
{
|
|
|
pageTime.each(function() {
|
|
|
/* 判断是否有参数项 */
|
|
|
if (!$(this).attr('_time'))
|
|
|
{
|
|
|
if (!$(this).attr('_time')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
/* 内容的发布时间 */
|
|
|
sendTime = parseInt($(this).attr('_time'), 10);
|
|
|
if (!sendTime || sendTime > nowTime)
|
|
|
{
|
|
|
if (!sendTime || sendTime > nowTime) {
|
|
|
return;
|
|
|
}
|
|
|
/* 当前时间与发布时间的相差时间戳 */
|
|
|
differTime = nowTime - sendTime;
|
|
|
console.log(differTime);
|
|
|
formattedTime=GetTimeDiff(differTime);
|
|
|
formattedTime = GetTimeDiff(differTime);
|
|
|
// 替换为格式化后显示的时间
|
|
|
var tmpHtml=$(this).html();
|
|
|
$(this).html(tmpHtml+formattedTime);
|
|
|
var tmpHtml = $(this).html();
|
|
|
$(this).html(tmpHtml + formattedTime);
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -434,39 +429,32 @@ setTime(); |
|
|
//获取两个时间点的间隔天数
|
|
|
function GetTimeDiff(differTime) {
|
|
|
// 小于 60 秒
|
|
|
var formattedTime='';
|
|
|
if (differTime < 60)
|
|
|
{
|
|
|
var formattedTime = '';
|
|
|
if (differTime < 60) {
|
|
|
formattedTime = (differTime > 1) ? differTime + 'secs ago' : '1sec ago';
|
|
|
}
|
|
|
}
|
|
|
// 1分钟 到 1小时
|
|
|
else if (differTime >= 60 && differTime < 3600)
|
|
|
{
|
|
|
else if (differTime >= 60 && differTime < 3600) {
|
|
|
formattedTime = (differTime > 120) ? Math.floor(differTime / 60) + 'mins ago' : '1min ago';
|
|
|
}
|
|
|
// 1小时 到 24小时
|
|
|
else if (differTime >= 3600 && differTime < 86400)
|
|
|
{
|
|
|
else if (differTime >= 3600 && differTime < 86400) {
|
|
|
formattedTime = (differTime > 7200) ? Math.floor(differTime / 3600) + 'hours ago' : '1hour ago';
|
|
|
}
|
|
|
// 1天 到 7天
|
|
|
else if (differTime >= 86400 && differTime < 604800)
|
|
|
{
|
|
|
else if (differTime >= 86400 && differTime < 604800) {
|
|
|
formattedTime = (differTime > 172800) ? Math.floor(differTime / 86400) + 'days ago' : '1day ago';
|
|
|
}
|
|
|
// 7天 到 4个星期
|
|
|
else if (differTime >= 604800 && differTime < 2592000)
|
|
|
{
|
|
|
else if (differTime >= 604800 && differTime < 2592000) {
|
|
|
formattedTime = (differTime > 1209600) ? Math.floor(differTime / 604800) + 'weeks ago' : '1week ago';
|
|
|
}
|
|
|
// 1个月 到 12个月
|
|
|
else if (differTime >= 2592000 && differTime < 31536000)
|
|
|
{
|
|
|
else if (differTime >= 2592000 && differTime < 31536000) {
|
|
|
formattedTime = (differTime > 5184000) ? Math.floor(differTime / 2592000) + 'months ago' : '1month ago';
|
|
|
}
|
|
|
// 1年 到 N年
|
|
|
else
|
|
|
{
|
|
|
else {
|
|
|
formattedTime = (differTime > 63072000) ? Math.floor(differTime / 31536000) + 'years ago' : '1year ago';
|
|
|
}
|
|
|
return formattedTime;
|
...
|
...
|
@@ -500,31 +488,24 @@ function setDate() { |
|
|
}
|
|
|
|
|
|
function getDate(days) {
|
|
|
if(days==1){
|
|
|
if (days == 1) {
|
|
|
return ' 1 day ago';
|
|
|
}
|
|
|
else if (days < 7) {
|
|
|
return days +' days ago';
|
|
|
}
|
|
|
else if(days < 14){
|
|
|
} else if (days < 7) {
|
|
|
return days + ' days ago';
|
|
|
} else if (days < 14) {
|
|
|
return ' 1 week ago';
|
|
|
}
|
|
|
else if (days < 30) {
|
|
|
return Match.floor(days/7) + ' weeks ago';
|
|
|
}else if(days<60){
|
|
|
} else if (days < 30) {
|
|
|
return Match.floor(days / 7) + ' weeks ago';
|
|
|
} else if (days < 60) {
|
|
|
return '1 month ago';
|
|
|
}
|
|
|
else if(days<365){
|
|
|
return Match.floor(days/30) + ' months ago';
|
|
|
}
|
|
|
else if(days<730){
|
|
|
} else if (days < 365) {
|
|
|
return Match.floor(days / 30) + ' months ago';
|
|
|
} else if (days < 730) {
|
|
|
return ' 1 year ago';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Match.floor(days/365) + ' years ago';
|
|
|
} else {
|
|
|
return Match.floor(days / 365) + ' years ago';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//==================================================================================== |
|
|
//==================================================================================== |
|
|
\ No newline at end of file |
...
|
...
|
|