mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
good
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
if(isset($_POST['thisUrl']))
|
||||
{
|
||||
$string = $_POST['thisUrl'];
|
||||
|
||||
$file = file_get_contents('videos.json');
|
||||
$data = json_decode($file);
|
||||
unset($file);//prevent memory leaks for large json.
|
||||
|
||||
50
index.php
50
index.php
@@ -1,34 +1,45 @@
|
||||
<?php require("main.php"); ?>
|
||||
<?php
|
||||
/*$host = 'http://'.$_SERVER['HTTP_HOST'].'/+';
|
||||
$short = $_SERVER['QUERY_STRING'];*/
|
||||
$video = htmlspecialchars($_GET['v']);
|
||||
$name = htmlspecialchars($_GET['n']);
|
||||
|
||||
$list = json_decode(file_get_contents('videos.json'));
|
||||
if(isset($_GET['v'])){
|
||||
$file = file_get_contents('videos.json');
|
||||
$data = json_decode($file);
|
||||
unset($file);//prevent memory leaks for large json.
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<title>Zöff</title>
|
||||
<link rel="stylesheet" type="text/css" href="static/style.css" title="Default" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" title="Default" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="top vcent centered">
|
||||
<div id="change" class="small">
|
||||
<div class="big noselect">Zöff</div>
|
||||
<div class="big">Zöff</div>
|
||||
Zöff
|
||||
<form name="ufo" action="" class="daform" id="base" method="get" onsubmit="return submitform();">
|
||||
<input id="longurl" name="v" type="text" class="innbox" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="swfobject.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<div id="ytapiplayer">
|
||||
You need Flash player 8+ and JavaScript enabled to view this video :(
|
||||
</div>
|
||||
<script type="text/javascript" src="static/swfobject.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script>
|
||||
You need Flash player 8+ and JavaScript enabled to view this video.
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/**
|
||||
TODO:
|
||||
-legge til timer når man trykker pause for at når man "unpauser", går den dit den ville vært, hvis videoen ville blitt ferdig, load en ny video men ha den på pause
|
||||
-legge til tid når en video ble påbegynt, for at hvis folk joiner midt i en video, hopper den dit
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Fetcher sangen som spilles fra JSON filen
|
||||
@@ -56,7 +67,6 @@
|
||||
/**
|
||||
eventlistener for når playeren endres
|
||||
*/
|
||||
|
||||
function onytplayerStateChange(newState) {
|
||||
if(newState == 0) //newState = 0 når videoen er ferdig
|
||||
{
|
||||
@@ -67,7 +77,6 @@
|
||||
|
||||
success: function() {
|
||||
console.log("saved");
|
||||
console.log(response);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,11 +86,10 @@
|
||||
async: false
|
||||
}).responseText;
|
||||
var url = $.parseJSON(response);
|
||||
console.log(url[0]);
|
||||
response = url[0];
|
||||
|
||||
ytplayer.loadVideoById(response);
|
||||
},100);
|
||||
},500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +116,6 @@
|
||||
ytplayer.loadVideoById(response);
|
||||
},100);
|
||||
}
|
||||
|
||||
function onYouTubePlayerReady(playerId) { //funksjon som kjøres når playeren er klar
|
||||
ytplayer = document.getElementById("myytplayer");
|
||||
ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); //eventlistenere
|
||||
@@ -117,10 +124,11 @@
|
||||
ytplayer.setVolume(100);
|
||||
ytplayer.playVideo();
|
||||
}
|
||||
</script>
|
||||
|
||||
</script>
|
||||
<br>
|
||||
<?php print_r($data); ?>
|
||||
<?php print_r($list); ?>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
7
save.php
7
save.php
@@ -1,26 +1,21 @@
|
||||
<?php
|
||||
|
||||
if(isset($_POST['thisUrl']))
|
||||
{
|
||||
$string = $_POST['thisUrl'];
|
||||
|
||||
$file = file_get_contents('videos.json');
|
||||
$data = json_decode($file);
|
||||
unset($file);//prevent memory leaks for large json.
|
||||
|
||||
//insert data here
|
||||
|
||||
if($data[0] == $string)
|
||||
{
|
||||
array_push($data, $string);
|
||||
array_shift($data);
|
||||
}
|
||||
|
||||
file_put_contents("videos.json", json_encode($data));
|
||||
unset($data);
|
||||
|
||||
}else
|
||||
{
|
||||
echo "You're a bad boy";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1 +1 @@
|
||||
["XU_9yi6xvRs", "mG6pm1WZ2uc"]
|
||||
["A8P01EjBQxY","dMrmfub2TBw","BSAUJIRqAF4","mG6pm1WZ2uc","to23klIOhkU","fkLEljSKY30","y6DHE_5drbM"]
|
||||
Reference in New Issue
Block a user