Fossil

Diff
Login

Differences From Artifact [2bd251dd1d]:

To Artifact [40f89a1782]:


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
** In all cases, the table columns tagged with "difftxt" are expanded,
** where possible, to fill the width of the screen.
**
** For a side-by-side diff, if either column is two wide to fit on the
** display, scrollbars are added.  The scrollbars are linked, so that
** both sides scroll together.  Left and right arrows also scroll.
*/
(function(){
  var SCROLL_LEN = 25;
  function initDiff(diff){
    var txtCols = diff.querySelectorAll('td.difftxt');
    var txtPres = diff.querySelectorAll('td.difftxt pre');
    var width = 0;
    if(txtPres.length>=2)Math.max(txtPres[0].scrollWidth, txtPres[1].scrollWidth);
    var i;







|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
** In all cases, the table columns tagged with "difftxt" are expanded,
** where possible, to fill the width of the screen.
**
** For a side-by-side diff, if either column is two wide to fit on the
** display, scrollbars are added.  The scrollbars are linked, so that
** both sides scroll together.  Left and right arrows also scroll.
*/
window.fossil.onPageLoad(function(){
  var SCROLL_LEN = 25;
  function initDiff(diff){
    var txtCols = diff.querySelectorAll('td.difftxt');
    var txtPres = diff.querySelectorAll('td.difftxt pre');
    var width = 0;
    if(txtPres.length>=2)Math.max(txtPres[0].scrollWidth, txtPres[1].scrollWidth);
    var i;
66
67
68
69
70
71
72


73
74

75
76
77

78

79
80
81
82

83

84
85
86
87

88

89
90
91
92
93
94
95
96
97

98
  window.fossil.page.tweakSbsDiffs = function(){
    document.querySelectorAll('table.splitdiff').forEach(initDiff);
  };
  var i, diffs = document.querySelectorAll('table.splitdiff')
  for(i=0; i<diffs.length; i++){
    initDiff(diffs[i]);
  }


  var lastWidth = 0;
  function checkWidth(){

    if( document.body.clientWidth!=lastWidth ){
      lastWidth = document.body.clientWidth;
      var w = lastWidth*0.5 - 100;

      var allCols = document.querySelectorAll('td.difftxtl pre');

      for(let i=0; i<allCols.length; i++){
        allCols[i].style.width = w + "px";
        allCols[i].style.maxWidth = w + "px";
      }

      allCols = document.querySelectorAll('td.difftxtr pre');

      for(let i=0; i<allCols.length; i++){
        allCols[i].style.width = w + "px";
        allCols[i].style.maxWidth = w + "px";
      }

      var allDiffs = document.querySelectorAll('table.diff');

      w = lastWidth;
      for(let i=0; i<allDiffs.length; i++){
        allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
        allDiffs[i].style.maxWidth = w + "px";
      }
    }
  }
  checkWidth();
  window.addEventListener('resize', checkWidth);

})();







>
>
|
<
>
|
|
|
>
|
>
|
|
|

>
|
>
|
|
|

>
|
>
|
|
|
|


|


>
|
66
67
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  window.fossil.page.tweakSbsDiffs = function(){
    document.querySelectorAll('table.splitdiff').forEach(initDiff);
  };
  var i, diffs = document.querySelectorAll('table.splitdiff')
  for(i=0; i<diffs.length; i++){
    initDiff(diffs[i]);
  }
  const checkWidth = function f(){
    if(undefined === f.lastWidth){
      f.lastWidth = 0;

    }
    if( document.body.clientWidth!=f.lastWidth ){
      f.lastWidth = document.body.clientWidth;
      var w = f.lastWidth*0.5 - 100;
      if(!f.colsL){
        f.colsL = document.querySelectorAll('td.difftxtl pre');
      }
      for(let i=0; i<f.colsL.length; i++){
        f.colsL[i].style.width = w + "px";
        f.colsL[i].style.maxWidth = w + "px";
      }
      if(!f.colsR){
        f.colsR = document.querySelectorAll('td.difftxtr pre');
      }
      for(let i=0; i<f.colsR.length; i++){
        f.colsR[i].style.width = w + "px";
        f.colsR[i].style.maxWidth = w + "px";
      }
      if(!f.allDiffs){
        f.allDiffs = document.querySelectorAll('table.diff');
      }
      w = f.lastWidth;
      for(let i=0; i<f.allDiffs.length; i++){
        f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
        f.allDiffs[i].style.maxWidth = w + "px";
      }
    }
  };
  checkWidth();
  window.addEventListener('resize', checkWidth);
}, false);