mirror of https://gitlab.com/curben/blog
parent
e02bdab651
commit
07afb16715
|
@ -8,6 +8,6 @@
|
|||
* https://hexo.io/api/tag
|
||||
* https://cloudinary.com/documentation/responsive_images
|
||||
*/
|
||||
hexo.extend.tag.register('cloudinary', function(fileName){
|
||||
return '<img class="cld-responsive" data-src="https://res.cloudinary.com/curben/image/upload/w_auto,f_auto,q_auto,c_scale/c_limit,w_500/' + fileName + '" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIiBjbGFzcz0ibGRzLXJpcHBsZSIgc3R5bGU9ImJhY2tncm91bmQ6MCUgMCUiPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZjNDMwOSIgc3Ryb2tlLXdpZHRoPSIyIj48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjA7NDAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMSIga2V5U3BsaW5lcz0iMCAwLjIgMC44IDEiIGJlZ2luPSItMC41cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjE7MCIga2V5VGltZXM9IjA7MSIgZHVyPSIxIiBrZXlTcGxpbmVzPSIwLjIgMCAwLjggMSIgYmVnaW49Ii0wLjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPjwvY2lyY2xlPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmNzY1YyIgc3Ryb2tlLXdpZHRoPSIyIj48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjA7NDAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMSIga2V5U3BsaW5lcz0iMCAwLjIgMC44IDEiIGJlZ2luPSIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjE7MCIga2V5VGltZXM9IjA7MSIgZHVyPSIxIiBrZXlTcGxpbmVzPSIwLjIgMCAwLjggMSIgYmVnaW49IjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPjwvY2lyY2xlPjwvc3ZnPg==" />';
|
||||
});
|
||||
hexo.extend.tag.register('cloudinary', function (fileName) {
|
||||
return '<img class="cld-responsive" data-src="https://res.cloudinary.com/curben/image/upload/w_auto,f_auto,q_auto,c_scale/c_limit,w_500/' + fileName + '" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIiBjbGFzcz0ibGRzLXJpcHBsZSIgc3R5bGU9ImJhY2tncm91bmQ6MCUgMCUiPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZjNDMwOSIgc3Ryb2tlLXdpZHRoPSIyIj48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjA7NDAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMSIga2V5U3BsaW5lcz0iMCAwLjIgMC44IDEiIGJlZ2luPSItMC41cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjE7MCIga2V5VGltZXM9IjA7MSIgZHVyPSIxIiBrZXlTcGxpbmVzPSIwLjIgMCAwLjggMSIgYmVnaW49Ii0wLjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPjwvY2lyY2xlPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIHI9IjAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmNzY1YyIgc3Ryb2tlLXdpZHRoPSIyIj48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJyIiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjA7NDAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMSIga2V5U3BsaW5lcz0iMCAwLjIgMC44IDEiIGJlZ2luPSIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiBjYWxjTW9kZT0ic3BsaW5lIiB2YWx1ZXM9IjE7MCIga2V5VGltZXM9IjA7MSIgZHVyPSIxIiBrZXlTcGxpbmVzPSIwLjIgMCAwLjggMSIgYmVnaW49IjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPjwvY2lyY2xlPjwvc3ZnPg==" />'
|
||||
})
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue