af730d9e24c0642fe39657f890bc117ed015ccbf
galt
  Wed Feb 15 01:12:26 2017 -0800
CSP code cleanup. Using new var-args versions of functions jsInlineF and jsOnEventByIdF to avoid using lots of fixed-size local javascript strings.

diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c
index 50cbbea..0caef77 100644
--- src/hg/hgCustom/hgCustom.c
+++ src/hg/hgCustom/hgCustom.c
@@ -562,34 +562,32 @@
                 printf("<TD><A HREF='%s?%s&position=%s&hgTracksConfigPage=notSet' TITLE=%s>%s:</A></TD>",
                     hgTracksName(), cartSidUrlString(cart),pos, pos, chrom);
             else
                 puts("<TD>&nbsp;</TD>");
             }
         else
             puts("<TD>&nbsp;</TD>");
         }
     if (errCt)
 	{
 	if (ct->networkErrMsg)
 	    {
 	    char id[256];
 	    safef(id, sizeof id, "_%d", butCount);
 	    printf("\n<TD><A href='#' id='%s'>Show</A></TD>\n", id);
-	    char javascript[1024];
-	    safef(javascript, sizeof javascript, "alert('%s');return false;",
+	    jsOnEventByIdF("click", id, "alert('%s');return false;",
 		javaScriptLiteralEncode(ct->networkErrMsg));
-	    jsOnEventById("click", id, javascript);
 	    }
 	else
 	    puts("<TD>&nbsp;</TD>");
 	}
     /* Delete checkboxes */
     printf("<TD COLSPAN=%d ALIGN=CENTER>", showAllButtons ? 2 : 1);
     safef(buf, sizeof(buf), "%s_%s", hgCtDeletePrefix,
             ct->tdb->track);
     cgiMakeCheckBoxJS(buf, setAllDelete, "class='deleteCheckbox'");
     puts("</TD>");
 
     /* Update checkboxes */
     if (updateCt)
         {
         printf("<TD COLSPAN=%d ALIGN=CENTER>", showAllButtons ? 2 : 1);
@@ -781,39 +779,37 @@
     {
     pos = ctInitialPosition(ctList);
     if (!pos)
         pos = ctFirstItemPos(ctList);
     }
 
 puts("<TR><TD>");
 makeOtherCgiForm(pos);
 puts("</TD></TR>");
 
 /* button to add custom tracks */
 puts("<TR><TD>");
 printf("<INPUT TYPE=SUBMIT NAME=\"addTracksButton\" ID=\"addTracksButton\" VALUE=\"%s\" "
        "STYLE=\"margin-top: 5px\" >\n",
        "add custom tracks");
-char javascript[1024];
-safef(javascript, sizeof javascript,
+// This submits mainForm with a hidden input that tells hgCustom to show add tracks page:
+jsOnEventByIdF("click", "addTracksButton", 
 	"var $form = $(\"form[name='mainForm']\"); "
 	"$form.append(\"<input name='%s' type='hidden'>\"); "
 	"$form.submit();"
 	, hgCtDoAdd);
 
-// This submits mainForm with a hidden input that tells hgCustom to show add tracks page:
-jsOnEventById("click", "addTracksButton", javascript);
 puts("</TD></TR>");
 
 puts("</TABLE>");
 puts("</TD>");
 
 cgiTableRowEnd();
 cgiTableEnd();
 
 
 // This vertically aligns the 'add tracks' button with the other-CGI select
 jsInline(
     "function fitUnder($el1, $el2) { "
     "  var off1 = $el1.offset(); "
     "  var off2 = $el2.offset(); "
     "  off2.left = off1.left; "