hexo-theme-amane/source/js/main.js

18 lines
655 B
JavaScript

(function($){
$('.article img:not(".not-gallery-item")').each(function () {
// wrap images with link and add caption if possible
if ($(this).parent('a').length === 0) {
$(this).wrap('<a class="gallery-item" href="' + $(this).attr('src') + '"></a>');
if (this.alt) {
$(this).after('<div class="has-text-centered is-size-6 has-text-grey caption">' + this.alt + '</div>');
}
}
});
if (typeof(moment) === 'function') {
$('.article-meta time').each(function () {
$(this).text(moment($(this).attr('datetime')).fromNow());
});
}
})(jQuery);