Fixed race condition where $ (jquery) was not loaded before fedilove.js

* Also fixed messages replacing #FediLove was removing too much text
This commit is contained in:
Bofh 2021-01-09 00:53:55 +01:00
parent 7f5af52e20
commit bc5fd8eb4e
2 changed files with 15 additions and 9 deletions

View File

@ -3,7 +3,7 @@ import { massageStatusPlainText } from './massageStatusPlainText'
export function massageUserText (text, emojis, $autoplayGifs) {
text = text || ''
text = text.replace(/<a[^<>]+>.*?#.*?>fedilove<.*?<\/a>/gi, '');
text = text.replace(/<a[^<>]+hashtag[^<>]+>.*?#.*?>fedilove<.*?<\/a>/gi, '');
text = emojifyText(text, emojis, $autoplayGifs)
text = massageStatusPlainText(text)
return text

View File

@ -607,12 +607,18 @@ function fedilove_customization() {
// and dispatch a call to "fedilove_customization" to load page customizations depending on URL context
var __window_url = null;
var __window_url_old = null;
setInterval(function() {
(function() {
const _this = setInterval(function() {
if (typeof $ !== "undefined") {
clearInterval(_this);
setInterval(function() {
const newurl = window.location.pathname;
if (newurl != __window_url) {
__window_url_old = __window_url;
__window_url = newurl;
fedilove_customization();
}
}, 100);
}, 100);
}
});
})();