- display header image + background colour

- display level + level image
- display card showcase on index page
- add appropriate colour to deck tables
- add number of collected cards to deck tables
- add colour marker in card name text
- add event names to log
- add link to service links
- move some data to variables file
master
trémeur 3 weeks ago
parent c967d1ea89
commit df32c9558e

9
.gitignore vendored

@ -1,4 +1,9 @@
build/
build/*/index.html
build/index.html
build/decks/*/*.gif
build/decks/*/type
build/assets/header.png
build/assets/levels/*.gif
__pycache__/
priority.py
variables.py
log.py

@ -0,0 +1,124 @@
/* basic colours */
:root {
--textcolour: black;
--linecolour: black;
--bgcolour: white;
}
@media(prefers-color-scheme: dark) {
:root {
--textcolour: white;
--linecolour: white;
--bgcolour: black;
}
}
* {
color: var(--textcolour);
background-color: var(--bgcolour);
}
/* basic layout */
body {
display: grid;
margin: 0;
grid-template: 1fr 1fr / minmax(200px,500px) minmax(700px,1fr);
height: 100vh;
}
body > aside {
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 1;
grid-row-end: 2;
border-bottom: 4px solid var(--linecolour);
padding: 5px;
}
body > nav {
grid-column-start: 1;
grid-column-end: 2;
grid-row-start: 2;
grid-row-end: 3;
}
body > main {
grid-column-start: 2;
grid-column-end: 3;
grid-row-start: 1;
grid-row-end: 3;
overflow: auto;
border-left: 4px solid var(--linecolour);
padding: 5px;
}
@media (max-width: 800px) {
body {
display: block;
}
body > * {
border-left: none !important;
border-bottom: 4px solid var(--linecolour) !important;
}
body > aside {
display: none;
}
}
table.decktable {
display: inline-block;
border: 1px solid var(--linecolour);
}
table.decktable.red th {
background-color: red;
}
table.decktable.orange th {
background-color: orange;
}
table.decktable.yellow th {
background-color: yellow;
}
table.decktable.green th {
background-color: green;
}
table.decktable.blue th {
background-color: blue;
}
table.decktable.purple th {
background-color: purple;
}
table.decktable.brown th {
background-color: brown;
}
table.decktable.gray th {
background-color: gray;
}
main img {
image-rendering: pixelated;
image-rendering: -moz-crisp-edges;
image-rendering: crisp-edges;
}
aside {
background: url("/assets/header.png");
background-size: auto;
background-repeat: no-repeat;
background-position: center;
background-color: var(--headbg);
}
span.cardname {
font-family: monospace;
white-space: nowrap;
}

