style: use ES6 syntax and standard style

This commit is contained in:
curben 2018-11-01 12:05:09 +10:30
parent 316aa03bd8
commit 624d449a3e
12 changed files with 53 additions and 50 deletions

View File

@ -15,8 +15,8 @@
<%/* Initialize cloudinary responsive function */%> <%/* Initialize cloudinary responsive function */%>
<script type="text/javascript"> <script type="text/javascript">
var cl = cloudinary.Cloudinary.new({cloud_name: "curben"}); const cl = cloudinary.Cloudinary.new({cloud_name: "curben"})
cl.responsive(); cl.responsive()
</script> </script>
<%/* javascript of Typing theme */%> <%/* javascript of Typing theme */%>

View File

@ -1,20 +1,20 @@
<% if (pagination == 2){ %> <% if (pagination === 2) { %>
<% page.posts.each(function(post) { %> <% page.posts.each(function(post) { %>
<%- partial('article', {post: post, index: true}) %> <%- partial('article', {post: post, index: true}) %>
<% }) %> <% }) %>
<% } else { %> <% } else { %>
<% var last; %> <% let last %>
<% page.posts.each(function(post, i) { %> <% page.posts.each(function(post, i) { %>
<% var year = post.date.year(); %> <% const year = post.date.year() %>
<% if (last != year){ %> <% if (last !== year) { %>
<% if (last != null){ %> <% if (last !== null) { %>
</div></section> </div></section>
<% } %> <% } %>
<% last = year; %> <% last = year %>
<section class="archives-wrap"> <section class="archives-wrap">
<div class="archives"> <div class="archives">
<% } %> <% } %>
<%- partial('archive-post', {post: post, even: i % 2 == 0}) %> <%- partial('archive-post', {post: post, even: i % 2 === 0}) %>
<% }) %> <% }) %>
<% if (page.posts.length) { %> <% if (page.posts.length) { %>
</div></section> </div></section>
@ -22,7 +22,10 @@
<% } %> <% } %>
<% if (page.total > 1) { %> <% if (page.total > 1) { %>
<nav id="page-nav" class="page-nav"> <nav id="page-nav" class="page-nav">
<% var prev_text = "&laquo; " + __('prev');var next_text = __('next') + " &raquo;"%> <%
let prev_text = "&laquo; " + __('prev')
let next_text = __('next') + " &raquo;"
%>
<%- paginator({ <%- paginator({
prev_text: prev_text, prev_text: prev_text,
next_text: next_text next_text: next_text

View File

@ -3,20 +3,20 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<% <%
var title = page.title; let title = page.title
if (is_archive()) { if (is_archive()) {
title = __('archive_a'); title = __('archive_a')
if (is_month()) { if (is_month()) {
title += ': ' + page.year + '/' + page.month; title += ': ' + page.year + '/' + page.month
} else if (is_year()) { } else if (is_year()) {
title += ': ' + page.year; title += ': ' + page.year
} }
} else if (is_category()) { } else if (is_category()) {
title = __('category') + ': ' + page.category; title = __('category') + ': ' + page.category
} else if (is_tag()) { } else if (is_tag()) {
title = __('tag') + ': ' + page.tag; title = __('tag') + ': ' + page.tag
} }
%> %>
<title><% if (title) { %><%= title %> | <% } %><%= config.title %></title> <title><% if (title) { %><%= title %> | <% } %><%= config.title %></title>

View File

@ -10,7 +10,7 @@
<% } else { %> <% } else { %>
<nav id="main-nav" class="main-nav"> <nav id="main-nav" class="main-nav">
<% } %> <% } %>
<% for (var i in theme.menu){ %> <% for (let i in theme.menu) { %>
<a class="main-nav-link" href="<%- url_for(theme.menu[i]) %>"><%= i %></a> <a class="main-nav-link" href="<%- url_for(theme.menu[i]) %>"><%= i %></a>
<% } %> <% } %>
</nav> </nav>

View File

@ -10,7 +10,7 @@
</div> </div>
</div> </div>
<ul class="footer-links"> <ul class="footer-links">
<% for (var key in theme.links.solid) { %> <% for (let key in theme.links.solid) { %>
<li> <li>
<% if (theme.icons) { %> <% if (theme.icons) { %>
<a href="<%= theme.links.solid[key] %>"><span class="fas fa-<%= key.toLowerCase() %>"></span></a> <a href="<%= theme.links.solid[key] %>"><span class="fas fa-<%= key.toLowerCase() %>"></span></a>
@ -19,7 +19,7 @@
<% } %> <% } %>
</li> </li>
<% } %> <% } %>
<% for (var key in theme.links.brands) { %> <% for (let key in theme.links.brands) { %>
<li> <li>
<% if (theme.icons) { %> <% if (theme.icons) { %>
<a href="<%= theme.links.brands[key] %>"><span class="fab fa-<%= key.toLowerCase() %>"></span></a> <a href="<%= theme.links.brands[key] %>"><span class="fab fa-<%= key.toLowerCase() %>"></span></a>