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

@ -7,7 +7,7 @@
<script src="https://cdn.jsdelivr.net/npm/cloudinary-jquery@2.5.0/cloudinary-jquery.min.js" x-sri-fallback="/js/cloudinary-jquery.min.js" integrity="sha384-oiCwTbCyQCCCk6ynsZWQIw6FPjjlX4/tPiboPLVURHvD0FXTXnG6Ew7QdRNkipYz" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/cloudinary-jquery@2.5.0/cloudinary-jquery.min.js" x-sri-fallback="/js/cloudinary-jquery.min.js" integrity="sha384-oiCwTbCyQCCCk6ynsZWQIw6FPjjlX4/tPiboPLVURHvD0FXTXnG6Ew7QdRNkipYz" crossorigin="anonymous"></script>
<% if (theme.fancybox){ %> <% if (theme.fancybox) { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.2/jquery.fancybox.min.js" x-sri-fallback="/fancybox/jquery.fancybox.min.js" integrity="sha384-j11bx3Frya+us3LfRdSq1uXZ7hsQU0UV5P3PEyRajHEHp87c8VLeM4jC/NE6SDsE" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.2/jquery.fancybox.min.js" x-sri-fallback="/fancybox/jquery.fancybox.min.js" integrity="sha384-j11bx3Frya+us3LfRdSq1uXZ7hsQU0UV5P3PEyRajHEHp87c8VLeM4jC/NE6SDsE" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.2/jquery.fancybox.min.css" x-sri-fallback="/fancybox/jquery.fancybox.min.css" integrity="sha384-GZkso4ketQR1gAuHEB2yZXtW5SF8uLAsjUsKhaHm4y33ZyPDmwnfZ8rQ4Tvqh1Et" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.2/jquery.fancybox.min.css" x-sri-fallback="/fancybox/jquery.fancybox.min.css" integrity="sha384-GZkso4ketQR1gAuHEB2yZXtW5SF8uLAsjUsKhaHm4y33ZyPDmwnfZ8rQ4Tvqh1Et" crossorigin="anonymous">
@ -15,9 +15,9 @@
<%/* 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 */%>
<%- js('js/typing') %> <%- js('js/typing') %>

View File

@ -1,28 +1,31 @@
<% 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>
<% } %> <% } %>
<% } %> <% } %>
<% 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

