Path: blob/master/build/pkgs/jmol/patches/Jmol.js.patch
8820 views
--- /home/jonathan/Documents/jmol-12.3.27.p0/src/jmol/Jmol.js1+++ /home/jonathan/Documents/jmol-12.3.27.p0/patches/Jmol.js2@@ -81,11 +81,6 @@3// bh 4/2010 -- added jmolSetMemoryMb(nMb)4// ah 1/2011 -- wider detection of browsers; more browsers now use the object tag instead of the applet tag;5// fix of object tag (removed classid) accounts for change of behavior in Chrome6-// bh 3/2011 -- added jmolLoadAjax_STOLAF_NIH7-// ah 9/2011 -- Applet is now wrapped in a <span> tag (might break existing user code).8-// Added jmolSwitchToSignedApplet(); replaces an applet with the signed applet,9-// preserving size, model and state; an additional script may be specified.10-// Note: as a result, unsigned and signed applets may coexist in a page.1112var defaultdir = "."13var defaultjar = "JmolApplet.jar"14@@ -104,9 +99,6 @@15// then the user is presented with a warning and asked whether it is OK to change Jar files.16// The default action, if the user just presses "OK" is to NOT allow the change.17// The user must type the word "yes" in the prompt box for the change to be approved.18-19-// For a simple change to the signed applet in the same original directory (if it's available),20-// you can use JMOLJAR=SIGNED on the URL.2122// If you don't want people to be able to switch in their own JAR file on your page,23// simply set this next line to read "var allowJMOLJAR = false".24@@ -135,7 +127,6 @@25alert("The web page URL was ignored. Continuing using " + _jmol.archivePath + ' in directory "' + codebaseDirectory + '"');26}27} else {28- if (f=="SIGNED") { f=true; }29fileNameOrUseSignedApplet = f;30}31}32@@ -148,6 +139,10 @@33_jmol.params.doTranslate = ''+TF;34}3536+function jmolToSigned(){37+ _jmolGetJarFilename(true);38+}39+40function _jmolGetJarFilename(fileNameOrFlag) {41_jmol.archivePath =42(typeof(fileNameOrFlag) == "string" ? fileNameOrFlag : (fileNameOrFlag ? "JmolAppletSigned" : "JmolApplet") + "0.jar");43@@ -494,26 +489,6 @@44}45if (typeof nowOrLater == "string" && nowOrLater.toLowerCase() == "now")46_jmolCheckBrowser();47-}48-49-var _jmolScriptForSwitching;50-function jmolSwitchToSignedApplet(targetSuffix, additionalScript) {51- if (!targetSuffix) { targetSuffix = "0"; }52- if (!additionalScript) { additionalScript = ""; }53- var s = jmolEvaluate("_signedApplet",targetSuffix);54- var w = jmolEvaluate("_width",targetSuffix);55- var h = jmolEvaluate("_height",targetSuffix);56- if (s=="true") {57- jmolScript(additionalScript,targetSuffix);58- return;59- }60- var appletParent = document.getElementById("jmolApplet"+targetSuffix).parentNode;61- _jmolScriptForSwitching = jmolGetPropertyAsString("stateInfo", "", targetSuffix) + additionalScript;62- appletParent.innerHTML = "";63- _jmolGetJarFilename(true);64- jmolSetDocument(false);65- appletParent.innerHTML = jmolApplet([w,h], "javascript jmolScript(_jmolScriptForSwitching," + targetSuffix + ")", targetSuffix);66- jmolSetDocument(document);67}6869////////////////////////////////////////////////////////////////70@@ -789,11 +764,11 @@71params.mayscript = 'true';72params.codebase = codebase;73params.code = 'JmolApplet';74- tHeader = "<span>" +75+ tHeader =76"<object name='jmolApplet" + nameSuffix +77"' id='jmolApplet" + nameSuffix + "' " + appletCssText + "\n" +78widthAndHeight + "\n";79- tFooter = "</object></span>";80+ tFooter = "</object>";81}82if (java_arguments)83params.java_arguments = java_arguments;84@@ -810,14 +785,14 @@85Removing the classid parameter seems to be well tolerated by all browsers (even IE!).86*/87} else { // use applet tag88- tHeader = "<span>" +89+ tHeader =90"<applet name='jmolApplet" + nameSuffix +91"' id='jmolApplet" + nameSuffix + "' " + appletCssText + "\n" +92widthAndHeight + "\n" +93" code='JmolApplet'" +94" archive='" + archivePath + "' codebase='" + codebase + "'\n" +95" mayscript='true'>\n";96- tFooter = "</applet></span>";97+ tFooter = "</applet>";98}99var visitJava;100if (useIEObject || useHtml4Object) {101@@ -1510,29 +1485,6 @@102return url103}104105-106-///////////////auto load NIH CACTVS data -- compound name or SMILES ///////////107-108-function jmolLoadAjax_STOLAF_NIH(compoundid,optionalscript,targetSuffix){109- _jmol.thismodel || (_jmol.thismodel = "aspirin")110- _jmol.serverURL || (_jmol.serverURL="http://fusion.stolaf.edu/chemistry/jmol/getajaxjs.cfm")111- _jmol.defaultURL_NIH || (_jmol.defaultURL_NIH="http://cactus.nci.nih.gov/chemical/structure/FILE/file?format=sdf&get3d=True")112- compoundid || (compoundid=prompt("Enter a compound name or a SMILES string:",_jmol.thismodel))113- if(!compoundid)return ""114- targetSuffix || (targetSuffix="0")115- optionalscript || (optionalscript="")116- var url=_jmol.defaultURL_NIH.replace(/FILE/g,compoundid)117- _jmol.optionalscript=optionalscript118- _jmol.thismodel=compoundid119- _jmol.thistargetsuffix=targetSuffix120- _jmol.thisurl=url121- _jmol.modelArray = []122- url=_jmol.serverURL+"?returnfunction=_jmolLoadModel&returnArray=_jmol.modelArray&id="+targetSuffix+_jmolExtractPostData(url)123- _jmolDomScriptLoad(url)124- return url125-}126-127-128/////////////// St. Olaf College AJAX server -- ANY URL ///////////129130function jmolLoadAjax_STOLAF_ANY(url, userid, optionalscript,targetSuffix){131132133