Code style: wrap regex

This commit is contained in:
nobody 2021-11-28 09:28:38 +01:00
parent 8405504be6
commit 05ea59029f
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
5 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
charset = (/charset\s*=/).test(header.value) && header.value.replace(/^.*?charset\s*=\s*/, '').replace(/["']?/g, '');
// Check if charset is supported by TextDecoder()
if (/charset\s*=/.test(header.value) && !EncodingTypes[charset.toString().toLowerCase()]) {
if ((/charset\s*=/).test(header.value) && !EncodingTypes[charset.toString().toLowerCase()]) {
console.error(`[ LocalCDN ] Unsupported charset: ${charset}`);
log.append(details.url, '-', `Unsupported charset: ${charset}`, true);
return;

View File

@ -46,7 +46,7 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
// Font Awesome injections in Chromium deactivated (https://gitlab.com/nobody42/localcdn/-/issues/67)
if (BrowserType.CHROMIUM) {
if (/(font-awesome|fontawesome)/.test(requestDetails.url)) {
if ((/(font-awesome|fontawesome)/).test(requestDetails.url)) {
console.warn(`${LogString.PREFIX} ${LogString.FONT_AWESOME}`);
log.append(tabDetails.url, requestDetails.url, LogString.FONT_AWESOME, true);
return false;

View File

@ -168,7 +168,7 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) {
'path': `resources/twitter-bootstrap/fonts/${helpers.extractFilenameFromPath(channelPath)}`,
'bundle': 'Bootstrap (Fonts)'
};
} else if (/cdnjs\.cloudflare\.com\/ajax\/libs\/jquery\.cycle2\/[\d.]+\//.test(CompleteURL)) {
} else if ((/cdnjs\.cloudflare\.com\/ajax\/libs\/jquery\.cycle2\/[\d.]+\//).test(CompleteURL)) {
if (channelPath.endsWith('js')) {
channelPath += 'm';
}
@ -201,7 +201,7 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) {
'path': `resources/materialize/1.0.0/${channelPath}`,
'bundle': 'Materialize'
};
} else if (/cdn\.jsdelivr\.net\/npm\/vue@(2|3)/.test(CompleteURL)) {
} else if ((/cdn\.jsdelivr\.net\/npm\/vue@(2|3)/).test(CompleteURL)) {
let version = CompleteURL.match(Resource.VERSION_EXPRESSION);
lastVersion = targets.setLastVersion(`/vue/${version}.`);
if (lastVersion === false) {

View File

@ -139,7 +139,7 @@ helpers.normalizeDomain = function (domain) {
};
helpers.extractDomainFromUrl = function (url, normalize) {
if (/^(?!(http[s]?|file):\/\/).*/.test(url)) {
if ((/^(?!(http[s]?|file):\/\/).*/).test(url)) {
return null;
}

View File

@ -173,7 +173,7 @@ optionsOther._onChangedHexColor = function ({target}) {
return;
}
if (/#([a-f0-9]{3}){1,2}\b/i.test(target.value)) {
if ((/#([a-f0-9]{3}){1,2}\b/i).test(target.value)) {
target.classList.remove('color-error');
if (target.id === element.BADGED_TEXT_COLOR) {
let txtColor = target.value;