From: <ahe...@us...> - 2008-10-09 10:22:58
|
Revision: 10023 http://jmol.svn.sourceforge.net/jmol/?rev=10023&view=rev Author: aherraez Date: 2008-10-09 10:21:56 +0000 (Thu, 09 Oct 2008) Log Message: ----------- website - update to 11.6 Modified Paths: -------------- trunk/Jmol-web/build.xml trunk/Jmol-web/source/doc/jmol/Jmol.js trunk/Jmol-web/source/doc/jmol/JmolApplet.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Popup.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Quantum.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ReadersCifPdb.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ReadersMolXyz.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ReadersMore.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ReadersXml.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ShapeBio.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ShapeSpecial.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Smiles.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_i18n.jar Added Paths: ----------- trunk/Jmol-web/source/doc/jmol/JmolApplet0_Minimize.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_ShapeSurface.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Symmetry.jar Removed Paths: ------------- trunk/Jmol-web/source/doc/jmol/JmolApplet0_Core.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Jars.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Jvxl.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Main.jar trunk/Jmol-web/source/doc/jmol/JmolApplet0_Viewer.jar Modified: trunk/Jmol-web/build.xml =================================================================== --- trunk/Jmol-web/build.xml 2008-10-09 09:52:45 UTC (rev 10022) +++ trunk/Jmol-web/build.xml 2008-10-09 10:21:56 UTC (rev 10023) @@ -6,7 +6,7 @@ <pathelement location="./ant-contrib.jar"/> </classpath> </taskdef> - <property name="version" value="11.4"/> + <property name="version" value="11.6"/> <property name="jmol-doc-dir" value="../Jmol"/> <property name="fah.projects.dir" value="../Jmol-FAH/projects"/> <property name="doc.dir" value="source/doc"/> Modified: trunk/Jmol-web/source/doc/jmol/Jmol.js =================================================================== --- trunk/Jmol-web/source/doc/jmol/Jmol.js 2008-10-09 09:52:45 UTC (rev 10022) +++ trunk/Jmol-web/source/doc/jmol/Jmol.js 2008-10-09 10:21:56 UTC (rev 10023) @@ -1,10 +1,10 @@ -/* Jmol 11.4 script library Jmol.js 12:44 PM 12/10/2007 hansonr +/* Jmol 11.0 script library Jmol.js (aka Jmol-11.js) 11:49 AM 9/23/2008 Bob Hanson - checkbox heirarchy -- see http://chemapps.stolaf.edu/jmol/docs/examples-11/check.htm + checkbox heirarchy -- see http://www.stolaf.edu/academics/jmol/docs/examples-11/check.htm based on: * - * Copyright (C) 2004-2007 Miguel, Jmol Development, www.jmol.org + * Copyright (C) 2004-2005 Miguel, Jmol Development, www.jmol.org * * Contact: ha...@st... * @@ -29,6 +29,7 @@ try{if(typeof(_jmol)!="undefined")exit() // place "?NOAPPLET" on your command line to check applet control action with a textarea +// place "?JMOLJAR=xxxxx" to use a specific jar file // bob hanson -- jmolResize(w,h) -- resizes absolutely or by percent (w or h 0.5 means 50%) // bob hanson -- jmolEvaluate -- evaluates molecular math 8:37 AM 2/23/2007 @@ -56,14 +57,37 @@ // bh -- jmolSetTranslation(TF) -- forces translation even if there might be message callback issues // bh -- minor fixes suggested by Angel // bh -- adds jmolSetSyncId() and jmolGetSyncId() +// bh 3/2008 -- adds jmolAppendInlineScript() and jmolAppendInlineArray() +// bh 3/2008 -- fixes IE7 bug in relation to jmolLoadInlineArray() +// bh 6/2008 -- adds jmolSetAppletWindow() +// Angel H. 6/2008 -- added html <label> tags to checkboxes and radio buttons [in jmolCheckbox() and _jmolRadio() functions] +// bh 7/2000 -- code fix "for(i..." not "for(var i..." + +var defaultdir = "." +var defaultjar = "JmolApplet.jar" -// bh -- workaround for Mac liveConnect bug not able to match method signature in loadInline: -// ALWAYS USE jmolLoadInlineArray() or jmolLoadInlineString() +// Note added 12:41 PM 9/21/2008 by Bob Hanson, ha...@st...: -var defaultdir = "." -var defaultjar = "JmolApplet.jar" +// JMOLJAR=xxxxx.jar on the URL for this page will override +// the JAR file specified in the jmolInitialize() call. +// The idea is that it can be very useful to test a web page with different JAR files +// Or for an expert user to substitute a signed applet for an unsigned one +// so as to use a broader range of models or to create JPEG files, for example. + +// If the JAR file is not in the current directory (has any sort of "/" in its name) +// then the user is presented with a warning and asked whether it is OK to change Jar files. +// The default action, if the user just presses "OK" is to NOT allow the change. +// The user must type the word "yes" in the prompt box for the change to be approved. + +// If you don't want people to be able to switch in their own JAR file on your page, +// simply set this next line to read "var allowJMOLJAR = false". + + +var allowJMOLJAR = true + + var undefined; // for IE 5 ... wherein undefined is undefined //////////////////////////////////////////////////////////////// @@ -71,23 +95,22 @@ //////////////////////////////////////////////////////////////// function jmolInitialize(codebaseDirectory, fileNameOrUseSignedApplet) { - if (_jmol.initialized) { - //alert("jmolInitialize() should only be called *ONCE* within a page"); - return; + if(allowJMOLJAR && document.location.search.indexOf("JMOLJAR=")>=0) { + var f = document.location.search.split("JMOLJAR=")[1].split("&")[0]; + if (f.indexOf("/") >= 0) { + alert ("This web page URL is requesting that the applet used be " + f + ". This is a possible security risk, particularly if the applet is signed, because signed applets can read and write files on your local machine or network.") + var ok = prompt("Do you want to use applet " + f + "? ","yes or no") + if (ok == "yes") { + codebaseDirectory = f.substring(0, f.lastIndexOf("/")); + fileNameOrUseSignedApplet = f.substring(f.lastIndexOf("/") + 1); + } else { + _jmolGetJarFilename(fileNameOrUseSignedApplet); + alert("The web page URL was ignored. Continuing using " + _jmol.archivePath + ' in directory "' + codebaseDirectory + '"'); + } + } else { + fileNameOrUseSignedApplet = f; + } } - if (! codebaseDirectory) { - alert("codebaseDirectory is a required parameter to jmolInitialize"); - codebaseDirectory = "."; - } - - if (codebaseDirectory.indexOf("http://") == 0 || - codebaseDirectory.indexOf("https://") == 0) - alert("In general, an absolute URL is not recommended for codebaseDirectory.\n" + - "A directory- or docroot-relative reference is recommended.\n\n" + - "If you need to use an absolute URL (because, for example, the JAR and data\n" + - "files are on another server), then insert a space before\n" + - "\"http\" in your URL to avoid this warning message."); - _jmolSetCodebase(codebaseDirectory); _jmolGetJarFilename(fileNameOrUseSignedApplet); _jmolOnloadResetForms(); @@ -124,6 +147,10 @@ " progresscolor=" + _jmol.params.progresscolor); } +function jmolSetAppletWindow(w) { + _jmol.appletWindow = w; +} + function jmolApplet(size, script, nameSuffix) { _jmolInitCheck(); return _jmolApplet(size, null, script, nameSuffix); @@ -181,7 +208,7 @@ t += eospan eospan = ""; } - t += labelHtml +eospan; + t += "<label for=\"" + id + "\">" + labelHtml + "</label>" +eospan; if (_jmol.debugAlert) alert(t); return _jmolDocumentWrite(t); @@ -364,58 +391,54 @@ } } -//Java in MacOS X bug: cannot differentiate properly between signatures String and String[] -//so we have to do these explicitly - -function jmolLoadInlineString(model, script, isAppend, targetSuffix) { +function jmolLoadInline(model, targetSuffix) { if (!model)return - if (!script)script =""; - if (!isAppend)isAppend = false; - if (!targetSuffix)targetSuffix = 0; var applet=_jmolGetApplet(targetSuffix); - if (!applet)return; - if (applet.loadInlineString) //Jmol 11.4 - applet.loadInlineString(model, script, isAppend); - else //Jmol 11.2 - applet.loadInlineString(model, script); - + if (!applet)return + if (typeof(model) == "string") + applet.loadInlineString(model, "", false); + else + applet.loadInlineArray(model, "", false); } -//If the array contains strings that include newline characters, then the array is assumed to -//be a set of models; if not, then the array is assumed to be a set of lines for one model -function jmolLoadInlineArray(model_or_models, script, isAppend, targetSuffix) { - if (!model_or_models)return - if (!script)script =""; - if (!isAppend)isAppend = false; - if (!targetSuffix)targetSuffix = 0; +function jmolLoadInlineScript(model, script, targetSuffix) { + if (!model)return var applet=_jmolGetApplet(targetSuffix); - if (!applet)return; - if (applet.loadInlineArray) //Jmol 11.4 - applet.loadInlineArray(model_or_models, script, isAppend); - else //Jmol 11.2 - applet.loadInline(model_or_models, script); + if (applet)applet.loadInlineString(model, script, false); } -// modified to work under MAC OS +function jmolLoadInlineArray(ModelArray, script, targetSuffix) { + if (!model)return + if (!script)script="" + var applet=_jmolGetApplet(targetSuffix); + if (!applet)return + try { + applet.loadInlineArray(ModelArray, script, false); + } catch (err) { + //IE 7 bug + applet.loadInlineString(ModelArray.join("\n"), script, false); + } +} -function jmolLoadInline(model, targetSuffix) { +function jmolAppendInlineArray(ModelArray, script, targetSuffix) { if (!model)return - if (!targetSuffix)targetSuffix = 0; - jmolLoadInlineString(model, "", false, targetSuffix); + if (!script)script="" + var applet=_jmolGetApplet(targetSuffix); + if (!applet)return + try { + applet.loadInlineArray(ModelArray, script, true); + } catch (err) { + //IE 7 bug + applet.loadInlineString(ModelArray.join("\n"), script, true); + } } -// modified to work under MAC OS - -function jmolLoadInlineScript(model, script, targetSuffix) { +function jmolAppendInlineScript(model, script, targetSuffix) { if (!model)return - if (!script)script =""; - if (!targetSuffix)targetSuffix = 0; - if (typeof(model)=="object") - jmolLoadInlineArray(model, script, false, targetSuffix); - else - jmolLoadInlineString(model, script, false, targetSuffix); + var applet=_jmolGetApplet(targetSuffix); + if (applet)applet.loadInlineString(model, script, true); } function jmolCheckBrowser(action, urlOrMessage, nowOrLater) { @@ -495,11 +518,12 @@ debugAlert: false, - codebase: ".", + codebase: "", modelbase: ".", appletCount: 0, appletSuffixes: [], + appletWindow: null, buttonCount: 0, checkboxCount: 0, @@ -646,6 +670,7 @@ haveSetTranslate = false; } + function jmolSetCallback(callbackName,funcName) { _jmol.params[callbackName] = funcName } @@ -690,7 +715,8 @@ var sz = _jmolGetAppletSize(size); var widthAndHeight = " width='" + sz[0] + "' height='" + sz[1] + "' "; var tHeader, tFooter; - + if (!codebase) + jmolInitialize("."); if (useIEObject || useHtml4Object) { params.name = 'jmolApplet' + nameSuffix; params.archive = archivePath; @@ -844,7 +870,7 @@ 2048 standard for GeoWall (http://geowall.geo.lsa.umich.edu/home.html) */ -if (allowedJmolSize==undefined) var allowedJmolSize = [25, 2048, 300] // min, max, default (pixels) +if (allowedJmolSize==undefined) var allowedJmolSize = [1, 2048, 300] // min, max, default (pixels) function _jmolGetAppletSize(size) { /* AngelH, mar2007 Accepts single number or 2-value array, each one can be either: @@ -894,13 +920,14 @@ t += eospan eospan = ""; } - t += labelHtml +eospan + separatorHtml; + t += "<label for=\"" + id + "\">" + labelHtml + "</label>" +eospan + separatorHtml; + return t; } function _jmolFindApplet(target) { // first look for the target in the current window - var applet = _jmolFindAppletInWindow(window, target); + var applet = _jmolFindAppletInWindow(_jmol.appletWindow != null ? _jmol.appletWindow : window, target); // THEN look for the target in child frames if (applet == undefined) applet = _jmolSearchFrames(window, target); @@ -923,15 +950,18 @@ var applet; var frames = win.frames; if (frames && frames.length) { // look in all the frames below this window + try{ for (var i = 0; i < frames.length; ++i) { applet = _jmolSearchFrames(frames[i], target); if (applet) - break; + return applet; } - } else { // look for the applet in this window - applet = _jmolFindAppletInWindow(win, target) + }catch(e) { + if (_jmol.debugAlert) + alert("Jmol.js _jmolSearchFrames cannot access " + win.name + ".frame[" + i + "] consider using jmolSetAppletWindow()") + } } - return applet; + return applet = _jmolFindAppletInWindow(win, target) } function _jmolFindAppletInWindow(win, target) { @@ -953,7 +983,8 @@ return index; } -function _jmolClick(scriptIndex, targetSuffix) { +function _jmolClick(scriptIndex, targetSuffix, elementClicked) { + _jmol.element = elementClicked; jmolScript(_jmol.scripts[scriptIndex], targetSuffix); } @@ -976,17 +1007,17 @@ } -_jmol.checkboxMasters = new Array(); -_jmol.checkboxItems = new Array(); +_jmol.checkboxMasters = {}; +_jmol.checkboxItems = {}; function jmolSetCheckboxGroup(chkMaster,chkBox) { var id = chkMaster; if(typeof(id)=="number")id = "jmolCheckbox" + id; chkMaster = document.getElementById(id); if (!chkMaster)alert("jmolSetCheckboxGroup: master checkbox not found: " + id); - var m = _jmol.checkboxMasters[id] = new Array(); + var m = _jmol.checkboxMasters[id] = {}; m.chkMaster = chkMaster; - m.chkGroup = new Array(); + m.chkGroup = {}; for (var i = 1; i < arguments.length; i++){ var id = arguments[i]; if(typeof(id)=="number")id = "jmolCheckbox" + id; @@ -1024,6 +1055,7 @@ } function _jmolCbClick(ckbox, whenChecked, whenUnchecked, targetSuffix) { + _jmol.control = ckbox _jmolClick(ckbox.checked ? whenChecked : whenUnchecked, targetSuffix); if(_jmol.checkboxMasters[ckbox.id]) _jmolNotifyGroup(_jmol.checkboxMasters[ckbox.id], ckbox.checked) @@ -1091,7 +1123,7 @@ }else if(!isNaN(A)||A==null){ sout+="\n"+key+"="+(A+""==""?"null":A) }else if(A.length){ - sout+=key+"=new Array()" + sout+=key+"=[]" for(var i=0;i<A.length;i++){ sout+="\n" if(typeof(A[i]) == "object"||typeof(A[i]) == "array"){ @@ -1102,7 +1134,7 @@ } }else{ if(key != ""){ - sout+=key+"=new Array()" + sout+=key+"={}" key+="." } @@ -1125,7 +1157,7 @@ function _jmolSortMessages(A){ if(!A || typeof(A)!="object")return [] - var B = new Array() + var B = [] for(var i=A.length-1;i>=0;i--)for(var j=0;j<A[i].length;j++)B[B.length]=A[i][j] if(B.length == 0) return B=B.sort(_jmolSortKey0) @@ -1135,10 +1167,10 @@ /////////additional extensions ////////// -function _jmolDomScriptLoad(URL, target){ +function _jmolDomScriptLoad(URL){ //open(URL) //to debug _jmol.servercall=URL - var node = document.getElementById("_jmolScriptNode" + target) + var node = document.getElementById("_jmolScriptNode") if (node && _jmol.browser!="msie"){ document.getElementsByTagName("HEAD")[0].removeChild(node) node=null @@ -1147,7 +1179,7 @@ node.setAttribute("src",URL) } else { node=document.createElement("script") - node.setAttribute("id","_jmolScriptNode" + target) + node.setAttribute("id","_jmolScriptNode") node.setAttribute("type","text/javascript") node.setAttribute("src",URL) document.getElementsByTagName("HEAD")[0].appendChild(node) @@ -1171,7 +1203,7 @@ //overload this function to customize return _jmol.remoteURL=remoteURL if(isError)alert(errorMessage) - jmolLoadInlineArray(array,_jmol.optionalscript,false,targetSuffix) + jmolLoadInlineScript(array.join("\n"),_jmol.optionalscript,targetSuffix) } //////////user property/status functions///////// @@ -1218,8 +1250,8 @@ if(!targetSuffix)targetSuffix="0" var Ret=jmolScriptWaitAsArray(script, targetSuffix) var s = "" - for(i=Ret.length;--i>=0;) - for(j=0;j< Ret[i].length;j++) + for(var i=Ret.length;--i>=0;) + for(var j=0;j< Ret[i].length;j++) s+=Ret[i][j]+"\n" return s } @@ -1242,8 +1274,8 @@ if(!targetSuffix)targetSuffix="0" var Ret=jmolScriptWaitAsArray(script, targetSuffix) var s = "" - for(i=Ret.length;--i>=0;) - for(j=Ret[i].length;--j>=0;) + for(var i=Ret.length;--i>=0;) + for(var j=Ret[i].length;--j>=0;) if (Ret[i][j][1] == "scriptEcho")s+=Ret[i][j][3]+"\n" return s.replace(/ \| /g, "\n") } @@ -1254,8 +1286,8 @@ if(!targetSuffix)targetSuffix="0" var Ret=jmolScriptWaitAsArray(script, targetSuffix) var s = "" - for(i=Ret.length;--i>=0;) - for(j=Ret[i].length;--j>=0;) + for(var i=Ret.length;--i>=0;) + for(var j=Ret[i].length;--j>=0;) if (Ret[i][j][1] == "scriptStatus")s+=Ret[i][j][3]+"\n" return s.replace(/ \| /g, "\n") } @@ -1340,9 +1372,9 @@ _jmol.thismodel=pdbid _jmol.thistargetsuffix=targetSuffix _jmol.thisurl=url - _jmol.modelArray = new Array() + _jmol.modelArray = [] url=_jmol.serverURL+"?returnfunction=_jmolLoadModel&returnArray=_jmol.modelArray&id="+targetSuffix+_jmolExtractPostData(url) - _jmolDomScriptLoad(url, targetSuffix) + _jmolDomScriptLoad(url) return url } @@ -1357,10 +1389,10 @@ if(!optionalscript)optionalscript="" _jmol.optionalscript=optionalscript _jmol.thistargetsuffix=targetSuffix - _jmol.modelArray = new Array() + _jmol.modelArray = [] _jmol.thisurl = url url=_jmol.serverURL+"?returnfunction=_jmolLoadModel&returnArray=_jmol.modelArray&id="+targetSuffix+_jmolExtractPostData(url) - _jmolDomScriptLoad(url, targetSuffix) + _jmolDomScriptLoad(url) } @@ -1384,9 +1416,9 @@ _jmol.thismodelMSA=value _jmol.thistargetsuffix=targetSuffix _jmol.thisurl=url - _jmol.modelArray = new Array() + _jmol.modelArray = [] loadModel=_jmolLoadModel - _jmolDomScriptLoad(url, targetSuffix) + _jmolDomScriptLoad(url) return url } @@ -1399,10 +1431,10 @@ _jmol.optionalscript=optionalscript _jmol.thismodel=userid _jmol.thistargetsuffix=targetSuffix - _jmol.modelArray = new Array() + _jmol.modelArray = [] _jmol.thisurl = url url+="&returnFunction=_jmolLoadModel&returnArray=_jmol.modelArray&id="+targetSuffix - _jmolDomScriptLoad(url, targetSuffix) + _jmolDomScriptLoad(url) } Property changes on: trunk/Jmol-web/source/doc/jmol/JmolApplet0_Minimize.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/Jmol-web/source/doc/jmol/JmolApplet0_ShapeSurface.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Property changes on: trunk/Jmol-web/source/doc/jmol/JmolApplet0_Symmetry.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |