Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Very rough proof-of-concept for a pure-CSS expand/collapse option for forum posts. Demonstrates the capability but is far from polished enough to bring online. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | forum-expand-poc |
| Files: | files | file ages | folders |
| SHA3-256: |
be157e46f03257e7128634ca2257fb7c |
| User & Date: | stephan 2020-07-09 15:35:16.995 |
Context
|
2020-07-09
| ||
| 15:59 | Expand/collapse toggle is no longer 100% wide. ... (check-in: bb333b0bd9 user: stephan tags: forum-expand-poc) | |
| 15:35 | Very rough proof-of-concept for a pure-CSS expand/collapse option for forum posts. Demonstrates the capability but is far from polished enough to bring online. ... (check-in: be157e46f0 user: stephan tags: forum-expand-poc) | |
| 14:53 | Change the height at which scrolling kicks in for forum posts from 40em to 100em. This is an experiment. ... (check-in: 29f7da9318 user: drh tags: trunk) | |
Changes
Changes to src/default.css.
| ︙ | ︙ | |||
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 |
}
div.forumHier, div.forumTime {
border: 1px solid black;
padding-left: 1ex;
padding-right: 1ex;
margin-top: 1ex;
}
div.forumPostBody {
max-height: 100em;
overflow: auto;
}
div.forumSel {
background-color: #cef;
}
div.forumObs {
color: #bbb;
}
#capabilitySummary {
text-align: center;
}
#capabilitySummary td {
padding-left: 3ex;
padding-right: 3ex;
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 |
}
div.forumHier, div.forumTime {
border: 1px solid black;
padding-left: 1ex;
padding-right: 1ex;
margin-top: 1ex;
}
div.forumHier, div.forumTime, div.forumHierRoot {
display: flex;
flex-direction: column;
}
div.forumPostBody {
max-height: 100em;
overflow: auto;
}
div.forumSel {
background-color: #cef;
}
div.forumObs {
color: #bbb;
}
input[type=checkbox].forum-post-collapser {
opacity: 0;
position: absolute;
z-index: -1;
}
input[type=checkbox].forum-post-collapser:checked ~ label.forum-post-collapser::before {
content: "Collapse";
}
input[type=checkbox].forum-post-collapser:not(:checked) ~ label.forum-post-collapser::before {
content: "Expand";
}
label.forum-post-collapser {
display: block;
border: 1px outset;
border-radius: 0.25em;
}
input[type=checkbox].forum-post-collapser:not(:checked) ~ div.forumPostBody {
max-height: 10em;
}
input[type=checkbox].forum-post-collapser:checked ~ div.forumPostBody {
max-height: 200em;
}
#capabilitySummary {
text-align: center;
}
#capabilitySummary td {
padding-left: 3ex;
padding-right: 3ex;
}
|
| ︙ | ︙ |
Changes to src/forum.c.
| ︙ | ︙ | |||
400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
}else{
zResult = fossil_strdup(zLogin);
}
db_reset(&q);
return zResult;
}
/*
** Display all posts in a forum thread in chronological order
*/
static void forum_display_chronological(int froot, int target, int bRawMode){
ForumThread *pThread = forumthread_create(froot, 0);
ForumEntry *p;
| > > > > > > > > > > > > > > > > | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
}else{
zResult = fossil_strdup(zLogin);
}
db_reset(&q);
return zResult;
}
/*
** Emits a checkbox and label for implementing a CSS-only
** collapse/expand button on posts. It should be passed the UUID of
** the current post, but that value is only used for constructing a
** unique ID for the (invisible) checkbox so that the label can be
** bound to it via its 'for' attribute. Thus it doesn't really matter
** whether the UUID refers to the current (edited) instance of the
** post or an ancestor version, so long as the UUID is unique within
** the current page.
*/
static void forum_emit_post_toggle(const char * zUuid){
@ <input type='checkbox' id='cb-post-%S(zUuid)' \
@ class='forum-post-collapser'>
@ <label for='cb-post-%S(zUuid)' \
@ class='forum-post-collapser'></label>
}
/*
** Display all posts in a forum thread in chronological order
*/
static void forum_display_chronological(int froot, int target, int bRawMode){
ForumThread *pThread = forumthread_create(froot, 0);
ForumEntry *p;
|
| ︙ | ︙ | |||
467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
}
if( !bRawMode ){
@ %z(href("%R/forumpost/%S?raw",zUuid))[source]</a>
}
isPrivate = content_is_private(p->fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@ </h3>
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
const char *zMimetype;
if( bRawMode ){
zMimetype = "text/plain";
}else if( p->pLeaf!=0 ){
| > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
}
if( !bRawMode ){
@ %z(href("%R/forumpost/%S?raw",zUuid))[source]</a>
}
isPrivate = content_is_private(p->fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@ </h3>
forum_emit_post_toggle(p->zUuid);
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
const char *zMimetype;
if( bRawMode ){
zMimetype = "text/plain";
}else if( p->pLeaf!=0 ){
|
| ︙ | ︙ | |||
582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
@ %z(href("%R/forumpost/%S?t=c",zUuid))[link]</a>
if( !bRawMode ){
@ %z(href("%R/forumpost/%S?raw",zUuid))[source]</a>
}
isPrivate = content_is_private(p->fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@ </h3>
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, bRawMode?"text/plain":pPost->zMimetype, pPost->zWiki,
0, 1);
}
if( g.perm.WrForum && p->pLeaf==0 ){
| > | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 |
@ %z(href("%R/forumpost/%S?t=c",zUuid))[link]</a>
if( !bRawMode ){
@ %z(href("%R/forumpost/%S?raw",zUuid))[source]</a>
}
isPrivate = content_is_private(p->fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
@ </h3>
forum_emit_post_toggle(zUuid);
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, bRawMode?"text/plain":pPost->zMimetype, pPost->zWiki,
0, 1);
}
if( g.perm.WrForum && p->pLeaf==0 ){
|
| ︙ | ︙ | |||
709 710 711 712 713 714 715 716 717 718 719 720 721 722 |
while( pIrt && pIrt->fpid!=p->mfirt ) pIrt = pIrt->pPrev;
if( pIrt ){
@ in reply to %z(href("%R/forumpost/%S?t=h",pIrt->zUuid))\
@ %d(pIrt->sid)</a>
}
}
@ </h3>
isPrivate = content_is_private(fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, pPost->zMimetype, pPost->zWiki, 0, 1);
}
| > | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
while( pIrt && pIrt->fpid!=p->mfirt ) pIrt = pIrt->pPrev;
if( pIrt ){
@ in reply to %z(href("%R/forumpost/%S?t=h",pIrt->zUuid))\
@ %d(pIrt->sid)</a>
}
}
@ </h3>
forum_emit_post_toggle(zUuid);
isPrivate = content_is_private(fpid);
sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0;
if( isPrivate && !g.perm.ModForum && !sameUser ){
@ <p><span class="modpending">Awaiting Moderator Approval</span></p>
}else{
forum_render(0, pPost->zMimetype, pPost->zWiki, 0, 1);
}
|
| ︙ | ︙ |