Fossil SCM

Remove the last bits of in-line javascript from the timelines.

drh 2017-12-06 13:48 trunk
Commit b799891b82d6876da0a5287105e3cfa6c61ad05d833538cc3064bc6ad4c42576
3 files changed +3 -3 +16 -11 +2 -3
+3 -3
--- src/finfo.c
+++ src/finfo.c
@@ -516,11 +516,11 @@
516516
@ style="background-color: %h(zBgClr);">
517517
}else{
518518
@ <td class="timeline%s(zStyle)Cell">
519519
}
520520
if( tmFlags & TIMELINE_COMPACT ){
521
- @ <span class='timelineCompactComment' onclick='toggleDetail(%d(frid))'>
521
+ @ <span class='timelineCompactComment' data-id='%d(frid)'>
522522
}else{
523523
@ <span class='timeline%s(zStyle)Comment'>
524524
if( (tmFlags & TIMELINE_VERBOSE)!=0 && zUuid ){
525525
hyperlink_to_uuid(zUuid);
526526
@ part of check-in \
@@ -527,12 +527,12 @@
527527
hyperlink_to_uuid(zCkin);
528528
}
529529
}
530530
@ %W(zCom)</span>
531531
if( (tmFlags & TIMELINE_COMPACT)!=0 ){
532
- @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(frid)' \
533
- @ onclick='toggleDetail(%d(frid))'>...</span>
532
+ @ <span class='timelineEllipsis' data-id='%d(frid)' \
533
+ @ id='ellipsis-%d(frid)'>...</span>
534534
@ <span class='clutter timelineCompactDetail'
535535
}
536536
if( tmFlags & TIMELINE_COLUMNAR ){
537537
if( zBgClr && zBgClr[0] ){
538538
@ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
539539
--- src/finfo.c
+++ src/finfo.c
@@ -516,11 +516,11 @@
516 @ style="background-color: %h(zBgClr);">
517 }else{
518 @ <td class="timeline%s(zStyle)Cell">
519 }
520 if( tmFlags & TIMELINE_COMPACT ){
521 @ <span class='timelineCompactComment' onclick='toggleDetail(%d(frid))'>
522 }else{
523 @ <span class='timeline%s(zStyle)Comment'>
524 if( (tmFlags & TIMELINE_VERBOSE)!=0 && zUuid ){
525 hyperlink_to_uuid(zUuid);
526 @ part of check-in \
@@ -527,12 +527,12 @@
527 hyperlink_to_uuid(zCkin);
528 }
529 }
530 @ %W(zCom)</span>
531 if( (tmFlags & TIMELINE_COMPACT)!=0 ){
532 @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(frid)' \
533 @ onclick='toggleDetail(%d(frid))'>...</span>
534 @ <span class='clutter timelineCompactDetail'
535 }
536 if( tmFlags & TIMELINE_COLUMNAR ){
537 if( zBgClr && zBgClr[0] ){
538 @ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
539
--- src/finfo.c
+++ src/finfo.c
@@ -516,11 +516,11 @@
516 @ style="background-color: %h(zBgClr);">
517 }else{
518 @ <td class="timeline%s(zStyle)Cell">
519 }
520 if( tmFlags & TIMELINE_COMPACT ){
521 @ <span class='timelineCompactComment' data-id='%d(frid)'>
522 }else{
523 @ <span class='timeline%s(zStyle)Comment'>
524 if( (tmFlags & TIMELINE_VERBOSE)!=0 && zUuid ){
525 hyperlink_to_uuid(zUuid);
526 @ part of check-in \
@@ -527,12 +527,12 @@
527 hyperlink_to_uuid(zCkin);
528 }
529 }
530 @ %W(zCom)</span>
531 if( (tmFlags & TIMELINE_COMPACT)!=0 ){
532 @ <span class='timelineEllipsis' data-id='%d(frid)' \
533 @ id='ellipsis-%d(frid)'>...</span>
534 @ <span class='clutter timelineCompactDetail'
535 }
536 if( tmFlags & TIMELINE_COLUMNAR ){
537 if( zBgClr && zBgClr[0] ){
538 @ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
539
+16 -11
--- src/graph.js
+++ src/graph.js
@@ -302,25 +302,16 @@
302302
function changeDisplay(selector,value){
303303
var x = document.getElementsByClassName(selector);
304304
var n = x.length;
305305
for(var i=0; i<n; i++) {x[i].style.display = value;}
306306
}
307
-function declutter(){
308
- changeDisplay('clutter','none');
309
- changeDisplay('anticlutter','inline');
310
- checkHeight();
311
-}
312
-function reclutter(){
313
- changeDisplay('clutter','inline');
314
- changeDisplay('anticlutter','none');
315
- checkHeight();
316
-}
317307
function changeDisplayById(id,value){
318308
var x = document.getElementById(id);
319309
if(x) x.style.display=value;
320310
}
321
-function toggleDetail(id){
311
+function toggleDetail(){
312
+ var id = parseInt(this.getAttribute('data-id'))
322313
var x = gebi("detail-"+id);
323314
if( x.style.display=="inline" ){
324315
x.style.display="none";
325316
changeDisplayById("ellipsis-"+id,"inline");
326317
changeDisplayById("links-"+id,"none");
@@ -350,5 +341,19 @@
350341
setTimeout(checkHeight, 1000);
351342
}
352343
initGraph();
353344
checkHeight();
354345
scrollToSelected();
346
+
347
+/* Set the onclick= attributes for elements of the "Compact" display
348
+** mode so that clicking turns the details on and off. */
349
+(function(){
350
+ var lx = document.getElementsByClassName('timelineEllipsis');
351
+ var i;
352
+ for(i=0; i<lx.length; i++){
353
+ if( lx[i].hasAttribute('data-id') ) lx[i].onclick = toggleDetail;
354
+ }
355
+ var lx = document.getElementsByClassName('timelineCompactComment');
356
+ for(i=0; i<lx.length; i++){
357
+ if( lx[i].hasAttribute('data-id') ) lx[i].onclick = toggleDetail;
358
+ }
359
+}())
355360
--- src/graph.js
+++ src/graph.js
@@ -302,25 +302,16 @@
302 function changeDisplay(selector,value){
303 var x = document.getElementsByClassName(selector);
304 var n = x.length;
305 for(var i=0; i<n; i++) {x[i].style.display = value;}
306 }
307 function declutter(){
308 changeDisplay('clutter','none');
309 changeDisplay('anticlutter','inline');
310 checkHeight();
311 }
312 function reclutter(){
313 changeDisplay('clutter','inline');
314 changeDisplay('anticlutter','none');
315 checkHeight();
316 }
317 function changeDisplayById(id,value){
318 var x = document.getElementById(id);
319 if(x) x.style.display=value;
320 }
321 function toggleDetail(id){
 
322 var x = gebi("detail-"+id);
323 if( x.style.display=="inline" ){
324 x.style.display="none";
325 changeDisplayById("ellipsis-"+id,"inline");
326 changeDisplayById("links-"+id,"none");
@@ -350,5 +341,19 @@
350 setTimeout(checkHeight, 1000);
351 }
352 initGraph();
353 checkHeight();
354 scrollToSelected();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
--- src/graph.js
+++ src/graph.js
@@ -302,25 +302,16 @@
302 function changeDisplay(selector,value){
303 var x = document.getElementsByClassName(selector);
304 var n = x.length;
305 for(var i=0; i<n; i++) {x[i].style.display = value;}
306 }
 
 
 
 
 
 
 
 
 
 
307 function changeDisplayById(id,value){
308 var x = document.getElementById(id);
309 if(x) x.style.display=value;
310 }
311 function toggleDetail(){
312 var id = parseInt(this.getAttribute('data-id'))
313 var x = gebi("detail-"+id);
314 if( x.style.display=="inline" ){
315 x.style.display="none";
316 changeDisplayById("ellipsis-"+id,"inline");
317 changeDisplayById("links-"+id,"none");
@@ -350,5 +341,19 @@
341 setTimeout(checkHeight, 1000);
342 }
343 initGraph();
344 checkHeight();
345 scrollToSelected();
346
347 /* Set the onclick= attributes for elements of the "Compact" display
348 ** mode so that clicking turns the details on and off. */
349 (function(){
350 var lx = document.getElementsByClassName('timelineEllipsis');
351 var i;
352 for(i=0; i<lx.length; i++){
353 if( lx[i].hasAttribute('data-id') ) lx[i].onclick = toggleDetail;
354 }
355 var lx = document.getElementsByClassName('timelineCompactComment');
356 for(i=0; i<lx.length; i++){
357 if( lx[i].hasAttribute('data-id') ) lx[i].onclick = toggleDetail;
358 }
359 }())
360
+2 -3
--- src/timeline.c
+++ src/timeline.c
@@ -457,11 +457,11 @@
457457
db_reset(&bisectQuery);
458458
}
459459
drawDetailEllipsis = (tmFlags & TIMELINE_COMPACT)!=0;
460460
db_column_blob(pQuery, commentColumn, &comment);
461461
if( tmFlags & TIMELINE_COMPACT ){
462
- @ <span class='timelineCompactComment' onclick='toggleDetail(%d(rid))'>
462
+ @ <span class='timelineCompactComment' data-id='%d(rid)'>
463463
}else{
464464
@ <span class='timeline%s(zStyle)Comment'>
465465
}
466466
if( (tmFlags & TIMELINE_VERBOSE)!=0 ){
467467
if( zType[0]=='c' ){
@@ -524,12 +524,11 @@
524524
525525
/* Generate extra information and hyperlinks to follow the comment.
526526
** Example: "(check-in: [abcdefg], user: drh, tags: trunk)"
527527
*/
528528
if( drawDetailEllipsis ){
529
- @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
530
- @ onclick='toggleDetail(%d(rid))'>...</span>
529
+ @ <span class='timelineEllipsis' id='ellipsis-%d(rid)' data-id='%d(rid)'>...</span>
531530
}
532531
if( tmFlags & TIMELINE_COLUMNAR ){
533532
if( zBgClr && zBgClr[0] && rid!=selectedRid ){
534533
@ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
535534
}else{
536535
--- src/timeline.c
+++ src/timeline.c
@@ -457,11 +457,11 @@
457 db_reset(&bisectQuery);
458 }
459 drawDetailEllipsis = (tmFlags & TIMELINE_COMPACT)!=0;
460 db_column_blob(pQuery, commentColumn, &comment);
461 if( tmFlags & TIMELINE_COMPACT ){
462 @ <span class='timelineCompactComment' onclick='toggleDetail(%d(rid))'>
463 }else{
464 @ <span class='timeline%s(zStyle)Comment'>
465 }
466 if( (tmFlags & TIMELINE_VERBOSE)!=0 ){
467 if( zType[0]=='c' ){
@@ -524,12 +524,11 @@
524
525 /* Generate extra information and hyperlinks to follow the comment.
526 ** Example: "(check-in: [abcdefg], user: drh, tags: trunk)"
527 */
528 if( drawDetailEllipsis ){
529 @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
530 @ onclick='toggleDetail(%d(rid))'>...</span>
531 }
532 if( tmFlags & TIMELINE_COLUMNAR ){
533 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
534 @ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
535 }else{
536
--- src/timeline.c
+++ src/timeline.c
@@ -457,11 +457,11 @@
457 db_reset(&bisectQuery);
458 }
459 drawDetailEllipsis = (tmFlags & TIMELINE_COMPACT)!=0;
460 db_column_blob(pQuery, commentColumn, &comment);
461 if( tmFlags & TIMELINE_COMPACT ){
462 @ <span class='timelineCompactComment' data-id='%d(rid)'>
463 }else{
464 @ <span class='timeline%s(zStyle)Comment'>
465 }
466 if( (tmFlags & TIMELINE_VERBOSE)!=0 ){
467 if( zType[0]=='c' ){
@@ -524,12 +524,11 @@
524
525 /* Generate extra information and hyperlinks to follow the comment.
526 ** Example: "(check-in: [abcdefg], user: drh, tags: trunk)"
527 */
528 if( drawDetailEllipsis ){
529 @ <span class='timelineEllipsis' id='ellipsis-%d(rid)' data-id='%d(rid)'>...</span>
 
530 }
531 if( tmFlags & TIMELINE_COLUMNAR ){
532 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
533 @ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
534 }else{
535

Keyboard Shortcuts

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