<?php
	require("../__common__/__define_common.php");
	require("__define.php");
	require("../__common__/include-common-all.php");
	require("../account/__logincheck.php");
	require("img-view-include.php");

	if (($img_file = my_GET('img').'') == '') {
		exit;
	}
	if (defined("photo_LIMITED_IMAGES_FOLDER") and photo_LIMITED_IMAGES_FOLDER <> '') {
		if ($_SESSION['システム管理者'] <> "YES" or photo_LIMITED_ADMIN_NOLIMIT <> 'YES') {
			$len = strlen(photo_LIMITED_IMAGES_FOLDER);
			if (substr($img_file, 0, $len) <> photo_LIMITED_IMAGES_FOLDER) {
				exit;
			}
		}
	}
	if (is_video_filename($img_file)) {
		$getimg = "video-jpeg.php?file=".urlencode($img_file);
	} else {
		$getimg = "img-view.php?img=".urlencode($img_file);
	}
	if ($_COOKIE['tenbyou_interval_time'].'' <> '') {
		$interval_time = $_COOKIE['tenbyou_interval_time'];
	} else {
		$interval_time = photo_TENBYOU_INTERVAL_TIME;
	}
	if ($_COOKIE['tenbyou_draw_rate'].'' <> '') {
		$draw_rate = $_COOKIE['tenbyou_draw_rate'];
	} else {
		$draw_rate = photo_TENBYOU_DRAW_RATE;
	}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>点描アニメ</title>
<style>
#pallet { display: none; }
body {
	font-size: 84%;
	font-family: "ＭＳ Ｐゴシック",arial,helvetica,clean,sans-serif;
}
</style>
</head>
<body>
<div>
<button id="button">スタート</button>
<button onClick="stopProc()">ストップ</button>
<button onClick="location.href='tenbyou.php?<?= $_SERVER['QUERY_STRING'] ?>'">クリア</button>
インターバル時間：<select id="interval_time" onChange="select_interval_time()">
<?php	for ($opt=1; $opt<=100; $opt++) { ?>
<option value="<?= $opt ?>"<?= $opt == $interval_time ? ' selected' : '' ?>><?= $opt ?>
<?php	} ?>
</select>
描画レート：<select id="draw_rate" onChange="select_draw_rate()">
<?php	for ($opt=40; $opt<=5120; $opt*=2) { ?>
<option value="<?= $opt ?>"<?= $opt == $draw_rate ? ' selected' : '' ?>><?= $opt ?>
<?php	} ?>
</select>
</div>
<canvas id="pallet"></canvas>
<canvas id="canvas"></canvas>
<script type="text/javascript" src="../scripts/jquery.js"></script>
<script type="text/javascript" src="../scripts/jquery.cookie.js"></script>
<script type="text/javascript">
var src = '<?= $getimg ?>'
var interval_time = <?= $interval_time ?>;
var draw_rate = <?= $draw_rate ?>;
var procStop = false;
function select_interval_time() {
	interval_time = Number($("#interval_time").val());
	$.cookie('tenbyou_interval_time', interval_time, { expires: 365 });
}
function select_draw_rate() {
	draw_rate = Number($("#draw_rate").val());
	$.cookie('tenbyou_draw_rate', draw_rate, { expires: 365 });
}
function stopProc() {
	procStop = true;
}
</script>
<script type="text/javascript" src="scripts/tenbyou.js"></script>
</body>
</html>
