Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/firefogg.js |
— | — | @@ -116,19 +116,7 @@ |
117 | 117 | }, |
118 | 118 | select_fogg:function(){ |
119 | 119 | var _this = this; |
120 | | - if(_this.fogg.selectVideo()) { |
121 | | - var editForm = document.getElementById( 'mw-upload-form' ); |
122 | | - _this.org_onsubmit = editForm.onsubmit; |
123 | | - _this.org_onsubmit_ran = false; |
124 | | - editForm.onsubmit = function return_false(){ |
125 | | - //run the original onsubmit (if not run yet set flag to avoid excessive chaining ) |
126 | | - if( ! _this.org_onsubmit_ran && _this.org_onsubmit == 'function' ){ |
127 | | - _this.org_onsubmit_ran=true; |
128 | | - _this.org_onsubmit(); |
129 | | - } |
130 | | - return false; |
131 | | - }; |
132 | | - |
| 120 | + if(_this.fogg.selectVideo()) { |
133 | 121 | //update destination filename: |
134 | 122 | if( _this.fogg.sourceFilename ){ |
135 | 123 | var destFileInput = document.getElementById( 'wpDestFile'); |
— | — | @@ -159,11 +147,21 @@ |
160 | 148 | if(e) |
161 | 149 | e.style.display='block'; |
162 | 150 | } |
163 | | - } |
164 | | - //set binding for "upload" button to call our transcode process |
165 | | - addHandler( editForm, 'submit', function() { |
166 | | - //call the onsubmit to run any script form value checks: |
167 | | - editForm.onsubmit(); |
| 151 | + } |
| 152 | + //setup the form handling |
| 153 | + var editForm = document.getElementById( 'mw-upload-form' ); |
| 154 | + //set up the org_onsubmit if not set: |
| 155 | + if( typeof( _this.org_onsubmit ) == 'undefined' ) |
| 156 | + _this.org_onsubmit = editForm.onsubmit; |
| 157 | + |
| 158 | + editForm.onsubmit = function() { |
| 159 | + //run the original onsubmit (if not run yet set flag to avoid excessive chaining ) |
| 160 | + if( typeof( _this.org_onsubmit ) == 'function' ){ |
| 161 | + //error in org submit return false; |
| 162 | + if( ! _this.org_onsubmit()){ |
| 163 | + return false; |
| 164 | + } |
| 165 | + } |
168 | 166 | //get the input |
169 | 167 | var formData = _this.getEditFormData( editForm ); |
170 | 168 | |
— | — | @@ -276,7 +274,7 @@ |
277 | 275 | encodingStatus(); |
278 | 276 | //don't submit the form (let firefogg handle it) |
279 | 277 | return false; |
280 | | - }); //addHandler mapping |
| 278 | + }; //addHandler mapping |
281 | 279 | }else{ |
282 | 280 | //remove upload binding if no file was selected |
283 | 281 | } |