Fossil SCM

Minor name refactoring and comment enhancements in graph.js. No logic changes. Improvements to the javascript compressor. Apply compression to "*/js.txt" files in addition to "*.js" files.

drh 2019-06-08 14:19 trunk
Commit 786d6167fa008d1fe37d98e355ea6c56a8a95f3f00c6395e501b9a3a83dd755c
2 files changed +15 -12 +8 -8
+15 -12
--- src/graph.js
+++ src/graph.js
@@ -99,50 +99,54 @@
9999
/* State information for the tooltip popup and its timers */
100100
window.tooltipInfo = {
101101
dwellTimeout: 250, /* The tooltip dwell timeout. */
102102
closeTimeout: 3000, /* The tooltip close timeout. */
103103
hashDigits: 16, /* Limit of tooltip hashes ("hash-digits"). */
104
- idTimer: 0, /* The tooltip dwell timer id. */
105
- idTimerClose: 0, /* The tooltip close timer id. */
106
- ixHover: -1, /* The id of the element with the mouse. */
107
- ixActive: -1, /* The id of the element with the tooltip. */
104
+ idTimer: 0, /* The tooltip dwell timer id */
105
+ idTimerClose: 0, /* The tooltip close timer id */
106
+ ixHover: -1, /* The mouse is over a thick riser arrow for
107
+ ** tx.rowinfo[ixHover]. Or -2 when the mouse is
108
+ ** over a graph node. Or -1 when the mouse is not
109
+ ** over anything. */
110
+ ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
111
+ ** ixActive is -1 if the tooltip is not visible */
108112
nodeHover: null, /* Graph node under mouse when ixHover==-2 */
109113
posX: 0, posY: 0 /* The last mouse position. */
110114
};
111115
112116
/* Functions used to control the tooltip popup and its timer */
113
-function onKeyDown(event){
117
+function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
114118
var key = event.which || event.keyCode;
115119
if( key==27 ){
116120
event.stopPropagation();
117121
hideGraphTooltip();
118122
}
119123
}
120
-function hideGraphTooltip(){
124
+function hideGraphTooltip(){ /* Hide the tooltip */
121125
document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
122126
stopCloseTimer();
123127
tooltipObj.style.display = "none";
124128
tooltipInfo.ixActive = -1;
125129
}
126130
document.body.onunload = hideGraphTooltip
127131
function stopDwellTimer(){
128
- if (tooltipInfo.idTimer != 0) {
132
+ if(tooltipInfo.idTimer!=0){
129133
clearTimeout(tooltipInfo.idTimer);
130134
tooltipInfo.idTimer = 0;
131135
}
132136
}
133137
function resumeCloseTimer(){
134138
/* This timer must be stopped explicitly to reset the elapsed timeout. */
135
- if(tooltipInfo.idTimerClose == 0 && tooltipInfo.closeTimeout>0) {
139
+ if(tooltipInfo.idTimerClose==0 && tooltipInfo.closeTimeout>0) {
136140
tooltipInfo.idTimerClose = setTimeout(function(){
137141
tooltipInfo.idTimerClose = 0;
138142
hideGraphTooltip();
139143
},tooltipInfo.closeTimeout);
140144
}
141145
}
142146
function stopCloseTimer(){
143
- if (tooltipInfo.idTimerClose != 0) {
147
+ if(tooltipInfo.idTimerClose!=0){
144148
clearTimeout(tooltipInfo.idTimerClose);
145149
tooltipInfo.idTimerClose = 0;
146150
}
147151
}
148152
@@ -194,12 +198,11 @@
194198
hideGraphTooltip();
195199
stopDwellTimer();
196200
stopCloseTimer();
197201
}
198202
};
199
- function nodeHover(e){
200
- /* Invoked by mousemove events over a graph node */
203
+ function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
201204
e.stopPropagation()
202205
if(tooltipInfo.ixHover==-2) return
203206
tooltipInfo.ixHover = -2
204207
tooltipInfo.posX = e.clientX
205208
tooltipInfo.posY = e.clientY
@@ -399,11 +402,11 @@
399402
if( p.f&1 ) cls += " leaf";
400403
var n = drawBox(cls,p.bg,p.x,p.y);
401404
n.id = "tln"+p.id;
402405
n.onclick = clickOnNode;
403406
n.ondblclick = dblclickOnNode;
404
- n.onmousemove = nodeHover;
407
+ n.onmousemove = mouseOverNode;
405408
n.style.zIndex = 10;
406409
if( !tx.omitDescenders ){
407410
if( p.u==0 ){
408411
if( p.hasOwnProperty('mo') && p.r==p.mo ){
409412
var ix = p.hasOwnProperty('cu') ? p.cu : p.mu;
410413
--- src/graph.js
+++ src/graph.js
@@ -99,50 +99,54 @@
99 /* State information for the tooltip popup and its timers */
100 window.tooltipInfo = {
101 dwellTimeout: 250, /* The tooltip dwell timeout. */
102 closeTimeout: 3000, /* The tooltip close timeout. */
103 hashDigits: 16, /* Limit of tooltip hashes ("hash-digits"). */
104 idTimer: 0, /* The tooltip dwell timer id. */
105 idTimerClose: 0, /* The tooltip close timer id. */
106 ixHover: -1, /* The id of the element with the mouse. */
107 ixActive: -1, /* The id of the element with the tooltip. */
 
 
 
 
108 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
109 posX: 0, posY: 0 /* The last mouse position. */
110 };
111
112 /* Functions used to control the tooltip popup and its timer */
113 function onKeyDown(event){
114 var key = event.which || event.keyCode;
115 if( key==27 ){
116 event.stopPropagation();
117 hideGraphTooltip();
118 }
119 }
120 function hideGraphTooltip(){
121 document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
122 stopCloseTimer();
123 tooltipObj.style.display = "none";
124 tooltipInfo.ixActive = -1;
125 }
126 document.body.onunload = hideGraphTooltip
127 function stopDwellTimer(){
128 if (tooltipInfo.idTimer != 0) {
129 clearTimeout(tooltipInfo.idTimer);
130 tooltipInfo.idTimer = 0;
131 }
132 }
133 function resumeCloseTimer(){
134 /* This timer must be stopped explicitly to reset the elapsed timeout. */
135 if(tooltipInfo.idTimerClose == 0 && tooltipInfo.closeTimeout>0) {
136 tooltipInfo.idTimerClose = setTimeout(function(){
137 tooltipInfo.idTimerClose = 0;
138 hideGraphTooltip();
139 },tooltipInfo.closeTimeout);
140 }
141 }
142 function stopCloseTimer(){
143 if (tooltipInfo.idTimerClose != 0) {
144 clearTimeout(tooltipInfo.idTimerClose);
145 tooltipInfo.idTimerClose = 0;
146 }
147 }
148
@@ -194,12 +198,11 @@
194 hideGraphTooltip();
195 stopDwellTimer();
196 stopCloseTimer();
197 }
198 };
199 function nodeHover(e){
200 /* Invoked by mousemove events over a graph node */
201 e.stopPropagation()
202 if(tooltipInfo.ixHover==-2) return
203 tooltipInfo.ixHover = -2
204 tooltipInfo.posX = e.clientX
205 tooltipInfo.posY = e.clientY
@@ -399,11 +402,11 @@
399 if( p.f&1 ) cls += " leaf";
400 var n = drawBox(cls,p.bg,p.x,p.y);
401 n.id = "tln"+p.id;
402 n.onclick = clickOnNode;
403 n.ondblclick = dblclickOnNode;
404 n.onmousemove = nodeHover;
405 n.style.zIndex = 10;
406 if( !tx.omitDescenders ){
407 if( p.u==0 ){
408 if( p.hasOwnProperty('mo') && p.r==p.mo ){
409 var ix = p.hasOwnProperty('cu') ? p.cu : p.mu;
410
--- src/graph.js
+++ src/graph.js
@@ -99,50 +99,54 @@
99 /* State information for the tooltip popup and its timers */
100 window.tooltipInfo = {
101 dwellTimeout: 250, /* The tooltip dwell timeout. */
102 closeTimeout: 3000, /* The tooltip close timeout. */
103 hashDigits: 16, /* Limit of tooltip hashes ("hash-digits"). */
104 idTimer: 0, /* The tooltip dwell timer id */
105 idTimerClose: 0, /* The tooltip close timer id */
106 ixHover: -1, /* The mouse is over a thick riser arrow for
107 ** tx.rowinfo[ixHover]. Or -2 when the mouse is
108 ** over a graph node. Or -1 when the mouse is not
109 ** over anything. */
110 ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive].
111 ** ixActive is -1 if the tooltip is not visible */
112 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
113 posX: 0, posY: 0 /* The last mouse position. */
114 };
115
116 /* Functions used to control the tooltip popup and its timer */
117 function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */
118 var key = event.which || event.keyCode;
119 if( key==27 ){
120 event.stopPropagation();
121 hideGraphTooltip();
122 }
123 }
124 function hideGraphTooltip(){ /* Hide the tooltip */
125 document.removeEventListener('keydown',onKeyDown,/* useCapture == */true);
126 stopCloseTimer();
127 tooltipObj.style.display = "none";
128 tooltipInfo.ixActive = -1;
129 }
130 document.body.onunload = hideGraphTooltip
131 function stopDwellTimer(){
132 if(tooltipInfo.idTimer!=0){
133 clearTimeout(tooltipInfo.idTimer);
134 tooltipInfo.idTimer = 0;
135 }
136 }
137 function resumeCloseTimer(){
138 /* This timer must be stopped explicitly to reset the elapsed timeout. */
139 if(tooltipInfo.idTimerClose==0 && tooltipInfo.closeTimeout>0) {
140 tooltipInfo.idTimerClose = setTimeout(function(){
141 tooltipInfo.idTimerClose = 0;
142 hideGraphTooltip();
143 },tooltipInfo.closeTimeout);
144 }
145 }
146 function stopCloseTimer(){
147 if(tooltipInfo.idTimerClose!=0){
148 clearTimeout(tooltipInfo.idTimerClose);
149 tooltipInfo.idTimerClose = 0;
150 }
151 }
152
@@ -194,12 +198,11 @@
198 hideGraphTooltip();
199 stopDwellTimer();
200 stopCloseTimer();
201 }
202 };
203 function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */
 
204 e.stopPropagation()
205 if(tooltipInfo.ixHover==-2) return
206 tooltipInfo.ixHover = -2
207 tooltipInfo.posX = e.clientX
208 tooltipInfo.posY = e.clientY
@@ -399,11 +402,11 @@
402 if( p.f&1 ) cls += " leaf";
403 var n = drawBox(cls,p.bg,p.x,p.y);
404 n.id = "tln"+p.id;
405 n.onclick = clickOnNode;
406 n.ondblclick = dblclickOnNode;
407 n.onmousemove = mouseOverNode;
408 n.style.zIndex = 10;
409 if( !tx.omitDescenders ){
410 if( p.u==0 ){
411 if( p.hasOwnProperty('mo') && p.r==p.mo ){
412 var ix = p.hasOwnProperty('cu') ? p.cu : p.mu;
413
+8 -8
--- src/mkbuiltin.c
+++ src/mkbuiltin.c
@@ -69,20 +69,18 @@
6969
int i, j, k;
7070
for(i=j=0; i<n; i++){
7171
unsigned char c = z[i];
7272
if( c=='/' ){
7373
if( z[i+1]=='*' ){
74
+ while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; }
7475
for(k=i+3; k<n && (z[k]!='/' || z[k-1]!='*'); k++){}
75
- if( k<n ){
76
- i = k;
77
- while( i+1<n && isspace(z[i+1]) ) i++;
78
- continue;
79
- }
76
+ i = k;
77
+ continue;
8078
}else if( z[i+1]=='/' ){
79
+ while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; }
8180
for(k=i+2; k<n && z[k]!='\n'; k++){}
82
- i = k;
83
- while( i+1<n && isspace(z[i+1]) ) i++;
81
+ i = k-1;
8482
continue;
8583
}
8684
}
8785
if( c=='\n' ){
8886
while( j>0 && isspace(z[j-1]) ) j--;
@@ -162,11 +160,13 @@
162160
if( pData[nSkip]=='\n' ) nSkip++;
163161
}
164162
165163
/* Compress javascript source files */
166164
nName = (int)strlen(aRes[i].zName);
167
- if( nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0 ){
165
+ if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
166
+ || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
167
+ ){
168168
int x = sz-nSkip;
169169
compressJavascript(pData+nSkip, &x);
170170
sz = x + nSkip;
171171
}
172172
173173
--- src/mkbuiltin.c
+++ src/mkbuiltin.c
@@ -69,20 +69,18 @@
69 int i, j, k;
70 for(i=j=0; i<n; i++){
71 unsigned char c = z[i];
72 if( c=='/' ){
73 if( z[i+1]=='*' ){
 
74 for(k=i+3; k<n && (z[k]!='/' || z[k-1]!='*'); k++){}
75 if( k<n ){
76 i = k;
77 while( i+1<n && isspace(z[i+1]) ) i++;
78 continue;
79 }
80 }else if( z[i+1]=='/' ){
 
81 for(k=i+2; k<n && z[k]!='\n'; k++){}
82 i = k;
83 while( i+1<n && isspace(z[i+1]) ) i++;
84 continue;
85 }
86 }
87 if( c=='\n' ){
88 while( j>0 && isspace(z[j-1]) ) j--;
@@ -162,11 +160,13 @@
162 if( pData[nSkip]=='\n' ) nSkip++;
163 }
164
165 /* Compress javascript source files */
166 nName = (int)strlen(aRes[i].zName);
167 if( nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0 ){
 
 
168 int x = sz-nSkip;
169 compressJavascript(pData+nSkip, &x);
170 sz = x + nSkip;
171 }
172
173
--- src/mkbuiltin.c
+++ src/mkbuiltin.c
@@ -69,20 +69,18 @@
69 int i, j, k;
70 for(i=j=0; i<n; i++){
71 unsigned char c = z[i];
72 if( c=='/' ){
73 if( z[i+1]=='*' ){
74 while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; }
75 for(k=i+3; k<n && (z[k]!='/' || z[k-1]!='*'); k++){}
76 i = k;
77 continue;
 
 
 
78 }else if( z[i+1]=='/' ){
79 while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; }
80 for(k=i+2; k<n && z[k]!='\n'; k++){}
81 i = k-1;
 
82 continue;
83 }
84 }
85 if( c=='\n' ){
86 while( j>0 && isspace(z[j-1]) ) j--;
@@ -162,11 +160,13 @@
160 if( pData[nSkip]=='\n' ) nSkip++;
161 }
162
163 /* Compress javascript source files */
164 nName = (int)strlen(aRes[i].zName);
165 if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
166 || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
167 ){
168 int x = sz-nSkip;
169 compressJavascript(pData+nSkip, &x);
170 sz = x + nSkip;
171 }
172
173

Keyboard Shortcuts

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