Fossil SCM

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.

stephan 2019-07-02 06:37 forum-reply-links merge
Commit 69364ba515eb2bf9259675670d6286c937cd7c33bce23eeb2c0cd2c5e339e2f5
3 files changed +8 -7 +8 -7 +1 -1
+8 -7
--- src/forum.c
+++ src/forum.c
@@ -340,17 +340,18 @@
340340
int sameUser; /* True if author is also the reader */
341341
342342
pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
343343
if( pPost==0 ) continue;
344344
if( p->fpid==target ){
345
- @ <div id="forum%d(p->fpid)" class="forumTime forumSel">
345
+ @ <div id="post-%!S(p->zUuid)" \
346
+ @ class="forumPost forumTime forumSel">
346347
}else if( p->pLeaf!=0 ){
347
- @ <div id="forum%d(p->fpid)" class="forumTime forumObs">
348
+ @ <div id="post-%!S(p->zUuid)" \
349
+ @ class="forumPost forumTime forumObs">
348350
}else{
349
- @ <div id="forum%d(p->fpid)" class="forumTime">
351
+ @ <div id="post-%!S(p->zUuid)" class="forumPost forumTime">
350352
}
351
- @ <a name="post-%!S(p->zUuid)"></a>
352353
if( pPost->zThreadTitle ){
353354
@ <h1>%h(pPost->zThreadTitle)</h1>
354355
}
355356
zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
356357
@ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
@@ -445,16 +446,16 @@
445446
}else{
446447
fpid = p->fpid;
447448
zUuid = p->zUuid;
448449
pPost = pOPost;
449450
}
450
- @ <a name="post-%!S(zUuid)"></a>
451451
zSel = p->fpid==target ? " forumSel" : "";
452452
if( p->nIndent==1 ){
453
- @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'>
453
+ @ <div id='post-%!S(p->zUuid)' \
454
+ @ class='forumPost forumHierRoot%s(zSel)'>
454455
}else{
455
- @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \
456
+ @ <div id='post-%!S(p->zUuid)' class='forumPost forumHier%s(zSel)' \
456457
@ style='margin-left: %d((p->nIndent-1)*3)ex;'>
457458
}
458459
pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
459460
if( pPost==0 ) continue;
460461
if( pPost->zThreadTitle ){
461462
--- src/forum.c
+++ src/forum.c
@@ -340,17 +340,18 @@
340 int sameUser; /* True if author is also the reader */
341
342 pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
343 if( pPost==0 ) continue;
344 if( p->fpid==target ){
345 @ <div id="forum%d(p->fpid)" class="forumTime forumSel">
 
346 }else if( p->pLeaf!=0 ){
347 @ <div id="forum%d(p->fpid)" class="forumTime forumObs">
 
348 }else{
349 @ <div id="forum%d(p->fpid)" class="forumTime">
350 }
351 @ <a name="post-%!S(p->zUuid)"></a>
352 if( pPost->zThreadTitle ){
353 @ <h1>%h(pPost->zThreadTitle)</h1>
354 }
355 zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
356 @ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
@@ -445,16 +446,16 @@
445 }else{
446 fpid = p->fpid;
447 zUuid = p->zUuid;
448 pPost = pOPost;
449 }
450 @ <a name="post-%!S(zUuid)"></a>
451 zSel = p->fpid==target ? " forumSel" : "";
452 if( p->nIndent==1 ){
453 @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'>
 
454 }else{
455 @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \
456 @ style='margin-left: %d((p->nIndent-1)*3)ex;'>
457 }
458 pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
459 if( pPost==0 ) continue;
460 if( pPost->zThreadTitle ){
461
--- src/forum.c
+++ src/forum.c
@@ -340,17 +340,18 @@
340 int sameUser; /* True if author is also the reader */
341
342 pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
343 if( pPost==0 ) continue;
344 if( p->fpid==target ){
345 @ <div id="post-%!S(p->zUuid)" \
346 @ class="forumPost forumTime forumSel">
347 }else if( p->pLeaf!=0 ){
348 @ <div id="post-%!S(p->zUuid)" \
349 @ class="forumPost forumTime forumObs">
350 }else{
351 @ <div id="post-%!S(p->zUuid)" class="forumPost forumTime">
352 }
 
353 if( pPost->zThreadTitle ){
354 @ <h1>%h(pPost->zThreadTitle)</h1>
355 }
356 zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
357 @ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
@@ -445,16 +446,16 @@
446 }else{
447 fpid = p->fpid;
448 zUuid = p->zUuid;
449 pPost = pOPost;
450 }
 
