Advertisement
Alakazard12

Chrome

Dec 17th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.92 KB | None | 0 0
  1. -- Created by eor84 and alakazard12
  2. -- Please give credit if used
  3.  
  4. local config = {
  5.     bg = colors.white;
  6.     text = colors.black;
  7.     bar = colors.cyan;
  8.     ucol = colors.lightGray;
  9. }
  10.  
  11. local logo = paintutils.loadImage("/chrome/logo")
  12.  
  13. local function round(num)
  14.     local ln = num - math.floor(num)
  15.     if ln > .5 then
  16.         return math.ceil(num)
  17.     else
  18.         return math.floor(num)
  19.     end
  20. end
  21.  
  22. webApis = {
  23.     cPrint = function(txt)
  24.         local w, h = term.getSize()
  25.         local t, r = term.getSize()
  26.         term.setCursorPos(round(round(w-#txt)/2), r)
  27.         print(txt)
  28.     end;
  29. }
  30.  
  31. local function doUrl(url)
  32.     if url == "test" then
  33.         term.setCursorPos(1, 3)
  34.         local rt = fs.open("/chrome/testpage", "r")
  35.         loadstring(rt.readAll())()
  36.         rt.close()
  37.     end
  38. end
  39.  
  40. local function getURL()
  41.     term.setCursorPos(1, 2)
  42.     term.setBackgroundColor(config.ucol)
  43.     term.setTextColor(config.text)
  44.     write("URL://")
  45.     local url = read()
  46.     doUrl(url)
  47. end
  48.  
  49. local function loadM()
  50.     term.setBackgroundColor(config.bg)
  51.     term.clear()
  52.     term.setTextColor(config.text)
  53.     term.setBackgroundColor(config.bar)
  54.     term.setCursorPos(1, 1)
  55.     local w, h = term.getSize()
  56.     write(string.rep(" ", w-1))
  57.     term.setBackgroundColor(colors.red)
  58.     write(" ")
  59.     term.setBackgroundColor(config.bar)
  60.     term.setCursorPos(1, 1)
  61.     write("[Google Chrome V1.0]")
  62.     term.setBackgroundColor(config.ucol)
  63.     term.setCursorPos(1, 2)
  64.     write(string.rep(" ", w))
  65. end
  66.  
  67. local function loadImage(image)
  68.     term.clear()
  69.     term.setCursorPos(1,1)
  70.     paintutils.drawImage(image, 1, 1)
  71. end
  72.  
  73. local function loadLogo()
  74.     term.clear()
  75.     term.setCursorPos(1,1)
  76.     term.setBackgroundColor(colors.white)
  77.     term.clear()
  78.     paintutils.drawImage(logo, 1, 1)
  79.     term.setTextColor(colors.blue)
  80.     term.setBackgroundColor(colors.white)
  81.     term.setCursorPos(19, 17)
  82.     term.write("Google ")
  83.     sleep(0.5)
  84.     term.write(" Chrome")
  85.     sleep(1)
  86. end
  87.  
  88. loadLogo()
  89. loadM()
  90. term.setCursorPos(1,1)
  91. getURL()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement