mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update components, fix url rewriter. Closes #2538
This commit is contained in:
parent
80b911c4d2
commit
e8cc66dce7
4 changed files with 30 additions and 54 deletions
18
resources/assets/js/app.js
vendored
18
resources/assets/js/app.js
vendored
|
@ -96,6 +96,24 @@ window.App.util = {
|
||||||
return interval + "m";
|
return interval + "m";
|
||||||
}
|
}
|
||||||
return Math.floor(seconds) + "s";
|
return Math.floor(seconds) + "s";
|
||||||
|
}),
|
||||||
|
rewriteLinks: (function(i) {
|
||||||
|
|
||||||
|
let tag = i.innerText;
|
||||||
|
|
||||||
|
if(i.href.startsWith(window.location.origin)) {
|
||||||
|
return i.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tag.startsWith('#') == true) {
|
||||||
|
tag = '/discover/tags/' + tag.substr(1) +'?src=rph';
|
||||||
|
} else if(tag.startsWith('@') == true) {
|
||||||
|
tag = '/' + i.innerText + '?src=rpp';
|
||||||
|
} else {
|
||||||
|
tag = '/i/redirect?url=' + encodeURIComponent(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
filters: [
|
filters: [
|
||||||
|
|
|
@ -905,15 +905,8 @@ export default {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
self.fetchState();
|
self.fetchState();
|
||||||
document.querySelectorAll('.status-comment .comment-text a').forEach(function(i, e) {
|
document.querySelectorAll('.status-comment .postCommentsContainer .comment-body a').forEach(function(i, e) {
|
||||||
if(i.href.startsWith(window.location.origin)) {
|
i.href = App.util.format.rewriteLinks(i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
let tag = i.innerText;
|
|
||||||
if(tag.startsWith('#')) {
|
|
||||||
tag = tag.substr(1);
|
|
||||||
}
|
|
||||||
i.href = '/discover/tags/'+tag+'?src=rph';
|
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -1260,15 +1253,8 @@ export default {
|
||||||
$('.postCommentsLoader').addClass('d-none');
|
$('.postCommentsLoader').addClass('d-none');
|
||||||
$('.postCommentsContainer').removeClass('d-none');
|
$('.postCommentsContainer').removeClass('d-none');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
document.querySelectorAll('.comments .comment-body a').forEach(function(i, e) {
|
document.querySelectorAll('.status-comment .postCommentsContainer .comment-body a').forEach(function(i, e) {
|
||||||
if(i.href.startsWith(window.location.origin)) {
|
i.href = App.util.format.rewriteLinks(i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
let tag = i.innerText;
|
|
||||||
if(tag.startsWith('#')) {
|
|
||||||
tag = tag.substr(1);
|
|
||||||
}
|
|
||||||
i.href = '/discover/tags/'+tag+'?src=rph';
|
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -627,15 +627,8 @@ export default {
|
||||||
}, 3000);
|
}, 3000);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
self.fetchState();
|
self.fetchState();
|
||||||
document.querySelectorAll('.status-comment .comment-text a').forEach(function(i, e) {
|
document.querySelectorAll('.status-comment .postCommentsContainer .comment-body a').forEach(function(i, e) {
|
||||||
if(i.href.startsWith(window.location.origin)) {
|
i.href = App.util.format.rewriteLinks(i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
let tag = i.innerText;
|
|
||||||
if(tag.startsWith('#')) {
|
|
||||||
tag = tag.substr(1);
|
|
||||||
}
|
|
||||||
i.href = '/discover/tags/'+tag+'?src=rph';
|
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -977,15 +970,8 @@ export default {
|
||||||
$('.postCommentsLoader').addClass('d-none');
|
$('.postCommentsLoader').addClass('d-none');
|
||||||
$('.postCommentsContainer').removeClass('d-none');
|
$('.postCommentsContainer').removeClass('d-none');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
document.querySelectorAll('.comments .comment-body a').forEach(function(i, e) {
|
document.querySelectorAll('.status-comment .postCommentsContainer .comment-body a').forEach(function(i, e) {
|
||||||
if(i.href.startsWith(window.location.origin)) {
|
i.href = App.util.format.rewriteLinks(i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
let tag = i.innerText;
|
|
||||||
if(tag.startsWith('#')) {
|
|
||||||
tag = tag.substr(1);
|
|
||||||
}
|
|
||||||
i.href = '/discover/tags/'+tag+'?src=rph';
|
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -839,15 +839,8 @@ body-class="p-2 rounded">
|
||||||
// this.fetchStories();
|
// this.fetchStories();
|
||||||
this.rtw();
|
this.rtw();
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
document.querySelectorAll('.caption .status-content a').forEach(function(i, e) {
|
document.querySelectorAll('.timeline .card-body .comments .comment-body a').forEach(function(i, e) {
|
||||||
if(i.href.startsWith(window.location.origin)) {
|
i.href = App.util.format.rewriteLinks(i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
let tag = i.innerText;
|
|
||||||
if(tag.startsWith('#')) {
|
|
||||||
tag = tag.substr(1);
|
|
||||||
}
|
|
||||||
i.href = '/discover/tags/'+tag+'?src=rph';
|
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -1004,15 +997,8 @@ body-class="p-2 rounded">
|
||||||
});
|
});
|
||||||
this.replies = _.reverse(data);
|
this.replies = _.reverse(data);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
document.querySelectorAll('.comments .comment-body a').forEach(function(i, e) {
|
document.querySelectorAll('.timeline .card-body .comments .comment-body a').forEach(function(i, e) {
|
||||||
if(i.href.startsWith(window.location.origin)) {
|
i.href = App.util.format.rewriteLinks(i);
|
||||||
return;
|
|
||||||
}
|
|
||||||
let tag = i.innerText;
|
|
||||||
if(tag.startsWith('#')) {
|
|
||||||
tag = tag.substr(1);
|
|
||||||
}
|
|
||||||
i.href = '/discover/tags/'+tag+'?src=rph';
|
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
Loading…
Reference in a new issue