<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Redeye - {{ project }}</title>
    {{ JSGlue.include() }}
    <link rel="icon" href="{{ url_for('static', filename='pics/redeye.ico') }}" type="image/x-icon" />
    <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap-4.4.1-dist/css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap-4.4.1-dist/css/all.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/jquery.flowchart.css') }}">
    <script>
        function getCookie(cname) {
            var name = cname + "=";
            var decodedCookie = decodeURIComponent(document.cookie);
            var ca = decodedCookie.split(';');
            for (var i = 0; i < ca.length; i++) {
                var c = ca[i];
                while (c.charAt(0) == ' ') {
                    c = c.substring(1);
                }
                if (c.indexOf(name) == 0) {
                    return c.substring(name.length, c.length);
                }
            }
            return "";
        };

        function parseJwt() {
            var token = getCookie("reduser");
            var base64Url = token.split('.')[1];
            var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
            var jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
                return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
            }).join(''));

            document.getElementById('user_span').innerHTML = "@" + JSON.parse(jsonPayload).user;
            return 1;
            // return JSON.parse(jsonPayload);
        };
    </script>
    {% if msg %}
    <script>
        alert("{{ msg }}")
    </script>
    {% endif %}