update
This commit is contained in:
85
scrapeje.py
85
scrapeje.py
@@ -278,7 +278,7 @@ if os.path.exists('rubrica.txt') and os.path.exists('./DATI_RUBRICA'):
|
|||||||
print( '\n', os.listdir('./DATI_RUBRICA'), '\n')
|
print( '\n', os.listdir('./DATI_RUBRICA'), '\n')
|
||||||
|
|
||||||
scelta = input("Scegli un numero esistente o premi Enter per metterre un link: ")
|
scelta = input("Scegli un numero esistente o premi Enter per metterre un link: ")
|
||||||
#scelta = '0'
|
#scelta = '1'
|
||||||
parserdarubrica()
|
parserdarubrica()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -320,51 +320,56 @@ salvainrubrica()
|
|||||||
# print("\n" + "-" * 25 + "\n")
|
# print("\n" + "-" * 25 + "\n")
|
||||||
|
|
||||||
|
|
||||||
#DA RIFARE
|
# DA RIFARE
|
||||||
# # Genera codice HTML
|
# Genera codice HTML
|
||||||
# html = "<html><body>"
|
html = "<html><body>"
|
||||||
# html += "<h1 style='text-align: center;'>" + nrist + "</h1><br><br>"
|
html += "<h1 style='text-align: center;'>" + nrist + "</h1><br><br>"
|
||||||
# for x in range(len(nome)):
|
for x in range(len(nome)):
|
||||||
# html += "<h2 style='text-align: center;'>" + nome[x] + "</h2>"
|
html += "<h2 style='text-align: center;'>" + nome[x] + "</h2>"
|
||||||
# html += "<p style='text-align: center;'>" + str(desc[x]) + "</p>"
|
html += "<p style='text-align: center;'>" + str(desc[x]) + "</p>"
|
||||||
# html += "<p style='text-align: center;'>N. pezzi: " + str(npezzi[x]) + "</p>"
|
html += "<p style='text-align: center;'>N. pezzi: " + str(npezzi[x]) + "</p>"
|
||||||
# html += "<p style='text-align: center;'>Prezzo: " + str(prezzoN[x]) + "€ </p>"
|
html += "<p style='text-align: center;'>Prezzo: " + str(prezzoN[x]) + "€ </p>"
|
||||||
# html += "<div style='text-align: center;'><button onclick=\"aggiungiProdotto('" + nome[x] + "', '" + str(prezzoN[x]) + "')\">+1</button></div>"
|
#html += "<div style='text-align: center;'><button onclick=\"aggiungiProdotto('" + nome[x] + "', '" + str(prezzoN[x]) + "')\">+1</button></div>"
|
||||||
# html += "<br><br>"
|
html += "<div style='text-align: center;'><button style='font-size: 1.5em;' onclick=\"aggiungiProdotto('" + nome[x] + "', '" + str(prezzoN[x]) + "')\">+1</button></div>"
|
||||||
|
|
||||||
# html += "<br><hr><h2>Prodotti aggiunti</h2>"
|
html += "<br><br>"
|
||||||
# html += "<div id=\"prodottiAggiunti\"></div>"
|
|
||||||
# html += '<div id="totalSection">Total: €<span id="totalValue">0.00</span></div>' #VA MA NON SERVE, NON VA
|
|
||||||
# html += "<script>"
|
|
||||||
|
|
||||||
# html += "function aggiungiProdotto(nome, prezzoN) {"
|
html += "<br><hr><h2>Prodotti aggiunti</h2>"
|
||||||
# html += " var prodotto = nome + ' (' + Number(prezzoN).toFixed(2) + '€)';"
|
html += "<div id=\"prodottiAggiunti\"></div>"
|
||||||
# html += " var box = document.getElementById('prodottiAggiunti');"
|
html += '<div id="total">Total: €<span id="totalValue">0.00</span></div>'
|
||||||
# html += " box.innerHTML += '<p>' + prodotto + ' <button onclick=\"rimuoviProdotto(this)\">-1</button></p>';"
|
|
||||||
# # html += ' var popup = window.open("", "Popup", "width=200,height=100,top=" + ((window.innerHeight - 100) / 2) + ",left=" + ((window.innerWidth - 200) / 2));' #FA SCHIFO
|
|
||||||
# # html += ' popup.document.write("<p>Prodotto aggiunto</p>");' #FA SCHIFO
|
|
||||||
# # html += " setTimeout(function(){ popup.close(); }, 1000);" #FA SCHIFO
|
|
||||||
# html += " updateTotal();" #NON VA
|
|
||||||
# html += "}"
|
|
||||||
|
|
||||||
# html += 'function updateTotal() {' #NON VA
|
html += "<script>"
|
||||||
# html += ' var total = prezzoN[x] + total;' #NON VA
|
|
||||||
# html += ' document.getElementById("totalValue").textContent = total;' #NON VA
|
|
||||||
# html += ' }' #NON VA
|
|
||||||
|
|
||||||
# html += "function rimuoviProdotto(element) {"
|
html += "var totalValue = 0;"
|
||||||
# html += " element.parentNode.remove();"
|
html += "function aggiungiProdotto(nome, prezzoN) {"
|
||||||
# html += "}"
|
html += " var prodotto = nome + ' (' + Number(prezzoN).toFixed(2) + '€)';"
|
||||||
|
html += " var box = document.getElementById('prodottiAggiunti');"
|
||||||
|
html += " box.innerHTML += '<p>' + prodotto + ' <button onclick=\"rimuoviProdotto(this, ' + prezzoN + ')\">-1</button></p>';"
|
||||||
|
html += " totalValue += parseFloat(prezzoN);"
|
||||||
|
html += " updateTotal();"
|
||||||
|
html += "}"
|
||||||
|
|
||||||
|
html += "function updateTotal() {"
|
||||||
|
html += " document.getElementById('totalValue').innerText = totalValue.toFixed(2);"
|
||||||
|
html += "}"
|
||||||
|
|
||||||
|
html += "function rimuoviProdotto(element, prezzoN) {"
|
||||||
|
html += " totalValue -= parseFloat(prezzoN);"
|
||||||
|
html += " element.parentNode.remove();"
|
||||||
|
html += " updateTotal();"
|
||||||
|
html += "}"
|
||||||
|
html += "</script>"
|
||||||
|
|
||||||
|
html += "</body></html>"
|
||||||
|
|
||||||
|
|
||||||
# html += "</script>"
|
# Salva su file
|
||||||
# html += "</body></html>"
|
with open("pagina.html", "w") as file:
|
||||||
|
file.write(html)
|
||||||
|
|
||||||
# # Salvataggio su file
|
|
||||||
# with open("pagina.html", "w") as file:
|
|
||||||
# file.write(html)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#FA SCHIFO
|
||||||
|
# html += ' var popup = window.open("", "Popup", "width=200,height=100,top=" + ((window.innerHeight - 100) / 2) + ",left=" + ((window.innerWidth - 200) / 2));'
|
||||||
|
# html += ' popup.document.write("<p>Prodotto aggiunto</p>");'
|
||||||
|
# html += ' setTimeout(function(){ popup.close(); }, 1000);'
|
||||||
Reference in New Issue
Block a user