This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
/
index.html
125 lines (106 loc) · 3.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html>
<head>
<title>MozillaBall</title>
<style>
#install_button {
padding-top: 3px;
position: relative;
float: right;
font: normal normal bold 10pt/normal Helvetica;
font-size: 16px;
vertical-align: middle;
text-align: center;
letter-spacing: -0.5px;
color: rgb(255,255,255);
text-shadow: 0px 1px rgba(0, 0, 0, 0.3);
width: 140px;
height: 28px;
line-height: 26px;
border: 1px solid rgba(0,0,0,0.2);
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
border-radius: 1em;
-moz-box-shadow:
inset rgba(218,255,191,1) 0 1px 0px,
inset rgba(0,0,0,0.2) 0 -2px 0px,
rgba(0,0,0,0.1) 0 2px 0px;
-webkit-box-shadow:
inset rgba(218,255,191,1) 0 1px 0px,
inset rgba(0,0,0,0.2) 0 -2px 0px,
rgba(0,0,0,0.1) 0 2px 0px;
-box-shadow:
inset rgba(218,255,191,1) 0 1px 0px,
inset rgba(0,0,0,0.2) 0 -2px 0px,
rgba(0,0,0,0.1) 0 2px 0px;
background-color: rgb(134,214,106); /* for non-css3 browsers */
background: -webkit-gradient(linear, left top, left bottom, from(rgba(134,214,106,1)), to(rgba(78,152,52,1))); /* for webkit browsers */
background: -moz-linear-gradient(top, rgba(134,214,106,1), rgba(78,152,52,1)); /* for firefox 3.6+ */
display: block;
}
</style>
<script>
var context;
var x=100;
var y=200;
var dx=5;
var dy=5;
function init()
{
context= document.getElementById('myCanvas').getContext('2d');
setInterval(draw,10);
}
function draw()
{
context.clearRect(0,0, 300,300);
context.beginPath();
context.fillStyle="#0000ff";
// Draws a circle of radius 20 at the coordinates 100,100 on the canvas
context.arc(x,y,20,0,Math.PI*2,true);
context.closePath();
context.fill();
if( x<20 || x>280) dx=-dx;
if( y<20 || y>280) dy=-dy;
x+=dx;
y+=dy;
}
</script>
</head>
<body onLoad="init();">
<canvas id="myCanvas" style="margin-left:50px;margin-top:50px" width="300" height="300" >
</canvas>
<div style="position:absolute;left:100px;top:100px;font:bold 24pt Helvetica;color:#908040">This is MozillaBall.</div>
<div style="position:absolute;left:420px;width:300px;top:100px;font:bold 10pt Helvetica;color:black">
This page exists as an example of how a normal website can
be wrapped up as an Open Web App.<br><br>
</div>
<div id="install_button" style="display:none;position:absolute;left:750px;width:140px;top:100px;">
INSTALL
</div>
</body>
<script src="jquery-1.4.2.min.js"></script>
<script src="https://myapps.mozillalabs.com/jsapi/include.js"></script>
<script>
var gManifestName = "/manifest.webapp";
$(document).ready(function() {
navigator.apps.amInstalled(function(result) {
if (!result) {
$("#install_button").show();
$("#install_button").click(function() {
navigator.apps.install({
url: gManifestName,
onsuccess: function() {
$("#install_button").text("INSTALLED!").unbind('click');
},
onerror: function(errObj) {
alert("Couldn't install (" + errObj.code + ") " + errObj.message);
}
});
});
} else {
$("#install_button").text("INSTALLED!").show();
}
});
});
</script>
</html>