-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
149 lines (145 loc) · 3.95 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE HTML>
<html>
<head>
<title>Test Page</title>
<style type="text/css">
#test {
width:100px;
height:100px;
position:relative;
background-color:blue;
}
#out {
background-color:red;
width:400px;
height:100px;
//position:absolute;
transition:width 1s;
}
#page2 {
display:none;
}
#can {
margin:0px;
padding:0px;
width:300px;
height:200px;
position:relative;
border: solid 1px black;
}
a:hover{color:Magenta;}
/*
#test:target {
animation:mover 2s;
}
#out:target {
width:400px;
}
@keyframes mover {
from {left:0px;}
to {left:300px;}
}
*/
</style>
<script src="phonegap.js"></script>
<script src="jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#can").on("touchstart touchmove", function(e) {
//Disable scrolling by preventing default touch behaviour
e.preventDefault();
var orig = e.originalEvent;
//var x = e.pageX - this.offsetLeft;
//var y = e.pageY - this.offsetTop;
//console.log(x);
//console.log(y);
var x = orig.changedTouches[0].pageX - $(this).offset().left;
var y = orig.changedTouches[0].pageY - $(this).offset().top;
var blah = document.getElementById("can");
var bcan = blah.getContext("2d");
bcan.clearRect(0,0,500,500);
bcan.beginPath();
bcan.moveTo(0,10);
bcan.lineTo(x,y);
bcan.lineTo(300,10);
bcan.stroke();
//bcan.fillRect(10,10,5,5);
//bcan.fillRect(10,40,5,5);
//bcan.fillRect(10,100,5,5);
//bcan.fillRect(10,140,5,5);
//bcan.fillStyle = "rgb(200,0,0)";
//bcan.fillRect(x,y,100,100);
// Move a div with id "rect"
//$("#out").css({top: y, left: x});
});
$("#can").on("touchend", function(e) {
e.preventDefault();
var blah = document.getElementById("can");
var bcan = blah.getContext("2d");
bcan.clearRect(0,0,500,500);
bcan.beginPath();
bcan.moveTo(0,10);
bcan.lineTo(300,10);
bcan.stroke();
});
$("#nextb").click(function () {
$("#page1").hide();
$("#page2").show();
});
$("#prev").click(function () {
$("#page1").show();
$("#page2").hide();
});
$("#click2").mouseenter(function () {
if ($("#out").width() != 400){
$("#out").animate({width: '400'});
} else {
$("#out").animate({width: '100'});
}
});
$("#click3").click(function () {
var med = new Media("/android_asset/www/sound/testtone.wav", function () {
alert("worked");
med.release();
},
function (error) {
alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n');
});
med.play();
var timer = setInterval(function () {
med.getCurrentPosition(function () {});
},1000);
//document.getElementById('sound').play();
});
$("p").text("YOO JQUERY FOR THE WIN!");
//document.getElementById("purplemangoattacksapple").innerHTML = "YOOOOOOO!";
});
</script>
</head>
<body>
<p id="purplemangoattacksapple" >Testing!!!!</p>
<div id="page1">
<div>
<button id="nextb" type="button">Next</button>
<button id="click2" type="button">Click 2</button> <button id="click3" type="button">Click 3</button>
<div id="test"></div>
<div id="out"></div>
</div>
<audio id="sound" controls="controls">
<source src="/android_asset/www/sound/horse.ogg" type="audio/ogg">
<source src="/android_asset/www/horse.ogg" type="audio/ogg">
<source src="/android_asset/www/sound/testtone.wav" type="audio/wav">
<source src="/android_asset/www/sound/testtone.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
<div style="clear:both"></div>
<canvas width="300px" height="200px" id="can">
</canvas>
</div>
<div id="page2">
<p>blah blah blah</p>
<button id="prev" type="button">Previous</button>
</div>
<a href="#">YOOOOO</a>
</body>
</html>