Fold lower priority decks

master
trémeur 3 weeks ago
parent 6a0367eb7a
commit e286f18542

@ -65,47 +65,64 @@ table.decktable {
border: 1px solid CanvasText; border: 1px solid CanvasText;
} }
table.decktable.red th { details.deckwrap {
border: 1px solid CanvasText;
width: 297px;
display: inline;
}
details.deckwrap summary {
margin: 2px;
font-weight: bold;
text-align: center;
cursor: pointer;
}
details.deckwrap table.decktable {
border: none;
}
table.decktable.red th, details.deckwrap:has(.red) summary {
background-color: red; background-color: red;
color: black; color: black;
} }
table.decktable.orange th { table.decktable.orange th, details.deckwrap:has(.orange) summary {
background-color: orange; background-color: orange;
color: black; color: black;
} }
table.decktable.yellow th { table.decktable.yellow th, details.deckwrap:has(.yellow) summary {
background-color: yellow; background-color: yellow;
color: black; color: black;
} }
table.decktable.green th { table.decktable.green th, details.deckwrap:has(.green) summary {
background-color: green; background-color: green;
color: white; color: white;
} }
table.decktable.blue th { table.decktable.blue th, details.deckwrap:has(.blue) summary {
background-color: blue; background-color: blue;
color: white; color: white;
} }
table.decktable.purple th { table.decktable.purple th, details.deckwrap:has(.purple) summary {
background-color: purple; background-color: purple;
color: white; color: white;
} }
table.decktable.brown th { table.decktable.brown th, details.deckwrap:has(.brown) summary {
background-color: brown; background-color: brown;
color: white; color: white;
} }
table.decktable.gray th { table.decktable.gray th, details.deckwrap:has(.gray) summary {
background-color: gray; background-color: gray;
color: white; color: white;
} }
table.decktable.special th { table.decktable.special th, details.deckwrap:has(.special) summary {
background: linear-gradient(90deg, hsl(0, 100%, 70%), hsl(30, 100%, 70%), hsl(60, 100%, 70%), hsl(90, 100%, 70%), hsl(120, 100%, 70%), hsl(150, 100%, 70%), hsl(180, 100%, 70%), hsl(210, 100%, 70%), hsl(240, 100%, 70%), hsl(270, 100%, 70%), hsl(300, 100%, 70%), hsl(330, 100%, 70%), hsl(360, 100%, 70%)); background: linear-gradient(90deg, hsl(0, 100%, 70%), hsl(30, 100%, 70%), hsl(60, 100%, 70%), hsl(90, 100%, 70%), hsl(120, 100%, 70%), hsl(150, 100%, 70%), hsl(180, 100%, 70%), hsl(210, 100%, 70%), hsl(240, 100%, 70%), hsl(270, 100%, 70%), hsl(300, 100%, 70%), hsl(330, 100%, 70%), hsl(360, 100%, 70%));
color: black; color: black;
} }
@ -143,6 +160,10 @@ h2.collectingheader {
background-color: Canvas; background-color: Canvas;
} }
p#masteredcarousel img {
vertical-align: middle;
}
/* portfolios */ /* portfolios */
a:has(div.foliocase) { a:has(div.foliocase) {
text-decoration: none; text-decoration: none;

@ -40,7 +40,7 @@ def collectinggen(colour=False):
if len(highpriority) > 0: if len(highpriority) > 0:
content.write("<div>\n<h2 class=\"collectingheader\">High priority</h2>\n") content.write("<div>\n<h2 class=\"collectingheader\">High priority</h2>\n")
for deck in highpriority: for deck in highpriority:
content.write(tcgcore.printdeck(deck)) content.write(tcgcore.printdeck(deck,False))
content.write("</div>\n") content.write("</div>\n")
if len(medpriority) > 0: if len(medpriority) > 0:
content.write("<div>\n<h2 class=\"collectingheader\">Medium priority</h2>\n") content.write("<div>\n<h2 class=\"collectingheader\">Medium priority</h2>\n")

@ -218,7 +218,7 @@ def indexgen():
if sketch % 20 < 10: if sketch % 20 < 10:
content.write("0" + str(sketch % 20)) content.write("0" + str(sketch % 20))
else: else:
content.write(sketch % 20) content.write(str(sketch % 20))
content.write(".gif\"></td>\n") content.write(".gif\"></td>\n")
if sketch > 19: if sketch > 19:
content.write("<td><img src=\"/assets/sketch/20.gif\"></td>\n") content.write("<td><img src=\"/assets/sketch/20.gif\"></td>\n")
@ -244,12 +244,14 @@ def indexgen():
mastereddecks.append({"name":deck,"date":tcgcore.datemastered(deck)}) mastereddecks.append({"name":deck,"date":tcgcore.datemastered(deck)})
mastereddecks = sorted(mastereddecks,key=lambda d: d["date"],reverse=True) mastereddecks = sorted(mastereddecks,key=lambda d: d["date"],reverse=True)
if len(mastereddecks) > 0: if len(mastereddecks) > 0:
content.write("<h2>mastered decks</h2>\n<p>") content.write("<h2>mastered decks</h2>\n<p id=\"masteredcarousel\">")
masteredcount = 0 masteredcount = 0
for deck in mastereddecks: for deck in mastereddecks:
if masteredcount < variables.maxmastered: if masteredcount < variables.maxmastered:
content.write("<img src=\"/decks/" + deck["name"] + "/master.gif\" title=\"mastered " + deck["name"] + "\">") content.write("<img src=\"/decks/" + deck["name"] + "/master.gif\" title=\"mastered " + deck["name"] + "\">")
masteredcount += 1 masteredcount += 1
if len(mastereddecks) > variables.maxmastered:
content.write(" <a href=\"mastered\">see all</a>")
content.write("</p>\n") content.write("</p>\n")
sigs = [] sigs = []
for card in tcgcore.ownedcards(): for card in tcgcore.ownedcards():

@ -120,16 +120,28 @@ def printcard(card):
cardid = card[-2:] cardid = card[-2:]
return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\" loading=\"lazy\">" return "<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\" loading=\"lazy\">"
def printdeck(deck): def printdeck(deck,fold=True):
deckstring = "<table class=\"decktable " if fold:
deckstring = "<details class=\"deckwrap\">\n<summary>" + deck + " ["
if deckmastered(deck):
deckstring += datemastered(deck).strftime("%Y-%m-%d")
else:
deckstring += str(len(deckcards(deck))) + "/20"
deckstring += "]</summary>\n"
else:
deckstring = ""
deckstring += "<table class=\"decktable "
with open("build/decks/" + deck + "/type") as thetype: with open("build/decks/" + deck + "/type") as thetype:
decktype = thetype.read() decktype = thetype.read()
deckstring += decktype + "\">\n<thead>\n <tr>\n <th colspan=\"5\">" + deck deckstring += decktype + "\">\n"
if not fold:
deckstring += "<thead>\n <tr>\n <th colspan=\"5\">" + deck + " ["
if deckmastered(deck): if deckmastered(deck):
deckstring += " [" + datemastered(deck).strftime("%Y-%m-%d") + "]" deckstring += datemastered(deck).strftime("%Y-%m-%d")
else: else:
deckstring += " [" + str(len(deckcards(deck))) + "/20]" deckstring += str(len(deckcards(deck))) + "/20"
deckstring += "</th>\n </tr>\n</thead>\n<tbody>\n" deckstring += "]</th>\n </tr>\n</thead>\n"
deckstring += "<tbody>\n"
test = 1 test = 1
while test < 21: while test < 21:
if test % 5 == 1: if test % 5 == 1:
@ -149,6 +161,8 @@ def printdeck(deck):
if deckmastered(deck): if deckmastered(deck):
deckstring += " <tr>\n <td colspan=\"5\" align=\"center\"><img src=\"/decks/" + deck + "/master.gif\" title=\"mastered " + deck + "\"><td>\n</tr>\n" deckstring += " <tr>\n <td colspan=\"5\" align=\"center\"><img src=\"/decks/" + deck + "/master.gif\" title=\"mastered " + deck + "\"><td>\n</tr>\n"
deckstring += "</tbody>\n</table>\n" deckstring += "</tbody>\n</table>\n"
if fold:
deckstring += "</details>\n"
return deckstring return deckstring
def filterwrite(page,colour=False,sigs=False): def filterwrite(page,colour=False,sigs=False):

Loading…
Cancel
Save