changeset 2557:f3c5cd908d6a

Make included javascript filename configurable in colormap.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 27 Jan 2024 02:09:32 +0200
parents e5be8e4e3820
children c8d55e2b8360
files Makefile.maps src/colormap.c
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.maps	Sat Jan 27 02:08:58 2024 +0200
+++ b/Makefile.maps	Sat Jan 27 02:09:32 2024 +0200
@@ -27,7 +27,7 @@
 
 %.html: %.tmp2 %.desc %.tmp3 $(COLORMAP_BIN)
 	@echo "COLORMAP $@"
-	@$(COLORMAP_BIN) $(COLORMAP_OPTS) -J $(COLORMAP_HTML) -P $(COLORMAP_EXTRA) -t "`cat $(patsubst %.tmp2,%.desc,$<)`" $< | \
+	@$(COLORMAP_BIN) $(COLORMAP_OPTS) -J util.js $(COLORMAP_HTML) -P $(COLORMAP_EXTRA) -t "`cat $(patsubst %.tmp2,%.desc,$<)`" $< | \
 	sed -e "/@LOCATIONS@/r $(patsubst %.tmp2,%.tmp3,$<)" -e "s/@LOCATIONS@//g" > $@
 
 
--- a/src/colormap.c	Sat Jan 27 02:08:58 2024 +0200
+++ b/src/colormap.c	Sat Jan 27 02:09:32 2024 +0200
@@ -36,14 +36,14 @@
 char    *optXHTMLTagName = NULL,
         *optMapTitle = NULL,
         *optUrchinFile = NULL;
+char    *optUseJS = NULL;
 
 bool    optPerformAnalysis = false,
         optUseOldFormat = false,
         optCheatMode = false,
         optNoHeaders = false,
         optPosGlue = false,
-        optCityFormat = false,
-        optUseJS = false;
+        optCityFormat = false;
 
 int     optOutputFormat = 0,
         optBackColor = 0;
@@ -67,7 +67,7 @@
     { 12,'P', "pos-glue",       "Generate JavaScript, etc. for posglue", OPT_NONE },
     { 13,'c', "city-format",    "Input is a city map", OPT_NONE },
     { 14,'u', "urchin-file",    "Specify urchin file", OPT_ARGREQ },
-    { 15,'J', "use-js",         "Include javascript bits", OPT_NONE },
+    { 15,'J', "use-js",         "Include javascript file", OPT_ARGREQ },
 };
 
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -215,10 +215,11 @@
 {
     char buf[32];
 
-    if (optUseJS)
+    if (optUseJS != NULL)
     {
         fprintf(fh,
-        " <script type=\"text/javascript\" src=\"util.js\"></script>\n");
+        " <script type=\"text/javascript\" src=\"%s\"></script>\n",
+        optUseJS);
     }
 
     fprintf(fh,
@@ -310,7 +311,7 @@
     fprintf(fh,
     "</head>\n");
 
-    if (optUseJS)
+    if (optUseJS != NULL)
     {
     fprintf(fh,
     "<body onload=\"mapOnLoad();\">\n");
@@ -710,7 +711,7 @@
         break;
 
     case 15:
-        optUseJS = true;
+        optUseJS = optArg;
         THMSG(2, "Including Javascript bits.\n");
         break;