diff options
| author | Teddy Wing | 2021-09-08 21:34:00 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2021-09-08 21:34:00 +0200 | 
| commit | e45127b404ce194e389b447b68a33957ad9f3492 (patch) | |
| tree | 37579e9d45090fc94f490db553440189e49c3858 /background.js | |
| parent | 87e585c3cb9ff18cc34159d19645f3df887d2f32 (diff) | |
| download | Legibility-e45127b404ce194e389b447b68a33957ad9f3492.tar.bz2 | |
wildcard_domains: Change wildcard character to '%'domain-wildcards
The '*' character is not ideal to use in filenames because if you forget
to escape it in the shell, it can have harmful consequences.
Diffstat (limited to 'background.js')
| -rw-r--r-- | background.js | 7 | 
1 files changed, 3 insertions, 4 deletions
| diff --git a/background.js b/background.js index beee8e0..5bde79a 100644 --- a/background.js +++ b/background.js @@ -38,13 +38,12 @@ browser.runtime.onMessage.addListener(function(message) {  }); -// TODO: Consider choosing a different wildcard character, as '*' is troublesome in a shell (maybe '%')  // Build a list of wildcard domains from the given hostname.  //  // Example:  //  //     wildcard_domains('en.wikipedia.org'); -//     => [ '*', '*.org', '*.wikipedia.org', 'en.wikipedia.org' ] +//     => [ '%', '%.org', '%.wikipedia.org', 'en.wikipedia.org' ]  function wildcard_domains (hostname) {  	var domain_parts = hostname.split('.');  	var domains = []; @@ -63,10 +62,10 @@ function wildcard_domains (hostname) {  	}  	for (var i = 0; i < domains.length - 1; i++) { -		domains[i] = '*.' + domains[i]; +		domains[i] = '%.' + domains[i];  	} -	domains.unshift('*'); +	domains.unshift('%');  	return domains;  } | 
