Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Commit fb65228

Browse files
committed
Start on a very basic browser app
1 parent f98aeb7 commit fb65228

5 files changed

Lines changed: 100 additions & 1 deletion

File tree

browser/browser.css

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#browser-html, #browser-body {
2+
height: 100%;
3+
padding: 0;
4+
margin: 0;
5+
}
6+
7+
#browser-body {
8+
margin: 0;
9+
display: -moz-box;
10+
-moz-box-orient: vertical;
11+
width: 100%;
12+
height: 100%;
13+
background-color: #000;
14+
}
15+
16+
#browser-tab {
17+
-moz-box-flex: 1;
18+
display: -moz-box;
19+
-moz-box-orient: vertical;
20+
}
21+
22+
#browser-toolbar {
23+
background-color: #666;
24+
display: -moz-box;
25+
-moz-box-orient: horizontal;
26+
width: 100%;
27+
height: 30px;
28+
margin: 0;
29+
}
30+
31+
#browser-address {
32+
background-color: #333;
33+
border-radius: 5px;
34+
-moz-box-flex: 1;
35+
display: -moz-box;
36+
-moz-box-orient: horizontal;
37+
height: 20px;
38+
margin: 5px;
39+
padding: 0;
40+
}
41+
42+
#browser-url {
43+
-moz-box-flex: 1;
44+
border: none;
45+
border-radius: 5px;
46+
height: 16px;
47+
padding: 2px 5px;
48+
}
49+
50+
.browser-button {
51+
display: block;
52+
padding: 0 4px;
53+
}
54+
55+
#browser-iframe {
56+
-moz-box-flex: 1;
57+
width: 100%;
58+
border: none;
59+
background-color: white;
60+
}

browser/browser.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html id="browser-html">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Browser</title>
7+
<link rel="stylesheet" href="browser.css" type="text/css" />
8+
<script type="text/javascript" src="../apps.js"></script>
9+
<script type="text/javascript" src="browser.js"></script>
10+
</head>
11+
12+
<body id="browser-body">
13+
<div id="browser-tab">
14+
<div id="browser-toolbar">
15+
<form id="browser-address">
16+
<input type="text" id="browser-url" value="https://wiki.mozilla.org/B2G">
17+
<input type="image" src="images/go.png" id="browser-go-button" class="browser-button" alt="Go">
18+
</form>
19+
</div>
20+
<iframe id="browser-iframe" src="https://wiki.mozilla.org/B2G">
21+
</iframe>
22+
</div>
23+
</body>
24+
25+
</html>

browser/browser.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
window.onload = function() {
2+
var go = document.getElementById("browser-go-button");
3+
go.addEventListener("click", Browser.navigate, false);
4+
5+
}
6+
7+
var Browser = {
8+
navigate: function(event) {
9+
var url = document.getElementById("browser-url").value;
10+
var iframe = document.getElementById("browser-iframe");
11+
iframe.setAttribute("src", url);
12+
event.preventDefault();
13+
}
14+
}

browser/images/go.png

381 Bytes
Loading

homescreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function OnLoad() {
391391
{ label: 'Books', src: 'images/Books.png',
392392
url: 'data:text/html,<font color="blue">Hello' },
393393
{ label: 'Browser', src: 'images/Browser.png',
394-
url: 'data:text/html,<font color="blue">Hello' },
394+
url: 'browser/browser.html' },
395395
{ label: 'Music', src: 'images/Music.png',
396396
url: 'data:text/html,<font color="blue">Hello' }
397397
];

0 commit comments

Comments
 (0)