-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
30 lines (23 loc) · 937 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict'
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