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 currentPage = "applets";
23 var signedJars = "jalviewApplet.jar,JmolApplet-12.2.4.jar,java-json.jar,json_simple-1.1.jar";
24 var unsignedJars = "u_jalviewApplet.jar,u_JmolApplet-12.2.4.jar,u_java-json.jar,u_json_simple-1.1.jar";
25 setOrUpdateCookie('jv_applet_mode', 'false', '1');
26 //var isSignedAppletMode = readCookie("jv_applet_mode");
27 //var appletJars = (isSignedAppletMode === 'true') ? signedJars : unsignedJars;
31 function createAppletTag(code, name, archive, width, height, params){
32 var app = document.createElement('applet');
36 app.archive = archive;
38 var arrayLength = params.length;
39 for (var i = 0; i < arrayLength; i++) {
40 //console.log('name : '+ params[i][0] + ' code : '+ params[i][1]);
41 var param = document.createElement('param');
42 param.name = params[i][0];
43 param.value = params[i][1];
44 app.appendChild(param);
49 function readCookie(name) {
50 var nameEQ = name + "=";
51 var ca = document.cookie.split(';');
52 for(var i=0;i < ca.length;i++) {
54 while (c.charAt(0)==' ') c = c.substring(1,c.length);
55 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
60 function setOrUpdateCookie(name, value, days) {
63 var date = new Date();
64 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
65 expires = "; expires=" + date.toGMTString();
70 document.cookie = name + "=" + value + expires + "; path=/";
74 var url = window.location.href;
76 var start = url.lastIndexOf("#");
77 var newPage = url.substring(start + 1, end);
78 var page = ((start === -1) ? currentPage : newPage);
79 alert("page:" + page);
80 $('#header').load("includes/header_jv.html");
81 $('#content').load(page+".html");
82 $('#nav').load("includes/nav_jv.html");
83 $('#footer').load("includes/footer_jv.html");
84 $('#'+ currentPage).addClass('active-trail active');
87 $(document).ready(function(){
88 //var currentPage = (readCookie("current_page")) ? readCookie("current_page") : "applets.html";
89 //updateLinks(currentPage);
90 var params = [["file","uniref50.fa"],
91 ["treeFile","ferredoxin.nw"],
92 ["userDefinedColour","C=yellow; R,K,H=FF5555; D,E=5555F"],
93 ["sortByTree","True"],
94 ["showSequenceLogo","true"],
95 ["showGroupConsensus","true"],
96 ["showFullId","false"],
97 ["linkLabel_1","Uniprot"],
98 ["linkUrl_1","http://www.uniprot.org/uniprot/$SEQUENCE_ID$"],
99 ["linkLabel_2","EMBL-EBI Search"],
100 ["linkUrl_2","http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$"],
101 ["APPLICATION_URL","http://www.jalview.org/services/launchApp"]];
102 var app = createAppletTag('jalview.bin.JalviewLite','',appletJars,'140','35', params);
103 console.log('—————————> app ———————> ' + app);
104 //var appDiv = document.getElementById("applet_div");
105 //var appDiv = document.getElementById("applet_div");
106 //appDiv.appendChild(app);
107 $("<div class='newbox'>I'm new box by appendTo</div>").appendTo('.applet_div');
108 //$(‘.applet_div').append(app);
111 function doSubmit(target){
112 //setOrUpdateCookie('current_page', target, '1');
113 //alert('current page : ' + readCookie("current_page"));
114 var currentPage = target+'.html';
115 $('#content').load(currentPage);
119 function updateLinks(target) {
120 var ul = document.getElementById("menu");
121 var items = ul.getElementsByTagName("li");
122 for (var i = 0; i < items.length; ++i) {
123 removeClass(items[i], "active-trail active");
125 $('#'+ target).addClass('active-trail active');
128 function hasClass(ele,cls) {
129 return !!ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
132 function addClass(ele,cls) {
133 if (!hasClass(ele,cls)) ele.className += " "+cls;
136 function removeClass(ele,cls) {
137 if (hasClass(ele,cls)) {
138 var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
139 ele.className=ele.className.replace(reg,' ');