<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>FreeGo</title>
    <style>
        * {
            font-family: 'Avenir Next', Avenir, 'Helvetica Neue', Helvetica, 'Franklin Gothic Medium', 'Franklin Gothic', 'ITC Franklin Gothic', Arial, sans-serif;
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            background: #ebebeb;
        }
        header {
            background: #fff;
            padding: 60px 0 50px 0;
        }
        header .title {
            text-align: center;
            color: #d55;
            font-size: 40px;
            margin-bottom: 20px;
        }
        header p {
            text-align: center;
            font-size: 16px;
            line-height: 25px;
        }
        a {
            color: #d55;
        }
        .container {
            border-radius: 4px;
            padding: 20px;
            background: #fff;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            margin: 20px 10px;
        }
        .ip-blocked p {
            float: left;
            font-size: 14px;
            line-height: 18px;
        }
        .ip-blocked .ip {
            color: #d55;
        }
        .btn {
            border: none;
            background: #d55;
            border-radius: 4px;
            color: #fff;
            padding: 10px 20px;
            font-weight: bold;
            outline: none;
        }
        #clear-btn, #confirm-btn {
            float: right;
        }
        #password {
            background: #ebebeb;
            border: #7d7d7d;
            border-radius: 4px;
            padding: 10px;
            width: 100%;
            display: block;
            margin-bottom: 10px;
            outline: none;
        }
    </style>
    <script>
        function getExpires(date)
        {
            var expires = new Date();
            expires.setMilliseconds(expires.getMilliseconds() + date * 864e+5);

            return expires.toUTCString();
        }
    </script>
</head>
<body>
<header>
    <h1 class="title">FreeGo</h1>
    <p>
        Proxy for Redirecting Requests<br/>
        View it on <a href="https://github.com/surunzi/freego">GitHub</a>
    </p>
</header>
<div class="container ip-blocked">
    <p>IP <span class="ip">{{ip}}</span><br/>is blocked!</p>
    <button id="clear-btn" class="btn">Leave</button>
    <script>
        var clearBtn = document.getElementById('clear-btn'),
            cookie = 'free_go_proxy=0;domain={{target.domain}};path={{target.path}};expires=' + getExpires(-1);

        clearBtn.onclick = function ()
        {
            document.cookie = cookie;
            location.reload();
        };
    </script>
</div>
{{#if password}}
<div class="container">
    <input id="password" type="password" placeholder="Password"/>
    <button id="confirm-btn" class="btn">Confirm</button>
</div>
<script>
    var confirmBtn = document.getElementById('confirm-btn');

    confirmBtn.onclick = function ()
    {
        var password = document.getElementById('password').value;

        document.cookie = 'free_go_password=' + password + ';domain={{target.domain}};path={{target.path}};expires=' + getExpires(30);
        location.reload();
    };
</script>
{{/if}}
</body>
</html>