Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -47,10 +47,6 @@ |
48 | 48 | /*parseUri class parses URIs:*/ |
49 | 49 | var parseUri=function(d){var o=parseUri.options,value=o.parser[o.strictMode?"strict":"loose"].exec(d);for(var i=0,uri={};i<14;i++){uri[o.key[i]]=value[i]||""}uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function(a,b,c){if(b)uri[o.q.name][b]=c});return uri};parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}}; |
50 | 50 | |
51 | | -var trimStr = function(v){ |
52 | | - return v.replace(/^\s+|\s+$/g, ''); |
53 | | -} |
54 | | - |
55 | 51 | //get mv_embed location if it has not been set |
56 | 52 | if( !mv_embed_path ){ |
57 | 53 | var mv_embed_path = getMvEmbedPath(); |
— | — | @@ -806,7 +802,7 @@ |
807 | 803 | var vid_html = '<video id="vid_' + i +'" '+ |
808 | 804 | 'src="' + src + '" poster="' + poster + '" style="width:' + pwidth + |
809 | 805 | 'px;height:' + pheight + 'px;"></video>'; |
810 | | - js_log("video html: " + vid_html); |
| 806 | + //js_log("video html: " + vid_html); |
811 | 807 | if( src && poster) |
812 | 808 | $j('#'+vidId).html( vid_html ); |
813 | 809 | //rewrite that video id: |
— | — | @@ -1130,7 +1126,7 @@ |
1131 | 1127 | //force format to json (if not already set) |
1132 | 1128 | options.data['format'] = 'json'; |
1133 | 1129 | |
1134 | | - js_log('do api req: ' + options.url + options.data); |
| 1130 | + js_log('do api req: ' + options.url +' data' + JSON.stringify( options.data ) ); |
1135 | 1131 | //build request string: |
1136 | 1132 | if( parseUri( document.URL ).host == parseUri( options.url ).host ){ |
1137 | 1133 | //local request do api request directly |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_vlcEmbed.js |
— | — | @@ -103,7 +103,9 @@ |
104 | 104 | */ |
105 | 105 | monitor: function(){ |
106 | 106 | this.getVLC(); |
107 | | - if(this.vlc.log){ |
| 107 | + if(!this.vlc) |
| 108 | + return ; |
| 109 | + if( this.vlc.log ){ |
108 | 110 | //js_log( 'state:' + this.vlc.input.state); |
109 | 111 | //js_log('time: ' + this.vlc.input.time); |
110 | 112 | //js_log('pos: ' + this.vlc.input.position); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/baseRemoteSearch.js |
— | — | @@ -94,17 +94,17 @@ |
95 | 95 | if( node!=null && attr_name == null ){ |
96 | 96 | if( node.childNodes[0] != null){ |
97 | 97 | //trim and strip html: |
98 | | - tag_val = trimStr( node.firstChild.nodeValue ).replace(/(<([^>]+)>)/ig,""); |
| 98 | + tag_val = $j.trim( node.firstChild.nodeValue ).replace(/(<([^>]+)>)/ig,""); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | if( node!=null && attr_name != null){ |
102 | 102 | if(typeof attr_name == 'string'){ |
103 | | - tag_val = trimStr( $j(node).attr( attr_name ) ); |
| 103 | + tag_val = $j.trim( $j(node).attr( attr_name ) ); |
104 | 104 | }else{ |
105 | 105 | var attr_vals = {}; |
106 | 106 | for(var j in attr_name){ |
107 | 107 | if( $j(node).attr( attr_name[j]).length != 0) |
108 | | - attr_vals[ attr_name[j] ] = trimStr( $j(node).attr( attr_name[j]) ).replace(/(<([^>]+)>)/ig,""); |
| 108 | + attr_vals[ attr_name[j] ] = $j.trim( $j(node).attr( attr_name[j]) ).replace(/(<([^>]+)>)/ig,""); |
109 | 109 | } |
110 | 110 | tag_val = attr_vals ; |
111 | 111 | } |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | getInlineDescWiki:function( rObj ){ |
153 | 153 | //return striped html & trim white space |
154 | 154 | if(rObj.desc) |
155 | | - return trimStr( rObj.desc.replace(/(<([^>]+)>)/ig,"") ); |
| 155 | + return $j.trim( rObj.desc.replace(/(<([^>]+)>)/ig,"") ); |
156 | 156 | //no desc avaliable: |
157 | 157 | return ''; |
158 | 158 | }, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/searchLibs/metavidSearch.js |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | o += '* part of longer [' + rObj.parent_clip + ' video clip]'+ "\n"; |
91 | 91 | |
92 | 92 | if( rObj.person && rObj.person['url'] && rObj.person['label'] ) |
93 | | - o += '* also see speeches by [' + trimStr( rObj.person.url ) + ' ' + rObj.person['label'] + ']'+ "\n"; |
| 93 | + o += '* also see speeches by [' + $j.trim( rObj.person.url ) + ' ' + rObj.person['label'] + ']'+ "\n"; |
94 | 94 | |
95 | 95 | //check for bill: |
96 | 96 | if( rObj.bill && rObj.bill['label'] && rObj.bill['url']) |
— | — | @@ -101,16 +101,16 @@ |
102 | 102 | var o = this.parent_getInlineDescWiki( rObj ); |
103 | 103 | //add in person if found |
104 | 104 | if( rObj.person && rObj.person['label'] ){ |
105 | | - o = trimStr( o.replace(rObj.person['label'], '') ); |
| 105 | + o = $j.trim( o.replace(rObj.person['label'], '') ); |
106 | 106 | //trim leading : |
107 | 107 | if(o.substr(0,1)==':') |
108 | | - o = trimStr( o.substr(1) ); |
| 108 | + o = o.substr(1); |
109 | 109 | //add quotes and person at the end: |
110 | 110 | var d = this.getDateFromLink( rObj.link ); |
111 | 111 | o ='"' + o + '" [[' + rObj.person['label'] + ']] on ' + d.toDateString(); |
112 | 112 | } |
113 | 113 | //could do ref or direct link: |
114 | | - o += ' \'\'[' + trimStr(rObj.link) + ' source clip]\'\' '; |
| 114 | + o += ' \'\'[' + $j.trim( rObj.link ) + ' source clip]\'\' '; |
115 | 115 | |
116 | 116 | //var o= '"' + o + '" by [[' + rObj.person['label'] + ']] '+ |
117 | 117 | // '<ref>[' + rObj.link + ' Metavid Source Page] for ' + rObj.title +'</ref>'; |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js |
— | — | @@ -1,7 +1,12 @@ |
2 | 2 | /* adds firefogg support. |
3 | 3 | * autodetects: new upload api or old http POST. |
4 | 4 | */ |
5 | | - |
| 5 | + |
| 6 | +loadGM( { |
| 7 | + "mv_upload_done" : "Your upload <i>should be<\/i> accessible <a href=\"$1\">here<\/a>", |
| 8 | + "mv_upload_completed" : "Upload Completed" |
| 9 | +}); |
| 10 | + |
6 | 11 | var default_firefogg_options = { |
7 | 12 | 'upload_done_action':'redirect', |
8 | 13 | 'enabled':false, |
— | — | @@ -296,11 +301,24 @@ |
297 | 302 | }, |
298 | 303 | doUploadStatus:function() { |
299 | 304 | var _this = this; |
| 305 | + _this.oldResponseText = ''; |
300 | 306 | //setup a local function for timed callback: |
301 | | - var uploadStatus = function(){ |
302 | | - var status = _this.fogg.status(); |
303 | | - //js_log(' up stats: ' + status + ' p:' + _this.fogg.progress() + ' state: '+ _this.fogg.state + ' result page:' + _this.fogg.responseText); |
304 | | - |
| 307 | + var uploadStatus = function(){ |
| 308 | + //get the response text: |
| 309 | + var response_text = _this.fogg.responseText; |
| 310 | + if( !response_text){ |
| 311 | + try{ |
| 312 | + var pstatus = JSON.parse( _this.fogg.uploadstatus() ); |
| 313 | + response_text = pstatus["responseText"]; |
| 314 | + }catch(e){ |
| 315 | + js_log("could not parse uploadstatus / could not get responseText"); |
| 316 | + } |
| 317 | + } |
| 318 | + |
| 319 | + if( _this.oldResponseText != response_text){ |
| 320 | + js_log('new result text:' + response_text); |
| 321 | + _this.oldResponseText = response_text; |
| 322 | + } |
305 | 323 | //update progress bar |
306 | 324 | _this.fogg_update_progress( _this.fogg.progress() ); |
307 | 325 | |
— | — | @@ -312,24 +330,20 @@ |
313 | 331 | else if( _this.fogg.state == 'upload done' || _this.fogg.state == 'done' ) { |
314 | 332 | js_log( 'firefogg:upload done: '); |
315 | 333 | //if in "post" upload mode read the html response (should be depricated): |
316 | | - if( _this.upload_mode == 'post' ) { |
317 | | - var response_text =''; |
318 | | - try{ |
319 | | - var pstatus = JSON.parse( _this.fogg.uploadstatus() ); |
320 | | - response_text = pstatus["responseText"]; |
321 | | - }catch(e){ |
322 | | - js_log("could not parse uploadstatus / could not get responseText"); |
323 | | - } |
| 334 | + if( _this.upload_mode == 'post' ) { |
324 | 335 | //js_log( 'done upload response is: ' + cat["responseText"] ); |
325 | 336 | _this.procPageResponse( response_text ); |
326 | 337 | |
327 | 338 | }else if( _this.upload_mode == 'chunks'){ |
328 | | - //should have an json result: |
329 | | - js_error('chunks upload not yet supported'); |
330 | | - //var foo = _this; |
331 | | - //var cat = _JSON.parse( _this.fogg.uploadstatus() ); |
332 | | - //debugger; |
333 | | - |
| 339 | + if( _this.fogg.resultUrl ){ |
| 340 | + //should have an json result: |
| 341 | + $j( '#dlbox-centered' ).html( '<h3>' + gM('mv_upload_completed') + '</h3>' + |
| 342 | + gM( 'mv_upload_done', _this.fogg.resultUrl) ); |
| 343 | + }else{ |
| 344 | + //done state with error? ..not really possible given how firefogg works |
| 345 | + js_log(" upload done, in chunks mode, but no resultUrl!"); |
| 346 | + } |
| 347 | + alert("upload done"); |
334 | 348 | } |
335 | 349 | }else{ |
336 | 350 | //upload error: |
— | — | @@ -343,16 +357,15 @@ |
344 | 358 | procPageResponse:function( result_page ){ |
345 | 359 | js_log('f:procPageResponse'); |
346 | 360 | var sstring = 'var wgTitle = "' + this.formData['wpDestFile'].replace('_',' '); |
347 | | - var error_txt = 'Your upload <i>should be</i> accessible <a href="' + |
348 | | - wgArticlePath.replace(/\$1/, 'File:' + this.formData['wpDestFile'] ) + '">'+ |
349 | | - 'here</a> \n'; |
| 361 | + var result_txt = gM('mv_upload_done', |
| 362 | + wgArticlePath.replace(/\$1/, 'File:' + this.formData['wpDestFile'] ) ); |
350 | 363 | //set the error text in case we dont' get far along in processing the response |
351 | | - $j( '#dlbox-centered' ).html( '<h3>Upload Completed:</h3>' + error_txt ); |
| 364 | + $j( '#dlbox-centered' ).html( gM('mv_upload_completed') + result_txt ); |
352 | 365 | |
353 | 366 | if( result_page && result_page.toLowerCase().indexOf( sstring.toLowerCase() ) != -1){ |
354 | 367 | js_log( 'upload done got redirect found: ' + sstring + ' r:' + _this.upload_done_action ); |
355 | 368 | if( _this.upload_done_action == 'redirect' ){ |
356 | | - $j( '#dlbox-centered' ).html( '<h3>Upload Completed:</h3>' + error_txt + '<br>' + form_txt); |
| 369 | + $j( '#dlbox-centered' ).html( '<h3>Upload Completed:</h3>' + result_txt + '<br>' + form_txt); |
357 | 370 | window.location = wgArticlePath.replace( /\$1/, 'File:' + formData['wpDestFile'] ); |
358 | 371 | }else{ |
359 | 372 | //check if the add_done_action is a callback: |
— | — | @@ -369,13 +382,13 @@ |
370 | 383 | var res = grabWikiFormError( result_page ); |
371 | 384 | |
372 | 385 | if(res.error_txt) |
373 | | - error_txt = res.error_txt; |
| 386 | + result_txt = res.error_txt; |
374 | 387 | |
375 | 388 | if(res.form_txt) |
376 | 389 | form_txt = res.form_txt; |
377 | 390 | } |
378 | | - js_log( 'error text is: ' + error_txt ); |
379 | | - $j( '#dlbox-centered' ).html( '<h3>Upload Completed:</h3>' + error_txt + '<br>' + form_txt); |
| 391 | + js_log( 'error text is: ' + result_txt ); |
| 392 | + $j( '#dlbox-centered' ).html( '<h3>' + gM('mv_upload_completed') + '</h3>' + result_txt + '<br>' + form_txt); |
380 | 393 | } |
381 | 394 | } |
382 | 395 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -1010,7 +1010,7 @@ |
1011 | 1011 | var wt = '{{Information '+"\n"+ |
1012 | 1012 | '|Description= ' + rObj.pSobj.getImportResourceDescWiki( rObj ); |
1013 | 1013 | //output person and bill info if |
1014 | | - wt+='|Source=' + '[' + trimStr( rObj.link ) + ' Original Source]'+ "\n"; |
| 1014 | + wt+='|Source=' + '[' + $j.trim( rObj.link ) + ' Original Source]'+ "\n"; |
1015 | 1015 | |
1016 | 1016 | if( rObj.author ) |
1017 | 1017 | wt+='|Author=' + rObj.author +"\n"; |