@ -1,5 +1,5 @@
import datetime,os
import log,priority,skel
import log,variables,skel
def collectinggen():
if not os.path.isdir("build/collecting"):
@ -21,14 +21,17 @@ def collectinggen():
highpriority = []
medpriority = []
for deck in decksofinterest:
if deck in priority.high:
if deck in variables.highpriority:
highpriority.append(deck)
else:
medpriority.append(deck)
if len(highpriority) > 0:
content.write("<h2>High priority</h2>\n")
for deck in highpriority:
content.write("<table class=\"decktable\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + "</th>\n </tr>\n</thead>\n<tbody>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
with open("build/decks/" + deck + "/type") as thetype:
decktype = thetype.read()
cardcount = sum(deck in card for card in ownedcards)
content.write("<table class=\"decktable " + decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + " [" + str(cardcount) + "/20]</th>\n </tr>\n</thead>\n<tbody>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "01" in ownedcards:
content.write("01")
else:
@ -132,7 +135,10 @@ def collectinggen():
if len(medpriority) > 0:
content.write("<h2>Medium priority</h2>\n")
for deck in medpriority:
content.write("<table class=\"decktable\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + "</th>\n </tr>\n</thead>\n<tbody>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
with open("build/decks/" + deck + "/type") as thetype:
decktype = thetype.read()
cardcount = sum(deck in card for card in ownedcards)
content.write("<table class=\"decktable " + decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck + " [" + str(cardcount) + "/20]</th>\n </tr>\n</thead>\n<tbody>\n <tr>\n <td><img src=\"/decks/" + deck + "/")
if deck + "01" in ownedcards:
content.write("01")
else:

@ -1,5 +1,5 @@
import datetime,os
import log,skel
import datetime,os,re
import log,skel,variables
def indexgen():
if os.path.exists("build/index.html"):
@ -14,7 +14,136 @@ def indexgen():
except:
pass
firstdate = log.log[0]["date"]
content.write("<ul>\n<li>" + str(cardstotal) + " cards held</li>\n<li>Started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n</ul>\n")
if cardstotal > 14400:
rankcode = "rainbow"
extra = cardstotal - 14400
plusranks = int(extra / 300)
if plusranks > 0:
rank = "rainbow + " + str(plusranks)
else:
rank = "rainbow"
else:
if cardstotal > 14100:
rank = "himalayan"
elif cardstotal > 13800:
rank = "puma"
elif cardstotal > 13500:
rank = "chartreux"
elif cardstotal > 13500:
rank = "russian blue"
elif cardstotal > 12900:
rank = "panther"
elif cardstotal > 12600:
rank = "cheetah"
elif cardstotal > 12300:
rank = "tiger"
elif cardstotal > 12000:
rank = "lion"
elif cardstotal > 11700:
rank = "metal"
elif cardstotal > 11400:
rank = "ground"
elif cardstotal > 11100:
rank = "darkness"
elif cardstotal > 10800:
rank = "water"
elif cardstotal > 10500:
rank = "nature"
elif cardstotal > 10200:
rank = "light"
elif cardstotal > 9900:
rank = "wind"
elif cardstotal > 9600:
rank = "fire"
elif cardstotal > 9300:
rank = "mercury"
elif cardstotal > 9000:
rank = "jupiter"
elif cardstotal > 8700:
rank = "uranus"
elif cardstotal > 8400:
rank = "neptune"
elif cardstotal > 8100:
rank = "earth"
elif cardstotal > 7800:
rank = "venus"
elif cardstotal > 7500:
rank = "saturn"
elif cardstotal > 7200:
rank = "mars"
elif cardstotal > 6900:
rank = "magnolia"
elif cardstotal > 6600:
rank = "chocolate cosmos"
elif cardstotal > 6300:
rank = "lilac"
elif cardstotal > 6000:
rank = "hydrangea"
elif cardstotal > 5700:
rank = "clover"
elif cardstotal > 5400:
rank = "daffodil"
elif cardstotal > 5100:
rank = "tiger lily"
elif cardstotal > 4800:
rank = "sakura"
elif cardstotal > 4500:
rank = "silver"
elif cardstotal > 4200:
rank = "bronze"
elif cardstotal > 3900:
rank = "amethyst"
elif cardstotal > 3600:
rank = "sapphire"
elif cardstotal > 3300:
rank = "emerald"
elif cardstotal > 3000:
rank = "gold"
elif cardstotal > 2700:
rank = "amber"
elif cardstotal > 2400:
rank = "ruby"
elif cardstotal > 2200:
rank = "dragon fruit"
elif cardstotal > 2000:
rank = "apricot"
elif cardstotal > 1800:
rank = "grape"
elif cardstotal > 1600:
rank = "blueberry"
elif cardstotal > 1400:
rank = "lime"
elif cardstotal > 1200:
rank = "lemon"
elif cardstotal > 1000:
rank = "tangerine"
elif cardstotal > 800:
rank = "strawberry"
elif cardstotal > 700:
rank = "gray"
elif cardstotal > 600:
rank = "brown"
elif cardstotal > 500:
rank = "purple"
elif cardstotal > 400:
rank = "blue"
elif cardstotal > 300:
rank = "green"
elif cardstotal > 200:
rank = "yellow"
elif cardstotal > 100:
rank = "orange"
else:
rank = "red"
rankcode = re.sub(" ","",rank)
content.write("<img src=\"/assets/levels/" + rankcode + ".gif\">\n<ul>\n<li>" + str(cardstotal) + " cards held (" + rank + ")</li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.today().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\">code</a> under construction</li>\n</ul>\n")
if len(variables.faves) > 0:
content.write("<h2>faves</h2>\n<p>")
for card in variables.faves:
deck = card[:-2]
cardid = card[-2:]
content.write("<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">")
content.write("</p>\n")
content.close()
skel.footerwrite(thefile)

@ -1,3 +1,3 @@
import datetime
log = [{"date":datetime.datetime(Y,M,D),"url":"link to comment","received":["card01","card02"]}]
log = [{"event":"event name","date":datetime.datetime(Y,M,D),"url":"link to comment","received":["card01","card02"]}]

@ -15,12 +15,33 @@ def loggen():
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code>: Received ")
receivedlist = sorted(event["received"])
for card in receivedlist:
content.write("<code>" + card + "</code>")
with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read()
content.write("<span class=\"cardname\">")
if cardtype == "red":
content.write("🔴")
elif cardtype == "orange":
content.write("🟠")
elif cardtype == "yellow":
content.write("🟡")
elif cardtype == "green":
content.write("🟢")
elif cardtype == "blue":
content.write("🔵")
elif cardtype == "purple":
content.write("🟣")
elif cardtype == "brown":
content.write("🟤")
elif cardtype == "gray":
content.write("")
elif cardtype == "special":
content.write("")
content.write(card + "</span>")
if receivedlist.index(card) == len(receivedlist) - 1:
content.write(" ")
else:
content.write(", ")
content.write(" <a href=\"" + event["url"] + "\">[x]</a>.</p>\n")
content.write(" <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>.</p>\n")
content.close()
skel.footerwrite(thefile)

@ -1 +0,0 @@
high = ["deckname"]

@ -1,6 +1,8 @@
import variables
def headerwrite(thefile,pagename):
header = open(thefile,"a")
header.write("<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"/style.css\"> <!-- temporary -->\n <title>TCG</title>\n </head>\n <body>\n <aside>\n <p>under construction</p>\n </aside>\n <nav>\n <ul>\n <li>")
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--headbg:" + variables.headerbackground + ";\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"/style.css\"> <!-- temporary -->\n <title>TCG :: " + pagename + "</title>\n </head>\n <body>\n <aside>\n \n </aside>\n <nav>\n <ul>\n <li>")
if pagename == "index":
header.write("home")
else:
@ -25,7 +27,7 @@ def headerwrite(thefile,pagename):
header.write("log")
else:
header.write("<a href=\"/log\">log</a>")
header.write("</li>\n <li><a href=\"https://mezzin.dreamwidth.org/351.html\" target=\"_blank\">trade post</a></li>\n </ul>\n </nav>\n <main>\n")
header.write("</li>\n <li><a href=\"" + variables.tradepost + "\" target=\"_blank\">trade post @ dw</a></li>\n <li><a href=\"https://colors-tcg.eu/services.php\" target=\"_blank\">service links</a></li>\n </ul>\n </nav>\n <main>\n")
header.close()
def footerwrite(thefile):

@ -0,0 +1,4 @@
highpriority = ["deckname","nameofadeck"]
tradepost = "URL"
faves = ["favecard01","favecard02"]
headerbackground = "#000000"

@ -1,5 +1,5 @@
import datetime,os
import log,priority,skel
import log,variables,skel
def wantedgen():
if not os.path.isdir("build/wanted"):
@ -28,14 +28,35 @@ def wantedgen():
highpriority = []
medpriority = []
for card in wantedcards:
if card[:-2] in priority.high:
if card[:-2] in variables.highpriority:
highpriority.append(card)
else:
medpriority.append(card)
if len(highpriority) > 0:
content.write("<p><b>High priority:</b> ")
for card in highpriority:
content.write("<code>" + card + "</code>")
with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read()
content.write("<span class=\"cardname\">")
if cardtype == "red":
content.write("🔴")
elif cardtype == "orange":
content.write("🟠")
elif cardtype == "yellow":
content.write("🟡")
elif cardtype == "green":
content.write("🟢")
elif cardtype == "blue":
content.write("🔵")
elif cardtype == "purple":
content.write("🟣")
elif cardtype == "brown":
content.write("🟤")
elif cardtype == "gray":
content.write("")
elif cardtype == "special":
content.write("")
content.write(card + "</span>")
if highpriority.index(card) == len(highpriority) - 1:
content.write(" ")
else:
@ -44,7 +65,28 @@ def wantedgen():
if len(medpriority) > 0:
content.write("<p><b>Medium priority:</b> ")
for card in medpriority:
content.write("<code>" + card + "</code>")
with open("build/decks/" + card[:-2] + "/type") as thetype:
cardtype = thetype.read()
content.write("<span class=\"cardname\">")
if cardtype == "red":
content.write("🔴")
elif cardtype == "orange":
content.write("🟠")
elif cardtype == "yellow":
content.write("🟡")
elif cardtype == "green":
content.write("🟢")
elif cardtype == "blue":
content.write("🔵")
elif cardtype == "purple":
content.write("🟣")
elif cardtype == "brown":
content.write("🟤")
elif cardtype == "gray":
content.write("")
elif cardtype == "special":
content.write("")
content.write(card + "</span>")
if medpriority.index(card) == len(medpriority) - 1:
content.write(" ")
else:

Loading…
Cancel
Save