diff --git a/themes/typing/scripts/cloudinary.js b/themes/typing/scripts/cloudinary.js index 920c53c..5674b7a 100644 --- a/themes/typing/scripts/cloudinary.js +++ b/themes/typing/scripts/cloudinary.js @@ -8,6 +8,6 @@ * https://hexo.io/api/tag * https://cloudinary.com/documentation/responsive_images */ -hexo.extend.tag.register('cloudinary', function(fileName){ - return ''; -}); +hexo.extend.tag.register('cloudinary', function (fileName) { + return '' +}) diff --git a/themes/typing/source/js/typing.js b/themes/typing/source/js/typing.js index edbfce1..1e0aad8 100644 --- a/themes/typing/source/js/typing.js +++ b/themes/typing/source/js/typing.js @@ -23,56 +23,54 @@ $('.fancybox').fancybox() } - - //Add "Copy" button to code snippet - var code = document.getElementsByClassName('code'); + // Add "Copy" button to code snippet + var code = document.getElementsByClassName('code') for (var i = 0; i < code.length; i++) { - var button = document.createElement('button'); - button.className = 'copy-button'; - button.textContent = 'Copy'; + var button = document.createElement('button') + button.className = 'copy-button' + button.textContent = 'Copy' - code[i].appendChild(button); + code[i].appendChild(button) } - $(document).ready(function() { - + $(document).ready(function () { // Add copy to clipboard button for code snippet var copyCode = new ClipboardJS('.copy-button', { - target: function(trigger) { - return trigger.previousElementSibling; - } - }); + target: function (trigger) { + return trigger.previousElementSibling + } + }) - copyCode.on('success', function(event) { - event.clearSelection(); - event.trigger.textContent = 'Copied'; - window.setTimeout(function() { - event.trigger.textContent = 'Copy'; - }, 2000); - }); + copyCode.on('success', function (event) { + event.clearSelection() + event.trigger.textContent = 'Copied' + window.setTimeout(function () { + event.trigger.textContent = 'Copy' + }, 2000) + }) - copyCode.on('error', function(event) { - event.trigger.textContent = 'Press "Ctrl + C" to copy'; - window.setTimeout(function() { - event.trigger.textContent = 'Copy'; - }, 2000); - }); + copyCode.on('error', function (event) { + event.trigger.textContent = 'Press "Ctrl + C" to copy' + window.setTimeout(function () { + event.trigger.textContent = 'Copy' + }, 2000) + }) // Navigation menu $('#menu').click(function (event) { - var nav = $('#main-nav'); - nav.toggle('fast'); - }); + var nav = $('#main-nav') + nav.toggle('fast') + }) // Show navigation button for smaller screen $(window).resize(function () { - var viewportWidth = $(window).width(); + var viewportWidth = $(window).width() if (viewportWidth > 468) { - $('#main-nav').show('fast'); + $('#main-nav').show('fast') } else { - $('#main-nav').hide('fast'); + $('#main-nav').hide('fast') } - }); - }); + }) + }) })(jQuery)