Minor QOL update

Updates include removing dependancy on Google Fonts, cleaning up build process, and pulling CSS back into it's own file
This commit is contained in:
2022-11-26 01:30:24 -08:00
parent 16511f1abd
commit 365be630b4
10 changed files with 26 additions and 505 deletions

BIN
src/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

51
src/index.html Normal file
View File

@@ -0,0 +1,51 @@
<!doctype html>
<html lang="en">
<head>
<title>WoW Historical Token Prices Tracker</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Track current and historical gold price trends for the World of Warcraft (WoW) in game token, including the US, EU, TW, and KR regions. Prices updated every minute. Simple, quick, and easy info, no ads or tracking, ever.">
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://data.wowtoken.app">
<link rel="dns-prefetch" href="https://data.wowtoken.app">
<link rel="preload" href="https://data.wowtoken.app/token/current.json" as="fetch" type="application/json" crossorigin="anonymous">
<link rel="preload" href="https://data.wowtoken.app/token/history/us/72h.json" as="fetch" type="application/json" crossorigin="anonymous">
<script src="bundle.js"></script>
</head>
<body>
<div class="flex-container">
<div><h1>1 Token = <u id="token">0</u> Gold</h1></div>
<div>
<canvas id="token-chart"></canvas>
<div id="option_select">
<label for="region">Region:</label>
<select name="region" id="region">
<option value="us">US</option>
<option value="eu">EU</option>
<option value="kr">KR</option>
<option value="tw">TW</option>
</select>
<br />
<label for="time">Time Selection:</label>
<select name="time" id="time">
<option value="72h">3 Days</option>
<option value="168h">7 Days</option>
<option value="336h">14 Days</option>
<option value="30d">1 Month</option>
<option value="90d">3 Months</option>
<option value="6m">6 Months</option>
<option value="1y">1 Year</option>
<option value="all">All Available</option>
</select>
</div>
<div id="source">
<p>
<a href="https://github.com/sneaky-emily/wowtoken.app">Source</a>
|
<a href="https://blog.emily.sh2021/04/developing-a-simple-wow-token-tracker/">About</a>
</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -11,7 +11,6 @@ import {
} from 'chart.js';
import $ from 'cash-dom';
import 'chartjs-adapter-dayjs-3';
import './style.css';
Chart.register(
@@ -25,17 +24,17 @@ Chart.register(
Tooltip
)
var current_region_selection = ''
var current_time_selection = ''
var current_price_hash = {
let current_region_selection = ''
let current_time_selection = ''
const current_price_hash = {
us: 0,
eu: 0,
kr: 0,
tw: 0
}
var chart_js_data;
var ctx;
var token_chart;
let chart_js_data;
let ctx;
let token_chart;
function populateChart() {
@@ -77,7 +76,7 @@ function updateTokens(data) {
}
function updateRegionalToken(region, data) {
if (current_price_hash[region] != data['price_data'][region]) {
if (current_price_hash[region] !== data['price_data'][region]) {
current_price_hash[region] = data['price_data'][region];
if (region === current_region_selection) {
formatToken();
@@ -87,7 +86,7 @@ function updateRegionalToken(region, data) {
}
export function updateRegionPreference(newRegion) {
if (newRegion != current_region_selection) {
if (newRegion !== current_region_selection) {
token_chart.destroy();
current_region_selection = newRegion;
}
@@ -95,7 +94,7 @@ export function updateRegionPreference(newRegion) {
pullChartData().then(populateChart);
}
export function updateTimePreference(newTime) {
if (newTime != current_time_selection) {
if (newTime !== current_time_selection) {
token_chart.destroy();
current_time_selection = newTime;
}
@@ -105,9 +104,9 @@ export function updateTimePreference(newTime) {
async function pullChartData() {
let resp = await fetch("https://data.wowtoken.app/token/history/" + current_region_selection + "/" + current_time_selection + ".json");
let chart_data = await resp.json();
var new_chart_js_data = []
for (var i = 0; i < chart_data.length; i++) {
var datum = {
let new_chart_js_data = []
for (let i = 0; i < chart_data.length; i++) {
let datum = {
x: chart_data[i]['time'],
y: chart_data[i]['value']
}

3
src/robots.txt Normal file
View File

@@ -0,0 +1,3 @@
# Allow robots everywhere
User-agent: *
Allow: /

View File

@@ -1,9 +1,6 @@
/* Adapted from https://github.com/thomasf/solarized-css and https://github.com/altercation/solarized
Portions Copyright (c) 2015 Thomas Frössman and Copyright (c) 2011 Ethan Schoonover */
@import url(https://fonts.googleapis.com/css?family=Inconsolata);
@import url(https://fonts.googleapis.com/css?family=PT+Sans);
@import url(https://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700);
article,
aside,
details,
@@ -163,11 +160,11 @@ table {
border-spacing: 0;
}
html {
font-family: 'PT Sans', sans-serif;
font-family: sans-serif;
}
pre,
code {
font-family: 'Inconsolata', sans-serif;
font-family: monospace;
}
h1,
h2,
@@ -175,7 +172,7 @@ h3,
h4,
h5,
h6 {
font-family: 'PT Sans Narrow', sans-serif;
font-family: sans-serif;
font-weight: 700;
}
html {