chore: add insight search hash support & fix commit counter link issue
This commit is contained in:
parent
2b450e5212
commit
99a47ee8d0
|
@ -1,9 +1,9 @@
|
||||||
<% if (post.comments) { %>
|
<% if (post.comments) { %>
|
||||||
<% if (theme.comment.disqus) { %>
|
<% 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) { %>
|
<% } 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) { %>
|
<% } 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>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
|
@ -13,9 +13,9 @@
|
||||||
<script>
|
<script>
|
||||||
(function ($) {
|
(function ($) {
|
||||||
$main = $('.ins-search');
|
$main = $('.ins-search');
|
||||||
|
$container = $('.ins-section-container');
|
||||||
$main.parent().remove('.ins-search');
|
$main.parent().remove('.ins-search');
|
||||||
$('body').append($main);
|
$('body').append($main);
|
||||||
$container = $('.ins-section-container');
|
|
||||||
|
|
||||||
$(document).on('click focus', '.search-form-input', function () {
|
$(document).on('click focus', '.search-form-input', function () {
|
||||||
$main.addClass('show');
|
$main.addClass('show');
|
||||||
|
@ -26,7 +26,6 @@
|
||||||
$main.removeClass('show');
|
$main.removeClass('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function section (title) {
|
function section (title) {
|
||||||
return $('<section>').addClass('ins-section')
|
return $('<section>').addClass('ins-section')
|
||||||
.append($('<header>').addClass('ins-section-header').text(title));
|
.append($('<header>').addClass('ins-section-header').text(title));
|
||||||
|
@ -190,6 +189,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$.getJSON('<%- url_for("/content.json")%>', function (json) {
|
$.getJSON('<%- url_for("/content.json")%>', function (json) {
|
||||||
|
if (location.hash.trim() == '#ins-search') {
|
||||||
|
$main.addClass('show');
|
||||||
|
}
|
||||||
$('.ins-search-input').on('input', function () {
|
$('.ins-search-input').on('input', function () {
|
||||||
var keywords = $(this).val();
|
var keywords = $(this).val();
|
||||||
searchResultToDOM(search(json, keywords));
|
searchResultToDOM(search(json, keywords));
|
||||||
|
|
Loading…
Reference in New Issue