1 |
2 |
fpga_is_fu |
// Copyright 2000 Adobe Systems Incorporated. All rights reserved. Permission
|
2 |
|
|
// to use, modify, distribute, and publicly display this file is hereby
|
3 |
|
|
// granted. This file is provided "AS-IS" with absolutely no warranties of any
|
4 |
|
|
// kind. Portions (C) Netscape Communications 1999.
|
5 |
|
|
|
6 |
|
|
// If you modify this file, please share your changes with Adobe and other SVG
|
7 |
|
|
// developers at http://www.adobe.com/svg/.
|
8 |
|
|
|
9 |
|
|
// Version 3/23/00
|
10 |
|
|
|
11 |
|
|
function getBrowser()
|
12 |
|
|
{
|
13 |
|
|
var agt=navigator.userAgent.toLowerCase();
|
14 |
|
|
var v_maj=parseInt(navigator.appVersion);
|
15 |
|
|
var v_min=parseFloat(navigator.appVersion);
|
16 |
|
|
is_nav=((agt.indexOf('mozilla')!=-1)&&(agt.indexOf('spoofer')==-1)&&
|
17 |
|
|
(agt.indexOf('compatible')==-1)&&(agt.indexOf('opera')==-1)&&
|
18 |
|
|
(agt.indexOf('webtv')==-1));
|
19 |
|
|
is_nav3=(is_nav&&(v_maj==3));
|
20 |
|
|
is_nav4up=(is_nav&&(v_maj>=4));
|
21 |
|
|
is_nav407up=(is_nav&&(v_min>=4.07));
|
22 |
|
|
is_nav408up=(is_nav&&(v_min>=4.08));
|
23 |
|
|
is_ie=(agt.indexOf("msie")!=-1);
|
24 |
|
|
is_ie3=(is_ie&&(v_maj<4));
|
25 |
|
|
is_ie4=(is_ie&&(v_maj==4)&&(agt.indexOf("msie 5.0")==-1));
|
26 |
|
|
is_ie4up=(is_ie&&(v_maj>=4));
|
27 |
|
|
is_ie5=(is_ie&&(v_maj==4)&&(agt.indexOf("msie 5.0")!=-1));
|
28 |
|
|
is_ie5up=(is_ie&&!is_ie3&&!is_ie4);
|
29 |
|
|
is_win=((agt.indexOf("win")!=-1)||(agt.indexOf("16bit")!=-1));
|
30 |
|
|
is_win95=((agt.indexOf("win95")!=-1)||(agt.indexOf("windows 95")!=-1));
|
31 |
|
|
is_win98=((agt.indexOf("win98")!=-1)||(agt.indexOf("windows 98")!=-1));
|
32 |
|
|
is_winnt=((agt.indexOf("winnt")!=-1)||(agt.indexOf("windows nt")!=-1));
|
33 |
|
|
is_win32=(is_win95||is_winnt||is_win98||
|
34 |
|
|
((v_maj>=4)&&(navigator.platform=="Win32"))||
|
35 |
|
|
(agt.indexOf("win32")!=-1)||(agt.indexOf("32bit")!=-1));
|
36 |
|
|
is_mac=(agt.indexOf("mac")!=-1);
|
37 |
|
|
is_macPPC=(is_mac&&((agt.indexOf("ppc")!=-1)||(agt.indexOf("powerpc")!=-1)));
|
38 |
|
|
}
|
39 |
|
|
|
40 |
|
|
function setCookie(name, value, expires, path, domain, secure) {
|
41 |
|
|
var curCookie=name+"="+escape(value)+
|
42 |
|
|
((expires)?"; expires="+expires.toGMTString():"")+
|
43 |
|
|
((path)?"; path="+path:"")+
|
44 |
|
|
((domain)?"; domain="+domain:"")+
|
45 |
|
|
((secure)?"; secure":"");
|
46 |
|
|
document.cookie=curCookie;
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
// returns null if cookie not found
|
50 |
|
|
function getCookie(name) {
|
51 |
|
|
var dc=document.cookie;
|
52 |
|
|
var prefix=name+"=";
|
53 |
|
|
var begin=dc.indexOf("; "+prefix);
|
54 |
|
|
if(begin==-1) {
|
55 |
|
|
begin=dc.indexOf(prefix);
|
56 |
|
|
if(begin!=0)
|
57 |
|
|
return null;
|
58 |
|
|
}
|
59 |
|
|
else
|
60 |
|
|
begin+=2;
|
61 |
|
|
var end=document.cookie.indexOf(";",begin);
|
62 |
|
|
if(end==-1)
|
63 |
|
|
end=dc.length;
|
64 |
|
|
return unescape(dc.substring(begin+prefix.length,end));
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
function deleteCookie(name, path, domain) {
|
68 |
|
|
if(getCookie(name))
|
69 |
|
|
document.cookie=name+"="+((path)?"; path="+path:"")+
|
70 |
|
|
((domain)?"; domain="+domain:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
function fixDate(date) {
|
74 |
|
|
var base=new Date(0);
|
75 |
|
|
var skew=base.getTime();
|
76 |
|
|
if(skew>0)
|
77 |
|
|
date.setTime(date.getTime()-skew);
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
var svgInstallBase="http://www.adobe.com/svg/viewer/install/";
|
81 |
|
|
var svgInstallPage=svgInstallBase+"auto/";
|
82 |
|
|
var svgInfoPage="http://www.adobe.com/svg/";
|
83 |
|
|
var svgDownloadPage=svgInstallBase;
|
84 |
|
|
var checkIntervalDays=30;
|
85 |
|
|
var firstSVG=true; // Ask only once per page even without cookies
|
86 |
|
|
|
87 |
|
|
function getSVGInstallPage() {
|
88 |
|
|
return svgInstallPage+"?"+location;
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
function getCheckInterval() {
|
92 |
|
|
return checkIntervalDays*24*60*60*1000;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
// The value of the cookie is '0'. We need some value, but it doesn't matter what.
|
96 |
|
|
// We set the cookie for the entire site by specifying the path '/'.
|
97 |
|
|
// We could include something from adobe.com and set the cookie for that site.
|
98 |
|
|
// This would enable only asking once no matter how many sites a user encounters
|
99 |
|
|
// with SVG.
|
100 |
|
|
function setSVGCookie() {
|
101 |
|
|
if(getCheckInterval()>0) {
|
102 |
|
|
var expires=new Date();
|
103 |
|
|
fixDate(expires); // NN2/Mac bug
|
104 |
|
|
expires.setTime(expires.getTime()+getCheckInterval());
|
105 |
|
|
setCookie('SVGCheck','0',expires,'/')
|
106 |
|
|
}
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
function isSVGPluginInstalled() {
|
110 |
|
|
return (navigator.mimeTypes["image/svg"]&&navigator.mimeTypes["image/svg"].enabledPlugin!=null)||
|
111 |
|
|
(navigator.mimeTypes["image/svg-xml"]&&navigator.mimeTypes["image/svg-xml"].enabledPlugin!=null);
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
function checkSVGViewer() {
|
115 |
|
|
window.askForSVGViewer=false;
|
116 |
|
|
if(window.svgInstalled)
|
117 |
|
|
return;
|
118 |
|
|
getBrowser();
|
119 |
|
|
if(is_win32 && is_ie4up) {
|
120 |
|
|
window.svgViewerAvailable=true;
|
121 |
|
|
window.svgInstalled=isSVGControlInstalled();
|
122 |
|
|
if(!window.svgInstalled)
|
123 |
|
|
window.askForSVGViewer=true;
|
124 |
|
|
}
|
125 |
|
|
else if((is_win32 && is_nav4up) || (is_macPPC && is_nav407up)) {
|
126 |
|
|
window.svgViewerAvailable=true;
|
127 |
|
|
window.svgInstalled=isSVGPluginInstalled();
|
128 |
|
|
if(!window.svgInstalled&&is_nav408up&&navigator.javaEnabled())
|
129 |
|
|
window.askForSVGViewer=true;
|
130 |
|
|
}
|
131 |
|
|
else if(is_macPPC && is_ie5up)
|
132 |
|
|
window.svgViewerAvailable=true;
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
function getSVGViewer() {
|
136 |
|
|
if(confirm('The Adobe SVG Viewer is not installed. Download now?'))
|
137 |
|
|
location=getSVGInstallPage();
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
function checkAndGetSVGViewer() {
|
141 |
|
|
checkSVGViewer();
|
142 |
|
|
var svgCookie=getCookie('SVGCheck');
|
143 |
|
|
if(firstSVG&&!svgCookie) {
|
144 |
|
|
if(window.askForSVGViewer) {
|
145 |
|
|
setSVGCookie();
|
146 |
|
|
getSVGViewer();
|
147 |
|
|
}
|
148 |
|
|
firstSVG=false;
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
function emitSVG(embedAttrs) {
|
153 |
|
|
if(window.svgInstalled)
|
154 |
|
|
document.writeln('<embed '+embedAttrs+'>');
|
155 |
|
|
else if(window.askForSVGViewer) {
|
156 |
|
|
if(navigator.appName=='Netscape') {
|
157 |
|
|
document.writeln('<p>To view this page you need an SVG viewer.');
|
158 |
|
|
document.writeln('<a href="'+getSVGInstallPage()+'">Click here</a> for more information.</p>');
|
159 |
|
|
}
|
160 |
|
|
else
|
161 |
|
|
document.writeln('<embed '+embedAttrs+' pluginspage="'+getSVGInstallPage()+'">');
|
162 |
|
|
}
|
163 |
|
|
else if(window.svgViewerAvailable)
|
164 |
|
|
document.writeln('<embed '+embedAttrs+' pluginspage="'+svgDownloadPage+'">');
|
165 |
|
|
else {
|
166 |
|
|
document.writeln('<p>To view this page you need an SVG viewer. There is currently no Adobe SVG ');
|
167 |
|
|
document.writeln('Viewer available for your browser. ');
|
168 |
|
|
document.writeln('<a href="'+svgInfoPage+'">Click here</a> for more information.</p>');
|
169 |
|
|
}
|
170 |
|
|
}
|