-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Euijong Joo
committed
Jan 8, 2020
1 parent
b509158
commit 981fc0e
Showing
11 changed files
with
118 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<article class="post"> | ||
<header class="post-header home"> | ||
<div class="post-title">Category - <span id='category-name'></span></div> | ||
</header> | ||
|
||
<div class="post-content"> | ||
{%- if site.posts.size > 0 -%} | ||
<ul class="post-list"> | ||
{%- for post in site.posts -%} | ||
<li class="post-list-item post-category-{{post.categories}}"> | ||
<!-- {%- assign date_format = site.date_format | default: "%b %-d, %Y" -%} --> | ||
{%- assign date_format = "%Y/%m/%d" -%} | ||
<span class="post-date">{{ post.date | date: date_format }}</span> | ||
<a class="post-link" href="{{ post.url | relative_url }}"> | ||
{{ post.title | escape }} | ||
</a> | ||
{%- if site.show_excerpts -%}{{ post.excerpt }}{%- endif -%} | ||
</li> | ||
{%- endfor -%} | ||
</ul> | ||
{%- endif -%} | ||
</div> | ||
</article> | ||
|
||
<script src="/public/js/jquery-3.4.1.slim.min.js"></script> | ||
<script> | ||
function removeCategory() { | ||
if (window.location.hash) { | ||
let hash = window.location.hash.substring(1); | ||
$('#category-name').text(hash.substring(0, 1).toUpperCase() + hash.substring(1)); | ||
let category_class = '.post-category-' + hash; | ||
let items = $('.post-list-item').each((i, e) => { | ||
if (!$(e).hasClass('post-category-' + hash)) { | ||
$(e).hide(); | ||
} else { | ||
$(e).show(); | ||
} | ||
}); | ||
} | ||
} | ||
$(window).on('hashchange', () => { | ||
removeCategory(); | ||
}); | ||
$(document).ready(() => { | ||
removeCategory(); | ||
}) | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
layout: default | ||
--- | ||
{%- include category.html -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
layout: post | ||
layout: category | ||
title: Category | ||
permalink: /category/ | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(function($) { | ||
|
||
function init() { | ||
/* Sidebar height set */ | ||
$sidebarStyles = $('.sidebar').attr('style') || ""; | ||
$sidebarStyles += ' min-height: ' + $(document).height() + 'px;'; | ||
$('.sidebar').attr('style', $sidebarStyles); | ||
|
||
/* Secondary contact links */ | ||
var $scontacts = $('#contact-list-secondary'); | ||
var $contactList = $('#contact-list'); | ||
|
||
$scontacts.hide(); | ||
$contactList.mouseenter(function(){ $scontacts.fadeIn(); }); | ||
$contactList.mouseleave(function(){ $scontacts.fadeOut(); }); | ||
|
||
/** | ||
* Tags & categories tab activation based on hash value. If hash is undefined then first tab is activated. | ||
*/ | ||
function activateTab() { | ||
if(['/tags.html', '/categories.html'].indexOf(window.location.pathname) > -1) { | ||
var hash = window.location.hash; | ||
if(hash) | ||
$('.tab-pane').length && $('a[href="' + hash + '"]').tab('show'); | ||
else | ||
$('.tab-pane').length && $($('.cat-tag-menu li a')[0]).tab('show'); | ||
} | ||
} | ||
|
||
// watch hash change and activate relevant tab | ||
$(window).on('hashchange', activateTab); | ||
|
||
// initial activation | ||
activateTab(); | ||
}; | ||
|
||
// run init on document ready | ||
$(document).ready(init); | ||
|
||
})(jQuery); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.