|
1 | | -/*! react-swf v0.12.3 | @syranide | MIT license */ |
| 1 | +/*! react-swf v0.13.0 | @syranide | MIT license */ |
2 | 2 |
|
3 | 3 | 'use strict'; |
4 | 4 |
|
5 | 5 | var React = require('react'); |
6 | 6 | var PropTypes = React.PropTypes; |
7 | 7 |
|
8 | | -var mimeTypeFP = 'application/x-shockwave-flash'; |
9 | | - |
10 | 8 | /* |
11 | 9 | flashVars = {key: string} or "key=value&..." |
12 | 10 |
|
@@ -98,92 +96,6 @@ function encodeFlashVarsObject(object) { |
98 | 96 | } |
99 | 97 |
|
100 | 98 |
|
101 | | -var memoizedFPVersion; |
102 | | - |
103 | | -function getMemoizedFPVersion() { |
104 | | - if (memoizedFPVersion === undefined) { |
105 | | - memoizedFPVersion = getFPVersion(); |
106 | | - } |
107 | | - |
108 | | - return memoizedFPVersion; |
109 | | -} |
110 | | - |
111 | | -/** |
112 | | - * Detect installed Flash Player version. Cached. |
113 | | - * |
114 | | - * @return {?string} 'X.Y.Z'-version or null. |
115 | | - */ |
116 | | -function getFPVersion() { |
117 | | - if (typeof navigator !== 'undefined') { |
118 | | - var navFPPlugin = ( |
119 | | - navigator.plugins && |
120 | | - navigator.plugins['Shockwave Flash'] |
121 | | - ); |
122 | | - var navFPMimeType = ( |
123 | | - navigator.mimeTypes && |
124 | | - navigator.mimeTypes[mimeTypeFP] |
125 | | - ); |
126 | | - |
127 | | - if (navFPPlugin && navFPMimeType && navFPMimeType.enabledPlugin) { |
128 | | - try { |
129 | | - return ( |
130 | | - navFPPlugin |
131 | | - .description |
132 | | - .match(/(\d+)\.(\d+) r(\d+)/) |
133 | | - .slice(1) |
134 | | - .join('.') |
135 | | - ); |
136 | | - } catch (e) { |
137 | | - } |
138 | | - } |
139 | | - } |
140 | | - |
141 | | - // ActiveXObject-fallback for IE8-10 |
142 | | - if (typeof ActiveXObject !== 'undefined') { |
143 | | - try { |
144 | | - return ( |
145 | | - new ActiveXObject('ShockwaveFlash.ShockwaveFlash') |
146 | | - .GetVariable('$version') |
147 | | - .match(/(\d+),(\d+),(\d+)/) |
148 | | - .slice(1) |
149 | | - .join('.') |
150 | | - ); |
151 | | - } catch (e) { |
152 | | - } |
153 | | - } |
154 | | - |
155 | | - return null; |
156 | | -} |
157 | | - |
158 | | -/** |
159 | | - * Detect if installed Flash Player meets version requirement. |
160 | | - * |
161 | | - * @param {string} versionString 'X.Y.Z', 'X.Y' or 'X'. |
162 | | - * @return {boolean} true if supported. |
163 | | - */ |
164 | | -function isFPVersionSupported(versionString) { |
165 | | - var installedString = getMemoizedFPVersion(); |
166 | | - |
167 | | - if (installedString == null) { |
168 | | - return false; |
169 | | - } |
170 | | - |
171 | | - var installedFields = installedString.split('.'); |
172 | | - var requiredFields = versionString.split('.'); |
173 | | - |
174 | | - for (var i = 0; i < 3; i++) { |
175 | | - var installedNumber = +installedFields[i]; |
176 | | - var requiredNumber = +(requiredFields[i] || 0); |
177 | | - |
178 | | - if (installedNumber !== requiredNumber) { |
179 | | - return installedNumber > requiredNumber; |
180 | | - } |
181 | | - } |
182 | | - |
183 | | - return true; |
184 | | -} |
185 | | - |
186 | | - |
187 | 99 | /** @constructor */ |
188 | 100 | function ReactSWF(props) { |
189 | 101 | React.Component.call(this, props); |
@@ -229,12 +141,9 @@ function ReactSWF(props) { |
229 | 141 | }; |
230 | 142 | } |
231 | 143 |
|
232 | | -Object.assign(ReactSWF, React.Component); |
233 | 144 | ReactSWF.prototype = Object.create(React.Component.prototype); |
234 | 145 | ReactSWF.prototype.constructor = ReactSWF; |
235 | | - |
236 | | -ReactSWF.getFPVersion = getMemoizedFPVersion; |
237 | | -ReactSWF.isFPVersionSupported = isFPVersionSupported; |
| 146 | +Object.assign(ReactSWF, React.Component); |
238 | 147 |
|
239 | 148 | ReactSWF.propTypes = { |
240 | 149 | src: PropTypes.string.isRequired, |
@@ -313,7 +222,7 @@ ReactSWF.prototype.render = function() { |
313 | 222 | var objectProps = { |
314 | 223 | ref: this._refCallback, |
315 | 224 | children: [], |
316 | | - type: mimeTypeFP, |
| 225 | + type: 'application/x-shockwave-flash', |
317 | 226 | data: state.src, |
318 | 227 | // Discard `props.src` |
319 | 228 | src: null |
|
0 commit comments