--- /dev/null
+/**
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+
+
+ var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets";
+ var signedJars = "jalviewApplet.jar,JmolApplet-12.2.4.jar,java-json.jar,json_simple-1.1.jar";
+ var unsignedJars = "u_jalviewApplet.jar,u_JmolApplet-12.2.4.jar,u_java-json.jar,u_json_simple-1.1.jar";
+ setOrUpdateCookie('jv_applet_mode', 'false', '1');
+ var isSignedAppletMode = readCookie("jv_applet_mode");
+ var appletJars = (isSignedAppletMode === 'true') ? signedJars : unsignedJars;
+ //alert(unsigned);
+
+
+ function createAppletTag(code, name, archive, width, height, params){
+ var app = document.createElement('applet');
+ app.code= code;
+ app.width = width;
+ app.height = height;
+ app.archive = archive;
+
+ var arrayLength = params.length;
+ for (var i = 0; i < arrayLength; i++) {
+ //console.log('name : '+ params[i][0] + ' code : '+ params[i][1]);
+ var param = document.createElement('param');
+ param.name = params[i][0];
+ param.value = params[i][1];
+ app.appendChild(param);
+ }
+ return app;
+ }
+
+ function readCookie(name) {
+ var nameEQ = name + "=";
+ var ca = document.cookie.split(';');
+ for(var i=0;i < ca.length;i++) {
+ var c = ca[i];
+ while (c.charAt(0)==' ') c = c.substring(1,c.length);
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
+ }
+ return null;
+ }
+
+ function setOrUpdateCookie(name, value, days) {
+ var expires;
+ if (days) {
+ var date = new Date();
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ expires = "; expires=" + date.toGMTString();
+ }
+ else {
+ expires = "";
+ }
+ document.cookie = name + "=" + value + expires + "; path=/";
+ }
+
+ $(function(){
+ //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets.html";
+ //alert("cur page : " + currentPage);
+ $('#header').load("includes/header_jv.html");
+ $('#content').load(currentPage+".html");
+ $('#nav').load("includes/nav_jv.html");
+ $('#footer').load("includes/footer_jv.html");
+ $('#'+ currentPage).addClass('active-trail active');
+ });
+
+ $(document).ready(function(){
+ //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets.html";
+ //updateLinks(currentPage);
+ var params = [["file","uniref50.fa"],
+ ["treeFile","ferredoxin.nw"],
+ ["userDefinedColour","C=yellow; R,K,H=FF5555; D,E=5555F"],
+ ["sortByTree","True"],
+ ["showSequenceLogo","true"],
+ ["showGroupConsensus","true"],
+ ["showFullId","false"],
+ ["linkLabel_1","Uniprot"],
+ ["linkUrl_1","http://www.uniprot.org/uniprot/$SEQUENCE_ID$"],
+ ["linkLabel_2","EMBL-EBI Search"],
+ ["linkUrl_2","http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$"],
+ ["APPLICATION_URL","http://www.jalview.org/services/launchApp"]];
+ var app = createAppletTag('jalview.bin.JalviewLite','',appletJars,'140','35', params);
+ console.log('—————————> app ———————> ' + app);
+ //var appDiv = document.getElementById("applet_div");
+ //var appDiv = document.getElementById("applet_div");
+ //appDiv.appendChild(app);
+ $("<div class='newbox'>I'm new box by appendTo</div>").appendTo('.applet_div');
+ //$(‘.applet_div').append(app);
+ });
+
+function doSubmit(target){
+ setOrUpdateCookie('current_page', target, '1');
+ //alert('current page : ' + readCookie("current_page"));
+ var currentPage = target+'.html';
+ $('#content').load(currentPage);
+ updateLinks(target);
+}
+
+function updateLinks(target) {
+ var ul = document.getElementById("menu");
+ var items = ul.getElementsByTagName("li");
+ for (var i = 0; i < items.length; ++i) {
+ removeClass(items[i], "active-trail active");
+ }
+ $('#'+ target).addClass('active-trail active');
+}
+
+function hasClass(ele,cls) {
+ return !!ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
+}
+
+function addClass(ele,cls) {
+ if (!hasClass(ele,cls)) ele.className += " "+cls;
+}
+
+function removeClass(ele,cls) {
+ if (hasClass(ele,cls)) {
+ var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
+ ele.className=ele.className.replace(reg,' ');
+ }
+}