Commit 6ab6fb22 authored by Zhai, Zirun's avatar Zhai, Zirun

Revert "Merge branch 'master' into 'develop'"

This reverts commit ed327f51
parent ed327f51
web: node index.js
\ No newline at end of file
......@@ -2,6 +2,7 @@
var MOUSE_VISITED_CLASSNAME = 'crx_mouse_visited_true';
var MOUSE_VISITED_CLASSNAME_FALSE = 'crx_mouse_visited_false';
var srcName;
var dietNum = 0;
var requestResult;
// var currName;
......@@ -61,30 +62,10 @@ function checkAllergen(product) {
return result;
}
const client = new Client({
connectionString: process.env.DATABASE_URL, //default name for main database is DATABASE_URL
ssl: {
rejectUnauthorized: false
}
});
// Previous dom, that we want to track, so we can remove the previous styling.
//var prevDOM = null;
function checkAllergens(name) {
client.connect();
client.query('SELECT Containsgluten, Containsdairy, Containscorn, Containsmeat FROM productsIngredients WHERE Product = ' + name + ';', (err, res) => {
if (err) throw err;
for (let col of res.cols) {
if (col) {
return col;
}
//returns true if any allergen is present.
}
return false;
});
client.end();
// return true;
}
// Mouse listener for any move event on the current document.
document.addEventListener('mousemove', function (e) {
let srcElement = e.srcElement;
......
//https://www.w3schools.com/nodejs/nodejs_mysql_select.asp
// two options for accessing database:
// 1. make it a function and connect and reconnect to the client each time we hover over an icon
// problem: connecting to the client within content.js?
// --> figure out how to call function from diff javascript file? and put the function here in index.js
// problem: cost of calling database that many times?
// --> probably not a big deal, can ignore (?)
// 2. store the entire database in the cache or something and load it once at startup
// problem: slows down the browser probably lmao
// --> cant really fix this? unless its negligible but i dont think so (?)
\ No newline at end of file
......@@ -9,6 +9,11 @@
"declarativeContent"
],
"permissions": [
"activeTab",
"declarativeContent"
],
"browser_action": {
"default_icon": "images/example-icon.png",
"default_title": "Clickerance",
......
......@@ -4,21 +4,16 @@
<meta charset = "utf-8"/>
<title> clickerance </title>
<link type="text/css" rel="stylesheet" href="style.css"/>
<script src="require.js" type="text/javascript"></script>
<script src="index.js" type="text/javascript"></script>
<script src="content.js" type="text/javascript"></script>
<script src="content.js"></script>
</head>
<body>
<div class="Title">
<b>Clickerance</b>
</div>
<div id="form">
<div class="Title"></div>
<h1> Clickerance </h1>
Dairy : <input type="checkbox" id="Dairy"><br>
Meat : <input type="checkbox" id="Meat"><br>
Corn : <input type="checkbox" id="Corn"><br>
Gluten : <input type="checkbox" id="Gluten"><br>
</div>
<p>Which ones you can't eat?</p>
......
This diff is collapsed.
.Title
{
text-align: justify;
font: 30px helvetica, sans-serif;
font: 40px helvetica, sans-serif;
color: white;
background-color: #47BD95;
padding: 4px
padding: 28px
}
.nameWrapper___4c05X {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment