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/hgSession/hgSession.c src/hg/hgSession/hgSession.c index 4217a15..0945b80 100644 --- src/hg/hgSession/hgSession.c +++ src/hg/hgSession/hgSession.c @@ -963,44 +963,40 @@ hgsNewSessionName, hgsNewSessionName, 32, sessionName); jsOnEventById("change" , hgsNewSessionName, highlightAccChanges); jsOnEventById("keypress", hgsNewSessionName, highlightAccChanges); dyStringPrintf(dyMessage, " <INPUT TYPE=SUBMIT NAME=\"%s%s\" VALUE=\"use\">" " <INPUT TYPE=SUBMIT NAME=\"%s%s\" id='%s%s' VALUE=\"delete\">" " <INPUT TYPE=SUBMIT ID=\"%s\" NAME=\"%s\" VALUE=\"accept changes\">" " <INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"cancel\"> " "<BR>\n", hgsLoadPrefix, encSessionName, hgsDeletePrefix, encSessionName, hgsDeletePrefix, encSessionName, hgsDoSessionChange, hgsDoSessionChange, hgsCancel); char id[256]; safef(id, sizeof id, "%s%s", hgsDeletePrefix, encSessionName); - char javascript[1024]; - safef(javascript, sizeof javascript, confirmDeleteFormat, encSessionName); - jsOnEventById("click", id, javascript); + jsOnEventByIdF("click", id, confirmDeleteFormat, encSessionName); dyStringPrintf(dyMessage, "Share with others? <INPUT TYPE=CHECKBOX NAME=\"%s%s\"%s VALUE=on " "id=\"detailsSharedCheckbox\">\n" "<INPUT TYPE=HIDDEN NAME=\"%s%s%s\" VALUE=0><BR>\n", hgsSharePrefix, encSessionName, (shared>0 ? " CHECKED" : ""), cgiBooleanShadowPrefix(), hgsSharePrefix, encSessionName); - safef(javascript, sizeof javascript, "{%s %s}", highlightAccChanges, toggleGalleryDisable); - jsOnEventById("change", "detailsSharedCheckbox", javascript); - safef(javascript, sizeof javascript, "{%s %s}", highlightAccChanges, toggleGalleryDisable); - jsOnEventById("click" , "detailsSharedCheckbox", javascript); + jsOnEventByIdF("change", "detailsSharedCheckbox", "{%s %s}", highlightAccChanges, toggleGalleryDisable); + jsOnEventByIdF("click" , "detailsSharedCheckbox", "{%s %s}", highlightAccChanges, toggleGalleryDisable); dyStringPrintf(dyMessage, "List in Public Sessions? <INPUT TYPE=CHECKBOX NAME=\"%s%s\"%s VALUE=on " "id=\"detailsGalleryCheckbox\">\n" "<INPUT TYPE=HIDDEN NAME=\"%s%s%s\" VALUE=0><BR>\n", hgsGalleryPrefix, encSessionName, (shared>=2 ? " CHECKED" : ""), cgiBooleanShadowPrefix(), hgsGalleryPrefix, encSessionName); jsOnEventById("change", "detailsGalleryCheckbox", highlightAccChanges); jsOnEventById("click" , "detailsGalleryCheckbox", highlightAccChanges); /* Set initial disabled state of the gallery checkbox */ jsInline(toggleGalleryDisable); dyStringPrintf(dyMessage, "Created on %s.<BR>\n", firstUse); /* Print custom track counts per assembly */