<?php
//no comment

//Licence
/*
 * ----------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <friidis@der-beweis.de> wrote this file. As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return Frieder Grießhammer
 * ----------------------------------------------------------------------------
 */

//Config
$bgc = "#000000"; //Background Color
$fgc = "#cccccc"; //Font Color

$basename = "minitube";
$baseurl = "http://www.der-beweis.de/etc/minitube.php"; //Please enter here the full location of this script

$vwidth = "320"; //Width of the video window
$vheight = "265"; //Height of the video window

$pwidth = "400"; //Width of the popup window
$pheight = "300"; //Height of the popup window

?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php echo $basename; ?></title>

<style type="text/css">

body {
	font-family: Arial, sans-serif;
	background: <?php echo $bgc; ?>;
	color: <?php echo $fgc; ?>;
}

a {
	color: <?php echo $fgc; ?>;
	text-decoration: underline;
}


a:hover {
	color: <?php echo $fgc; ?>;
	text-decoration: none;
}

.centered {
	text-align: center;
	margin: auto;
}

</style>

</head>
<body>
<div class="centered">
<?php

$vid = $_GET['vid'] ?? FALSE;

if ($vid == FALSE){
	echo '<b>'.$basename.'</b><br />'."\n";
	echo 'YouTube in klein, als Pop-Up<br />'."\n";
	echo '<a href="javascript:void(w=window.open(\''.$baseurl.'?vid=\'+location,\''.$basename.'\',\'width='.$pwidth.',height='.$pheight.'\'));">'.$basename.'</a> - Bookmarklet'."\n";
} else {
	$vid = parse_url($vid, PHP_URL_QUERY);
	$vid = str_replace('v=', '', $vid);

	echo '<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$vid.'&amp;color2=0x999999" width="'.$vwidth.'" height="'.$vheight.'">'."\n";
	echo '<param name="movie" value="http://www.youtube.com/v/'.$vid.'&amp;color2=0x999999" />'."\n";
	echo '<param name="wmode" value="transparent" />'."\n";
	echo '</object>'."\n";
}

?>
</div>
</body>
</html>
