1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00
Raymond Hill 2018-08-31 10:50:19 -04:00
parent 1e2b584662
commit cae7484be1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
7 changed files with 37 additions and 44 deletions

View File

@ -45,10 +45,10 @@
--><a class="fa mustread" href="" target="_blank">&#xf05a;</a>&#8203;<!--
--><span class="fa status unsecure" title="http">&#xf13e;</span>&#8203;<!--
--><span class="counts dim"></span>&#8203;<!--
--><span class="fa status obsolete" title="3pExternalListObsolete">&#xf071;</span>&#8203;<!--
--><span class="fa status obsolete" data-i18n-title="3pExternalListObsolete">&#xf071;</span>&#8203;<!--
--><span class="fa status cache">&#xf017;</span>&#8203;<!--
--><span class="fa status updating" title="3pUpdating">&#xf110;</span>&#8203;<!--
--><span class="fa status failed" title="3pNetworkError">&#xf127;</span>
--><span class="fa status updating" data-i18n-title="3pUpdating">&#xf110;</span>&#8203;<!--
--><span class="fa status failed" data-i18n-title="3pNetworkError">&#xf127;</span>
</li>
<li class="listEntry toImport"><input type="checkbox" id="importLists"><label for="importLists" data-i18n="3pImport"></label><!--
--><a class="fa info towiki" href="https://github.com/gorhill/uBlock/wiki/Filter-lists-from-around-the-web" target="_blank">&#xf05a;</a><!--

View File

@ -6,10 +6,10 @@
</head>
<body>
<div class="cloudTools">
<button id="cloudPush" type="button" class="custom" title="cloudPush"><span class="fa">&#xf0ee;</span></button>
<button id="cloudPush" type="button" class="custom" data-i18n-title="cloudPush"><span class="fa">&#xf0ee;</span></button>
<span id="cloudInfo" data-i18n="cloudNoData"></span>
<button id="cloudPull" type="button" class="custom" title="cloudPull" disabled><span class="fa">&#xf0ed;</span></button>
<button id="cloudPullAndMerge" type="button" class="custom" title="cloudPullAndMerge" disabled><span class="fa">&#xf0ed;<span>&#xf067;</span></span></button>
<button id="cloudPull" type="button" class="custom" data-i18n-title="cloudPull" disabled><span class="fa">&#xf0ed;</span></button>
<button id="cloudPullAndMerge" type="button" class="custom" data-i18n-title="cloudPullAndMerge" disabled><span class="fa">&#xf0ed;<span>&#xf067;</span></span></button>
</div>
<p id="cloudError"></p>
<span id="cloudCog" class="fa">&#xf013;</span>

View File

@ -12,7 +12,7 @@
<body>
<div id="dashboard-nav">
<div id="dashboard-nav-widgets">
<span class="hverbose" title="extName"><img src="img/ublock.svg"></span><!--
<span class="hverbose" data-i18n-title="extName"><img src="img/ublock.svg"></span><!--
--><a class="tabButton" href="#settings.html" data-i18n="settingsPageName"></a><!--
--><a class="tabButton" href="#3p-filters.html" data-i18n="3pPageName"></a><!--
--><a class="tabButton" href="#1p-filters.html" data-i18n="1pPageName"></a><!--

View File

