link tag
This commit is contained in:
parent
da41c34257
commit
26a212cf10
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var util = require('hexo-util');
|
|
||||||
const full_url_for = require('hexo-util').full_url_for.bind(hexo);
|
const full_url_for = require('hexo-util').full_url_for.bind(hexo);
|
||||||
|
|
||||||
hexo.extend.tag.register('link', function(args) {
|
hexo.extend.tag.register('link', function(args) {
|
||||||
|
@ -15,10 +14,11 @@ hexo.extend.tag.register('link', function(args) {
|
||||||
|
|
||||||
var el = '';
|
var el = '';
|
||||||
el += '<div class="tag-plugin link dis-select">';
|
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('://')) {
|
if (args.url.includes('://')) {
|
||||||
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
||||||
}
|
}
|
||||||
|
el += ' cardlink';
|
||||||
el += '>';
|
el += '>';
|
||||||
|
|
||||||
function loadIcon() {
|
function loadIcon() {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
margin: 1em auto
|
margin: 1em auto
|
||||||
display: flex
|
display: flex
|
||||||
justify-content: center
|
justify-content: center
|
||||||
@media screen and (max-width: $device-mobile-425)
|
@media screen and (max-width: $device-mobile-375)
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.md .link-card
|
.md .link-card
|
||||||
|
@ -14,8 +14,8 @@
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
min-width 280px
|
min-width 280px
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
width: 350px
|
width: 320px
|
||||||
@media screen and (max-width: $device-mobile-425)
|
@media screen and (max-width: $device-mobile-375)
|
||||||
width: 100%
|
width: 100%
|
||||||
box-shadow: $boxshadow-card
|
box-shadow: $boxshadow-card
|
||||||
border-radius: $border-block
|
border-radius: $border-block
|
||||||
|
|
|
@ -219,7 +219,7 @@ if (stellar.plugins.stellar) {
|
||||||
let js = stellar.plugins.stellar[key];
|
let js = stellar.plugins.stellar[key];
|
||||||
if (key == 'linkcard') {
|
if (key == 'linkcard') {
|
||||||
stellar.loadScript(js, { defer: true }).then(function () {
|
stellar.loadScript(js, { defer: true }).then(function () {
|
||||||
setCardLink(document.querySelectorAll('a.link-card'));
|
setCardLink(document.querySelectorAll('a.link-card[cardlink]'));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const els = document.getElementsByClassName('stellar-' + key + '-api');
|
const els = document.getElementsByClassName('stellar-' + key + '-api');
|
||||||
|
|
|
@ -27,6 +27,7 @@ function isHttp(url) {
|
||||||
function renderer(el, obj) {
|
function renderer(el, obj) {
|
||||||
if (obj.title && obj.title.length > 0) {
|
if (obj.title && obj.title.length > 0) {
|
||||||
el.querySelector('.title').innerHTML = obj.title;
|
el.querySelector('.title').innerHTML = obj.title;
|
||||||
|
el.title = obj.title;
|
||||||
}
|
}
|
||||||
if (obj.icon && obj.icon.length > 0) {
|
if (obj.icon && obj.icon.length > 0) {
|
||||||
el.querySelector('.img').style = 'background-image: url("' + obj.icon + '");';
|
el.querySelector('.img').style = 'background-image: url("' + obj.icon + '");';
|
||||||
|
|
Loading…
Reference in New Issue