Fossil

Check-in [69364ba5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Replaced the forum post DIV ids forum{RID} with post-{short-UUID}, which allowed removal of the new A NAME tag and enables permalinks (RIDs are volatile). Added forumPost class to all post DIVs, to hopefully simplify some upcoming JS code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | forum-reply-links
Files: files | file ages | folders
SHA3-256: 69364ba515eb2bf9259675670d6286c937cd7c33bce23eeb2c0cd2c5e339e2f5
User & Date: stephan 2019-07-02 06:37:15
Context
2019-07-02
07:31
When activating one of the new "in reply to" links, tag the newly-focused post with CSS class forumSelReplyTo so that it can be visually marked. Added default forumSelReplyTo CSS class which uses the same border as forumTime but with a dotted style. EDIT: do not merge with trunk - there are problems to solve (if feasible) regarding linking to edited posts, as their IDs are of course different, as well as linking responses made to deleted posts. Closed-Leaf check-in: 1bf7985d user: stephan tags: forum-reply-links
06:37
Replaced the forum post DIV ids forum{RID} with post-{short-UUID}, which allowed removal of the new A NAME tag and enables permalinks (RIDs are volatile). Added forumPost class to all post DIVs, to hopefully simplify some upcoming JS code. check-in: 69364ba5 user: stephan tags: forum-reply-links
05:53
Switched Immediately-Invoked Function Expression parentheses from Crockford-style to the more conventional/portable style. See https://stackoverflow.com/questions/9053842/ for details. check-in: 5d9d62d8 user: stephan tags: trunk
04:45
Per request in forumpost/9fd5135acc, added intra-document links to each response which link back to the being-replied-to post within the same page (using an #anchor-tag), without reloading from the server. check-in: 78721d4a user: stephan tags: forum-reply-links
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/forum.c.

338
339
340
341
342
343
344
345

346
347


348
349

350
351
352
353
354
355
356
357
358
...
443
444
445
446
447
448
449
450
451
452

453
454
455
456
457
458
459
460
461
462
    Manifest *pPost;
    int isPrivate;        /* True for posts awaiting moderation */
    int sameUser;         /* True if author is also the reader */

    pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
    if( pPost==0 ) continue;
    if( p->fpid==target ){
      @ <div id="forum%d(p->fpid)" class="forumTime forumSel">

    }else if( p->pLeaf!=0 ){
      @ <div id="forum%d(p->fpid)" class="forumTime forumObs">


    }else{
      @ <div id="forum%d(p->fpid)" class="forumTime">

    }
    @ <a name="post-%!S(p->zUuid)"></a>
    if( pPost->zThreadTitle ){
      @ <h1>%h(pPost->zThreadTitle)</h1>
    }
    zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
    @ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
    fossil_free(zDate);
    if( p->pEdit ){
................................................................................
      zUuid = p->pLeaf->zUuid;
      pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
    }else{
      fpid = p->fpid;
      zUuid = p->zUuid;
      pPost = pOPost;
    }
    @ <a name="post-%!S(zUuid)"></a>
    zSel = p->fpid==target ? " forumSel" : "";
    if( p->nIndent==1 ){

      @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'>
    }else{
      @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \
      @ style='margin-left: %d((p->nIndent-1)*3)ex;'>
    }
    pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
    if( pPost==0 ) continue;
    if( pPost->zThreadTitle ){
      @ <h1>%h(pPost->zThreadTitle)</h1>
    }







|
>

<
>
>

<
>

<







 







<


>
|

|







338
339
340
341
342
343
344
345
346
347

348
349
350

351
352

353
354
355
356
357
358
359
...
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460
461
462
463
    Manifest *pPost;
    int isPrivate;        /* True for posts awaiting moderation */
    int sameUser;         /* True if author is also the reader */

    pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
    if( pPost==0 ) continue;
    if( p->fpid==target ){
      @ <div id="post-%!S(p->zUuid)" \
      @ class="forumPost forumTime forumSel">
    }else if( p->pLeaf!=0 ){

      @ <div id="post-%!S(p->zUuid)" \
      @ class="forumPost forumTime forumObs">
    }else{

      @ <div id="post-%!S(p->zUuid)" class="forumPost forumTime">
    }

    if( pPost->zThreadTitle ){
      @ <h1>%h(pPost->zThreadTitle)</h1>
    }
    zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
    @ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
    fossil_free(zDate);
    if( p->pEdit ){
................................................................................
      zUuid = p->pLeaf->zUuid;
      pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
    }else{
      fpid = p->fpid;
      zUuid = p->zUuid;
      pPost = pOPost;
    }

    zSel = p->fpid==target ? " forumSel" : "";
    if( p->nIndent==1 ){
      @ <div id='post-%!S(p->zUuid)' \
      @ class='forumPost forumHierRoot%s(zSel)'>
    }else{
      @ <div id='post-%!S(p->zUuid)' class='forumPost forumHier%s(zSel)' \
      @ style='margin-left: %d((p->nIndent-1)*3)ex;'>
    }
    pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
    if( pPost==0 ) continue;
    if( pPost->zThreadTitle ){
      @ <h1>%h(pPost->zThreadTitle)</h1>
    }

Changes to src/forum.js.

12
13
14
15
16
17
18
19
  if(x[0]){
    var w = window.innerHeight;
    var h = x[0].scrollHeight;
    var y = absoluteY(x[0]);
    if( w>h ) y = y + (h-w)/2;
    if( y>0 ) window.scrollTo(0, y);
  }
}())







|
12
13
14
15
16
17
18
19
  if(x[0]){
    var w = window.innerHeight;
    var h = x[0].scrollHeight;
    var y = absoluteY(x[0]);
    if( w>h ) y = y + (h-w)/2;
    if( y>0 ) window.scrollTo(0, y);
  }
})()