feat: add copyright information

This commit is contained in:
Sebin Nyshkim 2020-04-21 19:04:16 +02:00
parent 1e5b4759f7
commit 641033d6d7
2 changed files with 43 additions and 1 deletions

View file

@ -1,7 +1,12 @@
<template>
<figure :class="[{ float: imgPos }, imgPos]">
<img :src="imgSrc" :alt="caption" />
<figcaption>{{ caption }}</figcaption>
<figcaption>
<div class="caption">{{ caption }}</div>
<div class="copyright">
By <a :href="getLink(copyright)[0]">{{ getLink(copyright)[1] }}</a>
</div>
</figcaption>
</figure>
</template>
@ -17,8 +22,27 @@ export default {
type: String,
required: true
},
copyright: {
type: String,
required: true
},
imgPos: String,
imgW: String
},
methods: {
getLink(username) {
if (username.match(/^(@)?([a-z0-9_]{1,30})$/i))
return this.formatTwitter(username);
if (username.match(/^(FA:)/)) return this.formatFuraffinity(username);
},
formatFuraffinity: username => {
let user = username.slice(3);
return [`https://www.furaffnity.net/user/${user}`, user];
},
formatTwitter: username => {
let user = username.slice(1);
return [`https://twitter.com/${user}`, username];
}
}
};
</script>
@ -42,6 +66,10 @@ figure {
text-align: center;
}
a {
color: #fff;
}
img {
display: block;
width: 100%;