<html>
	<head>
		<title>3DPrinterOS Client</title>
		<link rel="stylesheet" type="text/css" href="/static/styles/style.css">
    	<style type="text/css">
			!!!STYLE!!!
	   	</style>
	</head>
	<body bgcolor=#003333>
        !!!HTTPS_WARNING!!!
		<div id="host_version" align='right' style="align: right; color: #006666">!!!URL!!! !!!VERSION!!!</div>
		<form action="/edit_settings" method="get">
			<input type="submit" value="Edit settings" class="middle_button" style="margin: 2px;">
		</form>
		<div class="block1" id="login">
			<div class="block2">
				3DPrinterOS Client
			</div>
			<center>
				<div class="block3">
                    <form action="https://!!!URL!!!/streamerapi/cloud_login" method="get" target="_self">
                        <input type="button" value="Autologin" style="background: #ff9900; margin-top: 35px; margin-bottom: 10px;" class="big_button btn-submit">
					</form>
                    <p>
                        OR
                    </p>
                    <form action="/login" method="post">
                        <input type="text" name="login" placeholder="E-mail" class="text_field"><br />
                        <input type="password" name="password" placeholder="Password" class="text_field"><br />
                        <input type="button" value="Enter" style="background: #ff9900; margin-bottom: 0px;" class="big_button btn-submit">
                    </form>
                    <form action="/quit" method="post" >
                        <input type="submit" value="Quit" style="margin-top: 0px; margin-bottom: 10px" class="big_button">
                    </form>
                    <hr color="lightgrey">
					<form action="https://!!!URL!!!/" method="post" target="_blank" >
						<input type="submit" value="I don't have 3DPrinterOS account. Sign up." style="width: 360px; margin-bottom: 0px;font-size: 15px" class="middle_button">
					</form>
					<form action="https://!!!URL!!!/sign/restore" method="post" target="_blank" >
						<input type="submit" value="Forgot your password? Click here to restore." style="width: 360px; margin-top: 0px;font-size: 15px" class="middle_button">
					</form>
				</div>
			</center>
		</div>
        <script src="/static/scripts/jquery-1.11.3.js"></script>
        <script>
		$(document).ready(function(){
            setInterval(function(){
                $.get('/ajax/check_login',function(res){
                    if(res.result) {
                        console.log(res.result); location.reload();
                    }
                });
            }, 2000);
            $(document).on('click','.btn-submit', function(){
				var $btn = $(this);
				$btn.parents('form').submit();
				setTimeout(function () {
					$btn.css({'background-image': 'url(/static/images/preloading.png)'})
						.animate(
							{backgroundPositionX: "-400px"}, 10000, 'linear',
							function(){ $(this).css({'background-image': 'none', 'background-position-x':'0px'}); }
						);
 				}, 1);
            });
		});
		</script>
	</body>
</html>
