mirror of https://gitlab.com/curben/blog
parent
e02bdab651
commit
07afb16715
|
@ -9,5 +9,5 @@
|
||||||
* https://cloudinary.com/documentation/responsive_images
|
* https://cloudinary.com/documentation/responsive_images
|
||||||
*/
|
*/
|
||||||
hexo.extend.tag.register('cloudinary', function (fileName) {
|
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==" />';
|
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()
|
$('.fancybox').fancybox()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add "Copy" button to code snippet
|
// Add "Copy" button to code snippet
|
||||||
var code = document.getElementsByClassName('code');
|
var code = document.getElementsByClassName('code')
|
||||||
|
|
||||||
for (var i = 0; i < code.length; i++) {
|
for (var i = 0; i < code.length; i++) {
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button')
|
||||||
button.className = 'copy-button';
|
button.className = 'copy-button'
|
||||||
button.textContent = 'Copy';
|
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
|
// Add copy to clipboard button for code snippet
|
||||||
var copyCode = new ClipboardJS('.copy-button', {
|
var copyCode = new ClipboardJS('.copy-button', {
|
||||||
target: function (trigger) {
|
target: function (trigger) {
|
||||||
return trigger.previousElementSibling;
|
return trigger.previousElementSibling
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
copyCode.on('success', function (event) {
|
copyCode.on('success', function (event) {
|
||||||
event.clearSelection();
|
event.clearSelection()
|
||||||
event.trigger.textContent = 'Copied';
|
event.trigger.textContent = 'Copied'
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
event.trigger.textContent = 'Copy';
|
event.trigger.textContent = 'Copy'
|
||||||
}, 2000);
|
}, 2000)
|
||||||
});
|
})
|
||||||
|
|
||||||
copyCode.on('error', function (event) {
|
copyCode.on('error', function (event) {
|
||||||
event.trigger.textContent = 'Press "Ctrl + C" to copy';
|
event.trigger.textContent = 'Press "Ctrl + C" to copy'
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
event.trigger.textContent = 'Copy';
|
event.trigger.textContent = 'Copy'
|
||||||
}, 2000);
|
}, 2000)
|
||||||
});
|
})
|
||||||
|
|
||||||
// Navigation menu
|
// Navigation menu
|
||||||
$('#menu').click(function (event) {
|
$('#menu').click(function (event) {
|
||||||
var nav = $('#main-nav');
|
var nav = $('#main-nav')
|
||||||
nav.toggle('fast');
|
nav.toggle('fast')
|
||||||
});
|
})
|
||||||
|
|
||||||
// Show navigation button for smaller screen
|
// Show navigation button for smaller screen
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
var viewportWidth = $(window).width();
|
var viewportWidth = $(window).width()
|
||||||
if (viewportWidth > 468) {
|
if (viewportWidth > 468) {
|
||||||
$('#main-nav').show('fast');
|
$('#main-nav').show('fast')
|
||||||
} else {
|
} else {
|
||||||
$('#main-nav').hide('fast');
|
$('#main-nav').hide('fast')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
})(jQuery)
|
})(jQuery)
|
||||||
|
|
Loading…
Reference in New Issue