...
|
...
|
@@ -8,6 +8,7 @@ var $ = require('jquery'), |
|
|
Swiper = require("yoho-idangerous.swiper"),
|
|
|
jsonp = require("yoho-jsonp");
|
|
|
require("lazyload");
|
|
|
window.tmp$=$;
|
|
|
$(".lazy").lazyload();
|
|
|
//菜单初始化所使用变量
|
|
|
var menuTmpl = $("#menuItemTmpl").html(),
|
...
|
...
|
@@ -122,7 +123,7 @@ $(window).scroll(function() { |
|
|
"padding-top": "10px",
|
|
|
"top": 0,
|
|
|
//left:"50%",
|
|
|
"z-index": 99999
|
|
|
"z-index": 998
|
|
|
}).show();
|
|
|
minMenuHasShow = true;
|
|
|
$(".enterprise-header-fixed").show();
|
...
|
...
|
@@ -345,18 +346,7 @@ $(".search-text").click(function() { |
|
|
}
|
|
|
});
|
|
|
//=================================================================================
|
|
|
window.scrollWindow = function() {
|
|
|
if (document.body.clientWidth >= 1190) {
|
|
|
window.tmp$(window).scrollTop(926);
|
|
|
} else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
|
|
window.tmp$(window).scrollTop(931);
|
|
|
} else if (document.body.clientWidth <= 768) {
|
|
|
window.tmp$(window).scrollTop(889);
|
|
|
}
|
|
|
};
|
|
|
if ($("#scrollToContent")[0] != null) {
|
|
|
window.scrollWindow();
|
|
|
}
|
|
|
|
|
|
//初始化菜单============================================================================
|
|
|
jsonp({
|
|
|
url: YohoConfig.mainUrl + "/default/default/getnewest",
|
...
|
...
|
@@ -383,7 +373,7 @@ jsonp({ |
|
|
/**
|
|
|
* 设置并格式化时间
|
|
|
*/
|
|
|
function setTime() {
|
|
|
window.setTime=function() {
|
|
|
// 获取客户端的当前时间戳(秒)
|
|
|
var nowTime = Date.parse(new Date()) / 1000;
|
|
|
var sendTime = 0,
|
...
|
...
|
@@ -415,19 +405,18 @@ function setTime() { |
|
|
}
|
|
|
/* 当前时间与发布时间的相差时间戳 */
|
|
|
differTime = nowTime - sendTime;
|
|
|
console.log(differTime);
|
|
|
formattedTime = GetTimeDiff(differTime);
|
|
|
formattedTime=GetTimeDiff(differTime);
|
|
|
// 替换为格式化后显示的时间
|
|
|
var tmpHtml = $(this).html();
|
|
|
$(this).html(tmpHtml + formattedTime);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
setTime();
|
|
|
|
|
|
|
|
|
|
|
|
//获取两个时间点的间隔天数
|
|
|
function GetTimeDiff(differTime) {
|
|
|
window.GetTimeDiff=function(differTime) {
|
|
|
// 小于 60 秒
|
|
|
var formattedTime = '';
|
|
|
if (differTime < 60) {
|
...
|
...
|
@@ -460,52 +449,21 @@ function GetTimeDiff(differTime) { |
|
|
return formattedTime;
|
|
|
}
|
|
|
|
|
|
function getWeeks(days) {
|
|
|
return Match.floor(days / 7);
|
|
|
}
|
|
|
|
|
|
function formatDate(date) {
|
|
|
var tmp = date.split(' ').reverse();
|
|
|
return tmp.join('-');
|
|
|
}
|
|
|
|
|
|
function setDate() {
|
|
|
|
|
|
var homeTime = $(".item-date");
|
|
|
var channelTime = $(".content-item-detail-subchannle");
|
|
|
if (homeTime.length === 0 && channelTime > 0) {
|
|
|
channelTime.each(function(index, obj) {
|
|
|
var tmpDate = $(this).find("span").text();
|
|
|
var tmpDays = formatDate(tmpDate);
|
|
|
});
|
|
|
|
|
|
} else if (homeTime.length > 0 && channelTime === 0) {
|
|
|
homeTime.each(function(index, obj) {
|
|
|
var tmpDate = $(this).text().substring(4);
|
|
|
var tmpDays = formatDate(tmpDate);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getDate(days) {
|
|
|
if (days == 1) {
|
|
|
return ' 1 day ago';
|
|
|
} 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) {
|
|
|
return '1 month ago';
|
|
|
} 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';
|
|
|
//====================================================================================
|
|
|
window.scrollWindow = function() {
|
|
|
if (document.body.clientWidth >= 1190) {
|
|
|
window.tmp$(window).scrollTop(620);
|
|
|
} else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
|
|
window.tmp$(window).scrollTop(631);
|
|
|
} else if (document.body.clientWidth <= 768) {
|
|
|
window.tmp$(window).scrollTop(630);
|
|
|
}
|
|
|
|
|
|
setTime();
|
|
|
};
|
|
|
if ($("#scrollToContent")[0] != null) {
|
|
|
window.scrollWindow();
|
|
|
}
|
|
|
|
|
|
//==================================================================================== |
|
|
\ No newline at end of file |
|
|
else
|
|
|
{
|
|
|
setTime();
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|