Commit 4e7b7851 authored by ALGLAVE Ivan's avatar ALGLAVE Ivan
Browse files

Message posting event sent to parent window instead of top window, various fixes

parent 549353ee
...@@ -3,22 +3,25 @@ ...@@ -3,22 +3,25 @@
<head> <head>
<title>Drinkpedia</title> <title>Drinkpedia</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/MyAccount.css"> <link rel="stylesheet" type="text/css" href="css/Account.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script>
</head> </head>
<body> <body>
<h1>Connexion</h1> <div class="content">
<h1>Connexion</h1>
<label>Email</label>
<input id="emailInput" type="email">
<label>Mot de passe</label>
<input id="pwdInput" type="password">
<button onclick="tryConnect();">Se connecter</button>
<label>Email</label> <div class="alt">
<input id="emailInput" type="email"> <a onclick="goToCreate();">Pas de compte ? Créer</a>
<label>Mot de passe</label> </div>
<input id="pwdInput" type="password"> </div>
<button onclick="tryConnect();">Se connecter</button>
<label>Pas de compte ?</label>
<a onclick="goToCreate();">Créer</a>
<script src="scripts/DataQuery.js"></script>
<script> <script>
function goToCreate() function goToCreate()
{ {
...@@ -26,7 +29,7 @@ ...@@ -26,7 +29,7 @@
event: 'usercreate', event: 'usercreate',
value: '' value: ''
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
function tryConnect() function tryConnect()
...@@ -42,7 +45,7 @@ ...@@ -42,7 +45,7 @@
event: 'useraccount', event: 'useraccount',
value: e value: e
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
else else
{ {
......
...@@ -3,22 +3,25 @@ ...@@ -3,22 +3,25 @@
<head> <head>
<title>Drinkpedia</title> <title>Drinkpedia</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/MyAccount.css"> <link rel="stylesheet" type="text/css" href="css/Account.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script>
</head> </head>
<body> <body>
<h1>Création d'un compte</h1> <div class="content">
<h1>Création d'un compte</h1>
<label>Email</label>
<input id="emailInput" type="email">
<label>Mot de passe</label>
<input id="pwdInput" type="password">
<button onclick="createAccount();">Créer mon compte</button>
<label>Email</label> <div class="alt">
<input id="emailInput" type="email"> <a onclick="goToConnect();">Déjà un compte ? Se connecter</a>
<label>Mot de passe</label> </div>
<input id="pwdInput" type="password"> </div>
<button onclick="createAccount();">Créer mon compte</button>
<label>Déjà un compte ?</label>
<a onclick="goToConnect();">Se connecter</a>
<script src="scripts/DataQuery.js"></script>
<script> <script>
function goToConnect() function goToConnect()
{ {
...@@ -26,7 +29,7 @@ ...@@ -26,7 +29,7 @@
event: 'userconnect', event: 'userconnect',
value: '' value: ''
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
function createAccount() function createAccount()
...@@ -50,7 +53,7 @@ ...@@ -50,7 +53,7 @@
event: 'useraccount', event: 'useraccount',
value: e value: e
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
}) })
} }
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
showScore: 'false', showScore: 'false',
title: 'Résultats de la recherche :' title: 'Résultats de la recherche :'
}; };
window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]);
} }
function notifyParentScore(e) // Send a message to the parent window, asking to display the recipe #e function notifyParentScore(e) // Send a message to the parent window, asking to display the recipe #e
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
showScore: 'false', showScore: 'false',
title: 'Résultats de la recherche :' title: 'Résultats de la recherche :'
}; };
window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]);
} }
function appendIngredient(ing, status) function appendIngredient(ing, status)
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
event: 'hierarchyDisplay', event: 'hierarchyDisplay',
value: $aliment value: $aliment
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
</script> </script>
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<link rel="stylesheet" type="text/css" href="css/Home.css"> <link rel="stylesheet" type="text/css" href="css/Home.css">
</head> </head>
<body id="body"> <?php
<?php
include 'scripts/SQL.php'; include 'scripts/SQL.php';
//connect_db(); //connect_db();
?> ?>
<body id="body">
<div class="background"></div> <div class="background"></div>
<div id="content"> <div id="content">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<title>Drinkpedia</title> <title>Drinkpedia</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/MyAccount.css"> <link rel="stylesheet" type="text/css" href="css/Account.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script> <script src="scripts/DataQuery.js"></script>
</head> </head>
...@@ -18,16 +18,20 @@ ...@@ -18,16 +18,20 @@
event: 'userconnect', event: 'userconnect',
value: e value: e
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
}); });
</script> </script>
<h1>My Account</h1> <div class="content">
<h1>Mon compte</h1>
<label id="email"></label> <label id="email"></label>
<div class="alt">
<button onclick="disconnect();">Se déconnecter</button> <a onclick="alert('To be implemented');">Changer mon mot de passe</a>
</div>
<button onclick="disconnect();">Se déconnecter</button>
</div>
<script> <script>
...@@ -44,7 +48,7 @@ ...@@ -44,7 +48,7 @@
event: 'userconnect', event: 'userconnect',
value: '' value: ''
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
}); });
} }
</script> </script>
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<title>Drinkpedia</title> <title>Drinkpedia</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script>
</head> </head>
<body> <body>
<script src="scripts/DataQuery.js"></script>
<script> <script>
getFavourites(function(e) getFavourites(function(e)
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
showScore: 'false', showScore: 'false',
title: 'Favoris :' title: 'Favoris :'
}; };
window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]);
}) })
</script> </script>
</body> </body>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/RecipeList.css"> <link rel="stylesheet" type="text/css" href="css/RecipeList.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script>
</head> </head>
<body> <body>
...@@ -58,7 +59,6 @@ ...@@ -58,7 +59,6 @@
</ul> </ul>
<script src="scripts/DataQuery.js"></script>
<script> <script>
document.addEventListener('keyup', function (e) document.addEventListener('keyup', function (e)
{ {
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
event: 'keyup', event: 'keyup',
value: e.keyCode value: e.keyCode
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
}); });
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
event: 'recipeselect', event: 'recipeselect',
value: id value: id
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
function switchFavourite(img) function switchFavourite(img)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<head> <head>
<link rel="stylesheet" type="text/css" href="css/RecipeView.css"> <link rel="stylesheet" type="text/css" href="css/RecipeView.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script>
</head> </head>
<body> <body>
...@@ -47,7 +48,6 @@ ...@@ -47,7 +48,6 @@
</div> </div>
<script src="scripts/DataQuery.js"></script>
<script> <script>
document.addEventListener('keyup', function (e) document.addEventListener('keyup', function (e)
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
event: 'keyup', event: 'keyup',
value: e.keyCode value: e.keyCode
}; };
window.top.postMessage(data, [data.event, data.value]); window.parent.postMessage(data, [data.event, data.value]);
} }
}); });
......
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
<head> <head>
<title>Drinkpedia</title> <title>Drinkpedia</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/Recipes.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="scripts/DataQuery.js"></script>
</head> </head>
<body> <body>
<script src="scripts/DataQuery.js"></script>
<script> <script>
getRecipes([], [], 0, true, true, function(e) { getRecipes([], [], 0, true, true, function(e) {
var data = { var data = {
...@@ -17,7 +16,7 @@ ...@@ -17,7 +16,7 @@
showScore: 'false', showScore: 'false',
title: 'Tous les cocktails :' title: 'Tous les cocktails :'
}; };
window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]);
}); });
</script> </script>
......
body {
display: flex;
justify-content: center;
}
.content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 25px;
background-color: rgba(255, 255, 255, 0.75);
padding: 25px;
width: 50vw;
border-radius: 25px;
}
input {
margin-top: 5px;
width: 30%;
font-size: 20px;
font-weight: bold;
padding: 2px;
}
label {
margin-top: 10px;
font-size: 24px;
}
button {
font-size: x-large;
font-weight: bold;
border-radius: 10px;
background-color: darkgray;
margin: 10px;
cursor: pointer;
}
button:hover {
background-color: grey;
}
.alt {
margin: 25px;
display: inline;
}
a {
color: blue;
font-weight: bold;
text-decoration: underline;
cursor: pointer;
}
\ No newline at end of file
...@@ -50,6 +50,7 @@ body { ...@@ -50,6 +50,7 @@ body {
background-color: darkgray; background-color: darkgray;
margin: 25px; margin: 25px;
padding: 15px; padding: 15px;
cursor: pointer;
} }
#searchDiv button:hover { #searchDiv button:hover {
......
...@@ -11,7 +11,7 @@ ul { ...@@ -11,7 +11,7 @@ ul {
ul li { ul li {
padding: 8px 16px; padding: 8px 16px;
height: 75px; height: min-content;
border-bottom: 1px solid black; border-bottom: 1px solid black;
background-color: rgba(88, 88, 88, 0.5); background-color: rgba(88, 88, 88, 0.5);
display: block; display: block;
......
...@@ -15,4 +15,5 @@ img { ...@@ -15,4 +15,5 @@ img {
right: 0px; right: 0px;
width: 32px; width: 32px;
height: 32px; height: 32px;
cursor: pointer;
} }
\ No newline at end of file
li:hover {
cursor: pointer;
color: blue;
font-size: x-large;
}
\ No newline at end of file
<?php <?php
error_reporting(E_ERROR | E_PARSE);
session_start(); if(session_status() == PHP_SESSION_NONE) session_start();
$bdd = new PDO('mysql:host=localhost;dbname=drinkpedia;charset=utf8', 'root', '', array( /*$bdd = new PDO('mysql:host=localhost;dbname=drinkpedia;charset=utf8', 'root', '', array(
PDO::ATTR_PERSISTENT => true
));*/
$bdd = new PDO('mysql:host=localhost;dbname=id15804762_drinkpedia;charset=utf8', 'id15804762_access', 'DAccessPwd!1', array(
PDO::ATTR_PERSISTENT => true PDO::ATTR_PERSISTENT => true
)); ));
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
function connect_db() function connect_db()
...@@ -16,7 +20,7 @@ function create_user($u_email, $u_pwd) ...@@ -16,7 +20,7 @@ function create_user($u_email, $u_pwd)
global $bdd; global $bdd;
$res = $bdd->query('SELECT email FROM user WHERE email LIKE \'' . $u_email . '\''); $res = $bdd->query('SELECT email FROM user WHERE email LIKE \'' . $u_email . '\'');
if($res->fetch()) return '0'; if($res->fetch()) return '0';
$bdd->query('INSERT INTO user (email, pwdhash, favourites) VALUES (\'' . $u_email . '\', \'' . $u_pwd . '\', \'1|2|4\')'); $bdd->query('INSERT INTO user (email, pwdhash, favourites) VALUES (\'' . $u_email . '\', \'' . $u_pwd . '\', \'\')');
return '1'; return '1';
} }
......
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