Allow pasting card type symbols into search, show subsets of dupes list
This commit is contained in:
parent
1cee7bfe9e
commit
5b843a1537
1 changed files with 32 additions and 4 deletions
36
colors.py
36
colors.py
|
@ -989,18 +989,46 @@ def crayonlog(colour,event):
|
|||
crayonstring = str(crayonno) + " " + crayonrend
|
||||
return crayonstring
|
||||
|
||||
def dupes():
|
||||
def dupes(mass=True,nonmass=True,characters=True,specials=True):
|
||||
dupeslist = []
|
||||
previouscard = ""
|
||||
for card in cardlist:
|
||||
try:
|
||||
if card["name"] == previouscard["name"]:
|
||||
dupeslist.append(card["name"])
|
||||
if card["colour"] != "sig" and card ["colour"] != "limited":
|
||||
if card["name"] == previouscard["name"]:
|
||||
dupe = {}
|
||||
dupe["name"] = card["name"]
|
||||
if len(card["mass"]) > 0:
|
||||
if mass:
|
||||
dupe["mass"] = card["mass"]
|
||||
if card["colour"] == "special":
|
||||
if specials:
|
||||
dupeslist.append(dupe)
|
||||
else:
|
||||
if characters:
|
||||
dupeslist.append(dupe)
|
||||
else:
|
||||
if nonmass:
|
||||
if card["colour"] == "special":
|
||||
if specials:
|
||||
dupeslist.append(dupe)
|
||||
else:
|
||||
if characters:
|
||||
dupeslist.append(dupe)
|
||||
except:
|
||||
pass
|
||||
previouscard = card
|
||||
return dupeslist
|
||||
|
||||
def activitydupes():
|
||||
print(dupes(False,True,True,False))
|
||||
|
||||
def riku():
|
||||
print("Specials")
|
||||
print(dupes(True,False,False,True))
|
||||
print("Characters")
|
||||
print(dupes(True,False,True,False))
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Building index page")
|
||||
|
||||
|
@ -2009,7 +2037,7 @@ def searchgen():
|
|||
content.write(", ")
|
||||
content.write("'" + card["name"] + "'")
|
||||
precomma = True
|
||||
content.write("];\n const searchstring = document.getElementById('cardinput').value;\n const dupesarray = searchstring.replaceAll(' ','').replaceAll('\\n',',').replaceAll('\\r',',').toLowerCase().split(',');\n const searcharray = [ ...new Set(dupesarray) ];\n const hpwfound = [];\n const mpwfound = [];\n const lpwfound = [];\n const hptfound = [];\n const mptfound = [];\n const lptfound = [];\n for (const element of searcharray) {\n let cardend = element.substring(element.length, element.length - 2);\n if (!(thecards.includes(cardend))) {\n for (const ending of thecards) {\n searcharray.push(element + ending);\n };\n };\n };\n for (const element of searcharray) {\n if (hpw.includes(element)) {\n hpwfound.push(element);\n };\n if (mpw.includes(element)) {\n mpwfound.push(element);\n };\n if (lpw.includes(element)) {\n lpwfound.push(element);\n };\n if (hpt.includes(element)) {\n hptfound.push(element);\n };\n if (mpt.includes(element)) {\n mptfound.push(element);\n };\n if (lpt.includes(element)) {\n lptfound.push(element);\n };\n };\n if ((hpwfound.length) > 0) {\n document.getElementById('hpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (high priority):</span> <span class=\"searchresults\">' + hpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('hpwfound').innerHTML = '';\n };\n if ((mpwfound.length) > 0) {\n document.getElementById('mpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (medium priority):</span> <span class=\"searchresults\">' + mpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('mpwfound').innerHTML = '';\n };\n if ((lpwfound.length) > 0) {\n document.getElementById('lpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (low priority):</span> <span class=\"searchresults\">' + lpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('lpwfound').innerHTML = '';\n };")
|
||||
content.write("];\n const searchstring = document.getElementById('cardinput').value;\n const dupesarray = searchstring.replaceAll(' ','').replaceAll('\\n',',').replaceAll('\\r',',').replaceAll('🔴','').replaceAll('🟠','').replaceAll('🟡','').replaceAll('🟢','').replaceAll('🔵','').replaceAll('🟣','').replaceAll('🟤','').replaceAll('⚪','').replaceAll('✨','').replaceAll('🌈','').replaceAll('✍','').toLowerCase().split(',');\n const searcharray = [ ...new Set(dupesarray) ];\n const hpwfound = [];\n const mpwfound = [];\n const lpwfound = [];\n const hptfound = [];\n const mptfound = [];\n const lptfound = [];\n for (const element of searcharray) {\n let cardend = element.substring(element.length, element.length - 2);\n if (!(thecards.includes(cardend))) {\n for (const ending of thecards) {\n searcharray.push(element + ending);\n };\n };\n };\n for (const element of searcharray) {\n if (hpw.includes(element)) {\n hpwfound.push(element);\n };\n if (mpw.includes(element)) {\n mpwfound.push(element);\n };\n if (lpw.includes(element)) {\n lpwfound.push(element);\n };\n if (hpt.includes(element)) {\n hptfound.push(element);\n };\n if (mpt.includes(element)) {\n mptfound.push(element);\n };\n if (lpt.includes(element)) {\n lptfound.push(element);\n };\n };\n if ((hpwfound.length) > 0) {\n document.getElementById('hpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (high priority):</span> <span class=\"searchresults\">' + hpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('hpwfound').innerHTML = '';\n };\n if ((mpwfound.length) > 0) {\n document.getElementById('mpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (medium priority):</span> <span class=\"searchresults\">' + mpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('mpwfound').innerHTML = '';\n };\n if ((lpwfound.length) > 0) {\n document.getElementById('lpwfound').innerHTML = '<span class=\"sorttitle\">Wanted (low priority):</span> <span class=\"searchresults\">' + lpwfound.join(', ') + '</span>';\n } else {\n document.getElementById('lpwfound').innerHTML = '';\n };")
|
||||
if variables.trademedium:
|
||||
content.write("\n if ((hptfound.length) > 0) {\n document.getElementById('hptfound').innerHTML = '<span class=\"sorttitle\">Will trade out for <a href=\"")
|
||||
if len(variables.subfolder) > 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue