Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sfumatura = "white"
- sfumaturaSfondo = "black"
- 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 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
- function home()
- while true do
- clear()
- colore(colours.lime)
- print(" ____ ____ ____ ____ ____ ")
- print("||L ||||e ||||N ||||e ||||t ||")
- print("||__||||__||||__||||__||||__||")
- print("|/__\\||/__\\||/__\\||/__\\||/__\\| (c) lego11")
- fineColore()
- print("")
- print("")
- print("COMANDI:")
- print("")
- print("Q: Esce dal programma")
- print("G: Inserisce un URL")
- print("")
- print("")
- term.write("Clicca su un link ")
- link()
- term.write("come questo")
- fineLink()
- term.write(" per andare alla")
- print("\ndestinazione del link\n")
- term.write("Clicca ")
- link()
- term.write("qui")
- fineLink()
- term.write(" per andare al portale LeNet")
- event, key, x, y = os.pullEvent()
- if event == "mouse_click" and x >= 19 and x <= 29 and y == 13 then
- term.setCursorPos(1, 2)
- sfondo(colours.lightGrey)
- print("|-----------------------------------|")
- print("| AVVISO |")
- print("| |")
- print("| Hai aperto un link! |")
- print("| |")
- print("|Premere un tasto qualsiasi |")
- print("|-----------------------------------|")
- fineSfondo()
- os.pullEvent( "key" )
- home()
- elseif event == "mouse_click" and x >= 7 and x <= 10 and y == 16 then
- vai_a_url("lenet")
- elseif event == "key" then
- if key == keys.g then
- vai_a()
- elseif key == keys.q then
- shell.run("desktop")
- elseif key == keys.h then
- home()
- end
- end
- end
- 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 H per ritornare alla pagina iniziale")
- print("Premere Q per uscire da LeNet")
- event, key = os.pullEvent("key")
- if key == keys.g then
- vai_a()
- elseif key == keys.q then
- shell.run("desktop")
- elseif key == keys.h then
- home()
- end
- end
- end
- --Controlla il terminale
- if term.isColour == false then
- error("Errore: Scheda grafica del computer non supportata")
- end
- clear()
- home()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement