diff --git a/layout/_scripts/vendors.swig b/layout/_scripts/vendors.swig
index 95c5344bd1..a64d53240c 100644
--- a/layout/_scripts/vendors.swig
+++ b/layout/_scripts/vendors.swig
@@ -1,11 +1,3 @@
-{# Reset `window.Promise` when it was not a function. #}
-{# IE refers the element whose id is `Promise` as `window.Promise`, this causes Velocity throwing an exception #}
-
-
{% set js_vendors = {} %}
{% set js_defer_vendors = {} %}
{% set js_vendors.jquery = 'jquery/index.js?v=3.4.1' %}
diff --git a/layout/_third-party/analytics/lean-analytics.swig b/layout/_third-party/analytics/lean-analytics.swig
index acaf0eb135..9974e01dcc 100644
--- a/layout/_third-party/analytics/lean-analytics.swig
+++ b/layout/_third-party/analytics/lean-analytics.swig
@@ -23,7 +23,7 @@
})
{% endif %}
.fail(function ({ responseJSON }) {
- console.log('Failed to save Visitor num, with error message: ' + responseJSON.error);
+ console.log(`Failed to save Visitor num, with error message: ${responseJSON.error}`);
})
} else {
{% if theme.leancloud_visitors.security %}
@@ -43,7 +43,7 @@
}
})
.fail(function ({ responseJSON }) {
- console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
+ console.log(`LeanCloud Counter Error: ${responseJSON.code} ${responseJSON.error}`);
});
}
{% else %}
@@ -82,7 +82,7 @@
}
})
.fail(function ({ responseJSON }) {
- console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
+ console.log(`LeanCloud Counter Error: ${responseJSON.code} ${responseJSON.error}`);
});
}
{% endif %}
@@ -93,7 +93,7 @@
var Counter = function(method, url, data) {
return $.ajax({
method: method,
- url: 'https://' + api_server + '/1.1' + url,
+ url: `https://${api_server}/1.1${url}`,
headers: {
'X-LC-Id': '{{ theme.leancloud_visitors.app_id }}',
'X-LC-Key': '{{ theme.leancloud_visitors.app_key }}',
diff --git a/source/js/algolia-search.js b/source/js/algolia-search.js
index ac51950fa7..6f7d5f1dfb 100644
--- a/source/js/algolia-search.js
+++ b/source/js/algolia-search.js
@@ -37,18 +37,12 @@ $(document).ready(function() {
templates : {
item: function(data) {
var link = data.permalink ? data.permalink : CONFIG.root + data.path;
- return (
- ''
- + data._highlightResult.title.value
- + ''
- );
+ return `${data._highlightResult.title.value}`;
},
empty: function(data) {
- return (
- '
'
- + algoliaSettings.labels.hits_empty.replace(/\$\{query}/, data.query)
- + '
'
- );
+ return `
+ ${algoliaSettings.labels.hits_empty.replace(/\$\{query}/, data.query)}
+
`;
}
},
cssClasses: {
@@ -63,13 +57,11 @@ $(document).ready(function() {
var stats = algoliaSettings.labels.hits_stats
.replace(/\$\{hits}/, data.nbHits)
.replace(/\$\{time}/, data.processingTimeMS);
- return (
- stats
- + ''
- + ' '
- + ''
- + '
'
- );
+ return `${stats}
+
+
+
+
`;
}
}
}),
diff --git a/source/js/local-search.js b/source/js/local-search.js
index dd77a75f17..bd932b73ba 100644
--- a/source/js/local-search.js
+++ b/source/js/local-search.js
@@ -97,7 +97,7 @@ $(document).ready(function() {
slice.hits.forEach(function(hit) {
result += text.substring(prevEnd, hit.position);
var end = hit.position + hit.length;
- result += '' + text.substring(hit.position, end) + '';
+ result += `${text.substring(hit.position, end)}`;
prevEnd = end;
});
result += text.substring(prevEnd, slice.end);
@@ -194,15 +194,13 @@ $(document).ready(function() {
var resultItem = '';
if (slicesOfTitle.length !== 0) {
- resultItem += '' + highlightKeyword(title, slicesOfTitle[0]) + '';
+ resultItem += `${highlightKeyword(title, slicesOfTitle[0])}`;
} else {
- resultItem += '' + title + '';
+ resultItem += `${title}`;
}
slicesOfContent.forEach(function(slice) {
- resultItem += ''
- + '' + highlightKeyword(content, slice)
- + '...
';
+ resultItem += `${highlightKeyword(content, slice)}...
`;
});
resultItem += '';
@@ -291,11 +289,11 @@ $(document).ready(function() {
function searchFunc() {
// Start loading animation
$('body')
- .append('')
+ .append(``)
.css('overflow', 'hidden');
$('#search-loading-icon').css({
margin : '20% auto 0 auto',
diff --git a/source/js/next-boot.js b/source/js/next-boot.js
index f03184f5a1..793b6ff434 100644
--- a/source/js/next-boot.js
+++ b/source/js/next-boot.js
@@ -55,10 +55,10 @@ $(document).ready(function() {
// Initialize Sidebar & TOC Width.
var scrollbarWidth = NexT.utils.getScrollbarWidth();
if ($('.site-overview-wrap').height() > (document.body.clientHeight - NexT.utils.getSidebarSchemePadding())) {
- $('.site-overview').css('width', 'calc(100% + ' + scrollbarWidth + 'px)');
+ $('.site-overview').css('width', `calc(100% + ${scrollbarWidth}px)`);
}
if ($('.post-toc-wrap').height() > (document.body.clientHeight - NexT.utils.getSidebarSchemePadding())) {
- $('.post-toc').css('width', 'calc(100% + ' + scrollbarWidth + 'px)');
+ $('.post-toc').css('width', `calc(100% + ${scrollbarWidth}px)`);
}
// Initialize Sidebar & TOC Height.
diff --git a/source/js/scrollspy.js b/source/js/scrollspy.js
index 7efacace41..be16bf0f8f 100644
--- a/source/js/scrollspy.js
+++ b/source/js/scrollspy.js
@@ -119,9 +119,7 @@
this.clear();
- var selector = this.selector
- + '[data-target="' + target + '"],'
- + this.selector + '[href="' + target + '"]';
+ var selector = `${this.selector}[data-target="${target}"],${this.selector}[href="${target}"]`;
var active = $(selector)
.parents('li')
diff --git a/source/js/utils.js b/source/js/utils.js
index 195213767a..2a79e989ff 100644
--- a/source/js/utils.js
+++ b/source/js/utils.js
@@ -14,7 +14,7 @@ NexT.utils = {
if ($imageWrapLink.length < 1) {
var imageLink = $image.attr('data-src') || $image.attr('src');
- $imageWrapLink = $image.wrap('').parent('a');
+ $imageWrapLink = $image.wrap(``).parent('a');
if ($image.is('.post-gallery img')) {
$imageWrapLink.addClass('post-gallery-img');
$imageWrapLink.attr('data-fancybox', 'gallery').attr('rel', 'gallery');
@@ -26,7 +26,7 @@ NexT.utils = {
}
if (imageTitle) {
- $imageWrapLink.append('' + imageTitle + '
');
+ $imageWrapLink.append(`${imageTitle}
`);
// Make sure img title tag will show correctly in fancybox
$imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle);
}
@@ -135,7 +135,7 @@ NexT.utils = {
$(window).bind('hashchange', function() {
var tHash = location.hash;
if (tHash !== '' && !tHash.match(/%\S{2}/)) {
- $(tNav + 'li:has(a[href="' + tHash + '"])').addClass('active').siblings().removeClass('active');
+ $(`${tNav}li:has(a[href="${tHash}"])`).addClass('active').siblings().removeClass('active');
$(tHash).addClass('active').siblings().removeClass('active');
}
}).trigger('hashchange');
@@ -305,7 +305,7 @@ NexT.utils = {
},
getScrollbarWidth: function() {
- var $div = $('').addClass('scrollbar-measure').prependTo('body');
+ var $div = $('').addClass('scrollbar-measure').prependTo('body');
var div = $div[0];
var scrollbarWidth = div.offsetWidth - div.clientWidth;
$div.remove();