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.
22 var currentPage = "applets";
24 function createAppletTag(code, name, archive, width, height, params){
25 var app = document.createElement('applet');
29 app.archive = archive;
31 var arrayLength = params.length;
32 for (var i = 0; i < arrayLength; i++) {
33 //console.log('name : '+ params[i][0] + ' code : '+ params[i][1]);
34 var param = document.createElement('param');
35 param.name = params[i][0];
36 param.value = params[i][1];
37 app.appendChild(param);
42 function readCookie(name) {
43 var nameEQ = name + "=";
44 var ca = document.cookie.split(';');
45 for(var i=0;i < ca.length;i++) {
47 while (c.charAt(0)==' ') c = c.substring(1,c.length);
48 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
53 function setOrUpdateCookie(name, value, days) {
56 var date = new Date();
57 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
58 expires = "; expires=" + date.toGMTString();
63 document.cookie = name + "=" + value + expires + "; path=/";
67 var url = window.location.href;
69 var start = url.lastIndexOf("#");
70 var newPage = url.substring(start + 1, end);
71 var page = ((start === -1) ? currentPage : newPage);
72 //alert("page:" + page);
73 if(page === "embeddedWJmol"){
74 // do nothing embeddedWJmol page already include
76 $('#header').load("includes/header_jv.html");
77 //$('#content').load(page + ".html");
78 $('#nav').load("includes/nav_jv.html");
79 $('#footer').load("includes/footer_jv.html");
80 $('#'+ currentPage).addClass('active-trail active');
82 $('#header').load("includes/header_jv.html");
83 $('#content').load(page + ".html");
84 $('#nav').load("includes/nav_jv.html");
85 $('#footer').load("includes/footer_jv.html");
86 $('#'+ currentPage).addClass('active-trail active');
88 var e = document.getElementById("view_decorated");
89 e.style.display = 'none';
94 function doSubmit(target){
95 var currentPage = target+'.html';
96 //alert("page:" + target);
97 if(target == "embeddedWJmol"){
99 window.location.href = 'embeddedWJmol.html#' + target;
100 $('#content').load(currentPage);
102 window.location.href = 'index.html#' + target;
103 $('#content').load(currentPage);
110 function updateLinks(target) {
111 var ul = document.getElementById("menu");
112 var items = ul.getElementsByTagName("li");
113 for (var i = 0; i < items.length; ++i) {
114 removeClass(items[i], "active-trail active");
116 $('#'+ target).addClass('active-trail active');
119 function hasClass(ele,cls) {
120 return !!ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
123 function addClass(ele,cls) {
124 if (!hasClass(ele,cls)) ele.className += " "+cls;
127 function removeClass(ele,cls) {
128 if (hasClass(ele,cls)) {
129 var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
130 ele.className=ele.className.replace(reg,' ');