@ -67,14 +67,15 @@ const Popup = {
detections : document . querySelector ( '.detections' ) ,
empty : document . querySelector ( '.empty' ) ,
footer : document . querySelector ( '.footer' ) ,
tabPro : document . querySelector ( '.tab--pro' ) ,
tabPlus : document . querySelector ( '.tab--plus' ) ,
tabPlusDot : document . querySelector ( '.tab__dot' ) ,
termsButtonAccept : document . querySelector ( '.terms__button--accept' ) ,
termsButtonDecline : document . querySelector ( '.terms__button--decline' ) ,
headerSwitches : document . querySelectorAll ( '.header__switch' ) ,
headerSwitchEnabled : document . querySelector ( '.header__switch--enabled' ) ,
headerSwitchDisabled : document . querySelector ( '.header__switch--disabled' ) ,
p roConfigureApiKey: document . querySelector ( '.pro -configure__apikey') ,
p roConfigureSave: document . querySelector ( '.pro -configure__save') ,
p lusConfigureApiKey: document . querySelector ( '.plus -configure__apikey') ,
p lusConfigureSave: document . querySelector ( '.plus -configure__save') ,
headerSettings : document . querySelector ( '.header__settings' ) ,
headerThemes : document . querySelectorAll ( '.header__theme' ) ,
headerThemeLight : document . querySelector ( '.header__theme--light' ) ,
@ -101,6 +102,12 @@ const Popup = {
return templates
} , { } )
const plusTabViewed = await getOption ( 'plusTabViewed' , false )
if ( plusTabViewed ) {
el . tabPlusDot . classList . add ( 'tab__dot--hidden' )
}
// Disabled domains
const dynamicIcon = await getOption ( 'dynamicIcon' , false )
@ -132,7 +139,7 @@ const Popup = {
el . terms . classList . remove ( 'terms--hidden' )
el . detections . classList . add ( 'detections--hidden' )
el . footer . classList . add ( 'footer--hidden' )
el . tabP ro . classList . add ( 'tab--disabled' )
el . tabP lus . classList . add ( 'tab--disabled' )
el . termsButtonAccept . addEventListener ( 'click' , async ( ) => {
await setOption ( 'termsAccepted' , true )
@ -140,7 +147,7 @@ const Popup = {
el . terms . classList . add ( 'terms--hidden' )
el . footer . classList . remove ( 'footer--hidden' )
el . tabP ro . classList . remove ( 'tab--disabled' )
el . tabP lus . classList . remove ( 'tab--disabled' )
Popup . driver ( 'getDetections' ) . then ( Popup . onGetDetections . bind ( this ) )
} )
@ -151,7 +158,7 @@ const Popup = {
el . terms . classList . add ( 'terms--hidden' )
el . footer . classList . remove ( 'footer--hidden' )
el . tabP ro . classList . remove ( 'tab--disabled' )
el . tabP lus . classList . remove ( 'tab--disabled' )
Popup . driver ( 'getDetections' ) . then ( Popup . onGetDetections . bind ( this ) )
} )
@ -198,17 +205,17 @@ const Popup = {
headerSwitch . classList . add ( 'header__switch--hidden' )
}
el . tabP ro . classList . add ( 'tab--disabled' )
el . tabP lus . classList . add ( 'tab--disabled' )
}
}
// P RO configuration
el . p ro ConfigureApiKey. value = await getOption ( 'apiKey' , '' )
// P lus configuration
el . p lus ConfigureApiKey. value = await getOption ( 'apiKey' , '' )
el . p ro ConfigureSave. addEventListener ( 'click' , async ( event ) => {
await setOption ( 'apiKey' , el . p ro ConfigureApiKey. value )
el . p lus ConfigureSave. addEventListener ( 'click' , async ( event ) => {
await setOption ( 'apiKey' , el . p lus ConfigureApiKey. value )
await Popup . getP ro ( url )
await Popup . getP lus ( url )
} )
// Header
@ -246,8 +253,14 @@ const Popup = {
el . credits . classList . add ( 'credits--hidden' )
el . footer . classList . remove ( 'footer--hidden' )
if ( tab . classList . contains ( 'tab--pro' ) ) {
await Popup . getPro ( url )
if ( tab . classList . contains ( 'tab--plus' ) ) {
await Popup . getPlus ( url )
if ( ! plusTabViewed ) {
await setOption ( 'plusTabViewed' , true )
el . tabPlusDot . classList . add ( 'tab__dot--hidden' )
}
}
} )
} )
@ -463,40 +476,40 @@ const Popup = {
* Show company and contact details
* @ param { String } url
* /
async getP ro ( url ) {
async getP lus ( url ) {
const apiKey = await getOption ( 'apiKey' , '' )
const el = {
loading : document . querySelector ( '.loading' ) ,
panels : document . querySelector ( '.panels' ) ,
empty : document . querySelector ( '.p ro -empty') ,
crawl : document . querySelector ( '.p ro -crawl') ,
error : document . querySelector ( '.p ro -error') ,
errorMessage : document . querySelector ( '.p ro -error__message') ,
configure : document . querySelector ( '.p ro -configure') ,
empty : document . querySelector ( '.p lus -empty') ,
crawl : document . querySelector ( '.p lus -crawl') ,
error : document . querySelector ( '.p lus -error') ,
errorMessage : document . querySelector ( '.p lus -error__message') ,
configure : document . querySelector ( '.p lus -configure') ,
credits : document . querySelector ( '.credits' ) ,
creditsRemaining : document . querySelector ( '.credits__remaining' ) ,
footer : document . querySelector ( '.footer' ) ,
}
el . error . classList . add ( 'p ro -error--hidden')
el . error . classList . add ( 'p lus -error--hidden')
if ( apiKey ) {
el . loading . classList . remove ( 'loading--hidden' )
el . configure . classList . add ( 'p ro -configure--hidden')
el . configure . classList . add ( 'p lus -configure--hidden')
el . footer . classList . remove ( 'footer--hidden' )
} else {
el . loading . classList . add ( 'loading--hidden' )
el . configure . classList . remove ( 'p ro -configure--hidden')
el . configure . classList . remove ( 'p lus -configure--hidden')
el . footer . classList . add ( 'footer--hidden' )
return
}
el . panels . classList . add ( 'panels--hidden' )
el . empty . classList . add ( 'p ro -empty--hidden')
el . crawl . classList . add ( 'p ro -crawl--hidden')
el . error . classList . add ( 'p ro -error--hidden')
el . empty . classList . add ( 'p lus -empty--hidden')
el . crawl . classList . add ( 'p lus -crawl--hidden')
el . error . classList . add ( 'p lus -error--hidden')
while ( el . panels . lastElementChild ) {
el . panels . removeChild ( el . panels . lastElementChild )
@ -504,7 +517,7 @@ const Popup = {
try {
const response = await fetch (
` https://api.wappalyzer.com/p ro /v2/${ encodeURIComponent ( url ) } ` ,
` https://api.wappalyzer.com/p lus /v2/${ encodeURIComponent ( url ) } ` ,
{
method : 'GET' ,
headers : {
@ -537,14 +550,14 @@ const Popup = {
if ( crawl ) {
document
. querySelector ( '.p ro -crawl')
. classList . remove ( 'p ro -crawl--hidden')
. querySelector ( '.p lus -crawl')
. classList . remove ( 'p lus -crawl--hidden')
return
}
if ( ! Object . keys ( attributes ) . length ) {
el . empty . classList . remove ( 'p ro -empty--hidden')
el . empty . classList . remove ( 'p lus -empty--hidden')
return
}
@ -660,7 +673,7 @@ const Popup = {
? error . data
: 'No access. Please check your API key.'
el . configure . classList . remove ( 'p ro -configure--hidden')
el . configure . classList . remove ( 'p lus -configure--hidden')
} else if ( error . response . status === 429 ) {
el . errorMessage . textContent =
'Too many requests. Please try again in a few seconds.'
@ -673,7 +686,7 @@ const Popup = {
}
el . loading . classList . add ( 'loading--hidden' )
el . error . classList . remove ( 'p ro -error--hidden')
el . error . classList . remove ( 'p lus -error--hidden')
}
Array . from ( document . querySelectorAll ( '.panels a' ) ) . forEach ( ( a ) =>