diff --git a/assets/css/oscar.css b/assets/css/oscar.css index a57f47d..466a16f 100644 --- a/assets/css/oscar.css +++ b/assets/css/oscar.css @@ -79,7 +79,6 @@ h1, h2, h3, h4, h5, h6 { .masthead { padding-top: 0.5rem; padding-bottom: 0.5rem; - margin-bottom: 3rem; border-bottom: 1px solid #eee; display: inline-block; width: 100%; @@ -115,6 +114,23 @@ h1, h2, h3, h4, h5, h6 { padding-bottom: 0.5rem; } } +.tag-nav { + margin-top: 0.5rem; + margin-bottom: 2.5rem; + font-weight: 200; +} + +.tag-nav a { + padding: 0 5px; +} + +.tag-nav a:hover { + border:1px solid; + border-color: #B3B3B3; + border-radius: 5px; + text-decoration: none; + padding: 0 4px; +} .tag-template .masthead-title { font-size: 150%; @@ -146,42 +162,10 @@ h1, h2, h3, h4, h5, h6 { display: none; } } -.nav{ +/*******Navigation*********/ +.nav.animated{ display: none; } -// .masthead:hover{ -// display: inherit; -// padding-bottom: 1rem; -// animation: masterheadGrow .5s; -// } - -// .masthead:hover .nav{ -// animation: showNav .5s; -// } -// @keyframes showNav{ -// 0%{ -// background: red; -// display: none; -// } -// 90%{ -// background: blue; -// display: inherit; -// } -// 100%{ -// background: blue; -// display: inherit; -// } -// } -// @keyframes masterheadGrow{ -// 0%{ -// padding-bottom: 1rem; -// } -// 100%{ -// padding-bottom: 3rem; -// } -// } - -/*******Navigation*********/ .nav.container{ padding-top: 10px; diff --git a/assets/js/oscar.js b/assets/js/oscar.js index 62891af..c636f69 100644 --- a/assets/js/oscar.js +++ b/assets/js/oscar.js @@ -1,11 +1,38 @@ -$('.masthead').mouseenter(function(){ - $('.nav').slideToggle(200); -}).mouseleave(function(){ - $('.nav').slideToggle(200); -}); +let oscar = { + animatedNav: true, + tagMenu: true, + tagKey: '#tagnav', + requirePosts: false +}; + +if(oscar.animatedNav) { + $('.nav').addClass('animated'); + $('.masthead').mouseenter(function(){ + $('.nav').slideToggle(200); + }).mouseleave(function(){ + $('.nav').slideToggle(200); + }); +} $('a[href^=http]').each(function(){ if(this.href.indexOf(location.hostname) < 0) { $(this).attr({target: '_blank'}); } }); + +if(location.pathname === '/' && oscar.tagMenu) { + $.get(ghost.url.api('tags', {include: 'count.posts', order: 'count.posts DESC'})) + .then(function(data) { + var navTags = data.tags.filter(function(tag){ + return (oscar.requirePosts + ? tag.description && tag.count.posts && tag.description.includes(oscar.tagKey) + : tag.description && tag.description.includes(oscar.tagKey) + ); + }).forEach(function(tag){ + $('', { + href: '/tag/'+tag.slug, + text: tag.name + }).prependTo('.tag-nav'); + }); + }); +} diff --git a/default.hbs b/default.hbs index a138e36..ef2e03b 100644 --- a/default.hbs +++ b/default.hbs @@ -39,6 +39,7 @@ {{navigation}} +
{{{body}}}