-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
114 lines (96 loc) · 2.41 KB
/
index.php
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
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>magic</title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" media="all" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>
body > img {
width: 100%;
height:100%;
position: fixed;
z-index: 5;
}
body > div {
position: absolute;
top: 0;
left: 0;
z-index: 10;
}
form {
display: none;
}
fieldset {
width: 33%;
margin: auto;
margin-top: 50px;
padding: 20px;
border: 1px solid white;
}
legend {
padding: 0 5px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
var prefix = "<?php
if (isset($_GET['prefix'])) {
echo $_GET['prefix'];
} else {
echo "DEFAULT";
}
?>";
$(function(){
var pics;
var $image = $('<img />').appendTo('body');
$.get( (prefix != 'DEFAULT' ? prefix : "pics/default/") + 'pics.json', function(data) {
pics = data;
$image.attr("src", pics[0]);
});
var $c = $('#content');//$('<div></div>').appendTo('body');
for(var i = 0; i < 500; i++) {
$c.append('<p>hello</p>');
}
$(window).scroll(function(){
var p = Math.floor(pics.length * $(window).scrollTop() / ($(document).height() - $(window).height()));
$image.attr("src", pics[p]);
});
if (prefix == 'DEFAULT') {
$('form').show().submit(function(){
$('fieldset').append('<img src="loader.gif">').find('input[type=submit]').remove();
$.ajax({
url: $('form').attr("action"),
type: "GET",
dataType: "json",
data: $('form').serialize(),
success: function(data) {
$('form').hide();
pics = data;
$(window).scrollTop(0).trigger('scroll');
}
});
return false;
});
}
});
</script>
</head>
<body lang="en">
<div id="content">
<form action="get_panoramas_v2.php">
<fieldset>
<legend>Please play</legend>
<input name="or" placeholder="from">
<input name="de" placeholder="to">
<input type="hidden" name="hd" value="true">
<input type="hidden" name="ov" value="true">
<input type="submit" value="Go">
</fieldset>
</form>
</div>
</body>
</html>