Commit 674c44ad authored by Vanessa's avatar Vanessa

bug timeline

parent c047f532
......@@ -18,7 +18,7 @@
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.2, May 4, 2012
* @version 1.0.1.3, Jan 30, 2013
*/
/* article-list 相关操作 */
......@@ -135,6 +135,7 @@ admin.articleList = {
}
$it.html(tip);
$("#loadMsg").text("");
}
});
}
......
......@@ -1542,7 +1542,7 @@ admin.comment = {
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.1.2, May 4, 2012
* @version 1.0.1.3, Jan 30, 2013
*/
/* article-list 相关操作 */
......@@ -1659,6 +1659,7 @@ admin.articleList = {
}
$it.html(tip);
$("#loadMsg").text("");
}
});
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,7 +12,7 @@
<#include "header.ftl">
<div class="main">
<div class="wrapper">
<h2>${archive1Label}
<h2 id="archive">${archive1Label}
<#if "en" == localeString?substring(0, 2)>
${archiveDate.archiveDateMonth} ${archiveDate.archiveDateYear} (${archiveDate.archiveDatePublishedArticleCount})
<#else>
......
......@@ -12,7 +12,7 @@
<#include "header.ftl">
<div class="main">
<div class="wrapper">
<h2>${author1Label}${authorName}</h2>
<h2 id="author">${author1Label}${authorName}</h2>
<#include "article-list.ftl">
</div>
</div>
......
......@@ -11,7 +11,7 @@
${topBarReplacement}
<#include "header.ftl">
<div class="main">
<div class="wrapper">
<div class="wrapper" id="index">
<#include "article-list.ftl">
</div>
</div>
......
......@@ -28,16 +28,15 @@ var getNextPage = function () {
var $more = $(".article-next");
currentPage += 1;
var path = "/articles/";
if(location.pathname.indexOf("tags") === 1) {
var pathnames = location.pathname.split("/tags/");
path = "/articles/tags/" + pathnames[1].split("/")[0] + "/";
} else if (location.pathname.indexOf("archives") > -1) {
var archivesPathname = location.pathname.split("/archives/");
var archives = archivesPathname[1].split("/");
path = "/articles/archives/" + archives[0] + "/" + archives[1] + "/";
} else if (location.pathname.indexOf("authors") === 1) {
var pathnames = location.pathname.split("/authors/");
path = "/articles/authors/" + pathnames[1].split("/")[0] + "/";
if($("#tag").length === 1) {
var pathnames = location.pathname.split("/");
path = "/articles/tags/" + pathnames[pathnames.length - 1] + "/";
} else if ($("#archive").length === 1) {
var pathnames = location.pathname.split("/");
path = "/articles/archives/" + pathnames[pathnames.length - 2] + "/" + pathnames[pathnames.length - 1] + "/";
} else if ($("#author").length === 1) {
var pathnames = location.pathname.split("/");
path = "/articles/authors/" + pathnames[pathnames.length - 1] + "/";
}
$.ajax({
......
......@@ -13,7 +13,7 @@
<div class="main">
<div class="wrapper">
<h2>
<a rel="alternate" href="${servePath}/tag-articles-feed.do?oId=${tag.oId}">
<a id="tag" rel="alternate" href="${servePath}/tag-articles-feed.do?oId=${tag.oId}">
${tag1Label}
${tag.tagTitle}
(${tag.tagPublishedRefCount})
......
......@@ -10,7 +10,7 @@
<body>
${topBarReplacement}
<#include "header.ftl">
<h3 class="nav-abs">
<h3 class="nav-abs" id="author">
<img style="border-radius: 45px;" width="90" title="${authorName}" src="${authorThumbnailURL}"/>
<br/>
${authorName}
......
......@@ -60,7 +60,10 @@
"em11Label": "${em11Label}",
"em12Label": "${em12Label}",
"em13Label": "${em13Label}",
"em14Label": "${em14Label}"
"em14Label": "${em14Label}",
"localeString": "${localeString}",
"yearLabel": "${yearLabel}",
"monthLabel": "${monthLabel}"
};
</script>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
......
......@@ -13,7 +13,7 @@
<ul class="nav-abs" style="padding: 0;position: fixed">
<#list archiveDates as archiveDate>
<li data-year="${archiveDate.archiveDateYear}"
onclick="timeline.getArchive('${archiveDate.archiveDateYear}/${archiveDate.archiveDateMonth}')">
onclick="timeline.getArchive('${archiveDate.archiveDateYear}', '${archiveDate.archiveDateMonth}'<#if "en" == localeString?substring(0, 2)>, '${archiveDate.monthName}'</#if>)">
<#if "en" == localeString?substring(0, 2)>
${archiveDate.monthName} ${archiveDate.archiveDateYear}(${archiveDate.archiveDatePublishedArticleCount})
<#else>
......
......@@ -135,12 +135,17 @@ var timeline = {
window.open("http://translate.google.com/translate?sl=auto&tl=auto&u=" + location.href);
},
getArchive: function (archive) {
var archiveDate = archive.replace("/", "");
getArchive: function (year, month, monthName) {
var archiveDate = year + month,
archive = year + "/" + month;
if ($("#" + archiveDate + " > article").length > 0) {
window.location.hash = "#" + archiveDate;
} else {
var archiveHTML = '<h2><span class="article-archive">' + archiveDate + '</span></h2>'
var archiveDataTitle = year + " " + Label.yearLabel + " " + month + " " + Label.monthLabel;
if (Label.localeString.substring(0, 2) === "en") {
archiveDataTitle = monthName + " " + year;
}
var archiveHTML = '<h2><span class="article-archive">' + archiveDataTitle + '</span></h2>'
+ '<div class="article-more" onclick="timeline.getNextPage(this, \''
+ archive + '\')" data-page="0">' + Label.moreLabel + '</div>';
......@@ -153,12 +158,12 @@ var timeline = {
var $more = $(it),
currentPage = $more.data("page") + 1,
path = "/articles/";
if(location.pathname.indexOf("tags") === 1) {
var pathnames = location.pathname.split("/tags/");
path = "/articles/tags/" + pathnames[1].split("/")[0] + "/";
} else if (location.pathname.indexOf("authors") === 1) {
var pathnames = location.pathname.split("/authors/");
path = "/articles/authors/" + pathnames[1].split("/")[0] + "/";
if($("#tag").length === 1) {
var pathnames = location.pathname.split("/");
path = "/articles/tags/" + pathnames[pathnames.length - 1] + "/";
} else if ($("#author").length === 1) {
var pathnames = location.pathname.split("/");
path = "/articles/authors/" + pathnames[pathnames.length - 1] + "/";
} else if (archive) {
path = "/articles/archives/" + archive + "/";
}
......@@ -174,6 +179,11 @@ var timeline = {
if (!result.sc) {
return;
}
if (result.rslts.articles.length === 0) {
$more.remove();
return;
}
var articlesHTML = "",
pagination = result.rslts.pagination;
......@@ -220,30 +230,33 @@ var timeline = {
+ '</a></span></div></article>';
}
var colHA = parseInt($(".article-more").prev().prev().css("top")) + $(".article-more").prev().prev().outerHeight(true),
colHB = parseInt($(".article-more").prev().css("top")) + $(".article-more").prev().outerHeight(true);
var colHA = 0,
colHB = 0,
colH = [colHA, colHB];
if (archive) {
if (archive && $more.prev()[0].tagName.toLowerCase() === "h2") {
// 前面无 article
if ($(".article-more").prev()[0].tagName.toLowerCase() === "h2") {
colHA = timeline._COLHA + 60;
colHB = timeline._COLHB * 4;
}
colHA = timeline._COLHA + 60;
colHB = timeline._COLHB * 4;
colH = [colHA, colHB];
} else if (archive && $more.prev()[0].tagName.toLowerCase() === "article"
&& $more.prev().prev()[0].tagName.toLowerCase() === "h2") {
// 前面只有1篇文章
if ($(".article-more").prev()[0].tagName.toLowerCase() === "article"
&& $(".article-more").prev().prev()[0].tagName.toLowerCase() === "h2") {
colHA = parseInt($(".article-more").prev().css("top")) + $(".article-more").prev().outerHeight(true);
colHB = timeline._COLHB * 4;
colHA = parseInt($more.prev().css("top")) + $more.prev().outerHeight(true);
colHB = timeline._COLHB * 4;
colH = [colHA, colHB];
} else {
colHA = parseInt($more.prev().prev().css("top")) + $more.prev().prev().outerHeight(true);
colHB = parseInt($more.prev().css("top")) + $more.prev().outerHeight(true);
colH = [colHA, colHB];
if ($more.prev().prev().hasClass("r")) {
colH = [colHB, colHA];
}
}
var colH = [colHA, colHB];
$more.before(articlesHTML).data("page", currentPage);
// 最后一页处理
if (pagination.paginationPageCount === currentPage) {
if (pagination.paginationPageCount <= currentPage) {
$more.remove();
} else {
$more.css("background", "none #60829F").text(Label.moreLabel);
......
......@@ -10,7 +10,8 @@
<body>
${topBarReplacement}
<#include "header.ftl">
<h3 style="cursor: pointer" class="nav-abs" onclick="window.location.href='${servePath}/tag-articles-feed.do?oId=${tag.oId}'">
<h3 id="tag" style="cursor: pointer" class="nav-abs"
onclick="window.location.href='${servePath}/tag-articles-feed.do?oId=${tag.oId}'">
${tag.tagTitle}
(${tag.tagPublishedRefCount})
<img src="${staticServePath}/images/feed.png" alt="Atom"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment