From: Ben Soares Date: Fri, 15 Dec 2023 12:58:03 +0000 (+0000) Subject: JAL-4059 Use namespaced query parameters in preference to Info.args. Report what... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=736e66a7300ef13cb52dd643c9d22acb2ddc2bc7;p=jalview.git JAL-4059 Use namespaced query parameters in preference to Info.args. Report what's being used. --- diff --git a/src/jalview/util/JalviewJSUtil.java b/src/jalview/util/JalviewJSUtil.java index f46014b..22f79a5 100644 --- a/src/jalview/util/JalviewJSUtil.java +++ b/src/jalview/util/JalviewJSUtil.java @@ -268,7 +268,7 @@ public class JalviewJSUtil * URLSearchParams(window.location.search); * * var qsargs = []; - * + * * for (var param of qsParams) { * * var key = param[0]; @@ -287,16 +287,36 @@ public class JalviewJSUtil * * } * - * qsargs && (System.out.println("URL parameters detected - * were "+qsargs.join(" "))) && - * (J2S.thisApplet.__Info.urlargs = qsargs); + * if (qsargs !== undefined && qsargs.length > 0) { + * + * System.out.println("URL parameters detected are + * '"+qsargs.join("', '")+"'"); + * + * J2S.thisApplet.__Info.j2s_urlargs = qsargs; + * + * J2S.thisApplet.__Info.args = qsargs.join(" "); + * + * System.out.println("URL parameters were passed to J2S + * main."); + * + * } else { * - * (!J2S.thisApplet.__Info.args || J2S.thisApplet.__Info.args - * == "" || J2S.thisApplet.__Info.args == "??") && - * (J2S.thisApplet.__Info.args = qsargs.join(" ")) && - * (System.out.println("URL parameters were passed to J2S - * main.")); + * // look for Info.args * + * var infoArgs = J2S.thisApplet.__Info.args; + * + * if (infoArgs !== undefined) { + * + * System.out.println("Info.args parameters detected are + * "+J2S.thisApplet.__Info.args); + * + * System.out.println("Info.args parameters were passed to + * J2S main."); + * + * } + * + * } + * * } */ } catch (Throwable t) diff --git a/utils/jalviewjs/site-resources/index.html b/utils/jalviewjs/site-resources/index.html index 9605bd8..acc4972 100644 --- a/utils/jalviewjs/site-resources/index.html +++ b/utils/jalviewjs/site-resources/index.html @@ -6,10 +6,10 @@

jalviewjs.html and jalviewjs-core.html examples with new CLI style query parameters

diff --git a/utils/jalviewjs/site-resources/jalviewjs.html b/utils/jalviewjs/site-resources/jalviewjs.html index d735f00..e8d8cf8 100644 --- a/utils/jalviewjs/site-resources/jalviewjs.html +++ b/utils/jalviewjs/site-resources/jalviewjs.html @@ -22,6 +22,7 @@ jv_Info = { // all j2s_... values can be accessed in JalviewJSUtil.getInstance().getJSInfoValue(key) j2s_namespace: "jv", j2s_overflow: true, + args: "--open=examples/plantfdx.fa --colour=gecos-ocean --structure=examples/AF-P00221-F1-model_v4.pdb --seqid=FER1_SPIOL --tempfac=plddt --paematrix=../../examples/AF-P00221-F1-predicted_aligned_error_v4.json --noshowannotations --debug=true", }