parent
6b77f4cadf
commit
2a54f1cd4f
@ -1,108 +0,0 @@
|
||||
body {
|
||||
color: #303942;
|
||||
cursor: default;
|
||||
direction: __MSG_@@bidi_dir__;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: .8rem;
|
||||
line-height: 1.4rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 1rem 0;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
font-weight: normal;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-bottom: 1px solid #dbdbdb;
|
||||
font-size: 1.5rem;
|
||||
margin: 0 0 1.5rem 0;
|
||||
padding: 1rem 0 1.5rem 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.3em;
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: black;
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: rgb(17, 85, 204);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #4608ad;
|
||||
border: none;
|
||||
border-radius: .2rem;
|
||||
color: white;
|
||||
font-size: inherit;
|
||||
padding: 0 .6rem;
|
||||
line-height: 1.8rem;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: rgb(5, 37, 119);
|
||||
}
|
||||
|
||||
.hero {
|
||||
background: linear-gradient(160deg, #32067c, #150233);
|
||||
padding: 1.5rem 1.5rem 1rem 1.5rem;
|
||||
}
|
||||
|
||||
.hero img {
|
||||
height: 3rem;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
#options-saved {
|
||||
display: none;
|
||||
margin-left: .5rem;
|
||||
-webkit-animation: fadeout 2s;
|
||||
}
|
||||
|
||||
#about {
|
||||
border-top: 1px solid #dbdbdb;
|
||||
margin-top: 1.5rem;
|
||||
padding: 1.5rem 0 0 0;
|
||||
}
|
||||
|
||||
#about img {
|
||||
margin-right: .2rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#about button {
|
||||
background: white;
|
||||
border: 1px solid #dbdbdb;
|
||||
cursor: pointer;
|
||||
color: #303942;
|
||||
margin-bottom: .5rem;
|
||||
margin-inline-end: 1rem;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0; }
|
||||
}
|
@ -1,69 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title data-i18n="options">Wappalyzer options</title>
|
||||
|
||||
<link rel="icon" href="../images/icon_32.png">
|
||||
<title data-i18n="options"></title>
|
||||
|
||||
<link rel="stylesheet" href="../css/options.css">
|
||||
<link rel="stylesheet" href="../css/styles.css">
|
||||
|
||||
<script src="../node_modules/webextension-polyfill/dist/browser-polyfill.js"></script>
|
||||
<script src="../js/utils.js"></script>
|
||||
<script src="../js/options.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="hero">
|
||||
<div class="container">
|
||||
<img src="../images/logo-white.svg">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="container">
|
||||
<h1 data-i18n="options">Options</h1>
|
||||
<div class="options">
|
||||
<label class="options__label">
|
||||
<input class="options__checkbox" type="checkbox">
|
||||
|
||||
<p>
|
||||
<label for="option-upgrade-message">
|
||||
<input id="option-upgrade-message" type="checkbox">
|
||||
<span data-i18n="optionUpgradeMessage">Tell me about upgrades</span>
|
||||
<span data-i18n="optionUpgradeMessage"> </span>
|
||||
</label>
|
||||
<label for="option-dynamic-icon">
|
||||
<input id="option-dynamic-icon" type="checkbox">
|
||||
<span data-i18n="optionDynamicIcon">Use application icon instead of Wappalyzer logo</span>
|
||||
</label>
|
||||
<label for="option-tracking">
|
||||
<input id="option-tracking" type="checkbox">
|
||||
<span data-i18n="optionTracking">Anonymously send reports on detected applications to wappalyzer.com for research</span>
|
||||
|
||||
<label class="options__label">
|
||||
<input class="options__checkbox" type="checkbox">
|
||||
|
||||
<span data-i18n="optionDynamicIcon"> </span>
|
||||
</label>
|
||||
<label for="option-theme-mode">
|
||||
<input id="option-theme-mode" type="checkbox">
|
||||
<span data-i18n="optionThemeMode">Enable dark mode compatibility</span>
|
||||
|
||||
<label class="options__label">
|
||||
<input class="options__checkbox" type="checkbox">
|
||||
|
||||
<span data-i18n="optionTracking"> </span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<div id="about">
|
||||
<p>
|
||||
<button id="github">
|
||||
<img src="../images/github.png" width="16" height="16" alt="GitHub icon" />
|
||||
<span data-i18n="github">Fork Wappalyzer on GitHub!</span>
|
||||
</button>
|
||||
<button id="twitter">
|
||||
<img src="../images/twitter.png" width="16" height="16" alt="Twitter icon" />
|
||||
<span data-i18n="twitter">Follow Wappalyzer on Twitter</span>
|
||||
</button>
|
||||
<button id="wappalyzer">
|
||||
<img src="../images/icon_16.png" width="16" height="16" alt="Wappalyzer icon" />
|
||||
<span data-i18n="website">Go to wappalyzer.com</span>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<label class="options__label">
|
||||
<input class="options__checkbox" type="checkbox">
|
||||
|
||||
<span data-i18n="optionThemeMode"> </span>
|
||||
</label>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,109 +1,44 @@
|
||||
/** global: browser */
|
||||
/** global: Wappalyzer */
|
||||
/* globals browser Wappalyzer */
|
||||
'use strict'
|
||||
/* eslint-env browser */
|
||||
/* globals Utils */
|
||||
|
||||
const wappalyzer = new Wappalyzer()
|
||||
const { i18n, getOption, setOption } = Utils
|
||||
|
||||
/**
|
||||
* Get a value from localStorage
|
||||
*/
|
||||
function getOption(name, defaultValue = null) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let value = defaultValue
|
||||
const Options = {
|
||||
async init() {
|
||||
// Theme mode
|
||||
const themeMode = await getOption('themeMode', false)
|
||||
|
||||
try {
|
||||
const option = await browser.storage.local.get(name)
|
||||
|
||||
if (option[name] !== undefined) {
|
||||
value = option[name]
|
||||
}
|
||||
} catch (error) {
|
||||
wappalyzer.log(error.message, 'driver', 'error')
|
||||
|
||||
return reject(error.message)
|
||||
}
|
||||
|
||||
return resolve(value)
|
||||
})
|
||||
if (themeMode) {
|
||||
document.querySelector('body').classList.add('theme-mode')
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value in localStorage
|
||||
*/
|
||||
function setOption(name, value) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
await browser.storage.local.set({ [name]: value })
|
||||
} catch (error) {
|
||||
wappalyzer.log(error.message, 'driver', 'error')
|
||||
|
||||
return reject(error.message)
|
||||
}
|
||||
|
||||
return resolve()
|
||||
})
|
||||
}
|
||||
;[
|
||||
['upgradeMessage', true],
|
||||
['dynamicIcon', true],
|
||||
['tracking', true],
|
||||
['themeMode', false]
|
||||
].map(async ([option, defaultValue]) => {
|
||||
const el = document
|
||||
.querySelector(
|
||||
`[data-i18n="option${option.charAt(0).toUpperCase() +
|
||||
option.slice(1)}"]`
|
||||
)
|
||||
.parentNode.querySelector('input')
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const nodes = document.querySelectorAll('[data-i18n]')
|
||||
el.checked = !!(await getOption(option, defaultValue))
|
||||
|
||||
Array.prototype.forEach.call(nodes, (node) => {
|
||||
node.childNodes[0].nodeValue = browser.i18n.getMessage(node.dataset.i18n)
|
||||
el.addEventListener('click', async () => {
|
||||
await setOption(option, !!el.checked)
|
||||
})
|
||||
|
||||
document.querySelector('#github').addEventListener('click', () => {
|
||||
window.open(wappalyzer.config.githubURL)
|
||||
})
|
||||
|
||||
document.querySelector('#twitter').addEventListener('click', () => {
|
||||
window.open(wappalyzer.config.twitterURL)
|
||||
})
|
||||
|
||||
document.querySelector('#wappalyzer').addEventListener('click', () => {
|
||||
window.open(wappalyzer.config.websiteURL)
|
||||
})
|
||||
|
||||
let el
|
||||
let value
|
||||
|
||||
// Upgrade message
|
||||
value = await getOption('upgradeMessage', true)
|
||||
|
||||
el = document.querySelector('#option-upgrade-message')
|
||||
|
||||
el.checked = value
|
||||
|
||||
el.addEventListener('change', (e) =>
|
||||
setOption('upgradeMessage', e.target.checked)
|
||||
)
|
||||
|
||||
// Dynamic icon
|
||||
value = await getOption('dynamicIcon', true)
|
||||
|
||||
el = document.querySelector('#option-dynamic-icon')
|
||||
|
||||
el.checked = value
|
||||
|
||||
el.addEventListener('change', (e) =>
|
||||
setOption('dynamicIcon', e.target.checked)
|
||||
)
|
||||
|
||||
// Tracking
|
||||
value = await getOption('tracking', true)
|
||||
|
||||
el = document.querySelector('#option-tracking')
|
||||
|
||||
el.checked = value
|
||||
|
||||
el.addEventListener('change', (e) => setOption('tracking', e.target.checked))
|
||||
|
||||
// Theme Mode
|
||||
value = await getOption('themeMode', false)
|
||||
|
||||
el = document.querySelector('#option-theme-mode')
|
||||
|
||||
el.checked = value
|
||||
i18n()
|
||||
}
|
||||
}
|
||||
|
||||
el.addEventListener('change', (e) => setOption('themeMode', e.target.checked))
|
||||
})
|
||||
if (/complete|interactive|loaded/.test(document.readyState)) {
|
||||
Options.init()
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', Options.init)
|
||||
}
|
||||
|
Loading…
Reference in new issue