JAL-904 added scrollToRow and scrollToColumn methods to javascript API and reintroduc...
[jalview.git] / examples / javascript / jalview.js
index 4cc613e..66c5a3e 100644 (file)
@@ -17,11 +17,11 @@ function getDestinationFrms(source, frames) {
        var frid = "";\r
        for (frm in frames) {\r
                try {\r
-                       frid = (("" + source.getDatasetId()) == ("" + frames[frm]\r
-                                       .getDatasetId()));\r
+                       frid = (source!=null) && (("" + source.getSequenceSetId()) == ("" + frames[frm].currentAlignFrame\r
+                                       .getSequenceSetId()));\r
                } catch (q) {\r
-               }\r
-               ;\r
+               };\r
+               \r
                if (!frames[frm].equals(source) && !frid\r
                                && !frames[frm].currentAlignFrame.equals(source)) {\r
                        frms[frms.length] = frames[frm];\r
@@ -108,6 +108,7 @@ function linkJvJmol(applet, jmolView, modeltofiles) {
        // try { applet.setViewListener("viewlist"); } catch (err) {};\r
        if (jmolView)\r
        {\r
+               var sep = applet.getSeparator();\r
                var oldjm=jmolView;\r
                // recover full id of Jmol applet\r
                jmolView=_jmolGetApplet(jmolView).id;\r
@@ -129,14 +130,15 @@ function linkJvJmol(applet, jmolView, modeltofiles) {
                mtf="";\r
                var dbase = document.baseURI.substring(0,document.baseURI.lastIndexOf("/")+1);\r
                for (m in jmbinding._modelstofiles)\r
-               { mtf+=jmbinding._modelstofiles[m];\r
+               { if (m>0) { mtf+=sep; }\r
+               mtf+=jmbinding._modelstofiles[m];\r
                if (jmbinding._modelstofiles[m].indexOf("//")==-1)\r
-                       { jmbinding._fullmpath[m] = dbase+jmbinding._modelstofiles[m]; }\r
-                 jmbinding._filetonum.put(jmbinding._modelstofiles[m], m);\r
-                 jmbinding._filetonum.put(jmbinding._fullmpath[m], m);\r
+                       { jmbinding._fullmpath[m] = dbase+((jmbinding._modelstofiles[m].indexOf("/")==0) ? jmbinding._modelstofiles[m].substring(1) : jmbinding._modelstofiles[m]); }\r
+                 jmbinding._filetonum.put(jmbinding._modelstofiles[m], m+1); \r
+                 jmbinding._filetonum.put(jmbinding._fullmpath[m], m+1);\r
                  \r
-                 if (m>0) { mtf+=sep; }}\r
-               jvfollower.setStructureListener("_structure", mtf);\r
+                 }\r
+               applet.setStructureListener("_structure", mtf);\r
        }\r
 }\r
 \r
@@ -265,10 +267,11 @@ function _jmolhover(jmid, atomlabel, atomidx) {
        // relaxed third parameter - may be null or a model number for multi model\r
        // views\r
        atomlabel = ("" + atomlabel)\r
-                       .match(/\[(.+)\](\d+):(.)\.(\S+)\s*(\/\d+\.|).+/);\r
+                       .match(/\[(.+)\](\d+):(.)\.([^\/]+)(\/\d+\.|).+/);\r
        atomidx = "" + atomidx;\r
        if (atomlabel[5]) {\r
                atomlabel[5] = atomlabel[5].match(/\/(.+)\./)[1];\r
+               atomlabel[5] = parseInt(atomlabel[5])-1;\r
        } else {\r
                // default - first model\r
                atomlabel[5] = 0;\r
@@ -278,7 +281,8 @@ function _jmolhover(jmid, atomlabel, atomidx) {
                _jvapps[ap].mouseOverStructure(atomlabel[2], atomlabel[3],\r
                                document.baseURI\r
                                                .substring(0, document.baseURI.lastIndexOf('/'))\r
-                                               + "/" + modeltofiles[atomlabel[5]]);\r
+                                               + "/" + \r
+                                               modeltofiles[atomlabel[5]]);\r
                msg = _jmolhovermsg;\r
        }\r
 }\r