Check-in [5341655085]
Not logged in
Overview

SHA1 Hash:53416550852e1da68162ac5ed1f367b3a45983c7
Date: 2007-08-27 05:02:17
User: drh
Comment:Fix a bug in the javascript. Only versions that are independent of the mouse-over version are grayed out now.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/timeline.c from [e4c236d7a2] to [30b6c2143f].

@@ -165,21 +165,21 @@
 */
 static int save_parentage_javascript(int rid, Blob *pOut){
   const char *zSep;
   Stmt q;
 
-  db_prepare(&q, "SELECT pid FROM plink WHERE cid=%d AND isprim!=0", rid);
+  db_prepare(&q, "SELECT pid FROM plink WHERE cid=%d", rid);
   zSep = "";
   blob_appendf(pOut, "parentof[\"m%d\"] = [", rid);
   while( db_step(&q)==SQLITE_ROW ){
     int pid = db_column_int(&q, 0);
     blob_appendf(pOut, "%s\"m%d\"", zSep, pid);
     zSep = ",";
   }
   db_finalize(&q);
   blob_appendf(pOut, "];\n");
-  db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d AND isprim!=0", rid);
+  db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d", rid);
   zSep = "";
   blob_appendf(pOut, "childof[\"m%d\"] = [", rid);
   while( db_step(&q)==SQLITE_ROW ){
     int pid = db_column_int(&q, 0);
     blob_appendf(pOut, "%s\"m%d\"", zSep, pid);
@@ -248,15 +248,18 @@
   @   for(var x in parentof){
   @     setone(x,value);
   @   }
   @ }
   @ function setone(id, onoff){
+  @   if( parentof[id]==null ) return 0;
   @   var w = document.getElementById(id);
-  @   if( onoff==1 ){
-  @     w.style.color = "#000000";
+  @   var clr = onoff==1 ? "#000000" : "#a0a0a0";
+  @   if( w.style.color==clr ){
+  @     return 0
   @   }else{
-  @     w.style.color = "#a0a0a0";
+  @     w.style.color = clr
+  @     return 1
   @   }
   @ }
   @ function xin(id) {
   @   setall(0);
   @   setone(id,1);
@@ -265,23 +268,27 @@
   @ }
   @ function xout(id) {
   @   setall(1);
   @ }
   @ function set_parents(id){
-  @   if( parentof[id]==null ) return;
-  @   for(var x in parentof[id]){
-  @     var pid = parentof[id][x];
-  @     setone(pid,1);
-  @     set_parents(pid);
+  @   var plist = parentof[id];
+  @   if( plist==null ) return;
+  @   for(var x in plist){
+  @     var pid = plist[x];
+  @     if( setone(pid,1)==1 ){
+  @       set_parents(pid);
+  @     }
   @   }
   @ }
   @ function set_children(id){
-  @   if( childof[id]==null ) return;
-  @   for(var x in childof[id]){
-  @     var cid = childof[id][x];
-  @     setone(cid,1);
-  @     set_children(cid);
+  @   var clist = childof[id];
+  @   if( clist==null ) return;
+  @   for(var x in clist){
+  @     var cid = clist[x];
+  @     if( setone(cid,1)==1 ){
+  @       set_children(cid);
+  @     }
   @   }
   @ }
   @ function hilite(id) {
   @   var x = document.getElementById(id);
   @   x.style.backgroundColor = "#e0e0ff";