Brave-Detection-Blocker-Chr.../popup.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-03-25 18:10:48 +00:00
'use strict';
window.addEventListener(
'message',
(event) => {
if (event.data.action === 'proxyError') {
displayAlert('error', 'Wrong data, or proxy down double check the input.');
}
},
false,
);
const myTabs = document.querySelectorAll('ul.nav-tabs > li');
function myTabClicks(tabClickEvent) {
for (let i = 0; i < myTabs.length; i++) {
myTabs[i].classList.remove('active');
}
const clickedTab = tabClickEvent.currentTarget;
clickedTab.classList.add('active');
tabClickEvent.preventDefault();
const myContentPanes = document.querySelectorAll('.tab-pane');
for (let i = 0; i < myContentPanes.length; i++) {
myContentPanes[i].classList.remove('active');
}
const anchorReference = tabClickEvent.target;
const activePaneId = anchorReference.getAttribute('href');
const activePane = document.querySelector(activePaneId);
activePane.classList.add('active');
}
for (let i = 0; i < myTabs.length; i++) {
myTabs[i].addEventListener('click', myTabClicks);
}
const imgURL = chrome.runtime.getURL("images/BDB-ICON256.png");
document.getElementById("logo").src = imgURL;