Skip to content

Commit

Permalink
CLDR-7646 static init: remove SurveyTool loading VettingViewer unnnec…
Browse files Browse the repository at this point in the history
…essarily

- move the header CSS into CLDRURLS, it really could go in surveytool.css or something.
  • Loading branch information
srl295 committed Jan 5, 2024
1 parent 83003ac commit 567389d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONException;
import org.unicode.cldr.util.CLDRURLS;
import org.unicode.cldr.util.CldrUtility;
import org.unicode.cldr.util.VettingViewer;

public class SurveyTool extends HttpServlet {
static final Logger logger = SurveyLog.forClass(SurveyTool.class);
Expand Down Expand Up @@ -95,7 +95,7 @@ private void serveWaitingPage(HttpServletRequest request, PrintWriter out, Surve
out.write("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n");
out.write("<title>CLDR Survey Tool | Starting</title>\n");
includeCss(request, out);
out.write(VettingViewer.getHeaderStyles() + "\n");
out.write(CLDRURLS.getVettingViewerHeaderStyles() + "\n");
try {
includeJavaScript(request, out);
} catch (JSONException e) {
Expand Down Expand Up @@ -173,7 +173,7 @@ private void serveRunnningNormallyPage(
out.write("<meta name='gigabot' content='nofollow'>\n");
out.write(FAVICON_LINK);
includeCss(request, out);
out.write(VettingViewer.getHeaderStyles() + "\n");
out.write(CLDRURLS.getVettingViewerHeaderStyles() + "\n");
try {
includeJavaScript(request, out);
} catch (JSONException e) {
Expand Down
20 changes: 20 additions & 0 deletions tools/cldr-code/src/main/java/org/unicode/cldr/util/CLDRURLS.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,24 @@ public static boolean isKnownHash(String hash) {
public static final String toHTML(String url) {
return "<a href=\"" + url + "\">" + url + "</a>";
}

/**
* Provide the styles for inclusion into the ST &lt;head&gt; element.
*
* @return
*/
public static String getVettingViewerHeaderStyles() {
return "<style>\n"
+ ".hide {display:none}\n"
+ ".vve {}\n"
+ ".vvn {}\n"
+ ".vvp {}\n"
+ ".vvl {}\n"
+ ".vvm {}\n"
+ ".vvu {}\n"
+ ".vvw {}\n"
+ ".vvd {}\n"
+ ".vvo {}\n"
+ "</style>";
}
}

0 comments on commit 567389d

Please sign in to comment.