aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-25 14:25:11 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 22:06:27 -0500
commit527595f79bf97bc2d17cb821c8bb6b4e8b6776f9 (patch)
tree848035c9eb864e872999ca22d8ac5e15e8c3a9fa /ext
parent1daed122909532f5ec5c4b470ddf7f791944cf73 (diff)
Remove unnecessary escapes from regex literals
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/audio.js4
-rw-r--r--ext/bg/js/dictionary.js2
-rw-r--r--ext/bg/js/search.js4
-rw-r--r--ext/fg/js/document.js2
-rw-r--r--ext/fg/js/popup.js2
-rw-r--r--ext/mixed/js/audio.js2
6 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 9bbbf902..dc0ba5eb 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -107,7 +107,7 @@ const audioUrlBuilders = {
'custom': async (definition, optionsContext) => {
const options = await apiOptionsGet(optionsContext);
const customSourceUrl = options.audio.customSourceUrl;
- return customSourceUrl.replace(/\{([^\}]*)\}/g, (m0, m1) => (hasOwn(definition, m1) ? `${definition[m1]}` : m0));
+ return customSourceUrl.replace(/\{([^}]*)\}/g, (m0, m1) => (hasOwn(definition, m1) ? `${definition[m1]}` : m0));
}
};
@@ -133,7 +133,7 @@ function audioUrlNormalize(url, baseUrl, basePath) {
// Begins with "/"
url = baseUrl + url;
}
- } else if (!/^[a-z][a-z0-9\+\-\.]*:/i.test(url)) {
+ } else if (!/^[a-z][a-z0-9\-+.]*:/i.test(url)) {
// No URI scheme => relative path
url = baseUrl + basePath + url;
}
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index affce9e9..409bed85 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -322,7 +322,7 @@ async function dictFieldFormat(field, definition, mode, options, exceptions) {
compactGlossaries: options.general.compactGlossaries
};
const markers = dictFieldFormat.markers;
- const pattern = /\{([\w\-]+)\}/g;
+ const pattern = /\{([\w-]+)\}/g;
return await stringReplaceAsync(field, pattern, async (g0, marker) => {
if (!markers.has(marker)) {
return g0;
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index ae76c23b..552b7a59 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -207,7 +207,7 @@ class DisplaySearch extends Display {
async onSearchQueryUpdated(query, animate) {
try {
const details = {};
- const match = /[\*\uff0a]+$/.exec(query);
+ const match = /[*\uff0a]+$/.exec(query);
if (match !== null) {
details.wildcard = true;
query = query.substring(0, query.length - match[0].length);
@@ -356,7 +356,7 @@ class DisplaySearch extends Display {
}
static getSearchQueryFromLocation(url) {
- let match = /^[^\?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
+ let match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
return match !== null ? decodeURIComponent(match[1]) : null;
}
}
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 3dd12a40..10dea7df 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -17,7 +17,7 @@
*/
-const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^\)]*,\s*0(?:\.0+)?\s*\)/;
+const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^)]*,\s*0(?:\.0+)?\s*\)/;
function docSetImposterStyle(style, propertyName, value) {
style.setProperty(propertyName, value, 'important');
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index df784029..c40e5d60 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -303,7 +303,7 @@ class Popup {
}
static getColorInfo(cssColor) {
- const m = /^\s*rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d\.]+)\s*)?\)\s*$/.exec(cssColor);
+ const m = /^\s*rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)\s*$/.exec(cssColor);
if (m === null) { return null; }
const m4 = m[4];
diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js
index 7d5ffedd..35f283a4 100644
--- a/ext/mixed/js/audio.js
+++ b/ext/mixed/js/audio.js
@@ -68,7 +68,7 @@ class TextToSpeechAudio {
}
static createFromUri(ttsUri) {
- const m = /^tts:[^#\?]*\?([^#]*)/.exec(ttsUri);
+ const m = /^tts:[^#?]*\?([^#]*)/.exec(ttsUri);
if (m === null) { return null; }
const searchParameters = {};