mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 17:41:03 +01:00
Set tooltip to cname alias in popup panel
The toolip of a canonical name entry (blue) in the popup panel will provide the alias hostname related to the canonical hostname in order to help with rule-making decisions.
This commit is contained in:
parent
651955b97c
commit
4509483c7e
3 changed files with 14 additions and 16 deletions
|
@ -189,7 +189,7 @@ const µb = µBlock;
|
|||
|
||||
const getHostnameDict = function(hostnameToCountMap, out) {
|
||||
const hnDict = Object.create(null);
|
||||
const cnSet = [];
|
||||
const cnMap = [];
|
||||
for ( const [ hostname, hnCounts ] of hostnameToCountMap ) {
|
||||
if ( hnDict[hostname] !== undefined ) { continue; }
|
||||
const domain = vAPI.domainFromHostname(hostname) || hostname;
|
||||
|
@ -206,7 +206,7 @@ const getHostnameDict = function(hostnameToCountMap, out) {
|
|||
};
|
||||
const cname = vAPI.net.canonicalNameFromHostname(domain);
|
||||
if ( cname !== undefined ) {
|
||||
cnSet.push(cname);
|
||||
cnMap.push([ cname, domain ]);
|
||||
}
|
||||
}
|
||||
const domainEntry = hnDict[domain];
|
||||
|
@ -224,11 +224,11 @@ const getHostnameDict = function(hostnameToCountMap, out) {
|
|||
};
|
||||
const cname = vAPI.net.canonicalNameFromHostname(hostname);
|
||||
if ( cname !== undefined ) {
|
||||
cnSet.push(cname);
|
||||
cnMap.push([ cname, hostname ]);
|
||||
}
|
||||
}
|
||||
out.hostnameDict = hnDict;
|
||||
out.cnameSet = cnSet;
|
||||
out.cnameMap = cnMap;
|
||||
};
|
||||
|
||||
const getFirewallRules = function(srcHostname, desHostnames) {
|
||||
|
|
|
@ -87,11 +87,7 @@ const cachePopupData = function(data) {
|
|||
return popupData;
|
||||
}
|
||||
popupData = data;
|
||||
if ( Array.isArray(popupData.cnameSet) ) {
|
||||
popupData.cnameSet = new Set(popupData.cnameSet);
|
||||
} else if ( popupData.cnameSet === undefined ) {
|
||||
popupData.cnameSet = new Set();
|
||||
}
|
||||
popupData.cnameMap = new Map(popupData.cnameMap);
|
||||
scopeToSrcHostnameMap['.'] = popupData.pageHostname || '';
|
||||
const hostnameDict = popupData.hostnameDict;
|
||||
if ( typeof hostnameDict !== 'object' ) {
|
||||
|
@ -304,13 +300,16 @@ const buildAllFirewallRows = function() {
|
|||
classList.toggle('isRootContext', des === popupData.pageHostname);
|
||||
classList.toggle('isDomain', isDomain);
|
||||
classList.toggle('isSubDomain', !isDomain);
|
||||
classList.toggle('isCname', popupData.cnameSet.has(des));
|
||||
classList.toggle('allowed', hnDetails.allowCount !== 0);
|
||||
classList.toggle('blocked', hnDetails.blockCount !== 0);
|
||||
classList.toggle('totalAllowed', hnDetails.totalAllowCount !== 0);
|
||||
classList.toggle('totalBlocked', hnDetails.totalBlockCount !== 0);
|
||||
classList.toggle('expandException', expandExceptions.has(hnDetails.domain));
|
||||
|
||||
if ( classList.toggle('isCname', popupData.cnameMap.has(des)) ) {
|
||||
span.title = punycode.toUnicode(popupData.cnameMap.get(des));
|
||||
}
|
||||
|
||||
row = row.nextElementSibling;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,11 +117,7 @@ const cachePopupData = function(data) {
|
|||
return popupData;
|
||||
}
|
||||
popupData = data;
|
||||
if ( Array.isArray(popupData.cnameSet) ) {
|
||||
popupData.cnameSet = new Set(popupData.cnameSet);
|
||||
} else if ( popupData.cnameSet === undefined ) {
|
||||
popupData.cnameSet = new Set();
|
||||
}
|
||||
popupData.cnameMap = new Map(popupData.cnameMap);
|
||||
scopeToSrcHostnameMap['.'] = popupData.pageHostname || '';
|
||||
const hostnameDict = popupData.hostnameDict;
|
||||
if ( typeof hostnameDict !== 'object' ) {
|
||||
|
@ -339,13 +335,16 @@ const buildAllFirewallRows = function() {
|
|||
classList.toggle('isRootContext', des === popupData.pageHostname);
|
||||
classList.toggle('isDomain', isDomain);
|
||||
classList.toggle('isSubDomain', !isDomain);
|
||||
classList.toggle('isCname', popupData.cnameSet.has(des));
|
||||
classList.toggle('allowed', hnDetails.allowCount !== 0);
|
||||
classList.toggle('blocked', hnDetails.blockCount !== 0);
|
||||
classList.toggle('totalAllowed', hnDetails.totalAllowCount !== 0);
|
||||
classList.toggle('totalBlocked', hnDetails.totalBlockCount !== 0);
|
||||
classList.toggle('expandException', expandExceptions.has(hnDetails.domain));
|
||||
|
||||
if ( classList.toggle('isCname', popupData.cnameMap.has(des)) ) {
|
||||
span.title = punycode.toUnicode(popupData.cnameMap.get(des));
|
||||
}
|
||||
|
||||
row = row.nextElementSibling;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue