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

View File

@ -1,28 +1,31 @@
<% if (pagination == 2){ %>
<% page.posts.each(function(post){ %>
<% if (pagination === 2) { %>
<% page.posts.each(function(post) { %>
<%- partial('article', {post: post, index: true}) %>
<% }) %>
<% } else { %>
<% var last; %>
<% page.posts.each(function(post, i){ %>
<% var year = post.date.year(); %>
<% if (last != year){ %>
<% if (last != null){ %>
<% let last %>
<% page.posts.each(function(post, i) { %>
<% const year = post.date.year() %>
<% if (last !== year) { %>
<% if (last !== null) { %>
</div></section>
<% } %>
<% last = year; %>
<% last = year %>
<section class="archives-wrap">
<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>
<% } %>
<% } %>
<% if (page.total > 1){ %>
<% if (page.total > 1) { %>
<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({
prev_text: prev_text,
next_text: next_text

View File

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

View File

@ -3,27 +3,27 @@
<head>
<meta charset="utf-8">
<%
var title = page.title;
let title = page.title
if (is_archive()){
title = __('archive_a');
if (is_archive()) {
title = __('archive_a')
if (is_month()){
title += ': ' + page.year + '/' + page.month;
} else if (is_year()){
title += ': ' + page.year;
if (is_month()) {
title += ': ' + page.year + '/' + page.month
} else if (is_year()) {
title += ': ' + page.year
}
} else if (is_category()){
title = __('category') + ': ' + page.category;
} else if (is_tag()){
title = __('tag') + ': ' + page.tag;
} else if (is_category()) {
title = __('category') + ': ' + page.category
} else if (is_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">
<%/* Add Open Graph meta tags for easier sharing on social networking sites */%>
<%- open_graph() %>
<% if (theme.rss){ %>
<% if (theme.rss) { %>
<link rel="alternate" href="<%- theme.rss %>" title="<%= config.title %>" type="application/atom+xml">
<% } %>
@ -40,7 +40,7 @@
<meta name="theme-color" content="#ffffff">
<%- 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/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>

View File

@ -10,7 +10,7 @@
<% } else { %>
<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>
<% } %>
</nav>

View File

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

View File

@ -1,7 +1,7 @@
<% if (post.photos && post.photos.length){ %>
<% if (post.photos && post.photos.length) { %>
<div class="article-gallery">
<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 %>">
<img src="<%- url_for(photo) %>" itemprop="image">
</a>

View File

@ -1,10 +1,10 @@
<% if (post.prev || post.next){ %>
<% if (post.prev || post.next) { %>
<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">
<strong class="article-nav-caption"><%= __('newer') %></strong>
<div class="article-nav-title">
<% if (post.prev.title){ %>
<% if (post.prev.title) { %>
<%= post.prev.title %>
<% } else { %>
(no title)
@ -14,7 +14,7 @@
<% } else { %>
<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">
<strong class="article-nav-caption"><%= __('older') %></strong>
<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, {
show_count: false,
class: 'article-tag'

View File

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

View File

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

View File

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