Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
showPopup: false,
showPopupOnMouseOver: false,
showTrace: false,
showDetailOnIncludeDomains: false,
}
for (var option in optionsValues) {
var value = optionsValues[option]
Expand Down Expand Up @@ -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'),
}
}

Expand Down
11 changes: 10 additions & 1 deletion content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
}
})()
7 changes: 7 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ <h2>Global options</h2>
<label>
<textarea id="includeDomains" rows="3" style="width: 80%; max-width: 80%;"></textarea>
</label>
<label>
<input
type="checkbox"
id="showDetailOnIncludeDomains"
/>
show error details on these domains
</label>
</p>
<p>
<label>
Expand Down
1 change: 1 addition & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function filloutOptions() {
'showPopup',
'showPopupOnMouseOver',
'showTrace',
'showDetailOnIncludeDomains',
]

if (options['notificationIconOpacity'] == undefined) {
Expand Down