src/lib/htmshell.c 1.61

1.61 2009/08/06 05:52:27 galt
fixed problem where warnBox has text with display:none but doing select-all in browser (ctrl-a) selects this extra text even when there is no warning which messes up the clipboard with extra junk
Index: src/lib/htmshell.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/htmshell.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -b -B -U 4 -r1.60 -r1.61
--- src/lib/htmshell.c	24 Jul 2009 04:18:45 -0000	1.60
+++ src/lib/htmshell.c	6 Aug 2009 05:52:27 -0000	1.61
@@ -221,11 +221,9 @@
 	  "document.write(\"<center>"
 	    "<div id='warnBox' style='display:none; background-color:Beige; "
 	      "border: 3px ridge DarkRed; width:640px; padding:10px; margin:10px; "
 	      "text-align:left;'>"
-	    "<CENTER><B style='color:DarkRed;'>Error(s):</CENTER></B><UL id='warnList'></UL>"
-	    "<CENTER><img src='%simages/ok.jpg' onclick='hideWarnBox();return false;'></CENTER>"
-	    "</div></center>\");\n", relPath);
+	    "</div></center>\");\n");
 // Remember what worked nicely on FF3.0: 
 // "function showWarnBox() {"
 //   "var warnBox=document.getElementById('warnBox');"
 //   "if(warnBox!=undefined) {"
@@ -234,15 +232,20 @@
 //      "warnBox.style.width='auto';}}}"
 fprintf(f,
 	"function showWarnBox() {"
 	  "var warnBox=document.getElementById('warnBox');"
-	  "if(warnBox!=undefined) {warnBox.style.display=''; warnBox.style.width='65%%';}};\n"
+	  "if(warnBox!=undefined) {"
+	    "warnBox.innerHTML=\""
+	    "<CENTER><B style='color:DarkRed;'>Error(s):</B></CENTER><UL id='warnList'></UL>"
+	    "<CENTER><img src='%simages/ok.jpg' onclick='hideWarnBox();return false;'></CENTER>"
+	    "\";"
+	    "warnBox.style.display=''; warnBox.style.width='65%%';}};\n"
 	"function hideWarnBox() {"
 	  "var warnBox=document.getElementById('warnBox');"
 	  "if(warnBox!=undefined) {"
 	     "warnBox.style.display='none'; var warnList=document.getElementById('warnList'); "
-	     "warnList.innerHTML='';}};"
-        "}</script>\n");
+	     "warnBox.innerHTML='';}};"
+        "}</script>\n", relPath);
 }
 #endif//ifdef WARNBOX_IN_USE
 
 void htmlVaWarn(char *format, va_list args)
@@ -264,9 +267,9 @@
 if( strSwapStrs(warning, sizeof(warning),"'","&#39;") == -1) // Sheild single quotes
     strSwapChar(warning,'\'','`');  // ran out of memory, replacing them with (`)
 if( strSwapStrs(warning, sizeof(warning),"\n","<BR>") == -1) // new lines also break the code
     strSwapChar(warning,'\n',' ');  // ran out of memory, replacing them with ( )
-printf("<script type='text/javascript'>{var warnList=document.getElementById('warnList'); warnList.innerHTML += '<li>%s</li>'; showWarnBox();}</script>\n",warning);
+printf("<script type='text/javascript'>{showWarnBox();var warnList=document.getElementById('warnList'); warnList.innerHTML += '<li>%s</li>';}</script>\n",warning);
 
 #else//ifndef WARNBOX_IN_USE
 
 htmlHorizontalLine();