diff --git a/background.js b/background.js index d4e5b23..408fef4 100644 --- a/background.js +++ b/background.js @@ -69,6 +69,7 @@ showPopup: false, showPopupOnMouseOver: false, showTrace: false, + showDetailOnIncludeDomains: false, } for (var option in optionsValues) { var value = optionsValues[option] @@ -171,7 +172,8 @@ popupMaxHeight: await LS.getItem('popupMaxHeight'), includeDomains: await LS.getItem('includeDomains'), iconSize: await LS.getItem('iconSize'), - notificationIconOpacity: await LS.getItem('notificationIconOpacity') + notificationIconOpacity: await LS.getItem('notificationIconOpacity'), + showDetailOnIncludeDomains: await LS.getItem('showDetailOnIncludeDomains'), } } diff --git a/content.js b/content.js index b8fbe46..9dee228 100644 --- a/content.js +++ b/content.js @@ -35,7 +35,7 @@ new (function () { } function showErrorNotification(popupUrl) { - if (options.showPopup) { + if (options.showPopup || (options.showDetailOnIncludeDomains && options.includeDomains.indexOf(getBaseHostByUrl(window.location.href)) + 1)) { showPopup(popupUrl) } var includeSite = false @@ -193,4 +193,13 @@ new (function () { options = response })() } + + function getBaseHostByUrl(url) { + var localUrlRegexp = /(file:\/\/.*)|(:\/\/[^.:]+([\/?:]|$))/ // file:// | local + var rootHostRegexp = /:\/\/(([\w-]+\.\w+)|(\d+\.\d+\.\d+\.\d+)|(\[[\w:]+\]))([\/?:]|$)/ // domain.com | IPv4 | IPv6 + var subDomainRegexp = /:\/\/[^\/]*\.([\w-]+\.\w+)([\/?:]|$)/ // sub.domain.com + return localUrlRegexp.exec(url) + ? 'localhost' + : (rootHostRegexp.exec(url) || subDomainRegexp.exec(url))[1] + } })() diff --git a/options.html b/options.html index bb6eeac..0277bc1 100644 --- a/options.html +++ b/options.html @@ -114,6 +114,13 @@

Global options

+