Fossil SCM

Minor tweaks in the diff-related JS and CSS.

stephan 2021-09-08 02:43 diff-js-refactoring
Commit fd7d2557aa2a31c491abf4d44c3827c503a1d05c9dd3416d80509c1a635ae8d6
+1 -1
--- src/default.css
+++ src/default.css
@@ -532,11 +532,11 @@
532532
padding-top: 1px;
533533
}
534534
535535
/* Rules governing diff layout and colors */
536536
table.diff {
537
- width: 98%;
537
+ width: 100%;
538538
border-spacing: 0;
539539
border: 1px solid black;
540540
padding: 0 0.5em;
541541
}
542542
table.diff td {
543543
--- src/default.css
+++ src/default.css
@@ -532,11 +532,11 @@
532 padding-top: 1px;
533 }
534
535 /* Rules governing diff layout and colors */
536 table.diff {
537 width: 98%;
538 border-spacing: 0;
539 border: 1px solid black;
540 padding: 0 0.5em;
541 }
542 table.diff td {
543
--- src/default.css
+++ src/default.css
@@ -532,11 +532,11 @@
532 padding-top: 1px;
533 }
534
535 /* Rules governing diff layout and colors */
536 table.diff {
537 width: 100%;
538 border-spacing: 0;
539 border: 1px solid black;
540 padding: 0 0.5em;
541 }
542 table.diff td {
543
+24 -25
--- src/diff.js
+++ src/diff.js
@@ -38,35 +38,34 @@
3838
}
3939
const checkWidth = function f(){
4040
if(undefined === f.lastWidth){
4141
f.lastWidth = 0;
4242
}
43
- if( document.body.clientWidth!=f.lastWidth ){
44
- f.lastWidth = document.body.clientWidth;
45
- var w = f.lastWidth*0.5 - 100;
46
- if(!f.colsL){
47
- f.colsL = document.querySelectorAll('td.difftxtl pre');
48
- }
49
- for(let i=0; i<f.colsL.length; i++){
50
- f.colsL[i].style.width = w + "px";
51
- f.colsL[i].style.maxWidth = w + "px";
52
- }
53
- if(!f.colsR){
54
- f.colsR = document.querySelectorAll('td.difftxtr pre');
55
- }
56
- for(let i=0; i<f.colsR.length; i++){
57
- f.colsR[i].style.width = w + "px";
58
- f.colsR[i].style.maxWidth = w + "px";
59
- }
60
- if(!f.allDiffs){
61
- f.allDiffs = document.querySelectorAll('table.diff');
62
- }
63
- w = f.lastWidth;
64
- for(let i=0; i<f.allDiffs.length; i++){
65
- f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
66
- f.allDiffs[i].style.maxWidth = w + "px";
67
- }
43
+ if( document.body.clientWidth===f.lastWidth ) return;
44
+ f.lastWidth = document.body.clientWidth;
45
+ var w = f.lastWidth*0.5 - 100;
46
+ if(!f.colsL){
47
+ f.colsL = document.querySelectorAll('td.difftxtl pre');
48
+ }
49
+ for(let i=0; i<f.colsL.length; i++){
50
+ f.colsL[i].style.width = w + "px";
51
+ f.colsL[i].style.maxWidth = w + "px";
52
+ }
53
+ if(!f.colsR){
54
+ f.colsR = document.querySelectorAll('td.difftxtr pre');
55
+ }
56
+ for(let i=0; i<f.colsR.length; i++){
57
+ f.colsR[i].style.width = w + "px";
58
+ f.colsR[i].style.maxWidth = w + "px";
59
+ }
60
+ if(!f.allDiffs){
61
+ f.allDiffs = document.querySelectorAll('table.diff');
62
+ }
63
+ w = f.lastWidth;
64
+ for(let i=0; i<f.allDiffs.length; i++){
65
+ f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
66
+ f.allDiffs[i].style.maxWidth = w + "px";
6867
}
6968
};
7069
checkWidth();
7170
window.addEventListener('resize', checkWidth);
7271
}, false);
7372
--- src/diff.js
+++ src/diff.js
@@ -38,35 +38,34 @@
38 }
39 const checkWidth = function f(){
40 if(undefined === f.lastWidth){
41 f.lastWidth = 0;
42 }
43 if( document.body.clientWidth!=f.lastWidth ){
44 f.lastWidth = document.body.clientWidth;
45 var w = f.lastWidth*0.5 - 100;
46 if(!f.colsL){
47 f.colsL = document.querySelectorAll('td.difftxtl pre');
48 }
49 for(let i=0; i<f.colsL.length; i++){
50 f.colsL[i].style.width = w + "px";
51 f.colsL[i].style.maxWidth = w + "px";
52 }
53 if(!f.colsR){
54 f.colsR = document.querySelectorAll('td.difftxtr pre');
55 }
56 for(let i=0; i<f.colsR.length; i++){
57 f.colsR[i].style.width = w + "px";
58 f.colsR[i].style.maxWidth = w + "px";
59 }
60 if(!f.allDiffs){
61 f.allDiffs = document.querySelectorAll('table.diff');
62 }
63 w = f.lastWidth;
64 for(let i=0; i<f.allDiffs.length; i++){
65 f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
66 f.allDiffs[i].style.maxWidth = w + "px";
67 }
68 }
69 };
70 checkWidth();
71 window.addEventListener('resize', checkWidth);
72 }, false);
73
--- src/diff.js
+++ src/diff.js
@@ -38,35 +38,34 @@
38 }
39 const checkWidth = function f(){
40 if(undefined === f.lastWidth){
41 f.lastWidth = 0;
42 }
43 if( document.body.clientWidth===f.lastWidth ) return;
44 f.lastWidth = document.body.clientWidth;
45 var w = f.lastWidth*0.5 - 100;
46 if(!f.colsL){
47 f.colsL = document.querySelectorAll('td.difftxtl pre');
48 }
49 for(let i=0; i<f.colsL.length; i++){
50 f.colsL[i].style.width = w + "px";
51 f.colsL[i].style.maxWidth = w + "px";
52 }
53 if(!f.colsR){
54 f.colsR = document.querySelectorAll('td.difftxtr pre');
55 }
56 for(let i=0; i<f.colsR.length; i++){
57 f.colsR[i].style.width = w + "px";
58 f.colsR[i].style.maxWidth = w + "px";
59 }
60 if(!f.allDiffs){
61 f.allDiffs = document.querySelectorAll('table.diff');
62 }
63 w = f.lastWidth;
64 for(let i=0; i<f.allDiffs.length; i++){
65 f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
66 f.allDiffs[i].style.maxWidth = w + "px";
 
67 }
68 };
69 checkWidth();
70 window.addEventListener('resize', checkWidth);
71 }, false);
72
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -198,11 +198,11 @@
198198
@ h1 {
199199
@ font-size: 150%;
200200
@ }
201201
@
202202
@ table.diff {
203
-@ width: 98%;
203
+@ width: 100%;
204204
@ border-spacing: 0;
205205
@ border: 1px solid black;
206206
@ }
207207
@ table.diff td {
208208
@ vertical-align: top;
209209
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -198,11 +198,11 @@
198 @ h1 {
199 @ font-size: 150%;
200 @ }
201 @
202 @ table.diff {
203 @ width: 98%;
204 @ border-spacing: 0;
205 @ border: 1px solid black;
206 @ }
207 @ table.diff td {
208 @ vertical-align: top;
209
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -198,11 +198,11 @@
198 @ h1 {
199 @ font-size: 150%;
200 @ }
201 @
202 @ table.diff {
203 @ width: 100%;
204 @ border-spacing: 0;
205 @ border: 1px solid black;
206 @ }
207 @ table.diff td {
208 @ vertical-align: top;
209
+23 -25
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -72,35 +72,33 @@
7272
}
7373
const checkWidth = function f(){
7474
if(undefined === f.lastWidth){
7575
f.lastWidth = 0;
7676
}
77
- if( document.body.clientWidth!=f.lastWidth ){
78
- f.lastWidth = document.body.clientWidth;
79
- var w = f.lastWidth*0.5 - 100;
80
- if(!f.colsL){
81
- f.colsL = document.querySelectorAll('td.difftxtl pre');
82
- }
83
- for(let i=0; i<f.colsL.length; i++){
84
- f.colsL[i].style.width = w + "px";
85
- f.colsL[i].style.maxWidth = w + "px";
86
- }
87
- if(!f.colsR){
88
- f.colsR = document.querySelectorAll('td.difftxtr pre');
89
- }
90
- for(let i=0; i<f.colsR.length; i++){
91
- f.colsR[i].style.width = w + "px";
92
- f.colsR[i].style.maxWidth = w + "px";
93
- }
94
- if(!f.allDiffs){
95
- f.allDiffs = document.querySelectorAll('table.diff');
96
- }
97
- w = f.lastWidth;
98
- for(let i=0; i<f.allDiffs.length; i++){
99
- f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
100
- f.allDiffs[i].style.maxWidth = w + "px";
101
- }
77
+ if( document.body.clientWidth===f.lastWidth ) return;
78
+ f.lastWidth = document.body.clientWidth;
79
+ var w = f.lastWidth*0.5 - 100;
80
+ if(!f.colsL){
81
+ f.colsL = document.querySelectorAll('td.difftxtl pre');
82
+ }
83
+ for(let i=0; i<f.colsL.length; i++){
84
+ f.colsL[i].style.width = w + "px";
85
+ f.colsL[i].style.maxWidth = w + "px";
86
+ }
87
+ if(!f.colsR){
88
+ f.colsR = document.querySelectorAll('td.difftxtr pre');
89
+ }
90
+ for(let i=0; i<f.colsR.length; i++){
91
+ f.colsR[i].style.width = w + "px";
92
+ f.colsR[i].style.maxWidth = w + "px";
93
+ }
94
+ if(!f.allDiffs){
95
+ f.allDiffs = document.querySelectorAll('table.diff');
96
+ }
97
+ w = f.lastWidth;
98
+ for(let i=0; i<f.allDiffs.length; i++){
99
+ f.allDiffs[i].style.maxWidth = w + "px";
102100
}
103101
};
104102
checkWidth();
105103
window.addEventListener('resize', checkWidth);
106104
}, false);
107105
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -72,35 +72,33 @@
72 }
73 const checkWidth = function f(){
74 if(undefined === f.lastWidth){
75 f.lastWidth = 0;
76 }
77 if( document.body.clientWidth!=f.lastWidth ){
78 f.lastWidth = document.body.clientWidth;
79 var w = f.lastWidth*0.5 - 100;
80 if(!f.colsL){
81 f.colsL = document.querySelectorAll('td.difftxtl pre');
82 }
83 for(let i=0; i<f.colsL.length; i++){
84 f.colsL[i].style.width = w + "px";
85 f.colsL[i].style.maxWidth = w + "px";
86 }
87 if(!f.colsR){
88 f.colsR = document.querySelectorAll('td.difftxtr pre');
89 }
90 for(let i=0; i<f.colsR.length; i++){
91 f.colsR[i].style.width = w + "px";
92 f.colsR[i].style.maxWidth = w + "px";
93 }
94 if(!f.allDiffs){
95 f.allDiffs = document.querySelectorAll('table.diff');
96 }
97 w = f.lastWidth;
98 for(let i=0; i<f.allDiffs.length; i++){
99 f.allDiffs[i].style.width = '100%'; // setting to w causes unsightly horiz. scrollbar
100 f.allDiffs[i].style.maxWidth = w + "px";
101 }
102 }
103 };
104 checkWidth();
105 window.addEventListener('resize', checkWidth);
106 }, false);
107
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -72,35 +72,33 @@
72 }
73 const checkWidth = function f(){
74 if(undefined === f.lastWidth){
75 f.lastWidth = 0;
76 }
77 if( document.body.clientWidth===f.lastWidth ) return;
78 f.lastWidth = document.body.clientWidth;
79 var w = f.lastWidth*0.5 - 100;
80 if(!f.colsL){
81 f.colsL = document.querySelectorAll('td.difftxtl pre');
82 }
83 for(let i=0; i<f.colsL.length; i++){
84 f.colsL[i].style.width = w + "px";
85 f.colsL[i].style.maxWidth = w + "px";
86 }
87 if(!f.colsR){
88 f.colsR = document.querySelectorAll('td.difftxtr pre');
89 }
90 for(let i=0; i<f.colsR.length; i++){
91 f.colsR[i].style.width = w + "px";
92 f.colsR[i].style.maxWidth = w + "px";
93 }
94 if(!f.allDiffs){
95 f.allDiffs = document.querySelectorAll('table.diff');
96 }
97 w = f.lastWidth;
98 for(let i=0; i<f.allDiffs.length; i++){
99 f.allDiffs[i].style.maxWidth = w + "px";
 
 
100 }
101 };
102 checkWidth();
103 window.addEventListener('resize', checkWidth);
104 }, false);
105

Keyboard Shortcuts

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