[WIP] #8374: Limit post content by rendered height instead of number of characters #968

Merged
wiwie merged 19 commits from develop into develop 2020-03-18 01:48:19 +01:00
2 changed files with 35 additions and 31 deletions
Showing only changes of commit 58030804cb - Show all commits

View file

@ -1,42 +1,41 @@
.wall-item-body-toggle { .wall-item-body-toggle {
width: 100%; width: 100%;
text-align: center; text-align: center;
background-image: linear-gradient(rgba(0,0,0,0), #f6f6f6); background-image: linear-gradient(rgba(0,0,0,0), #f6f6f6);
cursor: pointer; cursor: pointer;
height: 50px; height: 50px;
position: absolute; position: absolute;
top: auto; top: auto;
bottom: 0; bottom: 0;
z-index: 11; z-index: 11;
left: 0; left: 0;
display: none; display: none;
} }
.wall-item-body-toggle-text { .wall-item-body-toggle-text {
width: 100%; width: 100%;
position: absolute; position: absolute;
top: auto; top: auto;
bottom: 0; bottom: 0;
z-index: 12; z-index: 12;
left: 0; left: 0;
text-shadow: 0 0 5px #f6f6f6; text-shadow: 0 0 5px #f6f6f6;
font-weight: bold; font-weight: bold;
background: none!important;
background: none!important; border: none;
border: none; padding: 0!important;
padding: 0!important; cursor: pointer;
cursor: pointer;
} }
.wall-item-body-toggle-text:hover { .wall-item-body-toggle-text:hover {
text-decoration:underline; text-decoration:underline;
} }
.wall-item-body { .wall-item-body {
position: relative; position: relative;
width: 100%; width: 100%;
} }
.wall-item-body-wrapper { .wall-item-body-wrapper {
position: relative; position: relative;
width: 100%; width: 100%;
display: inline-block; display: inline-block;
} }

View file

@ -1,7 +1,9 @@
var nextBodyIdx = 0;
$(document).ready(function(){ $(document).ready(function(){
$("head").append('<style type="text/css"></style>'); $("head").append('<style type="text/css"></style>');
var newStyleElement = $("head").children(':last'); var newStyleElement = $("head").children(':last');
newStyleElement.html('.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden;}'); newStyleElement.html('.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden; display:inline-block;}');
handleNewWallItemBodies(); handleNewWallItemBodies();
@ -19,6 +21,9 @@ function handleNewWallItemBodies() {
return; return;
} }
if (!$el.attr("id")) {
$el.attr("id", nextBodyIdx++);
}
addHeightToggleHandler($el); addHeightToggleHandler($el);
var limited = processHeightLimit($el); var limited = processHeightLimit($el);