451 zSel = p->fpid==target ? " forumSel" : "";
452 if( p->nIndent==1 ){
453 @ <div id='post-%!S(p->zUuid)' \
454 @ class='forumPost forumHierRoot%s(zSel)'>
455 }else{
456 @ <div id='post-%!S(p->zUuid)' class='forumPost forumHier%s(zSel)' \
457 @ style='margin-left: %d((p->nIndent-1)*3)ex;'>
458 }
459 pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
460 if( pPost==0 ) continue;
461 if( pPost->zThreadTitle ){
462
+8 -7
--- src/forum.c
+++ src/forum.c
@@ -340,17 +340,18 @@
340340
int sameUser; /* True if author is also the reader */
341341
342342
pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
343343
if( pPost==0 ) continue;
344344
if( p->fpid==target ){
345
- @ <div id="forum%d(p->fpid)" class="forumTime forumSel">
345
+ @ <div id="post-%!S(p->zUuid)" \
346
+ @ class="forumPost forumTime forumSel">
346347
}else if( p->pLeaf!=0 ){
347
- @ <div id="forum%d(p->fpid)" class="forumTime forumObs">
348
+ @ <div id="post-%!S(p->zUuid)" \
349
+ @ class="forumPost forumTime forumObs">
348350
}else{
349
- @ <div id="forum%d(p->fpid)" class="forumTime">
351
+ @ <div id="post-%!S(p->zUuid)" class="forumPost forumTime">
350352
}
351
- @ <a name="post-%!S(p->zUuid)"></a>
352353
if( pPost->zThreadTitle ){
353354
@ <h1>%h(pPost->zThreadTitle)</h1>
354355
}
355356
zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
356357
@ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
@@ -445,16 +446,16 @@
445446
}else{
446447
fpid = p->fpid;
447448
zUuid = p->zUuid;
448449
pPost = pOPost;
449450
}
450
- @ <a name="post-%!S(zUuid)"></a>
451451
zSel = p->fpid==target ? " forumSel" : "";
452452
if( p->nIndent==1 ){
453
- @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'>
453
+ @ <div id='post-%!S(p->zUuid)' \
454
+ @ class='forumPost forumHierRoot%s(zSel)'>
454455
}else{
455
- @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \
456
+ @ <div id='post-%!S(p->zUuid)' class='forumPost forumHier%s(zSel)' \
456457
@ style='margin-left: %d((p->nIndent-1)*3)ex;'>
457458
}
458459
pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
459460
if( pPost==0 ) continue;
460461
if( pPost->zThreadTitle ){
461462
--- src/forum.c
+++ src/forum.c
@@ -340,17 +340,18 @@
340 int sameUser; /* True if author is also the reader */
341
342 pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
343 if( pPost==0 ) continue;
344 if( p->fpid==target ){
345 @ <div id="forum%d(p->fpid)" class="forumTime forumSel">
 
346 }else if( p->pLeaf!=0 ){
347 @ <div id="forum%d(p->fpid)" class="forumTime forumObs">
 
348 }else{
349 @ <div id="forum%d(p->fpid)" class="forumTime">
350 }
351 @ <a name="post-%!S(p->zUuid)"></a>
352 if( pPost->zThreadTitle ){
353 @ <h1>%h(pPost->zThreadTitle)</h1>
354 }
355 zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
356 @ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
@@ -445,16 +446,16 @@
445 }else{
446 fpid = p->fpid;
447 zUuid = p->zUuid;
448 pPost = pOPost;
449 }
450 @ <a name="post-%!S(zUuid)"></a>
451 zSel = p->fpid==target ? " forumSel" : "";
452 if( p->nIndent==1 ){
453 @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'>
 
454 }else{
455 @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \
456 @ style='margin-left: %d((p->nIndent-1)*3)ex;'>
457 }
458 pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
459 if( pPost==0 ) continue;
460 if( pPost->zThreadTitle ){
461
--- src/forum.c
+++ src/forum.c
@@ -340,17 +340,18 @@
340 int sameUser; /* True if author is also the reader */
341
342 pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
343 if( pPost==0 ) continue;
344 if( p->fpid==target ){
345 @ <div id="post-%!S(p->zUuid)" \
346 @ class="forumPost forumTime forumSel">
347 }else if( p->pLeaf!=0 ){
348 @ <div id="post-%!S(p->zUuid)" \
349 @ class="forumPost forumTime forumObs">
350 }else{
351 @ <div id="post-%!S(p->zUuid)" class="forumPost forumTime">
352 }
 
353 if( pPost->zThreadTitle ){
354 @ <h1>%h(pPost->zThreadTitle)</h1>
355 }
356 zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate);
357 @ <p>By %h(pPost->zUser) on %h(zDate) (%d(p->fpid))
@@ -445,16 +446,16 @@
446 }else{
447 fpid = p->fpid;
448 zUuid = p->zUuid;
449 pPost = pOPost;
450 }
 
451 zSel = p->fpid==target ? " forumSel" : "";
452 if( p->nIndent==1 ){
453 @ <div id='post-%!S(p->zUuid)' \
454 @ class='forumPost forumHierRoot%s(zSel)'>
455 }else{
456 @ <div id='post-%!S(p->zUuid)' class='forumPost forumHier%s(zSel)' \
457 @ style='margin-left: %d((p->nIndent-1)*3)ex;'>
458 }
459 pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
460 if( pPost==0 ) continue;
461 if( pPost->zThreadTitle ){
462
+1 -1
--- src/forum.js
+++ src/forum.js
@@ -14,6 +14,6 @@
1414
var h = x[0].scrollHeight;
1515
var y = absoluteY(x[0]);
1616
if( w>h ) y = y + (h-w)/2;
1717
if( y>0 ) window.scrollTo(0, y);
1818
}
19
-}())
19
+})()
2020
--- src/forum.js
+++ src/forum.js
@@ -14,6 +14,6 @@
14 var h = x[0].scrollHeight;
15 var y = absoluteY(x[0]);
16 if( w>h ) y = y + (h-w)/2;
17 if( y>0 ) window.scrollTo(0, y);
18 }
19 }())
20
--- src/forum.js
+++ src/forum.js
@@ -14,6 +14,6 @@
14 var h = x[0].scrollHeight;
15 var y = absoluteY(x[0]);
16 if( w>h ) y = y + (h-w)/2;
17 if( y>0 ) window.scrollTo(0, y);
18 }
19 })()
20

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button