chore: minor refactors and dep update

This commit is contained in:
ppoffice 2020-03-09 02:44:42 -04:00
parent 05373b9099
commit c84710bc3d
5 changed files with 17 additions and 14 deletions

View File

@ -16,6 +16,9 @@
"busuanzi": {
"$ref": "/plugin/busuanzi.json"
},
"cnzz": {
"$ref": "/plugin/cnzz.json"
},
"gallery": {
"$ref": "/plugin/gallery.json"
},

View File

@ -37,7 +37,7 @@ module.exports = class extends Component {
{page.layout !== 'page' ? <div class="article-meta size-small is-uppercase level is-mobile">
<div class="level-left">
{/* Date */}
<time class="level-item" dateTime={date_xml(page.date)}>{date(page.date)}</time>
<time class="level-item" dateTime={date_xml(page.date)} title={date_xml(page.date)}>{date(page.date)}</time>
{/* Categories */}
{page.categories && page.categories.length ? <span class="level-item">
{(() => {

View File

@ -23,7 +23,7 @@
"bulma-stylus": "0.8.0",
"deepmerge": "^4.2.2",
"hexo": "^4.2.0",
"hexo-component-inferno": "^0.1.1",
"hexo-component-inferno": "^0.1.2",
"hexo-log": "^1.0.0",
"hexo-pagination": "^1.0.0",
"hexo-renderer-inferno": "^0.1.3",

View File

@ -1,4 +1,14 @@
document.addEventListener('DOMContentLoaded', () => {
$('.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('<p class="has-text-centered is-size-6 caption">' + this.alt + '</p>');
}
}
});
if (typeof $.fn.lightGallery === 'function') {
$('.article').lightGallery({ selector: '.gallery-item' });
}

View File

@ -4,16 +4,6 @@
$('.columns .column-right-shadow').append($('.columns .column-right').children().clone());
}
$('.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('<p class="has-text-centered is-size-6 caption">' + this.alt + '</p>');
}
}
});
if (typeof moment === 'function') {
$('.article-meta time').each(function() {
$(this).text(moment($(this).attr('datetime')).fromNow());
@ -138,10 +128,10 @@
if (!sitehost) return false;
// handle relative url
var data;
let data;
try {
data = new URL(input, 'http://' + sitehost);
} catch (e) { return false;}
} catch (e) { return false; }
// handle mailto: javascript: vbscript: and so on
if (data.origin === 'null') return false;