|
Server : Apache System : Linux s1230 5.15.0-139-generic #149~20.04.1 SMP Tue Jul 14 11:21:49 UTC 2026 x86_64 User : p141464 ( 418825) PHP Version : 7.4.33.12 Disable Function : NONE Directory : /html/relaunch-kmu/wp-content/plugins/wp-gdpr-compliance/Resources/js/admin/ |
Upload File : |
/**
* Admin Component for the request overview
*/
export default class RequestOverview {
constructor () {
this.setProperties()
this.init()
}
setProperties () {
this.overview = document.querySelector('.wpgdprc-tabs--requests')
this.tabTitle = document.querySelector('.wpgdprc-tabs--requests .wpgdprc-tabs__title')
this.activeLink = document.querySelector('.wpgdprc-tabs--requests [aria-controls="active-requests"]')
this.expiredLink = document.querySelector('.wpgdprc-tabs--requests [aria-controls="expired-requests"]')
}
init () {
this.handleTabSwitch()
}
handleTabSwitch () {
if (!this.overview || !this.tabTitle || !this.activeLink || !this.expiredLink) {
return
}
this.resetTabindex(this.activeLink)
this.resetTabindex(this.expiredLink)
if (this.expiredLink.getAttribute('aria-selected') === 'true') {
this.tabTitle.innerText = this.expiredLink.innerText
}
this.activeLink.addEventListener('click', event => {
this.tabTitle.innerText = event.target.innerText
this.resetTabindex(this.expiredLink)
})
this.expiredLink.addEventListener('click', event => {
this.tabTitle.innerText = event.target.innerText
this.resetTabindex(this.activeLink)
})
}
resetTabindex (element) {
if (!element) {
return
}
element.setAttribute('tabindex', '0')
}
}