From 55f5f11c2f2383b874b45b52fe04ac8cc6c87c00 Mon Sep 17 00:00:00 2001 From: curben Date: Wed, 10 Apr 2019 20:18:45 +0930 Subject: [PATCH] style: convert var to let/const ES6 syntax --- package.json | 2 +- themes/typing/source/js/typing.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 9b6be0e..361e9c4 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "hexo-renderer-marked": "^0.3.2", "hexo-renderer-stylus": "^0.3.3", "hexo-server": "^0.3.3", - "hexo-yam": "^1.0.4" + "hexo-yam": "^1.2.0" }, "devDependencies": { "renovate": "^14.42.2", diff --git a/themes/typing/source/js/typing.js b/themes/typing/source/js/typing.js index 85414e1..eed471c 100644 --- a/themes/typing/source/js/typing.js +++ b/themes/typing/source/js/typing.js @@ -5,7 +5,7 @@ // Don't insert fancybox element to cloudinary's cld-responsive img class if ($(this).hasClass('cld-responsive') || $(this).parent().hasClass('fancybox')) return - var alt = this.alt + const alt = this.alt if (alt) { $(this).after('' + alt + '') @@ -24,10 +24,10 @@ } // Add "Copy" button to code snippet - var code = document.getElementsByClassName('code') + const code = document.getElementsByClassName('code') - for (var i = 0; i < code.length; i++) { - var button = document.createElement('button') + for (let i = 0; i < code.length; i++) { + const button = document.createElement('button') button.className = 'copy-button' button.textContent = 'Copy' @@ -36,7 +36,7 @@ $(document).ready(function () { // Add copy to clipboard button for code snippet - var copyCode = new ClipboardJS('.copy-button', { + const copyCode = new ClipboardJS('.copy-button', { target: function (trigger) { return trigger.previousElementSibling }