-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
163 lines (143 loc) · 4.8 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css">
<style type="text/css">
.cursor {
width: 64px;
height: 64px;
}
video {
height: 385px;
width: 684px;
padding-bottom: 24px;
}
/*
from http://jsfiddle.net/AndrewDryga/zcX4h/1/
*/
.spinner {
display: inline-block;
opacity: 0;
width: 0;
padding-left: 8px;
-webkit-transition: opacity 0.25s, width 0.25s;
-moz-transition: opacity 0.25s, width 0.25s;
-o-transition: opacity 0.25s, width 0.25s;
transition: opacity 0.25s, width 0.25s;
}
.has-spinner.active .spinner {
opacity: 1;
width: auto; /* This doesn't work, just fix for unkown width elements */
}
.has-spinner.btn-large.active .spinner {
width: 19px;
}
</style>
<title>Let Minium google that for you</title>
</head>
<body>
<div class="container">
<video id="video" preload="auto" class="center-block">
<source src="minium.mp4" type='video/mp4' />
</video>
<form role="form">
<div class="form-group">
<input type="text" id="message" name="message" class="form-control input-lg" autocomplete="off">
</div>
<button type="submit" class="btn btn-default btn-lg center-block" data-style="expand-right" data-loading-text="Searching..." data-complete-text="Redirecting...">
Search Google
</button>
</form>
<img src="cursor.png" id="cursor" class="cursor" style="display: none" />
</div>
<!-- Scripts -->
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-url-parser/2.2.1/purl.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script>
jQuery(function($) {
$.fn.animatePosition = function(props, duration) {
var mergedProps = $.extend({}, props, {
using: function(css, calc) {
$(this).animate(css, duration, "easeOutQuad");
}
});
return $(this).position(mergedProps);
};
$.fn.repeat = function(n, fn) {
var that = this;
for (var i = 0; i < n; i++) {
that = fn.call(that, i);
}
return that;
};
$.fn.addSpinner = function() {
return $(this).append($("<span class='spinner'><i class='icon-spin icon-refresh'></i></span>")).addClass("has-spinner active");
}
var url = $.url(window.location.toString());
var searchText = url.param("q") ? url.param("q") : "Hello Minium!";
// cursor initial position
$("#cursor")
.show("fade", 50)
.position({
my: "right bottom",
at: "right bottom",
of: "#video"
});
$("#video").on("playing", function() {
// animate cursor
$("#cursor")
.delay(800)
.animatePosition({
my: "center top",
at: "left+5% center+25%",
of: "#message"
}, 600)
.delay(3200)
.animatePosition({
my: "left top",
at: "center center+25%",
of: ":submit",
}, 500);
// animate message field
var startTime = 3200, endTime = 4200;
$("#message")
.delay(1600)
.queue(function() {
$(this).focus().dequeue();
})
.delay(startTime - 1600)
.repeat(searchText.length, function(i) {
return this.queue(function() {
$(this).val(searchText.substr(0, i + 1)).dequeue();;
})
.delay((endTime - startTime) / searchText.length);
});
// animate send button
$(":submit")
.delay(6400)
.queue(function() {
$(this).button("loading").removeClass("btn-default").addClass("btn-primary").addSpinner().dequeue();
})
.delay(2000)
.queue(function() {
$(this).button("complete").removeClass("btn-primary").addClass("btn-success").addSpinner().dequeue();
})
})
.on("ended", function() {
window.location = "https://www.google.com/search?" + $.param({ q : searchText });
});
// check video to be ready, and then play it
var intervalId = setInterval(function() {
var video = $("#video").get(0);
if (video.readyState === 4) {
video.play();
clearInterval(intervalId);
}
}, 500);
});
</script>
</body>
</html>