Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Internet Browser (With History)

edited March 2016 in Code Sharing Posts: 79

I originally had the idea to combine the 4 major internet browsers: IE8, Safaru, Chrome, and FireFox, and I did it. With a semi-full history functionality, here is ISCF, InternetSafariChromeFox:

function setup()
    pageAddress = "http://"
    history = {}
    sitesVisited = 0
    textMode(CORNER)
    supportedOrientations(LANDSCAPE_ANY)
    displayMode(FULLSCREEN)
    parameter.boolean("UseBuiltIn", true)
    parameter.boolean("Incognito", false)
    parameter.action("Clear History", function()
        for i,v in ipairs(history) do
            history[i] = nil
        end
    end)
end

function draw() 
    background(93, 93, 93, 255)
    strokeWidth(20)
    -- Some icon stuff
    --spriteMode(CENTER)
    --icon = sprite(CAMERA, WIDTH/2, HEIGHT/2, 900,700)
    stroke(255, 255, 255, 255)
    rect(10,700,string.len(pageAddress)*8.45,20)
    fontSize(18)
    fill(0, 0, 0, 255)
    text(pageAddress,10,700)
    stroke(43, 43, 43, 255)
    rect(0,650,WIDTH,10)
    fontSize(30)
    text("History:",10,600)
    fontSize(20)
    if (#history <= 20) then
        fill(65, 126, 236, 255)
        for i,v in ipairs(history) do
            text(v,10,600-(i*21))
        end
    else
        text("TOO LONG!",10,579)
    end
end

function touched(touch)
    if touch.state == ENDED then
        showKeyboard()
    end
end

function keyboard(key)
    if key == BACKSPACE then
        pageAddress=string.sub(pageAddress, 1, -2)
    elseif key == RETURN then
        pageAddress = string.lower(pageAddress)
        searchSite(pageAddress)
        if (Incognito == false) then
            sitesVisited = sitesVisited + 1
            history[sitesVisited] = pageAddress
        end
    else
        pageAddress=pageAddress .. key
    end
end

--The main website component
function searchSite(website)
    openURL(website,UseBuiltIn)
end
Tagged:

Comments

  • Posts: 2,020

    here is ISCF, InternetSafariChromeFox:

    You're a day early for April Fool's :p

  • IgnatzIgnatz Mod
    Posts: 5,396

    Not in Australia, he's not..

  • Posts: 79

    Golly, I forgot about April Fools. I actually came up with the name with a couple of friends a couple months ago as a joke.

Sign In or Register to comment.