[WIP] #8374: Limit post content by rendered height instead of number of characters #968
No reviewers
Labels
No labels
2018.09
2019.01
2019.03
2019.06
2019.09
2019.12
2020.03
2020.06
2020.09
2020.12
2021.03
2021.07
2021.09
2022.02
2022.06
2022.09
2022.12
2023.04
2023.05
2023.09
2024.03
2024.06
2024.09
2024.12
dependencies
Hackathon 2021
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: friendica/friendica-addons#968
Loading…
Reference in a new issue
No description provided.
Delete branch "develop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Initial implementation as addon.
Thank you for your work, here's my feedback.
If I wanted to make the limit-height a addon setting; how would I go about that? I can't really figure out how I could inject the setting value into the JS and CSS files.
I can see two ways:
Ok, I can't figure out either of them; are there any examples for either approach?
(1) Does this mean to implement showmore_dyn_module()/showmore_dyn_content() and then somehow adding /showmore_dyn/X to the page header/footer?
(2) The registerFooterScript only takes a path to a JS file; if I'm getting you right, you mean I'd write the JS to a string and somehow add it to the dynamically in the code?
DI::page()['htmlhead'] .= '<script>var postHeightLimit = ' . intval($configValue) . ';</script>';
great, got it - thanks!
Addressed all your comments; except your question regarding "is wrapper needed". Are you ok with leaving it as is?
More feedback, for each code standards requests please check the whole file as I didn't repeat them for multiple instances.
Is there a good IDE I can use that does the source formatting automatically? I've been using vim so far but it's a pain to do this manually...
I'm used to eclipse for other programming languages, so that would be the easiest if I could just somehow import friendica as a new project.
If you install the editorconfig and the vim addon, then the basic stuff of formatting will be done automatically. But the enclosure of oberators with spaces e.g. not. There are linter addons for vim as well, which wont do it automatically, but tell you about code problems while in visual mode.
Addressed all comments.
I used the vim Autoformat plugin and double checked all formatting issues. I hope I didn't miss any...
If you did I'll be sure to mention them!
Please remove the wrapper.
Additionally, the height limit shouldn't trigger when viewing a single thread(
/display/...
). I suggest you check for the URL pattern since the HTML will vary greatly between themes.Okay. Are you confident that your approach works for all themes and all cases? So is it always like that that there is nothing else added to the content div after the body div? Because otherwise the show more would be placed too low and not at the bottom of the content body.
Edit: Okay, I think I misunderstood you. You suggested to add the toggle div directly to the body div, right? This is what I now tried, and - to my surprise - it works flawlessly. CSS is and will always be a great mystery to me ;-) Plus, I could throw out about half of the CSS statements and they didn't change a thing.
Thank you for your work! Since we are in Release Candidate period, this addon will be officially released in June with the Friendica 2020.06 version. Admins running the
develop
branch will be able to enable the addon sooner.Thanks for your help 😊