Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Header
- function clear()
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColour(colours.black)
- term.setTextColor( colors.white )
- end
- function link()
- term.setTextColour(colours.yellow)
- end
- function fineLink()
- term.setTextColour(colours.white)
- end
- function colore(sfumatura)
- term.setTextColour(sfumatura)
- end
- function fineColore()
- term.setTextColour(colours.white)
- end
- function sfondo(sfumaturaSfondo)
- term.setBackgroundColour(sfumaturaSfondo)
- end
- function fineSfondo()
- term.setBackgroundColour(colours.black)
- end
- function errore()
- while true do
- clear()
- colore(colours.red)
- sfondo(colours.yellow)
- print("Errore!")
- fineSfondo()
- print("")
- print("Errore: Impossibile caricare la pagina!")
- fineColore()
- print("")
- print("Cause comuni:")
- print("")
- print("- Nessuna connessione a LeNet")
- print("- Pagina inesistente")
- print("- Errore di digitazione dell'indirizzo")
- print("- Link errato o obsoleto.")
- print("")
- print("Premere G per navigare ad un'altra pagina")
- print("Premere Q per uscire da LeNet")
- event, key = os.pullEvent("key")
- if key == keys.g then
- vai_a()
- elseif key == keys.q then
- os.reboot()
- end
- end
- end
- function vai_a_url(url)
- clear()
- ln = http.get("http://172.16.20.220/luanet/"..url..".lua")
- if ln == nil or ln == '' then
- errore()
- end
- pagina = loadstring(ln.readAll())
- ln.close()
- pagina()
- if key == keys.g then
- vai_a()
- end
- end
- function vai_a()
- sleep(0.2)
- term.setCursorPos(1, 2)
- sfondo(colours.lightGrey)
- print("|-----------------------------------|")
- print("| VAI A INDIRIZZO.... |")
- print("| |")
- print("| ln:// |")
- print("| |")
- print("| |")
- print("|Premere Enter per navigare |")
- print("|-----------------------------------|")
- fineSfondo()
- term.setCursorPos(8, 5)
- url = read()
- vai_a_url(url)
- term.setCursorPos(1, 19)
- term.write("Premere G per andare ad un indirizzo, Q per uscire")
- while true do
- event, key = os.pullEvent("key")
- if key == keys.g then
- vai_a()
- end
- end
- end
- --inizio pagina
- colore(colours.black)
- sfondo(colours.yellow)
- print("BORSA DI KILMAURS - TRADING ONLINE")
- fineSfondo()
- fineColore()
- colore(colours.yellow)
- print(" ______ ___ _______ ______ _ ")
- print("|_ _ \\ .' '.|_ __ \\ .' ____ \\ / \\ ")
- print(" | |_) |/ .-. \\ | |__) || (___ \\_| / _ \\ ")
- print(" | __'.| | | | | __ / _.____'. / ___ \\ ")
- print(" _| |__) \\ '-' /_| | \\ \\| \\____) | _/ / \\ \\_ ")
- print("|_______/ '.___.'|____| |___\\______.'|____| |____| ")
- fineColore()
- print("\n")
- print("Benvenuti sul sito della Borsa di Kilmaurs.")
- print("")
- print("")
- link()
- print("Informazioni")
- print("Come si usa")
- print("Quotazioni")
- print("Area riservata")
- fineLink()
- -- Fine pagina
- term.setCursorPos(1, 19)
- term.write("Premere G per andare ad un indirizzo, Q per uscire")
- --Eventi per i link
- while true do
- event, key, x, y = os.pullEvent()
- if event == "mouse_click" and y == 13 then
- vai_a_url("borsakilmaurs/info")
- elseif event == "mouse_click" and y == 14 then
- vai_a_url("borsakilmaurs/uso")
- elseif event == "mouse_click" and y == 15 then
- vai_a_url("borsakilmaurs/quotazioni")
- elseif event == "mouse_click" and y == 16 then
- vai_a_url("borsakilmaurs/areariservata")
- elseif event == "key" then
- if key == keys.g then
- elseif key == keys.q then
- os.reboot()
- end
- end
- end
Add Comment
Please, Sign In to add comment