1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00
This commit is contained in:
gorhill 2015-03-23 10:19:43 -04:00
parent c13c34fc5e
commit 6724c991f5
3 changed files with 28 additions and 7 deletions

View File

@ -36,7 +36,7 @@
<div id="templates" style="display: none;">
<ul>
<li class="groupEntry"><span></span>
<li class="groupEntry"><span class="geName"></span> <span class="geCount dim"></span>
<ul></ul>
</li>
<li class="listEntry">

View File

@ -19,15 +19,18 @@ body[dir=rtl] #lists {
padding: 0;
list-style-type: none;
}
#lists > .groupEntry > span {
#lists > .groupEntry > .geName {
cursor: pointer;
font-size: 15px;
font-size: 110%;
}
#lists > .groupEntry:not(:first-child) > span:before {
#lists > .groupEntry > .geCount {
font-size: 90%;
}
#lists > .groupEntry:not(:first-child) > .geName:before {
color: #aaa;
content: '\2212 ';
}
#lists > .groupEntry.collapsed > span:before {
#lists > .groupEntry.collapsed > .geName:before {
color: #aaa;
content: '+ ';
}

View File

@ -142,15 +142,33 @@ var renderFilterLists = function() {
return li;
};
var listEntryCountFromGroup = function(listKeys) {
if ( Array.isArray(listKeys) === false ) {
return '';
}
var count = 0;
var i = listKeys.length;
while ( i-- ) {
if ( listDetails.available[listKeys[i]].off !== true ) {
count += 1;
}
}
return count === 0 ? '' : '(' + count.toLocaleString() + ')';
};
var liFromListGroup = function(groupKey, listKeys) {
var liGroup = listGroupTemplate.clone();
liGroup.descendants('span').text(vAPI.i18n('3pGroup' + groupKey.charAt(0).toUpperCase() + groupKey.slice(1)));
var groupName = vAPI.i18n('3pGroup' + groupKey.charAt(0).toUpperCase() + groupKey.slice(1));
if ( groupName !== '' ) {
liGroup.descendants('span.geName').text(groupName);
liGroup.descendants('span.geCount').text(listEntryCountFromGroup(listKeys));
}
var ulGroup = liGroup.descendants('ul');
if ( !listKeys ) {
return liGroup;
}
listKeys.sort(function(a, b) {
return (listDetails.available[a].title || "").localeCompare(listDetails.available[b].title || "");
return (listDetails.available[a].title || '').localeCompare(listDetails.available[b].title || '');
});
for ( var i = 0; i < listKeys.length; i++ ) {
ulGroup.append(liFromListEntry(listKeys[i]));