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
|
<?php ob_start(function($b){return preg_replace(['/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s'],['>','<','\\1'],$b);}); ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>A random youtube video!</title>
<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<style><?php echo file_get_contents('./css/style.min.css'); ?></style>
<?php require("static/noscript.html"); ?>
<style>
h3 {
color: black;
}
</style>
<?php ob_end_flush(); ?>
<script type='text/javascript'>
function get_random_video(){
r = new XMLHttpRequest();
r.onreadystatechange=function(){
if(r.readyState == 4 && r.status == 200){
if(r.responseText == ""){
location.reload();
} else {
document.getElementById('middle').innerHTML=r.responseText;
document.getElementById('heading').innerHTML="";
}
}
}
r.open('GET', '/youtube.php?ajax=1', true);
r.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
r.send();
}
<?php /*
function prep_player(){
r = new XMLHttpRequest();
r.onreadystatechange=function(){
if(r.readyState == 4 && r.status == 200){
document.getElementById('test1').innerHTML=r.responseText;
}
}
r.open('POST', 'print_video.php', true);
r.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
r.send('mime=<?php echo $mime; ?>', 'vname=<?php echo $filename?>');
<?php /*
r.send('vid=<?php echo $vid; ?>', mime='<?php echo $mime; ?>', 'vname=<?php echo $filename?>');
r.send('vid=<?php echo $_GET["vid"]; ?>', 'strm=1'); */ ?>
</script>
</head>
<?php ob_start(function($b){return preg_replace(['/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s'],['>','<','\\1'],$b);}); ?>
<body onload="get_random_video();">
<?php require_once("static/header.php"); ?>
<div class="container text-center">
<div class="row" id="heading">
<br>
<h3>Fetching a random youtube video!</h3>
</div>
<br>
<br>
<div class="row" id="middle">
<p>One moment please.</p>
<img src='/static/ajax-loader.gif' alt="ajax-loader">
</div>
</div>
<?php ob_end_flush(); ?>
<script>
document.addEventListener('keydown', function(event) {
if(event.keyCode == 82) { // someone pressed 'R'
get_random_video();
}
});
</script>
<?php ob_start(function($b){return preg_replace(['/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s'],['>','<','\\1'],$b);}); ?>
<?php require_once("static/foot.php"); ?>
<?php ob_end_flush(); ?>
|