瀏覽代碼

Update components, redirect remote hashtag to local hashtag page

Daniel Supernault 4 年之前
父節點
當前提交
b1fb7dcbc3
共有 2 個文件被更改,包括 24 次插入0 次删除
  1. 12 0
      resources/assets/js/components/PostComponent.vue
  2. 12 0
      resources/assets/js/components/Timeline.vue

+ 12 - 0
resources/assets/js/components/PostComponent.vue

@@ -860,6 +860,18 @@ export default {
                 }
                 }
                 this.loaded = true;
                 this.loaded = true;
                 this.fetchProfilePosts();
                 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 => {
             }).catch(error => {
               swal('Oops!', 'An error occured, please try refreshing the page.', 'error');
               swal('Oops!', 'An error occured, please try refreshing the page.', 'error');
             });
             });

+ 12 - 0
resources/assets/js/components/Timeline.vue

@@ -815,6 +815,18 @@
 					}
 					}
 					// this.fetchStories();
 					// this.fetchStories();
 					this.rtw();
 					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 => {
 				}).catch(err => {
 					swal(
 					swal(
 						'Oops, something went wrong',
 						'Oops, something went wrong',