Commit 1b1767ca authored by Liang Ding's avatar Liang Ding

Fix #11976

parent e729c4d8
...@@ -20,7 +20,7 @@ package org.b3log.solo.event; ...@@ -20,7 +20,7 @@ package org.b3log.solo.event;
* Event types. * Event types.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.7, Oct 17, 2012 * @version 1.1.0.7, May 30, 2014
* @since 0.3.1 * @since 0.3.1
*/ */
public final class EventTypes { public final class EventTypes {
...@@ -39,6 +39,11 @@ public final class EventTypes { ...@@ -39,6 +39,11 @@ public final class EventTypes {
* Indicates a remove article event. * Indicates a remove article event.
*/ */
public static final String REMOVE_ARTICLE = "Remove Article"; public static final String REMOVE_ARTICLE = "Remove Article";
/**
* Indicates a before render article event.
*/
public static final String BEFORE_RENDER_ARTICLE = "Before Render Article";
/** /**
* Indicates an add comment to article event. * Indicates an add comment to article event.
......
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.b3log.solo.plugin.list;
import org.b3log.latke.Latkes;
import org.b3log.latke.event.AbstractEventListener;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventException;
import org.b3log.latke.logging.Logger;
import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.Article;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
/**
* List (table of contents of an article) handler.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, May 30, 2014
* @since 0.6.7
*/
public class ListHandler extends AbstractEventListener<JSONObject> {
/**
* Logger.
*/
private static final Logger LOGGER = Logger.getLogger(ListHandler.class.getName());
/**
* Instance.
*/
private static final ListHandler INSTANCE = new ListHandler();
@Override
public String getEventType() {
return EventTypes.BEFORE_RENDER_ARTICLE;
}
/**
* Gets the instance.
*
* @return instance
*/
public static ListHandler getInstance() {
return INSTANCE;
}
@Override
public void action(final Event<JSONObject> event) throws EventException {
final JSONObject data = event.getData();
final JSONObject article = data.optJSONObject(Article.ARTICLE);
String content = article.optString(Article.ARTICLE_CONTENT);
final Document doc = Jsoup.parse(content);
final StringBuilder listBuilder = new StringBuilder();
listBuilder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + Latkes.getStaticPath() + "/plugins/list/style.css\" />");
final Elements hs = doc.select("h1, h2, h3, h4, h5");
listBuilder.append("<ul class='b3-solo-list'>");
for (int i = 0; i < hs.size(); i++) {
final Element element = hs.get(i);
final String tagName = element.tagName().toLowerCase();
final String text = element.text();
final String id = "b3_solo_" + tagName + "_" + i;
element.before("<span id='" + id + "'></span>");
listBuilder.append("<li class='b3-solo-list-").append(tagName).append("'><a href='#").append(id).append("'>").append(text).append(
"</a></li>");
}
listBuilder.append("</ul>");
final Element body = doc.getElementsByTag("body").get(0);
content = listBuilder.toString() + body.html();
article.put(Article.ARTICLE_CONTENT, content);
}
}
...@@ -28,6 +28,9 @@ import org.apache.commons.lang.StringUtils; ...@@ -28,6 +28,9 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateFormatUtils; import org.apache.commons.lang.time.DateFormatUtils;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
import org.b3log.latke.Latkes; import org.b3log.latke.Latkes;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventException;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.logging.Level; import org.b3log.latke.logging.Level;
import org.b3log.latke.logging.Logger; import org.b3log.latke.logging.Logger;
import org.b3log.latke.model.Pagination; import org.b3log.latke.model.Pagination;
...@@ -50,6 +53,7 @@ import org.b3log.latke.util.Requests; ...@@ -50,6 +53,7 @@ import org.b3log.latke.util.Requests;
import org.b3log.latke.util.Stopwatchs; import org.b3log.latke.util.Stopwatchs;
import org.b3log.latke.util.Strings; import org.b3log.latke.util.Strings;
import org.b3log.solo.SoloServletListener; import org.b3log.solo.SoloServletListener;
import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.*; import org.b3log.solo.model.*;
import org.b3log.solo.processor.renderer.ConsoleRenderer; import org.b3log.solo.processor.renderer.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.processor.util.Filler;
...@@ -66,7 +70,7 @@ import org.jsoup.Jsoup; ...@@ -66,7 +70,7 @@ import org.jsoup.Jsoup;
* Article processor. * Article processor.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.2.14, Nov 17, 2013 * @version 1.2.2.14, May 30, 2014
* @since 0.3.1 * @since 0.3.1
*/ */
@RequestProcessor @RequestProcessor
...@@ -130,20 +134,26 @@ public class ArticleProcessor { ...@@ -130,20 +134,26 @@ public class ArticleProcessor {
*/ */
@Inject @Inject
private ArticleMgmtService articleMgmtService; private ArticleMgmtService articleMgmtService;
/** /**
* Statistic management service. * Statistic management service.
*/ */
@Inject @Inject
private StatisticMgmtService statisticMgmtService; private StatisticMgmtService statisticMgmtService;
/**
* Event manager.
*/
@Inject
private EventManager eventManager;
/** /**
* Shows the article view password form. * Shows the article view password form.
* *
* @param context the specified context * @param context the specified context
* @param request the specified HTTP servlet request * @param request the specified HTTP servlet request
* @param response the specified HTTP servlet response * @param response the specified HTTP servlet response
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/console/article-pwd", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/console/article-pwd", method = HTTPRequestMethod.GET)
public void showArticlePwdForm(final HTTPRequestContext context, public void showArticlePwdForm(final HTTPRequestContext context,
...@@ -196,11 +206,11 @@ public class ArticleProcessor { ...@@ -196,11 +206,11 @@ public class ArticleProcessor {
/** /**
* Processes the article view password form submits. * Processes the article view password form submits.
* *
* @param context the specified context * @param context the specified context
* @param request the specified HTTP servlet request * @param request the specified HTTP servlet request
* @param response the specified HTTP servlet response * @param response the specified HTTP servlet response
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/console/article-pwd", method = HTTPRequestMethod.POST) @RequestProcessing(value = "/console/article-pwd", method = HTTPRequestMethod.POST)
public void onArticlePwdForm(final HTTPRequestContext context, public void onArticlePwdForm(final HTTPRequestContext context,
...@@ -242,9 +252,9 @@ public class ArticleProcessor { ...@@ -242,9 +252,9 @@ public class ArticleProcessor {
/** /**
* Gets random articles with the specified context. * Gets random articles with the specified context.
* *
* @param context the specified context * @param context the specified context
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/get-random-articles.do", method = HTTPRequestMethod.POST) @RequestProcessing(value = "/get-random-articles.do", method = HTTPRequestMethod.POST)
public void getRandomArticles(final HTTPRequestContext context) throws Exception { public void getRandomArticles(final HTTPRequestContext context) throws Exception {
...@@ -279,11 +289,11 @@ public class ArticleProcessor { ...@@ -279,11 +289,11 @@ public class ArticleProcessor {
/** /**
* Gets relevant articles with the specified context. * Gets relevant articles with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
* @param response the specified response * @param response the specified response
* @throws Exception exception * @throws Exception exception
*/ */
@RequestProcessing(value = "/article/id/*/relevant/articles", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/article/id/*/relevant/articles", method = HTTPRequestMethod.GET)
public void getRelevantArticles(final HTTPRequestContext context, public void getRelevantArticles(final HTTPRequestContext context,
...@@ -338,9 +348,9 @@ public class ArticleProcessor { ...@@ -338,9 +348,9 @@ public class ArticleProcessor {
/** /**
* Gets article content with the specified context. * Gets article content with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
*/ */
@RequestProcessing(value = "/get-article-content", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/get-article-content", method = HTTPRequestMethod.GET)
public void getArticleContent(final HTTPRequestContext context, final HttpServletRequest request) { public void getArticleContent(final HTTPRequestContext context, final HttpServletRequest request) {
...@@ -372,7 +382,7 @@ public class ArticleProcessor { ...@@ -372,7 +382,7 @@ public class ArticleProcessor {
/** /**
* Gets articles paged with the specified context. * Gets articles paged with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
*/ */
...@@ -429,7 +439,7 @@ public class ArticleProcessor { ...@@ -429,7 +439,7 @@ public class ArticleProcessor {
/** /**
* Gets tag articles paged with the specified context. * Gets tag articles paged with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
*/ */
...@@ -507,7 +517,7 @@ public class ArticleProcessor { ...@@ -507,7 +517,7 @@ public class ArticleProcessor {
/** /**
* Gets tag articles paged with the specified context. * Gets tag articles paged with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
*/ */
...@@ -578,7 +588,7 @@ public class ArticleProcessor { ...@@ -578,7 +588,7 @@ public class ArticleProcessor {
/** /**
* Gets author articles paged with the specified context. * Gets author articles paged with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
*/ */
...@@ -642,12 +652,12 @@ public class ArticleProcessor { ...@@ -642,12 +652,12 @@ public class ArticleProcessor {
/** /**
* Shows author articles with the specified context. * Shows author articles with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
* @param response the specified response * @param response the specified response
* @throws IOException io exception * @throws IOException io exception
* @throws JSONException json exception * @throws JSONException json exception
*/ */
@RequestProcessing(value = "/authors/**", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/authors/**", method = HTTPRequestMethod.GET)
public void showAuthorArticles(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response) public void showAuthorArticles(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response)
...@@ -730,7 +740,7 @@ public class ArticleProcessor { ...@@ -730,7 +740,7 @@ public class ArticleProcessor {
filler.fillBlogFooter(request, dataModel, preference); filler.fillBlogFooter(request, dataModel, preference);
filler.fillSide(request, dataModel, preference); filler.fillSide(request, dataModel, preference);
Skins.fillLangs(preference.optString(Preference.LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Preference.LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final ServiceException e) { } catch (final ServiceException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
...@@ -745,10 +755,10 @@ public class ArticleProcessor { ...@@ -745,10 +755,10 @@ public class ArticleProcessor {
/** /**
* Shows archive articles with the specified context. * Shows archive articles with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified request * @param request the specified request
* @param response the specified response * @param response the specified response
*/ */
@RequestProcessing(value = "/archives/**", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/archives/**", method = HTTPRequestMethod.GET)
public void showArchiveArticles(final HTTPRequestContext context, public void showArchiveArticles(final HTTPRequestContext context,
...@@ -825,7 +835,7 @@ public class ArticleProcessor { ...@@ -825,7 +835,7 @@ public class ArticleProcessor {
filler.fillBlogHeader(request, response, dataModel, preference); filler.fillBlogHeader(request, response, dataModel, preference);
filler.fillBlogFooter(request, dataModel, preference); filler.fillBlogFooter(request, dataModel, preference);
filler.fillSide(request, dataModel, preference); filler.fillSide(request, dataModel, preference);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
...@@ -840,7 +850,7 @@ public class ArticleProcessor { ...@@ -840,7 +850,7 @@ public class ArticleProcessor {
/** /**
* Updates article random double value. * Updates article random double value.
* *
* @param request the specified request * @param request the specified request
*/ */
@RequestProcessing(value = "/article-random-double-gen.do", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/article-random-double-gen.do", method = HTTPRequestMethod.GET)
...@@ -863,11 +873,11 @@ public class ArticleProcessor { ...@@ -863,11 +873,11 @@ public class ArticleProcessor {
/** /**
* Shows an article with the specified context. * Shows an article with the specified context.
* *
* @param context the specified context * @param context the specified context
* @param request the specified HTTP servlet request * @param request the specified HTTP servlet request
* @param response the specified HTTP servlet response * @param response the specified HTTP servlet response
* @throws IOException io exception * @throws IOException io exception
*/ */
@RequestProcessing(value = "/article", method = HTTPRequestMethod.GET) @RequestProcessing(value = "/article", method = HTTPRequestMethod.GET)
public void showArticle(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response) public void showArticle(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response)
...@@ -903,8 +913,6 @@ public class ArticleProcessor { ...@@ -903,8 +913,6 @@ public class ArticleProcessor {
articleQueryService.markdown(article); articleQueryService.markdown(article);
final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale());
// For <meta name="description" content="${article.articleAbstract}"/> // For <meta name="description" content="${article.articleAbstract}"/>
final String metaDescription = Jsoup.parse(article.optString(Article.ARTICLE_ABSTRACT)).text(); final String metaDescription = Jsoup.parse(article.optString(Article.ARTICLE_ABSTRACT)).text();
...@@ -937,8 +945,18 @@ public class ArticleProcessor { ...@@ -937,8 +945,18 @@ public class ArticleProcessor {
if (!Requests.hasBeenServed(request, response)) { if (!Requests.hasBeenServed(request, response)) {
articleMgmtService.incViewCount(articleId); articleMgmtService.incViewCount(articleId);
} }
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
// Fire [Before Render Article] event
final JSONObject eventData = new JSONObject();
eventData.put(Article.ARTICLE, article);
try {
eventManager.fireEventSynchronously(new Event<JSONObject>(EventTypes.BEFORE_RENDER_ARTICLE, eventData));
} catch (final EventException e) {
LOGGER.log(Level.ERROR, "Fires [" + EventTypes.BEFORE_RENDER_ARTICLE + "] event failed", e);
}
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
...@@ -952,7 +970,7 @@ public class ArticleProcessor { ...@@ -952,7 +970,7 @@ public class ArticleProcessor {
/** /**
* Sorts the specified articles by the specified preference. * Sorts the specified articles by the specified preference.
* *
* @param preference the specified preference * @param preference the specified preference
* @param articles the specified articles * @param articles the specified articles
* @throws JSONException json exception * @throws JSONException json exception
...@@ -969,7 +987,7 @@ public class ArticleProcessor { ...@@ -969,7 +987,7 @@ public class ArticleProcessor {
/** /**
* Gets archive date from the specified URI. * Gets archive date from the specified URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return archive date * @return archive date
*/ */
...@@ -981,7 +999,7 @@ public class ArticleProcessor { ...@@ -981,7 +999,7 @@ public class ArticleProcessor {
/** /**
* Gets the request page number from the specified request URI. * Gets the request page number from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return page number, returns {@code -1} if the specified request URI * @return page number, returns {@code -1} if the specified request URI
* can not convert to an number * can not convert to an number
...@@ -994,7 +1012,7 @@ public class ArticleProcessor { ...@@ -994,7 +1012,7 @@ public class ArticleProcessor {
/** /**
* Gets author id from the specified URI. * Gets author id from the specified URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return author id * @return author id
*/ */
...@@ -1012,7 +1030,7 @@ public class ArticleProcessor { ...@@ -1012,7 +1030,7 @@ public class ArticleProcessor {
/** /**
* Gets the request page number from the specified request URI. * Gets the request page number from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return page number * @return page number
*/ */
...@@ -1024,7 +1042,7 @@ public class ArticleProcessor { ...@@ -1024,7 +1042,7 @@ public class ArticleProcessor {
/** /**
* Gets the request page number from the specified request URI. * Gets the request page number from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return page number * @return page number
*/ */
...@@ -1034,7 +1052,7 @@ public class ArticleProcessor { ...@@ -1034,7 +1052,7 @@ public class ArticleProcessor {
/** /**
* Gets the request tag from the specified request URI. * Gets the request tag from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return tag * @return tag
*/ */
...@@ -1050,7 +1068,7 @@ public class ArticleProcessor { ...@@ -1050,7 +1068,7 @@ public class ArticleProcessor {
/** /**
* Gets the request page number from the specified request URI. * Gets the request page number from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return page number * @return page number
*/ */
...@@ -1060,7 +1078,7 @@ public class ArticleProcessor { ...@@ -1060,7 +1078,7 @@ public class ArticleProcessor {
/** /**
* Gets the request archive from the specified request URI. * Gets the request archive from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return archive, for example "2012/05" * @return archive, for example "2012/05"
*/ */
...@@ -1076,7 +1094,7 @@ public class ArticleProcessor { ...@@ -1076,7 +1094,7 @@ public class ArticleProcessor {
/** /**
* Gets the request page number from the specified request URI. * Gets the request page number from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return page number * @return page number
*/ */
...@@ -1086,7 +1104,7 @@ public class ArticleProcessor { ...@@ -1086,7 +1104,7 @@ public class ArticleProcessor {
/** /**
* Gets the request author id from the specified request URI. * Gets the request author id from the specified request URI.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @return author id * @return author id
*/ */
...@@ -1102,7 +1120,7 @@ public class ArticleProcessor { ...@@ -1102,7 +1120,7 @@ public class ArticleProcessor {
/** /**
* Gets the request page number from the specified request URI and author id. * Gets the request page number from the specified request URI and author id.
* *
* @param requestURI the specified request URI * @param requestURI the specified request URI
* @param authorId the specified author id * @param authorId the specified author id
* @return page number * @return page number
...@@ -1134,11 +1152,11 @@ public class ArticleProcessor { ...@@ -1134,11 +1152,11 @@ public class ArticleProcessor {
/** /**
* Prepares the specified data model for rendering author articles. * Prepares the specified data model for rendering author articles.
* *
* @param pageNums the specified page numbers * @param pageNums the specified page numbers
* @param dataModel the specified data model * @param dataModel the specified data model
* @param pageCount the specified page count * @param pageCount the specified page count
* @param currentPageNum the specified current page number * @param currentPageNum the specified current page number
* @param articles the specified articles * @param articles the specified articles
* @param author the specified author * @param author the specified author
* @throws ServiceException service exception * @throws ServiceException service exception
...@@ -1182,7 +1200,7 @@ public class ArticleProcessor { ...@@ -1182,7 +1200,7 @@ public class ArticleProcessor {
/** /**
* Prepares the specified data model for rendering archive articles. * Prepares the specified data model for rendering archive articles.
* *
* @param preference the specified preference * @param preference the specified preference
* @param dataModel the specified data model * @param dataModel the specified data model
* @param articles the specified articles * @param articles the specified articles
...@@ -1191,7 +1209,7 @@ public class ArticleProcessor { ...@@ -1191,7 +1209,7 @@ public class ArticleProcessor {
* @param archiveDateString the specified archive data string * @param archiveDateString the specified archive data string
* @param archiveDate the specified archive date * @param archiveDate the specified archive date
* @return page title for caching * @return page title for caching
* @throws Exception exception * @throws Exception exception
*/ */
private String prepareShowArchiveArticles(final JSONObject preference, private String prepareShowArchiveArticles(final JSONObject preference,
final Map<String, Object> dataModel, final Map<String, Object> dataModel,
...@@ -1246,7 +1264,7 @@ public class ArticleProcessor { ...@@ -1246,7 +1264,7 @@ public class ArticleProcessor {
/** /**
* Prepares the specified data model for rendering article. * Prepares the specified data model for rendering article.
* *
* @param preference the specified preference * @param preference the specified preference
* @param dataModel the specified data model * @param dataModel the specified data model
* @param article the specified article * @param article the specified article
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: B3log Solo parent POM. Description: B3log Solo parent POM.
Version: 2.0.4.10, Apr 28, 2014 Version: 2.0.4.11, May 31, 2014
Author: Liang Ding Author: Liang Ding
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<properties> <properties>
<servlet.version>2.5</servlet.version> <servlet.version>2.5</servlet.version>
<slf4j.version>1.7.5</slf4j.version> <slf4j.version>1.7.5</slf4j.version>
<org.b3log.latke.version>1.0.11</org.b3log.latke.version> <org.b3log.latke.version>1.0.12</org.b3log.latke.version>
<maven-gae-plugin.version>0.9.0</maven-gae-plugin.version> <maven-gae-plugin.version>0.9.0</maven-gae-plugin.version>
<gae.version>1.8.1.1</gae.version> <gae.version>1.8.1.1</gae.version>
......
...@@ -31,4 +31,3 @@ log4j.logger.org.b3log.solo=WARN ...@@ -31,4 +31,3 @@ log4j.logger.org.b3log.solo=WARN
log4j.logger.org.b3log.latke=ERROR log4j.logger.org.b3log.latke=ERROR
log4j.logger.org.b3log.latke.util.freemarker.Templates=ERROR log4j.logger.org.b3log.latke.util.freemarker.Templates=ERROR
#
# Copyright (c) 2009, 2010, 2011, B3log Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: Table of contents generator.
# Version: 1.0.0.0, May 30, 2014
# Author: Liang Ding
#
rendererId=footer.ftl
author=<a href="http://88250.b3log.org">88250</a>
name=Table of Contents Generator
version=0.0.1
types=PUBLIC
classesDirPath=/WEB-INF/classes/
pluginClass=
eventListenerClasses=org.b3log.solo.plugin.list.ListHandler
\ No newline at end of file
/*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* 403, 404, 500, article-pwd, init, login and kill-browser page style.
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.0.0, May 31, 2014
*/
.b3-solo-list {
margin: 20px 30px;
list-style: none;
}
.b3-solo-list-h1 {
}
.b3-solo-list-h2 {
margin-left: 16px;
}
.b3-solo-list-h3 {
margin-left: 32px;
}
.b3-solo-list-h4 {
margin-left: 48px;
}
.b3-solo-list-h5 {
margin-left: 62px;
}
\ No newline at end of file
...@@ -237,20 +237,7 @@ var ease = { ...@@ -237,20 +237,7 @@ var ease = {
scrollEvent: function () { scrollEvent: function () {
var _it = this; var _it = this;
$(window).scroll(function () { $(window).scroll(function () {
var y = $(window).scrollTop(), var y = $(window).scrollTop();
topH = 0;
if ($("#top").css("display") === "block") {
topH = $("#top").height();
}
// header event
if (y >= _it.headerH + topH) {
_it.$nav.css("position", "fixed");
_it.$body.css("marginTop", "55px");
} else {
_it.$nav.css("position" ,"inherit");
_it.$body.css("marginTop", "0");
}
// go top icon show or hide // go top icon show or hide
if (y > _it.headerH) { if (y > _it.headerH) {
...@@ -293,15 +280,6 @@ var ease = { ...@@ -293,15 +280,6 @@ var ease = {
$(".article-body").each(function () { $(".article-body").each(function () {
this.innerHTML = Util.replaceEmString($(this).html()); this.innerHTML = Util.replaceEmString($(this).html());
}); });
},
/**
* @description 纠正评论滚动位置偏差
*/
scrollToCmt: function () {
if ($(window.location.hash).length == 1) {
$(window).scrollTop($(window.location.hash).offset().top - 60);
}
} }
}; };
......
...@@ -158,7 +158,6 @@ ...@@ -158,7 +158,6 @@
$(document).ready(function() { $(document).ready(function() {
page.load(); page.load();
ease.scrollToCmt();
// emotions // emotions
page.replaceCommentsEm("#comments .article-body"); page.replaceCommentsEm("#comments .article-body");
<#nested> <#nested>
......
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