chore: add insight search hash support & fix commit counter link issue

This commit is contained in:
ppoffice 2016-04-07 10:53:51 +08:00
parent 2b450e5212
commit 99a47ee8d0
2 changed files with 7 additions and 5 deletions

View File

@ -1,9 +1,9 @@
<% if (post.comments) { %>
<% if (theme.comment.disqus) { %>
<a href="<%- url_for(post.permalink) %>#comments" class="article-comment-link disqus-comment-count" data-disqus-url="<%= url_for(post.permalink) %>"><%= __('article.comments') %></a>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link disqus-comment-count" data-disqus-url="<%= url_for(post.path) %>"><%= __('article.comments') %></a>
<% } else if (theme.comment.duoshuo) { %>
<a href="<%- url_for(post.permalink) %>#comments" class="article-comment-link ds-thread-count" data-thread-key="<%= post.path %>"><%= __('article.comments') %></a>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link ds-thread-count" data-thread-key="<%= post.path %>"><%= __('article.comments') %></a>
<% } else if (theme.comment.youyan) { %>
<a href="<%- url_for(post.permalink) %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<% } %>
<% } %>

View File

@ -13,9 +13,9 @@
<script>
(function ($) {
$main = $('.ins-search');
$container = $('.ins-section-container');
$main.parent().remove('.ins-search');
$('body').append($main);
$container = $('.ins-section-container');
$(document).on('click focus', '.search-form-input', function () {
$main.addClass('show');
@ -26,7 +26,6 @@
$main.removeClass('show');
});
function section (title) {
return $('<section>').addClass('ins-section')
.append($('<header>').addClass('ins-section-header').text(title));
@ -190,6 +189,9 @@
}
$.getJSON('<%- url_for("/content.json")%>', function (json) {
if (location.hash.trim() == '#ins-search') {
$main.addClass('show');
}
$('.ins-search-input').on('input', function () {
var keywords = $(this).val();
searchResultToDOM(search(json, keywords));