<%
    from urllib.parse import urlencode
%>
<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Tautulli - ${title} | ${server_name}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" sizes="32x32" href="${http_root}images/favicon/favicon-32x32.png?v=2.6.0">
    <link rel="icon" type="image/png" sizes="16x16" href="${http_root}images/favicon/favicon-16x16.png?v=2.6.0">
    <link rel="shortcut icon" href="${http_root}images/favicon/favicon.ico?v=2.6.0">
    <link href="${http_root}css/tautulli.css${cache_param}" rel="stylesheet">
    <style>
        * {
            padding: 0 !important;
            margin: 0 !important;
        }
    </style>
</head>

<body>
<div id="loader" class="newsletter-loader-container">
    <div class="newsletter-loader-message">
        <div class="newsletter-loader"></div>
        <br>
        Generating Newsletter
        <br>
        Please wait, this may take a few minutes...
    </div>
</div>

<script src="${http_root}js/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
    var frame = $('<iframe></iframe>', {
        src: 'real_newsletter?${urlencode(kwargs) | n}',
        frameborder: '0',
        style: 'display: none; height: 100vh; width: 100vw;'
    });
    frame.on('load', function (e) {
        $(e.target).fadeIn();
        $('#loader').fadeOut();
    });
    $('body').append(frame);
});
</script>

</body>
</html>
