fix for the @@ bug with mastodon notices

This commit is contained in:
Hannes Mannerheim 2016-11-21 22:44:34 +01:00
parent 440cd110ed
commit 474376938b

View File

@ -1996,13 +1996,13 @@ function detectRTL(s) {
$streamItem.children('.stream-item').children('.queet').addClass('rtl'); $streamItem.children('.stream-item').children('.queet').addClass('rtl');
} }
else { else {
// for ltr languages we move @, ! and # to inside // for ltr languages we move @, ! and # to inside (only because it looks better)
$streamItem.find('.queet-text').find('.h-card.mention').prepend('@'); prependCharIfItDoesntAlreadyExist($streamItem.find('.queet-text').find('.h-card.mention'),'@');
$streamItem.find('.queet-text').find('.h-card.group').prepend('!'); prependCharIfItDoesntAlreadyExist($streamItem.find('.queet-text').find('.h-card.group'),'!');
$streamItem.find('.queet-text').find('.vcard .fn.nickname:not(.group)').prepend('@'); // very old style prependCharIfItDoesntAlreadyExist($streamItem.find('.queet-text').find('.vcard .fn.nickname:not(.group)'),'@'); // very old style
$streamItem.find('.queet-text').find('.vcard .nickname.mention:not(.fn)').prepend('@'); // old style prependCharIfItDoesntAlreadyExist($streamItem.find('.queet-text').find('.vcard .nickname.mention:not(.fn)'),'@'); // old style
$streamItem.find('.queet-text').find('.vcard .nickname.group').prepend('!'); // old style prependCharIfItDoesntAlreadyExist($streamItem.find('.queet-text').find('.vcard .nickname.group'),'!'); // old style
$streamItem.find('.queet-text').find('a[rel="tag"]').prepend('#'); prependCharIfItDoesntAlreadyExist($streamItem.find('.queet-text').find('a[rel="tag"]'),'#');
} }
// we remove @, ! and #, they are added as pseudo elements, or have been moved to the inside // we remove @, ! and #, they are added as pseudo elements, or have been moved to the inside
@ -2010,6 +2010,13 @@ function detectRTL(s) {
} }
function prependCharIfItDoesntAlreadyExist(jQueryObject,char) {
if(jQueryObject.text().substring(0,1) != char) {
jQueryObject.prepend(char);
}
}
/* · /* ·
· ·