Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -201,7 +201,7 @@ |
202 | 202 | |
203 | 203 | //add json format |
204 | 204 | if( $j(_this.editForm).find("[name='format']").length == 0) |
205 | | - $j(_this.editForm).append('<input type="hidden" name="format" value="json">'); |
| 205 | + $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">'); |
206 | 206 | |
207 | 207 | //add text format type request (IE tries to "run"/download the script otherwise) |
208 | 208 | if( $j(_this.editForm).find("[name='ctypetext']").length == 0) |
— | — | @@ -261,34 +261,22 @@ |
262 | 262 | var doc = iframe.contentDocument ? iframe.contentDocument : frames[iframe.id].document; |
263 | 263 | // fixing Opera 9.26 |
264 | 264 | if (doc.readyState && doc.readyState != 'complete'){ |
265 | | - // Opera fires load event multiple times |
266 | | - // Even when the DOM is not ready yet |
267 | | - // this fix should not affect other browsers |
268 | 265 | return; |
269 | | - } |
270 | | - |
| 266 | + } |
271 | 267 | // fixing Opera 9.64 |
272 | | - if (doc.body && doc.body.innerHTML == "false"){ |
273 | | - // In Opera 9.64 event was fired second time |
274 | | - // when body.innerHTML changed from false |
275 | | - // to server response approx. after 1 sec |
| 268 | + if (doc.body && doc.body.innerHTML == "false"){ |
276 | 269 | return; |
277 | | - } |
278 | | - |
279 | | - var response; |
280 | | - |
| 270 | + } |
| 271 | + var response; |
281 | 272 | if (doc.XMLDocument){ |
282 | 273 | // response is a xml document IE property |
283 | 274 | response = doc.XMLDocument; |
284 | 275 | } else if (doc.body){ |
285 | | - // response is html document or plain text |
286 | | - response = doc.body.innerHTML; |
287 | | - // try and parse the api response: |
288 | | - if (doc.body.firstChild && doc.body.firstChild.nodeName.toUpperCase() == 'PRE'){ |
289 | | - response = doc.body.firstChild.firstChild.nodeValue; |
290 | | - } |
291 | | - if (response) { |
292 | | - response = window["eval"]("(" + response + ")"); |
| 276 | + // get the json str: |
| 277 | + json_str = $j(doc.body).find('pre').html(); |
| 278 | + //htmlentties |
| 279 | + if (json_str) { |
| 280 | + response = window["eval"]("(" +json_str + ")"); |
293 | 281 | } else { |
294 | 282 | response = {}; |
295 | 283 | } |
— | — | @@ -296,6 +284,7 @@ |
297 | 285 | // response is a xml document |
298 | 286 | var response = doc; |
299 | 287 | } |
| 288 | + //do proccess the api result |
300 | 289 | _this.processApiResult( response ); |
301 | 290 | }, |
302 | 291 | doHttpUpload:function( opt ){ |