From fd84cd7e5804a583889e415da13199de20797de4 Mon Sep 17 00:00:00 2001 From: Niko Date: Mon, 21 Feb 2022 17:53:25 +0100 Subject: [PATCH] Added post collapse fa icon (instead of "view_less/view_more" --- web/src/app/css/app.css | 11 ++++++++++- web/src/app/js/app.js | 4 ++-- web/src/app/js/base.js | 2 ++ web/src/app/js/pages/meet.js | 9 ++++----- web/src/config/lang/en.php | 2 -- web/src/config/lang/es.php | 2 -- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/web/src/app/css/app.css b/web/src/app/css/app.css index 4748dfe..b85b3a3 100644 --- a/web/src/app/css/app.css +++ b/web/src/app/css/app.css @@ -218,6 +218,15 @@ main { padding: 2em; padding-top: .2em; } +*[id*="collapse-link-"][collapsed="true"] .fa { + line-height: 0px !important; +} +*[id*="collapse-link-"] .fa { + font-size: 1.8em; + position: relative; + top: 4px; + line-height: 2em; +} .item .acct { font-size: .8em; @@ -276,7 +285,7 @@ main { border-radius: 2.6em; box-shadow: 0px 0px 2em #00000087; border: 1px solid #00000012; - min-width: 15em; + min-width: 20em; max-width: 90%; margin: 1em auto auto auto; padding: .5em; diff --git a/web/src/app/js/app.js b/web/src/app/js/app.js index 9134ff9..78d838f 100644 --- a/web/src/app/js/app.js +++ b/web/src/app/js/app.js @@ -136,13 +136,13 @@ app.post = { co.style = 'background: #f4f4f436'; setTimeout(function() { co.removeAttribute('style') }, 1000); } - cl.innerText = strs[1]; + cl.innerHTML = strs[1]; cl.parentNode.removeAttribute('collapsed'); cback(id, 'uncollapsed'); } else { app.post._collapsed[id] = true; co.classList.add('collapsed'); - cl.innerText = strs[0]; + cl.innerHTML = strs[0]; cl.parentNode.setAttribute('collapsed', 'true'); cback(id, 'collapsed'); } diff --git a/web/src/app/js/base.js b/web/src/app/js/base.js index 726f9c4..a4e1c0d 100644 --- a/web/src/app/js/base.js +++ b/web/src/app/js/base.js @@ -93,6 +93,8 @@ function animateTimeout(elem, style, time) { elem.classList.remove(style) }, time); } +function fa(icon) { return `` } + function isVisible(element) { const rect = element.getBoundingClientRect(); return ( diff --git a/web/src/app/js/pages/meet.js b/web/src/app/js/pages/meet.js index aa5d1e5..140e9c9 100644 --- a/web/src/app/js/pages/meet.js +++ b/web/src/app/js/pages/meet.js @@ -98,14 +98,13 @@ app.pages.meet = { if (ok && ti > 0) { var value = ptext.innerHTML; const id = 'meet'+item._id; - const t1 = (app.strings.app.view_more || 'view more').replaceAll(/('|")/g, '') + ' >>'; - const t2 = '<< ' + (app.strings.app.view_less || 'view less').replaceAll(/('|")/g, ''); - const act = `app.post.collapse('${id}', ['${t1}', '${t2}'], true, app.pages.meet.onPostCollapse)`; + const act = `app.post.collapse('${id}', [fa('sort-down'), fa('sort-up')], true, app.pages.meet.onPostCollapse)`; value = value.substr(0, gi)+ ` 
${t1}
`; + ` 
`+fa('sort-down')+`
`; ptext.innerHTML = value; if (!app.post.collapsed(id, true)) - app.post.collapse(id, [t1, t2], false, app.pages.meet.onPostCollapse); + app.post.collapse(id, [fa('sort-down'), fa('sort-up')], + false, app.pages.meet.onPostCollapse); } } } diff --git a/web/src/config/lang/en.php b/web/src/config/lang/en.php index 8c2112f..4357547 100644 --- a/web/src/config/lang/en.php +++ b/web/src/config/lang/en.php @@ -13,8 +13,6 @@ $strings = [ 'app' => [ 'years_old' => 'y/o', 'the_fediverse' => 'The Fediverse', - 'view_more' => 'view more', - 'view_less' => 'view less', 'yes' => 'Yes', 'no' => 'No', 'ok' => [ diff --git a/web/src/config/lang/es.php b/web/src/config/lang/es.php index e7cdd14..c967fb2 100644 --- a/web/src/config/lang/es.php +++ b/web/src/config/lang/es.php @@ -13,8 +13,6 @@ $strings = [ 'app' => [ 'years_old' => 'Años', 'the_fediverse' => 'El Fediverso', - 'view_more' => 'ver más', - 'view_less' => 'ver menos', 'yes' => 'Sí', 'no' => 'No', 'ok' => [