@ -70,7 +70,7 @@ var renderFilterLists = function(soft) {
listEntryTemplate = uDom('#templates .listEntry'),
listStatsTemplate = vAPI.i18n('3pListsOfBlockedHostsPerListStats'),
renderElapsedTimeToString = vAPI.i18n.renderElapsedTimeToString,
groupNames = new Map();
groupNames = new Map([ [ 'user', '' ] ]);
// Assemble a pretty list name if possible
var listNameFromListKey = function(listKey) {
@ -172,18 +172,12 @@ var renderFilterLists = function(soft) {
};
var liFromListGroup = function(groupKey, listKeys) {
var liGroup = document.querySelector('#lists > .groupEntry[data-groupkey="' + groupKey + '"]');
let liGroup = document.querySelector('#lists > .groupEntry[data-groupkey="' + groupKey + '"]');
if ( liGroup === null ) {
liGroup = listGroupTemplate.clone().nodeAt(0);
var groupName = groupNames.get(groupKey);
let groupName = groupNames.get(groupKey);
if ( groupName === undefined ) {
groupName = vAPI.i18n('3pGroup' + groupKey.charAt(0).toUpperCase() + groupKey.slice(1));
// Category "Social" is being renamed "Annoyances": ensure
// smooth transition.
// TODO: remove when majority of users are post-1.14.8 uBO.
if ( groupName === '' && groupKey === 'social' ) {
groupName = vAPI.i18n('3pGroupAnnoyances');
}
groupNames.set(groupKey, groupName);
}
if ( groupName !== '' ) {
@ -193,15 +187,15 @@ var renderFilterLists = function(soft) {
if ( liGroup.querySelector('.geName:empty') === null ) {
liGroup.querySelector('.geCount').textContent = listEntryCountFromGroup(listKeys);
}
var hideUnused = mustHideUnusedLists(groupKey);
let hideUnused = mustHideUnusedLists(groupKey);
liGroup.classList.toggle('hideUnused', hideUnused);
var ulGroup = liGroup.querySelector('.listEntries');
let ulGroup = liGroup.querySelector('.listEntries');
if ( !listKeys ) { return liGroup; }
listKeys.sort(function(a, b) {
return (listDetails.available[a].title || '').localeCompare(listDetails.available[b].title || '');
});
for ( var i = 0; i < listKeys.length; i++ ) {
var liEntry = liFromListEntry(
for ( let i = 0; i < listKeys.length; i++ ) {
let liEntry = liFromListEntry(
listKeys[i],
ulGroup.children[i],
hideUnused
@ -214,18 +208,19 @@ var renderFilterLists = function(soft) {
};
var groupsFromLists = function(lists) {
var groups = {};
var listKeys = Object.keys(lists);
var i = listKeys.length;
var listKey, list, groupKey;
while ( i-- ) {
listKey = listKeys[i];
list = lists[listKey];
groupKey = list.group || 'nogroup';
if ( groups[groupKey] === undefined ) {
groups[groupKey] = [];
let groups = new Map();
let listKeys = Object.keys(lists);
for ( let listKey of listKeys ) {
let list = lists[listKey];
let groupKey = list.group || 'nogroup';
if ( groupKey === 'social' ) {
groupKey = 'annoyances';
}
groups[groupKey].push(listKey);
let memberKeys = groups.get(groupKey);
if ( memberKeys === undefined ) {
groups.set(groupKey, (memberKeys = []));
}
memberKeys.push(listKey);
}
return groups;
};
@ -248,22 +243,21 @@ var renderFilterLists = function(soft) {
// Visually split the filter lists in purpose-based groups
var ulLists = document.querySelector('#lists'),
groups = groupsFromLists(details.available),
liGroup, i, groupKey,
groupKeys = [
'user',
'default',
'ads',
'privacy',
'malware',
'social',
'annoyances',
'multipurpose',
'regions',
'custom'
];
document.body.classList.toggle('hideUnused', mustHideUnusedLists('*'));
for ( i = 0; i < groupKeys.length; i++ ) {
groupKey = groupKeys[i];
liGroup = liFromListGroup(groupKey, groups[groupKey]);
for ( let i = 0; i < groupKeys.length; i++ ) {
let groupKey = groupKeys[i];
let liGroup = liFromListGroup(groupKey, groups.get(groupKey));
liGroup.setAttribute('data-groupkey', groupKey);
liGroup.classList.toggle(
'collapsed',
@ -272,13 +266,12 @@ var renderFilterLists = function(soft) {
if ( liGroup.parentElement === null ) {
ulLists.appendChild(liGroup);
}
delete groups[groupKey];
groups.delete(groupKey);
}
// For all groups not covered above (if any left)
groupKeys = Object.keys(groups);
for ( i = 0; i < groupKeys.length; i++ ) {
groupKey = groupKeys[i];
ulLists.appendChild(liFromListGroup(groupKey, groups[groupKey]));
for ( let groupKey of groupKeys.keys() ) {
ulLists.appendChild(liFromListGroup(groupKey, groupKey));
}
uDom('#lists .listEntries .listEntry.discard').remove();

View File

@ -189,11 +189,11 @@ vAPI.i18n.render = function(context) {
safeTextToDOM(text, elem);
}
elems = root.querySelectorAll('[title]');
elems = root.querySelectorAll('[data-i18n-title]');
n = elems.length;
for ( i = 0; i < n; i++ ) {
elem = elems[i];
text = vAPI.i18n(elem.getAttribute('title'));
text = vAPI.i18n(elem.getAttribute('data-i18n-title'));
if ( !text ) { continue; }
elem.setAttribute('title', text);
}

View File

@ -45,7 +45,7 @@
<span id="clean" class="button fa disabled">&#xf00d;</span>
<span id="clear" class="button fa disabled">&#xf12d;</span>
<span id="filterButton" class="button fa">&#xf0b0;</span><input id="filterInput" type="text" placeholder="logFilterPrompt">
<input id="maxEntries" type="text" size="5" title="logMaxEntriesTip">
<input id="maxEntries" type="text" size="5" data-i18n-title="logMaxEntriesTip">
</div>
</div>
<div class="vscrollable">

View File

@ -18,7 +18,7 @@
<li><input id="tooltips-disabled" type="checkbox" data-setting-name="tooltipsDisabled" data-setting-type="bool"><label data-i18n="settingsTooltipsPrompt" for="tooltips-disabled"></label>
<li><input id="color-blind-friendly" type="checkbox" data-setting-name="colorBlindFriendly" data-setting-type="bool"><label data-i18n="settingsColorBlindPrompt" for="color-blind-friendly"></label>
<li><input id="cloud-storage-enabled" type="checkbox" data-setting-name="cloudStorageEnabled" data-setting-type="bool"><label data-i18n="settingsCloudStorageEnabledPrompt" for="cloud-storage-enabled"></label> <a class="fa info" href="https://github.com/gorhill/uBlock/wiki/Cloud-storage" target="_blank">&#xf05a;</a>
<li><input id="advanced-user-enabled" type="checkbox" data-setting-name="advancedUserEnabled" data-setting-type="bool"><label data-i18n="settingsAdvancedUserPrompt" for="advanced-user-enabled"></label> <a class="fa info" href="advanced-settings.html" title="settingsAdvancedUserSettings">&#xf085;</a>
<li><input id="advanced-user-enabled" type="checkbox" data-setting-name="advancedUserEnabled" data-setting-type="bool"><label data-i18n="settingsAdvancedUserPrompt" for="advanced-user-enabled"></label> <a class="fa info" href="advanced-settings.html" data-i18n-title="settingsAdvancedUserSettings">&#xf085;</a>
<li class="subgroup"><span data-i18n="3pGroupPrivacy"></span><ul>
<li><input id="prefetching-disabled" type="checkbox" data-setting-name="prefetchingDisabled" data-setting-type="bool"><label data-i18n="settingsPrefetchingDisabledPrompt" for="prefetching-disabled"></label> <a class="fa info" href="https://wikipedia.org/wiki/Link_prefetching#Issues_and_criticisms" target="_blank">&#xf05a;</a>
<li><input id="hyperlink-auditing-disabled" type="checkbox" data-setting-name="hyperlinkAuditingDisabled" data-setting-type="bool"><label data-i18n="settingsHyperlinkAuditingDisabledPrompt" for="hyperlink-auditing-disabled"></label> <a class="fa info important" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#disable-hyperlink-auditing" target="_blank">&#xf05a;</a>