This commit is contained in:
xaoxuu 2022-11-03 22:25:08 +08:00
parent da41c34257
commit 26a212cf10
4 changed files with 7 additions and 6 deletions

View File

@ -7,7 +7,6 @@
'use strict';
var util = require('hexo-util');
const full_url_for = require('hexo-util').full_url_for.bind(hexo);
hexo.extend.tag.register('link', function(args) {
@ -15,10 +14,11 @@ hexo.extend.tag.register('link', function(args) {
var el = '';
el += '<div class="tag-plugin link dis-select">';
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + args.title + '" href="' + args.url + '"';
el += '<a class="link-card' + (args.desc ? ' rich' : ' plain') + '" title="' + (args.title || '') + '" href="' + args.url + '"';
if (args.url.includes('://')) {
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
}
el += ' cardlink';
el += '>';
function loadIcon() {

View File

@ -3,7 +3,7 @@
margin: 1em auto
display: flex
justify-content: center
@media screen and (max-width: $device-mobile-425)
@media screen and (max-width: $device-mobile-375)
width: 100%
.md .link-card
@ -14,8 +14,8 @@
cursor: pointer
min-width 280px
max-width: 100%
width: 350px
@media screen and (max-width: $device-mobile-425)
width: 320px
@media screen and (max-width: $device-mobile-375)
width: 100%
box-shadow: $boxshadow-card
border-radius: $border-block

View File

@ -219,7 +219,7 @@ if (stellar.plugins.stellar) {
let js = stellar.plugins.stellar[key];
if (key == 'linkcard') {
stellar.loadScript(js, { defer: true }).then(function () {
setCardLink(document.querySelectorAll('a.link-card'));
setCardLink(document.querySelectorAll('a.link-card[cardlink]'));
});
} else {
const els = document.getElementsByClassName('stellar-' + key + '-api');

View File

@ -27,6 +27,7 @@ function isHttp(url) {
function renderer(el, obj) {
if (obj.title && obj.title.length > 0) {
el.querySelector('.title').innerHTML = obj.title;
el.title = obj.title;
}
if (obj.icon && obj.icon.length > 0) {
el.querySelector('.img').style = 'background-image: url("' + obj.icon + '");';