diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-10 20:51:17 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-10 20:51:17 +0900 |
| commit | 9cf42d8b33a4105afca20d34b291fddf4c98fece (patch) | |
| tree | 4f8809b01ed54599f00f49e34e011d5eb01df902 /src/client/components/url.vue | |
| parent | :art: (diff) | |
| download | misskey-9cf42d8b33a4105afca20d34b291fddf4c98fece.tar.gz misskey-9cf42d8b33a4105afca20d34b291fddf4c98fece.tar.bz2 misskey-9cf42d8b33a4105afca20d34b291fddf4c98fece.zip | |
Better self link detection
Diffstat (limited to 'src/client/components/url.vue')
| -rw-r--r-- | src/client/components/url.vue | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/client/components/url.vue b/src/client/components/url.vue index 23f2be7be3..d81c98deb5 100644 --- a/src/client/components/url.vue +++ b/src/client/components/url.vue @@ -1,5 +1,5 @@ <template> -<component :is="hasRoute ? 'router-link' : 'a'" class="ieqqeuvs _link" :[attr]="hasRoute ? url.substr(local.length) : url" :rel="rel" :target="target" +<component :is="self ? 'router-link' : 'a'" class="ieqqeuvs _link" :[attr]="self ? url.substr(local.length) : url" :rel="rel" :target="target" @mouseover="onMouseover" @mouseleave="onMouseleave" > @@ -37,12 +37,7 @@ export default Vue.extend({ } }, data() { - const isSelf = this.url.startsWith(local); - const hasRoute = isSelf && ( - (this.url.substr(local.length) === '/') || - this.url.substr(local.length).startsWith('/@') || - this.url.substr(local.length).startsWith('/notes/') || - this.url.substr(local.length).startsWith('/tags/')); + const self = this.url.startsWith(local); return { local, schema: null as string | null, @@ -51,10 +46,9 @@ export default Vue.extend({ pathname: null as string | null, query: null as string | null, hash: null as string | null, - self: isSelf, - hasRoute: hasRoute, - attr: hasRoute ? 'to' : 'href', - target: hasRoute ? null : '_blank', + self: self, + attr: self ? 'to' : 'href', + target: self ? null : '_blank', showTimer: null, hideTimer: null, preview: null, |