Fossil

Check-in [3480785e39]
Login

Check-in [3480785e39]

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

Overview
Comment:Worked around, rather accidentally, the Darkmode and Xekri skin weirdness - side effects of padding. Bootstrap is still a bit funky, depending at least partially on which media query is currently active.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | diff-js-refactoring
Files: files | file ages | folders
SHA3-256: 3480785e39431ec9b69f88463eb8310be32e60439b13b0b42081095c2b4d3079
User & Date: stephan 2021-09-11 07:36:15.359
Context
2021-09-11
08:17
Diff-related CSS cleanups. ... (check-in: 1ca68f3ab4 user: stephan tags: diff-js-refactoring)
07:36
Worked around, rather accidentally, the Darkmode and Xekri skin weirdness - side effects of padding. Bootstrap is still a bit funky, depending at least partially on which media query is currently active. ... (check-in: 3480785e39 user: stephan tags: diff-js-refactoring)
05:48
jchunk-related style tweaks for Eagle and Khaki skins. ... (check-in: bbc534e7a4 user: stephan tags: diff-js-refactoring)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/default.css.
535
536
537
538
539
540
541



542

543
544
545


546
547
548








549
550
551
552
553
554
555
/* Rules governing diff layout and colors */
table.diff {
  width: 100%;
  border-spacing: 0;
  border: 1px solid black;
}
table.diff td.diffln{



  padding: 0 0.25em 0 0.5em;

}
table.diff td {
  vertical-align: top;


}
table.diff pre {
  margin: 0 0 0 0;








}
tr.diffskip.jchunk {
  /* jchunk gets added from JS to diffskip rows when they are
     plugged into the /jchunk route. */
  background-color: aliceblue;
  padding: 0;
}







>
>
>

>



>
>



>
>
>
>
>
>
>
>







535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
/* Rules governing diff layout and colors */
table.diff {
  width: 100%;
  border-spacing: 0;
  border: 1px solid black;
}
table.diff td.diffln{
  padding: 0;
}
table.diff td.diffln > pre{
  padding: 0 0.25em 0 0.5em;
  margin: 0;
}
table.diff td {
  vertical-align: top;
  padding: 0;
  overflow: hidden /*work around inner PRE slight overflow/overlap*/;
}
table.diff pre {
  margin: 0 0 0 0;
  padding: 0 0.5em;
}
table.diff td.diffln > pre {
  padding: 0 0.35em 0 0.5em;
}
table.diff td.difftxt > pre {
  min-width: 100%;
  max-width: 100%;
}
tr.diffskip.jchunk {
  /* jchunk gets added from JS to diffskip rows when they are
     plugged into the /jchunk route. */
  background-color: aliceblue;
  padding: 0;
}
Changes to src/fossil.diff.js.
687
688
689
690
691
692
693

694
695
696
697
698
699
700
701
702
703
704
705
706

707
708
709
710
711
712
713
    if(force || !f.colsR){
      f.colsR = document.querySelectorAll('td.difftxtr pre');
    }
    f.colsR.forEach(function(e){
      e.style.width = w + "px";
      e.style.maxWidth = w + "px";
    });

    if(!f.allDiffs){
      f.allDiffs = document.querySelectorAll('table.diff');
    }
    w = lastWidth;
    f.allDiffs.forEach(function f(e){
      if(!f.$){
        f.$ = e.getClientRects()[0];
        console.debug("diff table w =",w," f.$x",f.$);
        w - 2*f.$.x /* left margin (assume right==left, for simplicity) */;
      }
      e.style.maxWidth = w + "px";
    });
    //console.debug("checkTableWidth(",force,") lastWidth =",lastWidth);

    return this;
  };

  const scrollLeft = function(event){
    //console.debug("scrollLeft",this,event);
    const table = this.parentElement/*TD*/.parentElement/*TR*/.
      parentElement/*TBODY*/.parentElement/*TABLE*/;







>
|
|
|
|
|
|
|
|
|
|
|
|
|
>







687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
    if(force || !f.colsR){
      f.colsR = document.querySelectorAll('td.difftxtr pre');
    }
    f.colsR.forEach(function(e){
      e.style.width = w + "px";
      e.style.maxWidth = w + "px";
    });
    if(0){ // seems to be unnecessary
      if(!f.allDiffs){
        f.allDiffs = document.querySelectorAll('table.diff');
      }
      w = lastWidth;
      f.allDiffs.forEach(function f(e){
        if(0 && !f.$){
          f.$ = e.getClientRects()[0];
          console.debug("diff table w =",w," f.$x",f.$);
          w - 2*f.$.x /* left margin (assume right==left, for simplicity) */;
        }
        e.style.maxWidth = w + "px";
      });
      //console.debug("checkTableWidth(",force,") lastWidth =",lastWidth);
    }
    return this;
  };

  const scrollLeft = function(event){
    //console.debug("scrollLeft",this,event);
    const table = this.parentElement/*TD*/.parentElement/*TR*/.
      parentElement/*TBODY*/.parentElement/*TABLE*/;
742
743
744
745
746
747
748




749
750
751
752
753
754
755
756
757
758
759
760
    if(!diff.classList.contains('scroller')){
      D.addClass(diff, 'scroller');
      diff.addEventListener('keydown', function(e){
        e = e || event;
        const len = {37: -SCROLL_LEN, 39: SCROLL_LEN}[e.keyCode];
        if( !len ) return;
        this.$txtPres[0].scrollLeft += len;




        return false;
      }, false);
    }
    return this;
  }
  window.fossil.page.tweakSbsDiffs = function(){
    document.querySelectorAll('table.splitdiff').forEach((e)=>Diff.initTableDiff);
  };
  Diff.initTableDiff().checkTableWidth();
  window.addEventListener('resize', ()=>Diff.checkTableWidth());
}, false);








>
>
>
>












744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
    if(!diff.classList.contains('scroller')){
      D.addClass(diff, 'scroller');
      diff.addEventListener('keydown', function(e){
        e = e || event;
        const len = {37: -SCROLL_LEN, 39: SCROLL_LEN}[e.keyCode];
        if( !len ) return;
        this.$txtPres[0].scrollLeft += len;
        /* ^^^ bug: if there is a 2nd column and it has a scrollbar
           but txtPres[0] does not, no scrolling happens here. We need
           to find the widest of txtPres and scroll that one. Example:
           Checkin a7fbefee38a1c522 file diff.c */
        return false;
      }, false);
    }
    return this;
  }
  window.fossil.page.tweakSbsDiffs = function(){
    document.querySelectorAll('table.splitdiff').forEach((e)=>Diff.initTableDiff);
  };
  Diff.initTableDiff().checkTableWidth();
  window.addEventListener('resize', ()=>Diff.checkTableWidth());
}, false);