|
|
@@ -4,12 +4,15 @@
|
|
|
<div class="script-info flex">
|
|
|
<div class="script-name ellipsis" v-text="script._cache.name"></div>
|
|
|
<div class="flex-auto"></div>
|
|
|
- <div class="script-author ellipsis" :title="script.meta.author" v-if="author">
|
|
|
- <span v-text="i18n('labelAuthor')"></span>
|
|
|
- <a :href="'mailto:'+author.email" v-if="author.email" v-text="author.name"></a>
|
|
|
- <span v-if="!author.email" v-text="author.name"></span>
|
|
|
- </div>
|
|
|
- <div class="script-version" v-text="script.meta.version ? `v${script.meta.version}` : ''"></div>
|
|
|
+ <tooltip :title="i18n('labelAuthor') + script.meta.author" class="script-author" v-if="author" align="end">
|
|
|
+ <icon name="author"></icon>
|
|
|
+ <a class="ellipsis" :href="`mailto:${author.email}`" v-if="author.email" v-text="author.name"></a>
|
|
|
+ <span class="ellipsis" v-else v-text="author.name"></span>
|
|
|
+ </tooltip>
|
|
|
+ <tooltip :title="lastModified.title" align="end">
|
|
|
+ <span v-text="script.meta.version ? `v${script.meta.version}` : ''"></span>
|
|
|
+ <span class="secondary" v-text="lastModified.show"></span>
|
|
|
+ </tooltip>
|
|
|
<div v-if="script.config.removed" v-text="i18n('labelRemoved')"></div>
|
|
|
<div v-if="script.config.removed">
|
|
|
<tooltip :title="i18n('buttonUndo')" placement="left">
|
|
|
@@ -131,6 +134,29 @@ export default {
|
|
|
description() {
|
|
|
return this.script.custom.description || getLocaleString(this.script.meta, 'description');
|
|
|
},
|
|
|
+ lastModified() {
|
|
|
+ const { lastModified } = this.script.props;
|
|
|
+ const ret = {};
|
|
|
+ if (lastModified) {
|
|
|
+ let delta = (Date.now() - lastModified) / 1000 / 60;
|
|
|
+ const units = [
|
|
|
+ [60, 'min'],
|
|
|
+ [24, 'h'],
|
|
|
+ [30, 'd'],
|
|
|
+ [12, 'mon'],
|
|
|
+ [-1, 'yr'],
|
|
|
+ ];
|
|
|
+ const unitInfo = units.find(([max]) => {
|
|
|
+ if (max < 0 || delta < max) return true;
|
|
|
+ delta = Math.floor(delta / max);
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ const date = new Date(lastModified);
|
|
|
+ ret.title = this.i18n('labelLastUpdatedAt', date.toLocaleString());
|
|
|
+ ret.show = `${delta | 0}${unitInfo[1]}`;
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
const { icon } = this.script.meta;
|
|
|
@@ -314,10 +340,17 @@ export default {
|
|
|
&:hover {
|
|
|
border-color: darkgray;
|
|
|
}
|
|
|
+ .secondary {
|
|
|
+ color: gray;
|
|
|
+ font-size: small;
|
|
|
+ }
|
|
|
&.disabled,
|
|
|
&.removed {
|
|
|
background: #f0f0f0;
|
|
|
color: #999;
|
|
|
+ .secondary {
|
|
|
+ color: darkgray;
|
|
|
+ }
|
|
|
}
|
|
|
&.removed {
|
|
|
padding-bottom: 10px;
|
|
|
@@ -336,6 +369,9 @@ export default {
|
|
|
> .disabled {
|
|
|
color: gainsboro;
|
|
|
}
|
|
|
+ .icon {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
}
|
|
|
&-info {
|
|
|
margin-left: 3.5rem;
|
|
|
@@ -344,9 +380,6 @@ export default {
|
|
|
> *:not(:last-child) {
|
|
|
margin-right: 8px;
|
|
|
}
|
|
|
- .icon {
|
|
|
- display: block;
|
|
|
- }
|
|
|
}
|
|
|
&-icon {
|
|
|
position: absolute;
|
|
|
@@ -370,7 +403,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
&-author {
|
|
|
- max-width: 30%;
|
|
|
+ > * {
|
|
|
+ vertical-align: middle;
|
|
|
+ }
|
|
|
+ > .ellipsis {
|
|
|
+ display: inline-block;
|
|
|
+ max-width: 100px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.dragging {
|