Commit 674c44ad authored by Vanessa's avatar Vanessa

bug timeline

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