<html>
<head>
    <link rel="stylesheet" type="text/css" href="<%= cdnURL %>/css/juxt.css">
    <script src="<%= cdnURL %>/js/pjax.min.js"></script>
    <script src="<%= cdnURL %>/js/juxt.js"></script>
    <!-- Google Analytics -->
    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

        ga('create', 'UA-195842548-1', 'auto');
        ga('send', 'pageview');
    </script>
    <!-- End Google Analytics -->

</head>
<body>
<%- include('nav_bar', { selection: 4 }); %>
<div id="main">
    <h1 id="title" class="page-header">Notifications</h1>

    <div class="community-page-posts-wrapper">
        <table cellspacing="0">
            <tbody id="messages-list">
            <% if(user.notification_list.length === 0) {%>
                <p class="no-posts-text"><%= lang.notifications.none %></p>
            <%} else { %>
                <% for(let i = user.notification_list.length - 1; i >= 0; i--) { %>
                    <% var content; if(user.notification_list[i].content.indexOf('NEW_FOLLOWER') !== -1) content = user.notification_list[i].content.replace('NEW_FOLLOWER', lang.notifications.new_follower); else content = user.notification_list[i].content %>
                    <% if(i === user.notification_list.length - 1) { %>
                    <tr class="message-wrapper" data-pjax="<%=user.notification_list[i].link%>">
                        <td class="messages-unread-badge-wrapper top">
                            <%if(!user.notification_list[i].read) {%><div class="unread-badge"></div><%}%>
                        </td>
                        <td class="messages-list-wrapper top">
                            <h3 class="notifications-list-content"><%= content %><span style="color: rgba(113,141,148,1)"> - <%= moment(user.notification_list[i].created_at).fromNow() %></span></h3>
                        </td>
                    </tr>
                    <%} else {%>
                    <tr class="message-wrapper" data-pjax="<%=user.notification_list[i].link%>">
                        <td class="messages-unread-badge-wrapper">
                            <%if(!user.notification_list[i].read) {%><div class="unread-badge"></div><%}%>
                        </td>
                        <td class="messages-list-wrapper">
                            <h3 class="notifications-list-content"><%= content %><span style="color: rgba(113,141,148,1)"> - <%= moment(user.notification_list[i].created_at).fromNow() %></span></h3>
                        </td>
                    </tr>
                    <%}%>
                <%}%>
            <%}%>
            </tbody>
        </table>
    </div>
    <img src="" onerror="wiiuBrowser.showLoadingIcon(!1);window.scroll(0, 0);">
</div>
<body onload="stopLoading();wiiuBrowser.lockUserOperation(false);">
</body>
</html>
