2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets";
22 var signedJars = "jalviewApplet.jar,JmolApplet-12.2.4.jar,java-json.jar,json_simple-1.1.jar";
23 var unsignedJars = "u_jalviewApplet.jar,u_JmolApplet-12.2.4.jar,u_java-json.jar,u_json_simple-1.1.jar";
24 setOrUpdateCookie('jv_applet_mode', 'false', '1');
25 var isSignedAppletMode = readCookie("jv_applet_mode");
26 var appletJars = (isSignedAppletMode === 'true') ? signedJars : unsignedJars;
30 function createAppletTag(code, name, archive, width, height, params){
31 var app = document.createElement('applet');
35 app.archive = archive;
37 var arrayLength = params.length;
38 for (var i = 0; i < arrayLength; i++) {
39 //console.log('name : '+ params[i][0] + ' code : '+ params[i][1]);
40 var param = document.createElement('param');
41 param.name = params[i][0];
42 param.value = params[i][1];
43 app.appendChild(param);
48 function readCookie(name) {
49 var nameEQ = name + "=";
50 var ca = document.cookie.split(';');
51 for(var i=0;i < ca.length;i++) {
53 while (c.charAt(0)==' ') c = c.substring(1,c.length);
54 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
59 function setOrUpdateCookie(name, value, days) {
62 var date = new Date();
63 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
64 expires = "; expires=" + date.toGMTString();
69 document.cookie = name + "=" + value + expires + "; path=/";
73 //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets.html";
74 //alert("cur page : " + currentPage);
75 $('#header').load("includes/header_jv.html");
76 $('#content').load(currentPage+".html");
77 $('#nav').load("includes/nav_jv.html");
78 $('#footer').load("includes/footer_jv.html");
79 $('#'+ currentPage).addClass('active-trail active');
82 $(document).ready(function(){
83 //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets.html";
84 //updateLinks(currentPage);
85 var params = [["file","uniref50.fa"],
86 ["treeFile","ferredoxin.nw"],
87 ["userDefinedColour","C=yellow; R,K,H=FF5555; D,E=5555F"],
88 ["sortByTree","True"],
89 ["showSequenceLogo","true"],
90 ["showGroupConsensus","true"],
91 ["showFullId","false"],
92 ["linkLabel_1","Uniprot"],
93 ["linkUrl_1","http://www.uniprot.org/uniprot/$SEQUENCE_ID$"],
94 ["linkLabel_2","EMBL-EBI Search"],
95 ["linkUrl_2","http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$"],
96 ["APPLICATION_URL","http://www.jalview.org/services/launchApp"]];
97 var app = createAppletTag('jalview.bin.JalviewLite','',appletJars,'140','35', params);
98 console.log('—————————> app ———————> ' + app);
99 //var appDiv = document.getElementById("applet_div");
100 //var appDiv = document.getElementById("applet_div");
101 //appDiv.appendChild(app);
102 $("<div class='newbox'>I'm new box by appendTo</div>").appendTo('.applet_div');
103 //$(‘.applet_div').append(app);
106 function doSubmit(target){
107 setOrUpdateCookie('current_page', target, '1');
108 //alert('current page : ' + readCookie("current_page"));
109 var currentPage = target+'.html';
110 $('#content').load(currentPage);
114 function updateLinks(target) {
115 var ul = document.getElementById("menu");
116 var items = ul.getElementsByTagName("li");
117 for (var i = 0; i < items.length; ++i) {
118 removeClass(items[i], "active-trail active");
120 $('#'+ target).addClass('active-trail active');
123 function hasClass(ele,cls) {
124 return !!ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
127 function addClass(ele,cls) {
128 if (!hasClass(ele,cls)) ele.className += " "+cls;
131 function removeClass(ele,cls) {
132 if (hasClass(ele,cls)) {
133 var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
134 ele.className=ele.className.replace(reg,' ');