Updated BioJsTemplate to not show the menu by default and implemented a toggle button...
authorCharles Ofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 7 Nov 2014 12:08:22 +0000 (12:08 +0000)
committerCharles Ofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 7 Nov 2014 12:08:22 +0000 (12:08 +0000)
resources/templates/BioJSTemplate.txt

index 972aa0b..88ade1a 100644 (file)
 <!-- <link type=text/css rel=stylesheet href=https://s3-eu-west-1.amazonaws.com/biojs/msa/latest/msa.css /> -->
   
   
-<div id="menuDiv"></div>
 <div id="yourDiv">press "Run with JS"</div>
 <input type='hidden' id='seqData' name='seqData' value='#sequenceData#'/>
 </br>
 </br>
 
 <button onclick="javascipt:openJalviewUsingCurrentUrl();">Launch in Jalview</button>
+<input type="button" name="divToggleButton" id="divToggleButton" onclick="javascipt:toggleMenuVisibility();" value="Show BioJs Menu"></input>
 
 </body>
 </html>
 
 
 <script>
+
+function toggleMenuVisibility(){
+       //alert("toggleMenuVisibility called!");
+       
+       var menu = document.getElementsByClassName("biojs_msa_menubar");
+       var divToggleButton = document.getElementById("divToggleButton");
+       if(menu[0].style.display == 'block'){
+          menu[0].style.display = 'none';
+          divToggleButton.value="Show BioJs Menu";
+       }else{
+          menu[0].style.display = 'block'; 
+          divToggleButton.value="Hide BioJs Menu";
+          }
+}
+function openJalviewUsingCurrentUrl2(){
+var jnpl = "<!--"+
+"Hi!"+
+"If you have downloaded this file after pressing \"Launch Full Application\" from Jalview on a web page and you don't know what to do with this file, you must install Java from http://www.java.sun.com then try opening this file again."+
+" \n"+
+"      JNLP generated by /jalviewServlet/services/launchAppDev"+
+"      JNLP generated from http://www.jalview.org/builds/develop/webstart/jalview.jnlp"+
+"Available servlet parameters (please URLEncode):"+
+"      open=<alignment file URL>"+
+"      jvm-max-heap=heap size in M or G"+
+"      features maps to        '-features'"+
+"      treeFile maps to        '-tree'"+
+"      tree maps to    '-tree'"+
+"      annotations maps to     '-annotations'"+
+"      colour maps to  '-colour'"+
+" "+
+"-->"+
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?><jnlp spec=\"1.0+\" codebase=\"http://www.jalview.org/builds/develop/webstart\">    <information>           <title>Jalview</title>          <vendor>The Barton Group</vendor>               <homepage href=\"http://www.jalview.org\"/>             <description>Jalview Multiple Alignment Editor</description>            <description kind=\"short\">Jalview</description>               <icon href=\"JalviewLogo_big.png\"/>            <offline-allowed/>      </information>  <security>              <all-permissions/>      </security>     <resources>             <j2se version=\"1.7+\" initial-heap-size=\"10M\" max-heap-size=\"2G\"/>         <jar href=\"jalview.jar\"/>             <jar href=\"JGoogleAnalytics_0.3.jar\"/>                <jar href=\"Jmol-12.2.4.jar\"/>         <jar href=\"VARNAv3-91.jar\"/>          <jar href=\"activation.jar\"/>          <jar href=\"apache-mime4j-0.6.jar\"/>           <jar href=\"axis.jar\"/>                <jar href=\"castor-1.1-cycle-xml.jar\"/>                <jar href=\"commons-codec-1.3.jar\"/>           <jar href=\"commons-discovery.jar\"/>           <jar href=\"commons-logging-1.1.1.jar\"/>               <jar href=\"groovy-all-1.8.2.jar\"/>            <jar href=\"httpclient-4.0.3.jar\"/>            <jar href=\"httpcore-4.0.1.jar\"/>              <jar href=\"httpmime-4.0.3.jar\"/>              <jar href=\"jalview_jnlp_vm.jar\"/>             <jar href=\"jaxrpc.jar\"/>              <jar href=\"jdas-1.0.4.jar\"/>          <jar href=\"jhall.jar\"/>               <jar href=\"json_simple-1.1.jar\"/>             <jar href=\"jsoup-1.8.1.jar\"/>         <jar href=\"jswingreader-0.3.jar\"/>            <jar href=\"log4j-to-slf4j-2.0-rc2.jar\"/>              <jar href=\"mail.jar\"/>                <jar href=\"miglayout-4.0-swing.jar\"/>         <jar href=\"min-jabaws-client-2.1.0.jar\"/>             <jar href=\"regex.jar\"/>               <jar href=\"saaj.jar\"/>                <jar href=\"slf4j-api-1.7.7.jar\"/>             <jar href=\"slf4j-log4j12-1.7.7.jar\"/>         <jar href=\"spring-core-3.0.5.RELEASE.jar\"/>           <jar href=\"spring-web-3.0.5.RELEASE.jar\"/>            <jar href=\"vamsas-client.jar\"/>               <jar href=\"wsdl4j.jar\"/>              <jar href=\"xercesImpl.jar\"/>          <jar href=\"xml-apis.jar\"/>            <property name=\"jalview.version\" value=\"Development Branch Build\"/> </resources>"+
+"<application-desc main-class=\"jalview.bin.Jalview\">"+
+"<argument>-open</argument>"+
+"<argument>file:///Users/tcnofoegbu/Documents/workspace/java/dev/jalview/examples/example_biojs.html</argument>"+
+"</application-desc>"+
+"      <security>"+
+"              <all-permissions/>"+
+"      </security>"+
+"</jnlp>"
+
+var encodedUri = encodeURI(jnpl);
+window.open(encodedUri)
+//alert(jnpl)
+}
+
 function openJalviewUsingCurrentUrl(){
        var url = "http://webservices.compbio.dundee.ac.uk:38080/jalviewServlet/services/launchAppDev";
        var myForm = document.createElement("form");
@@ -9082,7 +9128,6 @@ function Nets(uri, opts, cb) {
 
 // this is a way how you use a bundled file parser
 biojs.io.clustal.read("#", function(seqs){
-
 var opts = {};
 
 // set your custom properties
@@ -9091,7 +9136,7 @@ var opts = {};
 opts.seqs = JSON.parse(document.getElementById("seqData").value); 
 
 opts.el = document.getElementById("yourDiv");
-opts.vis = {conserv: false, overviewbox: false, labelid: false};
+opts.vis = {conserv: false, overviewbox: false, labelId: false};
 opts.zoomer = {alignmentHeight: 225, labelWidth: 130,labelFontsize: "13px",labelIdLength: 20,   menuFontsize: "12px",menuMarginLeft: "3px", menuPadding: "3px 4px 3px 4px", menuItemFontsize: "14px", menuItemLineHeight: "14px"};
 
 
@@ -9110,6 +9155,8 @@ m.addView("menu", defMenu);
 
 // call render at the end to display the whole MSA
 m.render();
-  
+toggleMenuVisibility(); 
+toggleMenuVisibility(); 
 });
 </script>
\ No newline at end of file