added localhost support
This commit is contained in:
parent
31a98da73d
commit
3413272ac0
26
index.html
26
index.html
|
@ -19,6 +19,9 @@ transform:scale(0.7);
|
|||
|
||||
|
||||
<script>
|
||||
//set background to dark grey
|
||||
var BgColor = '#222222';
|
||||
document.body.style.backgroundColor = BgColor;
|
||||
let ranks = {
|
||||
1:"poor",
|
||||
100:"painter",
|
||||
|
@ -194,6 +197,17 @@ transform:scale(0.7);
|
|||
|
||||
|
||||
|
||||
}
|
||||
function toInv(index) {
|
||||
var inv = getCookie('inv');
|
||||
inv = JSON.parse(inv)
|
||||
var store = getCookie('storage');
|
||||
store = JSON.parse(store)
|
||||
inv.push(store[index])
|
||||
store.splice(index, 1)
|
||||
createCookie('storage', JSON.stringify(store));
|
||||
createCookie('inv', JSON.stringify(inv));
|
||||
updateInv()
|
||||
}
|
||||
function updateInv() {
|
||||
var inve = document.getElementById("inv");
|
||||
|
@ -206,6 +220,7 @@ transform:scale(0.7);
|
|||
var balance = document.getElementById("balance");
|
||||
balance.innerHTML = getCookie("bank") + " <font size=1.5>(" + getRank() + ")</font>"
|
||||
let i = ""
|
||||
|
||||
for (let item of inv) {
|
||||
|
||||
|
||||
|
@ -226,10 +241,10 @@ transform:scale(0.7);
|
|||
if(item != null){
|
||||
let t = '{color:' + String(item.color) + ', rarity:' + String(item.rarity) + ', value: ' + String(item.value) + '}'
|
||||
if(item.s){
|
||||
s += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'store')\" ondragstart=\"drag(event, 'store')\" ondragover=\"allowDrop(event)\" draggable=\"true\" class='shiny' onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"drag into inv to sell/combine \"' id='" + storage.indexOf(item) + "'>" + t + " //shiny!</div>")
|
||||
s += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'store')\" ondragstart=\"drag(event, 'store')\" ondragover=\"allowDrop(event)\" draggable=\"true\" class='shiny' onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"click to move to inv \"' id='" + storage.indexOf(item) + "'>" + t + " //shiny!</div>")
|
||||
|
||||
} else {
|
||||
s += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'store')\" ondragstart=\"drag(event, 'store')\" ondragover=\"allowDrop(event)\" draggable=\"true\" onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"drag into inv to sell/combine \"' id='" + storage.indexOf(item) + "'style='color:" + item.color + ";'>" + t + "</div>")
|
||||
s += ("<div ondrop=\"drop(event," + inv.indexOf(item) + ", 'store')\" ondragstart=\"drag(event, 'store')\" ondragover=\"allowDrop(event)\" draggable=\"true\" onmouseout='this.innerHTML = \"" + t + "\"'onmouseover='this.innerHTML=\"click to move to inv \"' onclick='toInv(" + storage.indexOf(item) + ");' id='" + storage.indexOf(item) + "'style='color:" + item.color + ";'>" + t + "</div>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +252,7 @@ transform:scale(0.7);
|
|||
|
||||
}
|
||||
function clear() {
|
||||
createCookie('inv', JSON.stringify([]));
|
||||
createCookie('inv', JSON.stringify([]))
|
||||
createCookie('storage', JSON.stringify([]));
|
||||
createCookie('bank', 15);
|
||||
}
|
||||
|
@ -339,9 +354,9 @@ transform:scale(0.7);
|
|||
|
||||
.then(data => {
|
||||
var intervalID = window.setInterval(myCallback, 500);
|
||||
|
||||
function myCallback() {
|
||||
updateInv()
|
||||
|
||||
x = document.getElementsByClassName("shiny")
|
||||
for(let i of x){
|
||||
inner = i.innerHTML.split("")
|
||||
|
@ -359,6 +374,7 @@ transform:scale(0.7);
|
|||
|
||||
}
|
||||
document.write("<title>Antheia</title>")
|
||||
|
||||
function setFavicons(favImg){
|
||||
let headTitle = document.querySelector('head');
|
||||
let setFavicon = document.createElement('link');
|
||||
|
@ -430,7 +446,7 @@ setFavicons('https://raw.githubusercontent.com/squiresgrant/Antheia/main/icon.ic
|
|||
|
||||
}
|
||||
|
||||
|
||||
document.body.style.backgroundColor = BgColor;
|
||||
return (0)
|
||||
}).then((open) => {
|
||||
var number = 5; //just for an example
|
||||
|
|
28
index.js
28
index.js
|
@ -1,13 +1,23 @@
|
|||
var http = require('http');
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
//express
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
//this dir
|
||||
var dir = __dirname;
|
||||
const PORT=3000;
|
||||
|
||||
let t = dir + './crates.json'
|
||||
fs.readFile('./index.html', function (err, html) {
|
||||
|
||||
if (err) throw err;
|
||||
|
||||
http.createServer(function(request, response) {
|
||||
response.write(html);
|
||||
}).listen(PORT);
|
||||
//listen
|
||||
app.listen(PORT, function () {
|
||||
console.log('listening on port ' + PORT);
|
||||
});
|
||||
//on request serve index.html
|
||||
app.get('/', function (req, res) {
|
||||
res.sendFile('index.html', {root: __dirname })
|
||||
})
|
||||
app.get('/crates.json', function (req, res) {
|
||||
res.sendFile('crates.json', {root: __dirname })
|
||||
})
|
||||
|
||||
});
|
Loading…
Reference in New Issue