<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: 0 }); %>
<div id="main">
    <div id="windowOverlay" class="overlay" style="margin-bottom: 0">
        <div class="overlay-content">
            <div id="post-window" class="post-wrapper">
                <!--Start of Main Post-->
                <form action="/users/me" method="post" enctype="multipart/form-data">
                    <table>
                        <tr>
                            <td class="post-close-button-wrapper">
                                <div class="post-close-button" onclick="hideOverlay()" ><%= lang.global.close %></div>
                            </td>
                            <td>
                                <input type="submit" value="<%= lang.global.save %>" class="submit-button" onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1);wiiuSound.playSoundByName('BGM_OLV_MAIN_LOOP_NOWAIT', 3);">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h1 class="communities-header" style="padding-left: 75px; padding-top: 50px"><%= lang.user_settings.profile_settings %></h1>
                            </td>
                        </tr>
                        <tr></tr>
                        <tr>
                            <td style="padding-left: 75px;">
                                <label class="checkbox-container"><%= lang.user_settings.show_country %>
                                    <input type="checkbox" id="country" name="country" value="true" onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1);" <%if(user.country_visibility){%>checked="checked"<%}%>>
                                    <span class="checkmark"></span>
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left: 75px;">
                                <label class="checkbox-container"><%= lang.user_settings.show_birthday %>
                                    <input type="checkbox" id="birthday" name="birthday" value="true" onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1);" <%if(user.birthday_visibility){%>checked="checked"<%}%>>
                                    <span class="checkmark"></span>
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left: 75px;">
                                <label class="checkbox-container"><%= lang.user_settings.show_game %>
                                    <input type="checkbox" id="experience" name="experience" value="true" onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1);" <%if(user.game_skill_visibility){%>checked="checked"<%}%>>
                                    <span class="checkmark"></span>
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left: 75px;">
                                <label class="checkbox-container"><%= lang.user_settings.show_comment %>
                                    <input type="checkbox" id="commentShow" name="commentShow" value="true" onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1);" <%if(user.profile_comment_visibility){%>checked="checked"<%}%>>
                                    <span class="checkmark"></span>
                                </label>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-left: 75px;">
                                <label for="comment" style="font-size: xx-large"><%= lang.user_settings.profile_comment %></label>
                                <input type="text" id="comment" name="comment" class="user-input-text-area" maxlength="150" value="<%= user.profile_comment %>" onchange="if(wiiuFilter.checkWord(this.value) === -2) { this.value = ''; alert('<%= lang.user_settings.swearing %>');}">
                            </td>
                            <br>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
    <div class="community-page-header" style="background: #673DB6; margin-left: -75px; width: 1165px !important;"></div>
    <div class="user-page-back-button" onclick="back()">
        <p class="user-page-back-button-text"><%= lang.global.go_back %></p>
    </div>
    <div class="community-page-info-container">
        <div class="community-page-action-button-wrapper">
            <div class="user-page-follow-button-wrapper" <%if(user.pid === 1000000000 || user.account_status !== 0) {%> style="display: none" <%}%>>
                <p class="user-page-follow-button-text" onclick="showOverlay()"><%= lang.user_settings.profile_settings %></p>
            </div>
        </div>
        <%if(user.official) {%>
            <img class="community-page-info-icon verified" src="<%= mii_image_CDN %>/<%= user.pid %>/normal_face.png">
            <span class="community-page-verified-user-badge community-page-verified" style="margin-left: 110px;margin-top: 5px;"></span>
        <%} else {%>
            <img class="community-page-info-icon" src="<%= mii_image_CDN %>/<%= user.pid %>/normal_face.png">
            <span class="community-page-verified-user-badge community-page-verified" style="display: none;"></span>
        <%}%>
        <h2 class="community-page-title"><%= user.user_id %> (<%= user.pnid %>)</h2>
        <h4 class="community-page-description"><%if(user.profile_comment_visibility){%> <%= user.profile_comment %> <%}else {%><%= lang.global.private %><%}%></h4>
        <div class="community-page-margin-line"></div>
        <table class="community-page-table-wrapper">
            <tbody>
            <tr>
                <td>
                    <div class="community-page-shaded-info-container">
                        <h4 class="community-page-table-label"><%= lang.user_page.country %></h4>
                        <h4 class="community-page-table-text"><%if(user.country_visibility){%><%=user.country%><%}else {%><%= lang.global.private %><%}%></h4>
                    </div>
                </td>
                <td>
                    <div class="community-page-shaded-info-container">
                        <h4 class="community-page-table-label"><%= lang.user_page.birthday %></h4>
                        <h4 class="community-page-table-text"><%if(user.birthday_visibility){%><%=moment.utc(user.birthday).format("MMM Do")%><%}else {%><%= lang.global.private %><%}%></h4>
                    </div>
                </td>
                <td>
                    <div class="community-page-shaded-info-container">
                        <h4 class="community-page-table-label"><%= lang.user_page.game_experience %></h4>
                        <h4 class="community-page-table-text">
                            <%if(user.game_skill_visibility){%>
                            <%if(user.game_skill === 0) {%>
                                <%= lang.setup.experience_text.beginner %>
                            <%} else if(user.game_skill === 1) {%>
                                <%= lang.setup.experience_text.intermediate %>
                            <%} else if(user.game_skill === 2) {%>
                                <%= lang.setup.experience_text.expert %>
                            <%} else {%>
                                N/A
                            <%}%>
                            <%}else {%>
                                <%= lang.global.private %>
                            <%}%>
                        </h4>
                    </div>
                </td>
                <td>
                    <div class="community-page-shaded-info-container">
                        <h4 class="community-page-table-label"><%= lang.global.yeahs %></h4>
                        <h4 class="community-page-table-text">0</h4>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div>
        <table class="user-page-tab-table">
            <tbody>
            <tr>
                <td onclick="switchUserPageTabs(0, '<%= user.pid %>')">
                    <div class="user-page-tab left selected" id="user-page-posts-tab">
                        <%=numPosts%> <%= lang.user_page.posts %>
                    </div>
                    <div class="user-page-tab-triangle selected" id="user-page-posts-triangle"></div>
                </td>
                <td onclick="switchUserPageTabs(1, '<%= user.pid %>')">
                    <div class="user-page-tab" id="user-page-friends-tab">
                        0 <%= lang.user_page.friends %>
                    </div>
                    <div class="user-page-tab-triangle" id="user-page-friends-triangle"></div>
                </td>
                <td onclick="switchUserPageTabs(2, '<%= user.pid %>')">
                    <div class="user-page-tab" id="user-page-following-tab">
                        <%= user.following %> <%= lang.user_page.following %>
                    </div>
                    <div class="user-page-tab-triangle" id="user-page-following-triangle"></div>
                </td>
                <td onclick="switchUserPageTabs(3, '<%= user.pid %>')">
                    <div class="user-page-tab right" id="user-page-followers-tab">
                        <%= user.followers %> <%= lang.user_page.followers %>
                    </div>
                    <div class="user-page-tab-triangle" id="user-page-followers-triangle"></div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div class="community-page-post-box" <% if(numPosts === 0) {%>style="height: 110px"<%}%>>
        <% if(numPosts === 0) {%>
            <p class="no-posts-text"><%= lang.global.no_posts %></p>
        <%} else { %>
            <button id="load-more-posts-button" data-offset="20" onclick="loadUserPosts(this, '<%= user.pid %>')"><%= lang.global.more %></button>
            <% newPosts.forEach(function(post) { %>
                <%- include('post_template', { post: post, mii_image_CDN: mii_image_CDN, lang: lang, reply: false  }); %>
            <% }); %>
        <%}%>
    </div>
    <br>
    <img src="" onerror="wiiuBrowser.showLoadingIcon(!1);window.scroll(0, 0);">
</div>
<br>
<body onload="stopLoading(); wiiuBrowser.showLoadingIcon(!1);wiiuBrowser.lockUserOperation(false);">
</body>
</html>
