@@ -10686,6 +10686,7 @@ return jQuery;
1068610686})(jQuery,document,"click mousemove mouseup touchmove touchend", "outjsmol");
1068710687// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
1068810688
10689+ // BH 2025.04.17 adds option for explicit directory for core files different from j2sPath/core
1068910690// BH 2024.11.09 makes equivalent J2S._debugCore and J2S._nozcore, as well as J2S._debugCode and J2S._nocore
1069010691// BH 2024.10.03 adds two-finger tap as "click"; reinstates touch gestures lost when we went to pointerup 2023.11.01
1069110692// BH 2023.12.14 fixes resizing into application (making it smaller)
@@ -11964,8 +11965,6 @@ if (database == "_" && J2S._serverUrl.indexOf("//your.server.here/") >= 0) {
1196411965}
1196511966}
1196611967
11967- J2S.getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}
11968-
1196911968// J2S._localFileSaveFunction -- // do something local here; Maybe try the
1197011969// FileSave interface? return true if successful
1197111970
@@ -13275,26 +13274,39 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1327513274type = null;
1327613275}
1327713276
13277+ var thisPath, isFullName;
1327813278if (type) {
13279- type = type.toLowerCase().split(".")[0]; // package name only
13279+ var key = type.toLowerCase().substring(type.lastIndexOf("/") + 1);
13280+ key = key.toLowerCase().split(".")[0]; // package name only
1328013281
1328113282// return if type is already part of the set.
13282- if (__coreSet.join("").indexOf(type ) >= 0)
13283+ if (__coreSet.join("").indexOf(key ) >= 0)
1328313284return;
1328413285
13286+ __coreSet.push(key);
13287+ __coreSet.sort();
13288+
1328513289// create a concatenated lower-case name for a core file that
1328613290// includes
1328713291// all Java applets on the page
13292+ // only if this is not a full name
1328813293
13289- __coreSet.push(type);
13290- __coreSet.sort();
13291- J2S._coreFiles = [ path + "/core/core" + __coreSet.join("")
13292- + ".z.js" ];
13294+ // 2025.04.17 adds option to give full (local) path to core file
13295+ isFullName = (type.indexOf("/") >= 0);
13296+ if (isFullName){
13297+ // bypass core/package.js
13298+ J2S.Globals["core.registered"] = true;
13299+ }
13300+ thisPath = (isFullName ? type : path + "/core/core" + __coreSet.join("") + ".z.js");
13301+ J2S._coreFiles = [ thisPath ];
1329313302}
1329413303if (more && (Array.isArray(more) || (more = more.split(" "))))
1329513304for (var i = 0; i < more.length; i++)
13296- if (more[i] && __coreMore.join("").indexOf(more[i]) < 0)
13297- __coreMore.push(path + "/core/core" + more[i] + ".z.js")
13305+ if (more[i] && __coreMore.join("").indexOf(more[i]) < 0) {
13306+ isFullName = (more[i].indexOf("/") >= 0);
13307+ thisPath = (isFullName ? type : path + "/core/core" + more[i] + ".z.js");
13308+ __coreMore.push(thisPath);
13309+ }
1329813310for (var i = 0; i < __coreMore.length; i++)
1329913311J2S._coreFiles.push(__coreMore[i]);
1330013312}
@@ -13492,15 +13504,6 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1349213504return c;
1349313505}
1349413506
13495- var __j2sDebugCode = function() {
13496- if (!document.getElementById("j2sprofile")) {
13497- $('body').append(`<div id=j2sprofile><a href='#"diff-6676e5f02d38c50b48417f416f2d0ff43f5b2f625ba2f91dacd688db80064a7f-13498-13506-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">13498
- }
13499- if (!document.getElementById("sysoutdiv")) {
13500- $('body').append(`<div spellcheck="false" id="sysoutdiv" contentEditable="true" style="border:1px solid green;width:800;height:300;overflow:auto">This is System.out</div>`);
13501- }
13502- }
13503-
1350413507proto._setupJS = function() {
1350513508J2S.setGlobal("j2s.lib", {
1350613509base : this._j2sPath + "/",
@@ -13510,15 +13513,10 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1351013513});
1351113514J2S.setGlobal("j2s.tmpdir", "/TEMP/");
1351213515var isFirst = (__execStack.length == 0);
13513- if (isFirst)
13516+ if (isFirst)
1351413517J2S._addExec([ this, __loadClazz, null, "loadClazz" ]);
1351513518this._addCoreFiles();
1351613519J2S._addExec([ this, this.__startAppletJS, null, "start applet" ])
13517-
13518- if (J2S._debugCode) {
13519- J2S._addExec([ this, __j2sDebugCode, null, "j2sdebugcode" ])
13520- }
13521-
1352213520this._isSigned = true; // access all files via URL hook
1352313521this._ready = false;
1352413522this._applet = null;
@@ -14159,6 +14157,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1415914157
1416014158// Google closure compiler cannot handle Clazz.new or Clazz.super
1416114159
14160+ // BH 2025.04.17 adds option for explicit directory for core files different from j2sPath/core
1416214161// BH 2025.03.12 adds support for writable byte[] parameters in WASM
1416314162// BH 2025.03.06 adds support for JNA+WASM, automated loading of Java native classes if WASM is available
1416414163// BH 2025.02.22 add hashCode$() for Java Integer.TYPE and related types
@@ -14874,6 +14873,8 @@ Clazz.new_ = function(c, args, cl) {
1487414873 return obj;
1487514874}
1487614875
14876+ Clazz._Pointer = null;
14877+
1487714878Clazz._loadWasm = function(cls, lib){
1487814879if (cls.wasmLoaded)
1487914880return;
@@ -15010,6 +15011,9 @@ Clazz._loadWasm = function(cls, lib){
1501015011var retType = "number";
1501115012switch (jsm.nativeReturn) {
1501215013case "com.sun.jna.Pointer":
15014+ if (!Clazz._Pointer) {
15015+ Clazz._Pointer = Clazz.load("com.sun.jna.Pointer");
15016+ }
1501315017fret = retPtr;
1501415018break;
1501515019case "[B": // It is assumed these are strings
@@ -15055,7 +15059,6 @@ Clazz._loadWasm = function(cls, lib){
1505515059cls.wasmInitialized = true;
1505615060J2S.wasm[libName].$ready = true;
1505715061}
15058- // may have been preloaded by other JavaScript
1505915062var module = J2S[libName + "_module"]
1506015063if (module)
1506115064f(module);
@@ -16852,9 +16855,10 @@ _Loader.loadPackageClasspath = function (pkg, base, isIndex, fSuccess, mode, pt)
1685216855 // the package idea has been deprecated
1685316856 // the only package is core/package.js
1685416857 if (pkg == "java")
16855- pkg = "core" // JSmol -- moves java/package.js to core/package.js
16858+ pkg =(J2S.Globals[ "core.registered"] ? null : "core") // JSmol -- moves java/package.js to core/package.js
1685616859 // not really asynchronous
16857- _Loader.loadClass(pkg + ".package", null, true, true, 1);
16860+ if (pkg)
16861+ _Loader.loadClass(pkg + ".package", null, true, true, 1);
1685816862 }
1685916863 fSuccess && fSuccess();
1686016864};