included "database" and primitive balance checking
let's make it so we have a way to integrate it with sql in later stages. PLEASE FIX the "fstring" in the js and the id to balance sequence
This commit is contained in:
@ -3,12 +3,14 @@
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/home.css">
|
||||
<link rel="stylesheet" href="http://github.hubspot.com/odometer/themes/odometer-theme-default.css">
|
||||
<script src="http://github.hubspot.com/odometer/odometer.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<title>Currency site</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="http://github.hubspot.com/odometer/odometer.js"></script>
|
||||
<h1 id="odometer" class="odometer">This is where you'll see the thing</h1>
|
||||
<script type="text/javascript" src="scripts/getCurrentCoins.js"></script>
|
||||
<h2 id="balance">Your balance is:</h2>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
1
Website/scripts/Cookies.js
Normal file
1
Website/scripts/Cookies.js
Normal file
@ -0,0 +1 @@
|
||||
document.cookie = "id=1";
|
@ -1,5 +1,9 @@
|
||||
socketAdress="ws://localhost:8765"
|
||||
// Lacking protocol for ids lmao
|
||||
document.cookie = "id=1";
|
||||
|
||||
function currencyTicker(){
|
||||
var ws = new WebSocket("ws://localhost:8765/");
|
||||
var ws = new WebSocket(socketAdress);
|
||||
|
||||
ws.onopen = function(){
|
||||
console.log("Connection is Established");
|
||||
@ -12,5 +16,20 @@ function currencyTicker(){
|
||||
|
||||
};
|
||||
}
|
||||
currencyTicker()
|
||||
|
||||
function userBalance(){
|
||||
var ws = new WebSocket(socketAdress);
|
||||
ws.onopen = function(){
|
||||
ws.send("STATUSONUSER");
|
||||
};
|
||||
|
||||
ws.onmessage = function(evt){
|
||||
var balanceStatus = evt.data;
|
||||
// this doesnt work, fix pls
|
||||
var websiteReplace = "Your balance is:${balanceStatus}"
|
||||
w = document.getElementById("balance").innerHTML = websiteReplace
|
||||
}
|
||||
|
||||
}
|
||||
var t=setInterval(currencyTicker,5000);
|
||||
var y=setInterval(userBalance,10000);
|
||||
|
Reference in New Issue
Block a user