Fossil

Check-in [1bf7985d]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | forum-reply-links
Files: files | file ages | folders
SHA3-256: 1bf7985d109f3b3cee67bf55bd46c21aa82fcbf6b260b631b8ee0c3b8e96ca1b
User & Date: stephan 2019-07-02 07:31:50
Original Comment: 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.
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/default_css.txt.

739
740
741
742
743
744
745





746
747
748
749
750
751
752
  padding-left: 1ex;
  padding-right: 1ex;
  margin-top: 1ex;
}
div.forumSel {
  background-color: #cef;
}





div.forumObs {
  color: #bbb;
}
#capabilitySummary {
  text-align: center;
}
#capabilitySummary td {







>
>
>
>
>







739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
  padding-left: 1ex;
  padding-right: 1ex;
  margin-top: 1ex;
}
div.forumSel {
  background-color: #cef;
}
div.forumSelReplyTo {
// This class gets set on DIV.forumPost entries when
// a "in reply to" link for that DIV gets clicked.
  border: 1px dotted black;
}
div.forumObs {
  color: #bbb;
}
#capabilitySummary {
  text-align: center;
}
#capabilitySummary td {

Changes to src/forum.js.

1

2
3
4
5
6
7
8
..
12
13
14
15
16
17
18




























19
(function(){

  function absoluteY(obj){
    var top = 0;
    if( obj.offsetParent ){
      do{
        top += obj.offsetTop;
      }while( obj = obj.offsetParent );
    }
................................................................................
  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);
  }




























})()

>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
..
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(function(){
  "use strict";
  function absoluteY(obj){
    var top = 0;
    if( obj.offsetParent ){
      do{
        top += obj.offsetTop;
      }while( obj = obj.offsetParent );
    }
................................................................................
  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);
  }

  // Set up click handlers for "in reply to" links...
  var respondeeSelectClass = 'forumSelReplyTo'
  /* CSS class to apply to selected "in reply to" post. */;
  var responseLinkClick = function(){
    /** This <A> tag has an href in the form /something#post-{UID},
        and post-{UID} is the ID of a forum post DIV on this
        page. Here we fish that ID out of this anchor,
        unmark any currently-selected DIV, and mark this anchor's
        corresponding DIV.
    */
    var m = /#post-\w+/.exec(this.href);
    if(!m || !m.length) return /*unexpected*/;
    // Remove respondeeSelectClass from all entries...
    document.querySelectorAll('.forumPost.'+respondeeSelectClass)
      .forEach(function(e){
        e.classList.remove(respondeeSelectClass);
      });
    // Add respondeeSelectClass to the matching entry...
    document.querySelectorAll(m[0])
      .forEach(function(e){
        e.classList.add(respondeeSelectClass);
      });
  };
  document.querySelectorAll('a[href*="#post-"]')
    .forEach(function(e){
      e.addEventListener( "click", responseLinkClick, false );
    });
})();