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