@ -9,7 +9,7 @@
</header> </header>
<% } %> <% } %>
<div class="article-entry typo" itemprop="articleBody"> <div class="article-entry typo" itemprop="articleBody">
<% if (post.excerpt && index){ %> <% if (post.excerpt && index) { %>
<%- post.excerpt %> <%- post.excerpt %>
<% if (theme.excerpt_link) { %> <% if (theme.excerpt_link) { %>
<p class="article-more-link"> <p class="article-more-link">

View File

@ -3,27 +3,27 @@
<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>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%/* Add Open Graph meta tags for easier sharing on social networking sites */%> <%/* Add Open Graph meta tags for easier sharing on social networking sites */%>
<%- open_graph() %> <%- open_graph() %>
<% if (theme.rss){ %> <% if (theme.rss) { %>
<link rel="alternate" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml"> <link rel="alternate" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml">
<% } %> <% } %>
@ -40,7 +40,7 @@
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<%- css('css/typing') %> <%- css('css/typing') %>
<% if (theme.icons){ %> <% if (theme.icons) { %>
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/solid.js" x-sri-fallback="/fontawesome/solid.min.js" integrity="sha384-GJiigN/ef2B3HMj0haY+eMmG4EIIrhWgGJ2Rv0IaWnNdWdbWPr1sRLkGz7xfjOFw" crossorigin="anonymous"></script> <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/solid.js" x-sri-fallback="/fontawesome/solid.min.js" integrity="sha384-GJiigN/ef2B3HMj0haY+eMmG4EIIrhWgGJ2Rv0IaWnNdWdbWPr1sRLkGz7xfjOFw" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/brands.js" x-sri-fallback="/fontawesome/brands.min.js" integrity="sha384-2vdvXGQdnt+ze3ylY5ESeZ9TOxwxlOsldUzQBwtjvRpen1FwDT767SqyVbYrltjb" crossorigin="anonymous"></script> <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/brands.js" x-sri-fallback="/fontawesome/brands.min.js" integrity="sha384-2vdvXGQdnt+ze3ylY5ESeZ9TOxwxlOsldUzQBwtjvRpen1FwDT767SqyVbYrltjb" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/fontawesome.js" x-sri-fallback="/fontawesome/fontawesome.min.js" integrity="sha384-2OfHGv4zQZxcNK+oL8TR9pA+ADXtUODqGpIRy1zOgioC4X3+2vbOAp5Qv7uHM4Z8" crossorigin="anonymous"></script> <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/fontawesome.js" x-sri-fallback="/fontawesome/fontawesome.min.js" integrity="sha384-2OfHGv4zQZxcNK+oL8TR9pA+ADXtUODqGpIRy1zOgioC4X3+2vbOAp5Qv7uHM4Z8" crossorigin="anonymous"></script>

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

@ -1,4 +1,4 @@
<% if (post.categories && post.categories.length){ %> <% if (post.categories && post.categories.length) { %>
<div class="article-category"> <div class="article-category">
<%- list_categories(post.categories, { <%- list_categories(post.categories, {
show_count: false, show_count: false,

View File

@ -1,11 +1,11 @@
<% if (post.photos && post.photos.length){ %> <% if (post.photos && post.photos.length) { %>
<div class="article-gallery"> <div class="article-gallery">
<div class="article-gallery-photos"> <div class="article-gallery-photos">
<% post.photos.forEach(function(photo, i){ %> <% post.photos.forEach(function(photo, i) { %>
<a class="article-gallery-img fancybox" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>"> <a class="article-gallery-img fancybox" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>">
<img src="<%- url_for(photo) %>" itemprop="image"> <img src="<%- url_for(photo) %>" itemprop="image">
</a> </a>
<% }) %> <% }) %>
</div> </div>
</div> </div>
<% } %> <% } %>

View File

@ -1,10 +1,10 @@
<% if (post.prev || post.next){ %> <% if (post.prev || post.next) { %>
<nav id="article-nav" class="article-nav"> <nav id="article-nav" class="article-nav">
<% if (post.prev){ %> <% if (post.prev) { %>
<a href="<%- url_for(post.prev.path) %>" id="article-nav-newer" class="article-nav-link-wrap newer"> <a href="<%- url_for(post.prev.path) %>" id="article-nav-newer" class="article-nav-link-wrap newer">
<strong class="article-nav-caption"><%= __('newer') %></strong> <strong class="article-nav-caption"><%= __('newer') %></strong>
<div class="article-nav-title"> <div class="article-nav-title">
<% if (post.prev.title){ %> <% if (post.prev.title) { %>
<%= post.prev.title %> <%= post.prev.title %>
<% } else { %> <% } else { %>
(no title) (no title)
@ -14,7 +14,7 @@
<% } else { %> <% } else { %>
<span id="article-nav-newer" class="article-nav-link-wrap newer"></span> <span id="article-nav-newer" class="article-nav-link-wrap newer"></span>
<% } %> <% } %>
<% if (post.next){ %> <% if (post.next) { %>
<a href="<%- url_for(post.next.path) %>" id="article-nav-older" class="article-nav-link-wrap older"> <a href="<%- url_for(post.next.path) %>" id="article-nav-older" class="article-nav-link-wrap older">
<strong class="article-nav-caption"><%= __('older') %></strong> <strong class="article-nav-caption"><%= __('older') %></strong>
<div class="article-nav-title"><%= post.next.title %></div> <div class="article-nav-title"><%= post.next.title %></div>

View File

@ -1,4 +1,4 @@
<% if (post.tags && post.tags.length){ %> <% if (post.tags && post.tags.length) { %>
<%- list_tags(post.tags, { <%- list_tags(post.tags, {
show_count: false, show_count: false,
class: 'article-tag' class: 'article-tag'

View File

@ -1,9 +1,9 @@
<% if (post.link){ %> <% if (post.link) { %>
<h1 itemprop="name"> <h1 itemprop="name">
<a class="<%= class_name %>" href="<%- url_for(post.link) %>" itemprop="url"><%= post.title %></a> <a class="<%= class_name %>" href="<%- url_for(post.link) %>" itemprop="url"><%= post.title %></a>
</h1> </h1>
<% } else if (post.title){ %> <% } else if (post.title) { %>
<% if (index){ %> <% if (index) { %>
<h1 itemprop="name"> <h1 itemprop="name">
<a class="<%= class_name %>" href="<%- url_for(post.path) %>"><%= post.title %></a> <a class="<%= class_name %>" href="<%- url_for(post.path) %>"><%= post.title %></a>
</h1> </h1>
@ -12,4 +12,4 @@
<%= post.title %> <%= post.title %>
</h1> </h1>
<% } %> <% } %>
<% } %> <% } %>

View File

@ -10,18 +10,18 @@
</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>
<% } else { %> <% } else { %>
<a href="<%= theme.links.solid[key] %>"><%= key %></a> <a href="<%= theme.links.solid[key] %>"><%= key %></a>
<% } %> <% } %>
</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>
<% } else { %> <% } else { %>
<a href="<%= theme.links.brands[key] %>"><%= key %></a> <a href="<%= theme.links.brands[key] %>"><%= key %></a>

View File

@ -1,6 +1,6 @@
<div class="archive-container"> <div class="archive-container">
<%- partial('_partial/header') %> <%- partial('_partial/header') %>
<% if (theme.nav === 'left'){ %> <% if (theme.nav === 'left') { %>
<hr class="header-hr header-hr-left"/> <hr class="header-hr header-hr-left"/>
<% } else { %> <% } else { %>
<hr class="header-hr"/> <hr class="header-hr"/>