...
|
...
|
@@ -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(),
|
...
|
...
|
@@ -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,
|
...
|
...
|
@@ -422,11 +412,11 @@ function setTime() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
setTime();
|
|
|
|
|
|
|
|
|
|
|
|
//获取两个时间点的间隔天数
|
|
|
function GetTimeDiff(differTime) {
|
|
|
window.GetTimeDiff=function(differTime) {
|
|
|
// 小于 60 秒
|
|
|
var formattedTime = '';
|
|
|
if (differTime < 60) {
|
...
|
...
|
@@ -459,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(600);
|
|
|
} 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);
|
|
|
}
|
|
|
|
|
|
setTime();
|
|
|
};
|
|
|
if ($("#scrollToContent")[0] != null) {
|
|
|
window.scrollWindow();
|
|
|
}
|
|
|
|
|
|
//==================================================================================== |
|
|
else
|
|
|
{
|
|
|
setTime();
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|