Skip to content

Commit

Permalink
Add post-layout logic as per #85
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Lafourcade committed Dec 29, 2019
1 parent 71cea6b commit 7f871f2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions themes/vimways/layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2>{{ .Title }}</h2>
<div class="articles">
{{ range $pages_on_screen }}
{{ if hasPrefix . "ko" }}
<div class="future">
<div class="future" data-movable="{{ strings.TrimPrefix "ko" . }}">
<article>
<div class="bar"></div>
<div class="tile">
Expand Down Expand Up @@ -87,7 +87,7 @@ <h2 class="spoiler">
</div>
{{ else }}
{{ with (index (sort $.Pages.ByPublishDate "value" "desc") (int .)) }}
<a href="{{ .Permalink }}">
<a href="{{ .Permalink }}" class="-{{ .PublishDate.Format "2" }}-{{ .PublishDate.Format "January" }}">
<article>
<div class="tile">
<div class="date">
Expand Down
22 changes: 22 additions & 0 deletions themes/vimways/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,26 @@ document.addEventListener("DOMContentLoaded", function() {
window.location.href = this.elements[0].value;
}, false);
}

if (window.location.pathname === '/2019/') {
var futures = document.querySelectorAll('.future');
var container = document.querySelector('.container > .articles');

var articles = [];

futures.forEach(function(future){
var movable = parseInt(future.attributes['data-movable'].value, 10);
if (movable > 0 && movable <= 5) {
articles.push(future);
}
if (movable > 5 && movable < 25) {
future.parentNode.removeChild(future);
}
});

articles.forEach(function(article) {
article.querySelector('.month-year').innerHTML = 'January';
container.appendChild(article);
});
}
}, false);

0 comments on commit 7f871f2

Please sign in to comment.