+++ /dev/null
-Jalview = {}
-
-
-$(document).ready(function() {
- Jalview.processAllAppletElements();
-});
-
-
-var currentPage = "applets";
-
-Jalview.processAllAppletElements = function() {
- var apps = document.getElementsByTagName("applet");
- for (var i = apps.length; --i >= 0;) {
- processAppletElement(apps[i]);
- }
-}
-
-Jalview.jvid = 0;
-
-Jalview.doStartJalview = function(e) {
- var element = e.target.appletElement;
- var text = element.outerHTML;
-
- var Info = self.JalviewInfo || {
-code: null,
-main: "jalview.bin.Jalview",
-core: "NONE",
- width: 850,
- height: 550,
- readyFunction: null,
- serverURL: 'https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php',
- j2sPath: 'swingjs/j2s',
- console:'sysoutdiv',
- allowjavascript: true
- }
-
-var addParam = function(key,value) {
- args.push("name=\"" + key + "\" value=\"" + value + "\"");
-}
-
-var id = "JVApplet" + jvid++;
-var args = text.replace(/[\n\t]/g, " ").split("<param ");
-Info.j2sAppletID = i;
-Info.j2sAppletID = id;
-Info.jalview_SCREEN_X= 10,
-Info.jalview_SCREEN_Y= 10;
-//Info.jalview_EMBEDDED= true;
-
-
-Info.jalview_SCREEN_WIDTH = 400;
-Info.jalview_SCREEN_HEIGHT = 100;
-for (var i in Info) {
- var v = ("" + Info[i] || "null").replace(/\"/g,"'");
- addParam(args, "Info." + i, v);
-}
- Info.args = args;
- SwingJS.getApplet(id, Info);
- document.title = id;
- e.target.style.visibility="hidden";
-}
-
-Jalview.processAppletElement = function(element) {
-var code = element.getAttribute("code");
-var parent = element.parentElement;
-if (code == "jalview.bin.JalviewLite") {
- var text = element.outerHTML;
- console.log(text);
- var btn = document.createElement("button");
- btn.innerHTML = "Start Jalview";
- var a = element.getAttribute("width");
- btn.style.width = (a || 140) + "px";
- a = element.getAttribute("height");
- btn.style.height = (a || 25) + "px";
- btn.appletElement = element;
- parent.replaceChild(btn, element);
- $(btn).click(doStartJalview)
-} else {
- parent.removeElement(element);
-}
-}
-
-
- /**
- * Generate an applet tag
- *
- * @param code
- * @param name
- * @param archive
- * @param width
- * @param height
- * @param params
- * @returns a DOM APPLET element
- */
-
-Jalview.createAppletTag = function(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;
-}
-