Skip to content

Commit f3968aa

Browse files
committed
improve applet export code
1 parent 9a4cb5a commit f3968aa

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

generate/lib/Example.class.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,40 @@ function display()
8989
{
9090
$html = "\n<div class=\"example\">";
9191
if (file_exists($this->applet)) {
92+
$html .= "\n<div class=\"applet\">\n\t";
9293

93-
$html .= "\n<div class=\"applet\">\n\t";
94+
# for newer browsers, use the deployment script
95+
# which will let us use loading.gif instead of the coffee cup
96+
$html .= '<script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script>';
97+
$html .= '<script type="text/javascript">' . "\n";
98+
$html .= '/* <![CDATA[ */' . "\n";
99+
$html .= "var attributes = { ";
100+
$html .= "code: '" . $this->name . ".class',";
101+
$html .= "archive: 'media/" . $this->name . ".jar,media/core.jar',";
102+
$html .= "width: '" . $this->width . "',";
103+
$html .= "height: '" . $this->height . "',";
104+
$html .= "image: 'media/loading.gif'";
105+
$html .= "};\n";
106+
$html .= "deployJava.runApplet(attributes, { }, '1.5');\n";
107+
$html .= "/* ]]> */\n";
108+
$html .= "</script>\n\n";
109+
110+
# fallback for the oldschool folks
111+
$html .= "<noscript>\n";
94112
$html .= '<applet code="' . $this->name . '"' .
95113
' archive="media/' . $this->name.'.jar,media/core.jar"' .
96114
' width="' . $this->width.'"' .
97115
' height="' . $this->height.'"' .
98116
'></applet>';
99-
$html .= "\n</div>";
100-
101-
if ($this->width > 200) {
102-
117+
$html .= "\n";
118+
$html .= "</noscript>\n";
119+
$html .= "</div>\n";
120+
121+
if ($this->width > 200) {
103122
$html .= "\n<p class=\"doc\">";
104123

105124
} else {
106-
107125
$html .= "\n<p class=\"doc-float\">";
108-
109126
}
110127

111128
} else {

0 commit comments

Comments
 (0)