From 949e66493cfc5bd774acc1e2e6dd576d556c00ca Mon Sep 17 00:00:00 2001 From: CaramelKat <32065563+caramelkat@users.noreply.github.com> Date: Wed, 15 Sep 2021 00:14:42 -0500 Subject: [PATCH] Added support for hiding spoilers. Added new notification when a user responds to your post --- src/services/juxt-web/routes/portal/posts.js | 10 ++---- src/webfiles/portal/community.ejs | 2 +- src/webfiles/portal/css/juxt.css | 36 +++++++++++++++++--- src/webfiles/portal/js/juxt.js | 5 +++ src/webfiles/portal/me_page.ejs | 2 +- src/webfiles/portal/notifications.ejs | 6 +--- src/webfiles/portal/post_template.ejs | 7 ++-- src/webfiles/portal/user_page.ejs | 2 +- 8 files changed, 49 insertions(+), 21 deletions(-) diff --git a/src/services/juxt-web/routes/portal/posts.js b/src/services/juxt-web/routes/portal/posts.js index 51fc009..681a131 100644 --- a/src/services/juxt-web/routes/portal/posts.js +++ b/src/services/juxt-web/routes/portal/posts.js @@ -77,11 +77,6 @@ router.get('/:post_id', function (req, res) { lang: lang, mii_image_CDN: config.mii_image_CDN }); - user.notification_list.filter(noti => noti.read === false).forEach(function(notification) { - notification.read = true; - }); - user.markModified('notification_list'); - user.save(); }).catch(error => { console.log(error); res.set("Content-Type", "application/xml"); @@ -145,7 +140,7 @@ router.post('/:post_id/new', upload.none(), async function (req, res, next) { feeling_id: req.body.emotion, id: snowflake.nextId(), is_autopost: req.body.is_autopost, - is_spoiler: req.body.is_spoiler, + is_spoiler: (req.body.spoiler) ? 1 : 0, is_app_jumpable: req.body.is_app_jumpable, language_id: req.body.language_id, mii: usrObj.mii, @@ -158,6 +153,7 @@ router.post('/:post_id/new', upload.none(), async function (req, res, next) { }; const newPost = new POST(document); newPost.save(); + await database.pushNewNotificationByPID(parentPost.pid, usrObj.user_id + ' replied to your post!', '/posts/' + parentPost.id) res.redirect('/posts/' + req.params.post_id.toString()); } } @@ -223,7 +219,7 @@ router.post('/new', upload.none(), async function (req, res, next) { feeling_id: req.body.emotion, id: snowflake.nextId(), is_autopost: req.body.is_autopost, - is_spoiler: req.body.is_spoiler, + is_spoiler: (req.body.spoiler) ? 1 : 0, is_app_jumpable: req.body.is_app_jumpable, language_id: req.body.language_id, mii: usrObj.mii, diff --git a/src/webfiles/portal/community.ejs b/src/webfiles/portal/community.ejs index 6ae22f3..ff8282e 100644 --- a/src/webfiles/portal/community.ejs +++ b/src/webfiles/portal/community.ejs @@ -126,7 +126,7 @@
-
+

Go back

style="display: none" <%}%>> diff --git a/src/webfiles/portal/css/juxt.css b/src/webfiles/portal/css/juxt.css index aea3950..e14d496 100644 --- a/src/webfiles/portal/css/juxt.css +++ b/src/webfiles/portal/css/juxt.css @@ -1035,6 +1035,7 @@ h4 { .community-page-info-icon { width: 100px; + height: 100px; border-radius: 10px; margin: 20px; float: left; @@ -1050,9 +1051,12 @@ h4 { .community-page-description { margin-top: 5px; position: absolute; - margin-left: 140px; + margin-left: 150px; width: 550px; + max-width: 500px; + line-break: anywhere; line-height: 20px; + overflow: hidden; } .community-page-posts-wrapper { @@ -1094,7 +1098,6 @@ h4 { } .community-page-post-screenshot { - margin-top: 20px; width: 760px; border-radius: 10px; margin-bottom: 20px; @@ -1218,6 +1221,8 @@ h4 { .community-page-post-username { padding-top: 20px; margin-bottom: 0; + min-width: 140px; + max-width: 340px; } .community-page-post-text-overlay { @@ -1425,8 +1430,8 @@ iframe { font-size: large; border-width: 0; border-radius: 15px; - bottom: 15px; - left: 430px + bottom: -70px; + left: 430px; } #user-new-post-wrapper { @@ -1808,6 +1813,7 @@ iframe { border: 1.5px solid #ffffff00; border-radius: 10px; margin-top: 40px; + margin-bottom: 55px; width: 1060px; min-height: 190px; } @@ -1862,4 +1868,26 @@ iframe { .replies-line:last-child { display:none; +} + +.spoiler-overlay { + display: grid; + height: 100px; + width: 793px; + margin-left: 10px; + margin-bottom: -10px; + z-index: 10; +} + +.spoiler-overlay > button { + width: 775px; + height: 70px; + margin: auto; + background: #673DB6; + color: white; + font-size: large; + border-width: 0; + border-radius: 15px; + box-shadow: 0 3px 20px 2px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 0 3px 20px 2px rgba(0, 0, 0, 0.5); } \ No newline at end of file diff --git a/src/webfiles/portal/js/juxt.js b/src/webfiles/portal/js/juxt.js index 1e4b1b2..e2c9bb0 100644 --- a/src/webfiles/portal/js/juxt.js +++ b/src/webfiles/portal/js/juxt.js @@ -119,6 +119,11 @@ function exit() { wiiuBrowser.closeApplication(); } } +function back() { + wiiuSound.playSoundByName('SE_WAVE_MENU', 1); + wiiuBrowser.showLoadingIcon(!0); + window.history.back(); +} function showOverlay() { wiiuSound.playSoundByName('SE_OLV_OK', 1) wiiuSound.playSoundByName('BGM_OLV_SETTING', 3) diff --git a/src/webfiles/portal/me_page.ejs b/src/webfiles/portal/me_page.ejs index 462bbf4..7c7d8d3 100644 --- a/src/webfiles/portal/me_page.ejs +++ b/src/webfiles/portal/me_page.ejs @@ -84,7 +84,7 @@
-
+

<%= lang.global.go_back %>

diff --git a/src/webfiles/portal/notifications.ejs b/src/webfiles/portal/notifications.ejs index 33e5b79..68077e5 100644 --- a/src/webfiles/portal/notifications.ejs +++ b/src/webfiles/portal/notifications.ejs @@ -27,7 +27,7 @@ <% if(user.notification_list.length === 0) {%>

<%= lang.notifications.none %>

<%} else { %> - <% let i = 0; user.notification_list.reverse().forEach(function(notification) { %> + <% let i = 0; user.notification_list.forEach(function(notification) { %> <% if(i === 0) { %> @@ -49,10 +49,6 @@ <%}%> <%});%> - - - - <%}%> diff --git a/src/webfiles/portal/post_template.ejs b/src/webfiles/portal/post_template.ejs index e8b04fe..b3213fe 100644 --- a/src/webfiles/portal/post_template.ejs +++ b/src/webfiles/portal/post_template.ejs @@ -8,7 +8,7 @@ <%}%>

<%= post.screen_name %>

-

<%= moment(post.created_at).fromNow() %> -

<%= communityMap.get(post.community_id) %>

+

<%= moment(post.created_at).fromNow() %> -

<%= communityMap.get(post.community_id) %>

@@ -26,7 +26,10 @@
<%= post.empathy_count %> <%= lang.global.yeahs %>
-
onclick="pjax.loadUrl('/posts/<%= post.id%>')"<%}%>> +
style="display: none"<%}%>> + +
+
onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1); pjax.loadUrl('/posts/<%= post.id%>')"<%}%> <% if(post.is_spoiler === 1) {%>style="display: none"<%}%>> <% if(post.body !== '' && post.painting === '' && post.screenshot === '' && !post.url) { %>

<%= post.body %>

<%} else { %> diff --git a/src/webfiles/portal/user_page.ejs b/src/webfiles/portal/user_page.ejs index cae6817..5d7a7d3 100644 --- a/src/webfiles/portal/user_page.ejs +++ b/src/webfiles/portal/user_page.ejs @@ -25,7 +25,7 @@ <%- include('nav_bar', { selection: -1 }); %>
-
+

<%= lang.global.go_back %>