mirror of https://github.com/gorhill/uBlock.git
Fix sorting of lists in "Filter lists" pane
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/2645#issuecomment-1556090600
This commit is contained in:
parent
2a9378b5a8
commit
e50d6ee6ed
|
@ -312,7 +312,7 @@ select {
|
|||
.countryFlag {
|
||||
height: var(--font-size);
|
||||
position: relative;
|
||||
top: calc(var(--font-size) / 6);
|
||||
top: calc(var(--font-size) / 7);
|
||||
width: calc(var(--font-size) * 1.4);
|
||||
}
|
||||
|
||||
|
|
|
@ -173,9 +173,10 @@ const renderFilterLists = ( ) => {
|
|||
const listEntries = dom.clone('#templates .listEntries');
|
||||
const treeEntries = Object.entries(listTree);
|
||||
if ( depth !== 0 ) {
|
||||
const reEmojis = /[\p{Emoji}]/gu;
|
||||
treeEntries.sort((a ,b) => {
|
||||
const as = a[1].title || a[0];
|
||||
const bs = b[1].title || b[0];
|
||||
const as = (a[1].title || a[0]).replace(reEmojis, '');
|
||||
const bs = (b[1].title || b[0]).replace(reEmojis, '');
|
||||
return as.localeCompare(bs);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -318,19 +318,18 @@ if ( isBackgroundProcess !== true ) {
|
|||
const match = reUnicodeFlags.exec(text);
|
||||
if ( match === null ) { break; }
|
||||
if ( match.index > i ) {
|
||||
fragment.append(document.createTextNode(text.slice(i, match.index)));
|
||||
fragment.append(text.slice(i, match.index));
|
||||
}
|
||||
const img = document.createElement('img');
|
||||
const countryCode = unicodeFlagToImageSrc.get(match[0]);
|
||||
img.src = `/img/flags-of-the-world/${countryCode}.png`;
|
||||
img.title = countryCode;
|
||||
img.classList.add('countryFlag');
|
||||
fragment.append(img);
|
||||
fragment.append(document.createTextNode('\u2009'));
|
||||
fragment.append(img, '\u2009');
|
||||
i = reUnicodeFlags.lastIndex;
|
||||
}
|
||||
if ( i < text.length ) {
|
||||
fragment.append(document.createTextNode(text.slice(i)));
|
||||
fragment.append(text.slice(i));
|
||||
}
|
||||
return fragment;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue