1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

notification bar tweaks

This commit is contained in:
Kyle Spearrin
2017-10-24 13:04:37 -04:00
parent 18277207f6
commit c2a49d1074

View File

@@ -5,8 +5,9 @@
pageHref = null, pageHref = null,
observer = null, observer = null,
domObservationCollectTimeout = null, domObservationCollectTimeout = null,
collectIfNeededTimeout = null,
iframed = isIframed(), iframed = isIframed(),
submitButtonNames = ['log in', 'sign in', 'login', 'go', 'submit', 'continue']; submitButtonNames = ['log in', 'sign in', 'login', 'go', 'submit', 'continue', 'next'];
if (window.location.hostname.indexOf('bitwarden.com') === -1) { if (window.location.hostname.indexOf('bitwarden.com') === -1) {
chrome.storage.local.get('neverDomains', function (obj) { chrome.storage.local.get('neverDomains', function (obj) {
@@ -17,7 +18,7 @@
chrome.storage.local.get('disableAddLoginNotification', function (obj) { chrome.storage.local.get('disableAddLoginNotification', function (obj) {
if (!obj || !obj.disableAddLoginNotification) { if (!obj || !obj.disableAddLoginNotification) {
setInterval(collectIfNeeded, 1000); collectIfNeeded();
} }
}); });
}); });
@@ -69,7 +70,7 @@
var bodies = document.querySelectorAll('body'); var bodies = document.querySelectorAll('body');
if (bodies && bodies.length > 0) { if (bodies && bodies.length > 0) {
observer = new window.MutationObserver(function (mutations) { observer = new window.MutationObserver(function (mutations) {
if (!mutations || !mutations.length) { if (!mutations || !mutations.length || pageHref !== window.location.href) {
return; return;
} }
@@ -131,6 +132,11 @@
collect(); collect();
observeDom(); observeDom();
} }
if (collectIfNeededTimeout) {
clearTimeout(collectIfNeededTimeout);
}
collectIfNeededTimeout = setTimeout(collectIfNeeded, 1000);
} }
function collect() { function collect() {