Added options page

This commit is contained in:
z0ccc 2021-06-26 16:12:06 -04:00
parent 48b28fb665
commit 03c2ed4961
3 changed files with 33 additions and 11 deletions

View file

@ -18,5 +18,9 @@
"48": "icon_48.png",
"128": "icon_128.png"
}
},
"options_ui": {
"page": "options.html",
"open_in_tab": false
}
}

15
public/options.html Normal file
View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<!-- <div class="checkBoxWrap">
<input type="checkbox" id="clickOnly" name="clickOnly"/>
<label for="clickOnly">Run browser popup only when icon is clicked</label>
</div>
<div class="optionText">Github: <a target="_blank" href="https://github.com/z0ccc/Reddit-Wherever">https://github.com/z0ccc/Reddit-Wherever</a></div> -->
<div id="options"></div>
</body>
<script src="options.js"></script>
</html>

View file

@ -13,6 +13,17 @@ const sortArr = (arr) => {
return list;
};
const sortPlugins = (data) => {
const length = data.length;
let list = '';
for (let i = 0; i < length; i++) {
if (i !== 0) list += ', ';
list += data[i].name;
}
return list;
};
const sendData = (data) => {
fetch('http://localhost:8000/', {
method: 'POST',
@ -24,16 +35,6 @@ const sendData = (data) => {
};
const TableWrap = () => {
const uaResult = Bowser.parse(navigator.userAgent);
const date = new Date();
const pluginsLength = navigator.plugins.length;
let pluginList = '';
for (let i = 0; i < pluginsLength; i++) {
if (i !== 0) pluginList += ', ';
pluginList += navigator.plugins[i].name;
}
const [batLevel, setBatLevel] = useState('');
const [batStatus, setBatStatus] = useState('');
@ -49,6 +50,8 @@ const TableWrap = () => {
}
}, []);
const uaResult = Bowser.parse(navigator.userAgent);
const date = new Date();
const gl = document.createElement('canvas').getContext('webgl');
const ext = gl.getExtension('WEBGL_debug_renderer_info');
@ -136,7 +139,7 @@ const TableWrap = () => {
{
key: 'plugins',
title: 'Plugins',
value: pluginList || 'N/A',
value: sortPlugins(navigator.plugins) || 'N/A',
},
];