check for regex errors & misc ui changes

This commit is contained in:
alexadam 2017-07-13 22:38:42 +03:00
parent a867a88550
commit e4f6940ecc
4 changed files with 38 additions and 33 deletions

View file

@ -32,9 +32,14 @@ function createStyleList(styles) {
currentUrl = currentUrl.replace(/(http[s]?:\/\/|www\.)/i, '').toLowerCase();
var styleUrl = styles[i].url;
var styleUrlRegex = new RegExp('.*' + styleUrl + '.*', 'i');
var styleUrlRegex = null;
if (styleUrlRegex.test(currentUrl)) {
try {
styleUrlRegex = new RegExp('.*' + styleUrl + '.*', 'i');
} catch (e) {
}
if (styleUrlRegex && styleUrlRegex.test(currentUrl)) {
allMatchingStyles.push({
index: i,
length: styleUrl.length