From b1fb7dcbc30cdc3c27a8874f9d5e2c5dc14dfa82 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 5 Aug 2020 00:26:29 -0600 Subject: [PATCH] Update components, redirect remote hashtag to local hashtag page --- resources/assets/js/components/PostComponent.vue | 12 ++++++++++++ resources/assets/js/components/Timeline.vue | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 3f5a369e..8b0c0e11 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -860,6 +860,18 @@ export default { } this.loaded = true; this.fetchProfilePosts(); + setTimeout(function() { + document.querySelectorAll('.status-comment .comment-text a').forEach(function(i, e) { + if(i.href.startsWith(window.location.origin)) { + return; + } + let tag = i.innerText; + if(tag.startsWith('#')) { + tag = tag.substr(1); + } + i.href = '/discover/tags/'+tag+'?src=rph'; + }); + }, 500); }).catch(error => { swal('Oops!', 'An error occured, please try refreshing the page.', 'error'); }); diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 6b8b4a05..eab0869e 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -815,6 +815,18 @@ } // this.fetchStories(); this.rtw(); + setTimeout(function() { + document.querySelectorAll('.caption .status-content a').forEach(function(i, e) { + if(i.href.startsWith(window.location.origin)) { + return; + } + let tag = i.innerText; + if(tag.startsWith('#')) { + tag = tag.substr(1); + } + i.href = '/discover/tags/'+tag+'?src=rph'; + }); + }, 500); }).catch(err => { swal( 'Oops, something went wrong',