Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop IE support #1023

Merged
merged 3 commits into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions layout/_scripts/vendors.swig
Original file line number Diff line number Diff line change
@@ -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 #}
<script>
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>

{% set js_vendors = {} %}
{% set js_defer_vendors = {} %}
{% set js_vendors.jquery = 'jquery/index.js?v=3.4.1' %}
Expand Down
8 changes: 4 additions & 4 deletions layout/_third-party/analytics/lean-analytics.swig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -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 %}
Expand Down Expand Up @@ -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 %}
Expand All @@ -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 }}',
Expand Down
26 changes: 9 additions & 17 deletions source/js/algolia-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,12 @@ $(document).ready(function() {
templates : {
item: function(data) {
var link = data.permalink ? data.permalink : CONFIG.root + data.path;
return (
'<a href="' + link + '" class="algolia-hit-item-link">'
+ data._highlightResult.title.value
+ '</a>'
);
return `<a href="${link}" class="algolia-hit-item-link">${data._highlightResult.title.value}</a>`;
},
empty: function(data) {
return (
'<div id="algolia-hits-empty">'
+ algoliaSettings.labels.hits_empty.replace(/\$\{query}/, data.query)
+ '</div>'
);
return `<div id="algolia-hits-empty">
${algoliaSettings.labels.hits_empty.replace(/\$\{query}/, data.query)}
</div>`;
}
},
cssClasses: {
Expand All @@ -63,13 +57,11 @@ $(document).ready(function() {
var stats = algoliaSettings.labels.hits_stats
.replace(/\$\{hits}/, data.nbHits)
.replace(/\$\{time}/, data.processingTimeMS);
return (
stats
+ '<span class="algolia-powered">'
+ ' <img src="' + CONFIG.root + 'images/algolia_logo.svg" alt="Algolia" />'
+ '</span>'
+ '<hr />'
);
return `${stats}
<span class="algolia-powered">
<img src="${CONFIG.root}images/algolia_logo.svg" alt="Algolia"/>
</span>
<hr/>`;
}
}
}),
Expand Down
20 changes: 9 additions & 11 deletions source/js/local-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
result += `<b class="search-keyword">${text.substring(hit.position, end)}</b>`;
prevEnd = end;
});
result += text.substring(prevEnd, slice.end);
Expand Down Expand Up @@ -196,15 +196,13 @@ $(document).ready(function() {
var resultItem = '';

if (slicesOfTitle.length !== 0) {
resultItem += '<li><a href="' + articleUrl + '" class="search-result-title">' + highlightKeyword(title, slicesOfTitle[0]) + '</a>';
resultItem += `<li><a href="${articleUrl}" class="search-result-title">${highlightKeyword(title, slicesOfTitle[0])}</a>`;
} else {
resultItem += '<li><a href="' + articleUrl + '" class="search-result-title">' + title + '</a>';
resultItem += `<li><a href="${articleUrl}" class="search-result-title">${title}</a>`;
}

slicesOfContent.forEach(function(slice) {
resultItem += '<a href="' + articleUrl + '">'
+ '<p class="search-result">' + highlightKeyword(content, slice)
+ '...</p></a>';
resultItem += `<a href="${articleUrl}"><p class="search-result">${highlightKeyword(content, slice)}...</p></a>`;
});

resultItem += '</li>';
Expand Down Expand Up @@ -294,11 +292,11 @@ $(document).ready(function() {
function searchFunc() {
// Start loading animation
$('body')
.append('<div class="search-popup-overlay local-search-pop-overlay">'
+ '<div id="search-loading-icon">'
+ '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>'
+ '</div>'
+ '</div>')
.append(`<div class="search-popup-overlay local-search-pop-overlay">
<div id="search-loading-icon">
<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
</div>
</div>`)
.css('overflow', 'hidden');
$('#search-loading-icon').css({
margin: '20% auto 0 auto',
Expand Down
4 changes: 2 additions & 2 deletions source/js/next-boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,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.
Expand Down
4 changes: 1 addition & 3 deletions source/js/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions source/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NexT.utils = {

if ($imageWrapLink.length < 1) {
var imageLink = $image.attr('data-src') || $image.attr('src');
$imageWrapLink = $image.wrap('<a class="fancybox fancybox.image" href="' + imageLink + '" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>').parent('a');
$imageWrapLink = $image.wrap(`<a class="fancybox fancybox.image" href="${imageLink}" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>`).parent('a');
if ($image.is('.post-gallery img')) {
$imageWrapLink.addClass('post-gallery-img');
$imageWrapLink.attr('data-fancybox', 'gallery').attr('rel', 'gallery');
Expand All @@ -28,7 +28,7 @@ NexT.utils = {
}

if (imageTitle) {
$imageWrapLink.append('<p class="image-caption">' + imageTitle + '</p>');
$imageWrapLink.append(`<p class="image-caption">${imageTitle}</p>`);
// Make sure img title tag will show correctly in fancybox
$imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle);
}
Expand Down Expand Up @@ -108,7 +108,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');
Expand Down Expand Up @@ -295,7 +295,7 @@ NexT.utils = {
},

getScrollbarWidth: function() {
var $div = $('<div />').addClass('scrollbar-measure').prependTo('body');
var $div = $('<div/>').addClass('scrollbar-measure').prependTo('body');
var div = $div[0];
var scrollbarWidth = div.offsetWidth - div.clientWidth;
$div.remove();
Expand Down