* basic subtitle support (via wikiTitleKey)
authorMichael Dale <dale@users.mediawiki.org>
Sat, 7 Nov 2009 11:12:12 +0000 (11:12 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Sat, 7 Nov 2009 11:12:12 +0000 (11:12 +0000)
* some language test updates
* drag drop support stubs
* language updates for add media wizard search

14 files changed:
js2/editPage.js
js2/mwEmbed/libAddMedia/dragDropFile.js
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libClipEdit/mvClipEdit.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/libSequencer/mvSequencer.js
js2/mwEmbed/libTimedText/mvTextInterface.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/languages/mwEmbed.i18n.php
js2/mwEmbed/skins/ctrlBuilder.js
js2/mwEmbed/tests/testLang.html
js2/mwEmbed/tests/testLang.js
js2/remoteMwEmbed.js

index 936dc2d..8e41461 100644 (file)
@@ -59,4 +59,6 @@ js2AddOnloadHook( function() {
                                $j(".tool [rel='file']").addMediaWiz( amwConf );
                }
        }, 120)
+       //drag drop for editbar: 
+       //$j('textarea#wpTextbox1').dragFileUpload();
 });
index a033b8c..f425087 100644 (file)
@@ -1,11 +1,15 @@
 /* firefox 3.6 drag-drop uploading 
 */
-var TCNDDU = TCNDDU || {};
-               
-(function( $ ) {
-       $.dragDropFile = function ( selector ) {
+loadGM({
+       "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}",
+       "mwe-review-upload": "Review File {{PLURAL:$1|Upload|Uploads}}"
+});
+
+(function($){
+       $.fn.dragDropFile = function () {
+               js_log("drag drop: " + this.selector);
                //setup drag binding and highlight
-               var dC = $j( selector ).get(0);
+               var dC = $j( this.selector ).get(0);
                dC.addEventListener("dragenter", 
                        function(event){
                                $j(dC).css('border', 'solid red');
@@ -26,50 +30,71 @@ var TCNDDU = TCNDDU || {};
                        }, false);
                dC.addEventListener("drop", 
                        function( event ){                                                                                                                      
-                               //for some reason scope does not persist for events so here we go: 
                                doDrop( event );
-                               //handle the drop loader and call event 
-                               
+                               //handle the drop loader and call event                                 
                        }, false);
-       function doDrop(event){         
-               var dt = event.dataTransfer,
-                       files = dt.files,
-                       imgPreviewFragment = document.createDocumentFragment(),
-                       count = files.length,
-                       domElements;
-                       
-               event.stopPropagation();
-               event.preventDefault();
-               // ( error out if they dragged multiple files for now) 
-               if( files.length > 1 ){
-                       js_log( 'errro multiple files');
+               function doDrop(event){
+                       var dt = event.dataTransfer,
+                               files = dt.files,                               
+                               fileCount = files.length;
+                               
+                       event.stopPropagation();
+                       event.preventDefault();
+                                               
+                       $j('#multiple_file_input').remove();
                        
-                       return false;
-               }
-               for (var i = 0; i < count; i++) {
-                       if(files[i].fileSize < 1048576) {
-                               domElements = [
-                                       document.createElement('li'),
-                                       document.createElement('a'),
-                                       document.createElement('img')
-                               ];
+                       $j('body').append('<div title="' + gM('mwe-upload-multi', fileCount) + '" '+
+                       'style="position:absolute;bottom:5em;top:3em;right:0px;left:0px" '+
+                       'id="multiple_file_input">'+                                    
+                       '</div>');
+               
                        
-                               domElements[2].src = files[i].getAsDataURL(); // base64 encodes local file(s)
-                               domElements[2].width = 300;
-                               domElements[2].height = 200;
-                               domElements[1].appendChild(domElements[2]);
-                               domElements[0].id = "item"+i;
-                               domElements[0].appendChild(domElements[1]);
-                               
-                               imgPreviewFragment.appendChild(domElements[0]);
-                               
-                               dropListing.appendChild(imgPreviewFragment);
-                               
-                               TCNDDU.processXHR(files.item(i), i);
-                       } else {
-                               alert("file is too big, needs to be below 1mb");
-                       }       
+                       var cBtn = {};                  
+                       cBtn[ gM('mwe-cancel') ] = function(){
+                               $j(this).dialog('close');
+                       }
+                       cBtn[ gM('mwe-upload-multi', fileCount) ] = function(){
+                               alert('do multiple file upload');
+                       }
+                       //open up the dialog 
+                       $j('#multiple_file_input').dialog({
+                               bgiframe: true,
+                               autoOpen: true,
+                               modal: true,
+                               draggable:false,
+                               resizable:false,
+                               buttons:cBtn
+                       });
+                       $j('#multiple_file_input').dialogFitWindow();
+                       $j(window).resize(function(){
+                               $j('#multiple_file_input').dialogFitWindow();
+                       });
+                       //add the inital table / title: 
+                       $j('#multiple_file_input').html('<h3>' + gM('mwe-review-upload') + '</h3>'+
+                               '<table width="100%" border="1" class="table_list" style="border:none;"></table>');
+                       $j.each(files, function(i, file){               
+                               if(file.fileSize < 64048576) {  
+                                       $j('#multiple_file_input .table_list').append(
+                                               '<tr>' +
+                                                       '<td width="300" style="padding:5px"><img width="250" src="'+ file.getAsDataURL() +'">' +'</td>'+
+                                                       '<td valign="top">' + 
+                                                               'File Name: <input name="file['+i+'][title]" value="' + file.name + '"><br>'+
+                                                               'File Desc: <textarea style="width:300px;" name="file['+i+'][desc]"></textarea><br>'+ 
+                                                       '</td>'+
+                                               '</tr>'
+                                       );                                                                                      
+                                       /*$j.addDialog( "upload this image", '<img width="300" src="' + files[i].getAsDataURL() + '">' +
+                                               '<br>name: ' + files[i].name + '</br>' +
+                                               '<br>size: ' + files[i].fileSize + '</br>' +
+                                               '<br>mime: ' + files[i].mediaType + '</br>');
+                                       */
+                                       //do the add-media-wizard with the upload tab                                   
+                               } else {
+                                       alert("file is too big, needs to be below 64mb");
+                               }       
+                       }); 
                }
        }
-       
-})(window.$mw);
+})(jQuery);
+
+
index 4bab6f6..4a6a10d 100644 (file)
@@ -525,7 +525,7 @@ remoteSearchDriver.prototype = {
 
                js_log('got caret_pos:' + this.caret_pos.s);
                //restore text value: (creating textRanges sometimes screws with the text content)
-               $j(this.target_textbox).val(this.caret_pos.text);
+               $j(this.target_textbox).val( this.caret_pos.text );
        },
        init_modal:function(){
                js_log("init_modal");
@@ -541,13 +541,7 @@ remoteSearchDriver.prototype = {
                        var cBtn = {};
                        cBtn[ gM('mwe-cancel') ] = function(){
                                _this.cancelClipEditCB();
-                       }                       
-                       function doResize(){
-                               js_log('do resize:: ' + _this.target_container);                                
-                               $j( '#rsd_modal_target').dialog('option', 'width', $j(window).width()-50 );
-                               $j( '#rsd_modal_target').dialog('option', 'height', $j(window).height()-50 );
-                               $j( '#rsd_modal_target').dialog('option', 'position','center');
-                       }
+                       }                                               
                        
                        $j(_this.target_container).dialog({
                                bgiframe: true,
@@ -563,22 +557,13 @@ remoteSearchDriver.prototype = {
                                        $j(this).parents('.ui-dialog').fadeOut('slow');                         
                                }
                        });                             
-                       doResize();
+                       $j(_this.target_container).dialogFitWindow();
                        $j(window).resize(function(){
-                               doResize();
-                       });
-                       
+                               $j(_this.target_container).dialogFitWindow();
+                       });                     
                        
                        //add cancel callback and updated button with icon
-                       _this.cancelClipEditCB();
-                       
-                       //update the child position: (some of this should be pushed up-stream via dialog config options
-                       $j(_this.target_container +'~ .ui-dialog-buttonpane').css({
-                               'position':'absolute',
-                               'left':'0px',
-                               'right':'0px',
-                               'bottom':'0px'
-                       });                     
+                       _this.cancelClipEditCB();                                       
                }
        },
        //sets up the initial html interface
@@ -708,7 +693,7 @@ remoteSearchDriver.prototype = {
                                                _this.addResourceEditLoader();
                                                //@@note: we have most of what we need in resultData imageinfo
                                                cp.sObj.addByTitle( wTitle, function( rObj ){                                                           
-                                                       //redraw (with added result if new)
+                                                       //redraw ( with added result if new )
                                                        _this.drawOutputResults();
                                                        //pull up resource editor:                                                                      
                                                        _this.resourceEdit( rObj, $j('#res_upload__' + rObj.id).get(0) );                                                                       
index 9367ce1..9ba1233 100644 (file)
@@ -15,9 +15,16 @@ mediaWikiSearch.prototype = {
                //inherit the cp settings for 
        },      
        //returns a rObj by title 
-       addByTitle:function( title , callback){         
+       addByTitle:function( title , callback, redirect_count){         
                js_log("AddByTitle::" + title);
-               var _this = this;
+               var _this = this;               
+               if(!redirect_count)
+                       redirect_count=0;
+               if(redirect_count > 5){
+                       js_log('Error: addByTitle too many redirects');
+                       callback( false );
+                       return false;
+               }
                var reqObj = {
                        'action':'query',
                        'titles':'File:'+title, 
@@ -29,7 +36,24 @@ mediaWikiSearch.prototype = {
                do_api_req( {
                        'data':reqObj, 
                        'url':this.cp.api_url 
-                       }, function(data){                                              
+                       }, function(data){      
+                               //check for redirect
+                               for(var i in data.query.pages){
+                                       var page = data.query.pages[i];                                 
+                                       if(page.revisions[0]['*'] && page.revisions[0]['*'].indexOf('#REDIRECT') === 0){
+                                               var re = new RegExp(/[^\[]*\[\[([^\]]*)/);
+                                               var pt = page.revisions[0]['*'].match( re );
+                                               if( pt[1] ){
+                                                       _this.addByTitle( pt[1], callback, redirect_count++);
+                                                       return ;
+                                               }else{
+                                                       js_log('Error: addByTitle could not proccess redirect');
+                                                       callback( false );
+                                                       return false;
+                                               }
+                                       }
+                               }
+                               //if not a redirect do the callback directly:   
                                callback( _this.addSingleResult(data) );                        
                        }
                );                      
index 8a08d0c..87ce225 100644 (file)
@@ -29,7 +29,7 @@ loadGM({
        "mwe-end_time" : "End time",
        "mwe-preview_inout" : "Preview in-out points",
        "mwe-edit-tools" : "Edit tools",
-       "mwe-inline-description" : "Inline description",
+       "mwe-inline-description" : "Caption",
        "mwe-edit-video-tools" : "Edit video tools:",
        "mwe-duration" : "Duration:"
 });
index 5a1b7b1..74ae795 100644 (file)
@@ -519,7 +519,7 @@ mediaElement.prototype =
                        this.thumbnail = $j(video_element).attr('poster');
                
                if($j(video_element).attr('wikiTitleKey'))
-                       this.wikiTitleKey=$j(video_element).attr('wikiTitleKey');
+                       this.wikiTitleKey = $j(video_element).attr('wikiTitleKey');
                        
                // Process all inner <source> elements  
                //js_log("inner source count: " + video_element.getElementsByTagName('source').length );
@@ -679,13 +679,13 @@ mediaElement.prototype =
        },
        /** Adds a single mediaSource using the provided element if
                the element has a 'src' attribute.              
-               @param element {element} <video>, <source> or <mediaSource> element.
+               @param element {element} <video>, <source> or <mediaSource> <text> element.
        */
        tryAddSource:function(element)
        {
                js_log('f:tryAddSource:'+ $j(element).attr("src"));             
                if (! $j(element).attr("src")){
-                       //js_log("element has no src");
+                       js_log("element has no src");
                        return false;
                }
                var new_src = $j(element).attr('src');
@@ -700,7 +700,7 @@ mediaElement.prototype =
                }
                var source = new mediaSource( element );                
                this.sources.push(source);              
-               //alert('pushed source to stack'+ source + 'sl:'+this.sources.length);
+               js_log('pushed source to stack'+ source + 'sl:'+this.sources.length);
        },
        getPlayableSources: function(){          
                 var playable_sources= new Array();
@@ -1738,11 +1738,7 @@ embedVideo.prototype = {
                                ], function(){                                  
                                        _this.textInterface = new mvTextInterface( _this );                                                     
                                        //show interface
-                                       _this.textInterface.show();
-                                       js_log("NEW TEXT INTERFACE");
-                                       for(var i in _this.textInterface.availableTracks){
-                                               js_log("tracks in new interface: "+_this.id+ ' tid:' + i);                                              
-                                       }
+                                       _this.textInterface.show();                                     
                                }
                        );
                }else{
index 520e1d5..d75af2e 100644 (file)
@@ -217,14 +217,14 @@ mvSequencer.prototype = {
                        '<div id="' + this.video_container_id + '" style="position:absolute;right:0px;top:0px;' +
                                'width:' + this.video_width + 'px;height:' + (this.video_height+54) + 'px;"/>'+
                        '<div id="' + this.timeline_id + '" class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;' +
-                               'left:0px;right:0px;top:'+(this.video_height+60)+'px;bottom:35px;overflow:auto;">'+
+                               'left:0px;right:0px;top:'+(this.video_height+60)+'px;bottom:20px;overflow:auto;">'+
                                        gM('mwe-loading_timeline')+ '</div>'+
                        '<div class="seq_status" style="position:absolute;left:0px;width:300px;"></div>'+
                        '<div class="seq_save_cancel" style="position:absolute;'+
-                               'left:5px;bottom:0px;height:25px;">'+
+                               'left:5px;bottom:0px;height:15px;">'+
                                        gM('mwe-loading_user_rights') +
                        '</div>'+
-                       '<div class="about_editor" style="position:absolute;right:5px;bottom:7px;">' +
+                       '<div class="about_editor" style="position:absolute;right:5px;bottom:0px;">' +
                                gM('mwe-sequencer_credit_line') +
                        '</div>'+
                        '<div id="'+this.sequence_tools_id+'" style="position:absolute;' +
@@ -442,7 +442,7 @@ mvSequencer.prototype = {
                                //add in play box and container tracks
                                $j('#'+timeline_id).append(''+
                                        '<div id="interface_container_track_' + i + '" ' +
-                                       '       style="position:absolute;top:25px;height:'+(track_height+30)+'px;left:10px;right:0px;"' +
+                                       '       style="position:absolute;top:5px;height:'+(track_height+30)+'px;left:10px;right:0px;"' +
                                        '>'+
                                                '<div id="container_track_'+i+'" style="position:relative;top:0px;' +
                                                        'height:'+(track_height+30)+'px;left:0px;right:0px;" class="container_track">' +
index b672106..9843e66 100644 (file)
@@ -4,7 +4,8 @@ loadGM({
        "mwe-auto_scroll" : "auto scroll",
        "mwe-close" : "close",
        "mwe-improve_transcript" : "Improve",
-       "mwe-no_text_tracks_found" : "No text tracks were found"
+       "mwe-no_text_tracks_found" : "No text tracks were found",
+       "mwe-subtitles" : "$1 Subtitles"
 })
 // text interface object (for inline display captions)
 var mvTextInterface = function( parentEmbed ){
@@ -30,17 +31,61 @@ mvTextInterface.prototype = {
        getTimedTextTracks:function(){
                js_log("load timed text from roe: "+ this.pe.roe);
                var _this = this;
+               var apiUrl = mwGetLocalApiUrl();
                //if roe not yet loaded do load it:
-               if(this.pe.roe){
+               if(this.pe.roe || _this.pe.wikiTitleKey ){
                        if(!this.pe.media_element.addedROEData){
                                js_log("load roe data!");
-                               $j('#mv_txt_load_'+_this.pe.id).show(); //show the loading icon
-                               do_request( _this.pe.roe, function(data)
-                               {
-                                       //continue
-                                       _this.pe.media_element.addROE(data);
-                                       _this.getParseTimedText_rowReady();
-                               });
+                               $j('#mv_txt_load_'+_this.pe.id).show(); //show the loading icon         
+                               if(_this.pe.roe){
+                                       do_request( _this.pe.roe, function(data)
+                                       {
+                                               //continue
+                                               _this.pe.media_element.addROE(data);
+                                               _this.getParseTimedText_rowReady();
+                                       });
+                               }else if( _this.pe.wikiTitleKey ){                                      
+                                       do_api_req({    
+                                                       'url':  apiUrl,                                 
+                                                       'data': {
+                                                               'list' : 'allpages',
+                                                               'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey
+                                                       }
+                                       }, function( subData ) {
+                                               do_api_req({
+                                                               'url':  apiUrl, 
+                                                               'data': {
+                                                                       'meta' : 'siteinfo',
+                                                                       'siprop' : 'languages'
+                                                               }
+                                                       }, function( langDataRaw ) {
+                                                                       var langData = {};
+                                                                       var lagRaw = langDataRaw.query.languages;
+                                                                       for(var j in lagRaw){
+                                                                               langData[ lagRaw[j].code ] = lagRaw[j]['*'];
+                                                                       }
+                                                                       for(var i in subData.query.allpages){                                                           
+                                                                               var subPage = subData.query.allpages[i];
+                                                                               langKey = subPage.title.split('.');
+                                                                               langKey = langKey[ langKey.length-2 ];
+                                                                               if( !langData[ langKey] ){
+                                                                                       js_log('Error: langkey:'+ langKey + ' not found'); 
+                                                                               }else{
+                                                                                       var textElm = document.createElement('text');
+                                                                                       $j(textElm).attr({
+                                                                                               'category' : 'SUB',
+                                                                                               'lang'  : langKey,
+                                                                                               'type'  : "text/x-srt",
+                                                                                               'title' : gM('mwe-subtitles', langData[ langKey]),
+                                                                                               'src' : wgServer + wgScript + '?title=' + subPage.title + '&action=raw' 
+                                                                                       });                                                                                                                                                             
+                                                                                       _this.pe.media_element.tryAddSource( textElm );
+                                                                                       _this.getParseTimedText_rowReady();
+                                                                               }
+                                                                       }
+                                                               });             //do_api_req({                  
+                                       });     //function( subData ) {
+                               }
                        }else{
                                js_log('row data ready (no roe request)');
                                _this.getParseTimedText_rowReady();
index 181f0ca..3f72a98 100644 (file)
@@ -114,7 +114,7 @@ lcPaths({
        "$j.ui.draggable"               : "jquery/jquery.ui/ui/ui.draggable.js",
        "$j.ui.selectable"              : "jquery/jquery.ui/ui/ui.selectable.js",
 
-       "$mw.dragDropFile"              : "libAddMedia/dragDropFile.js",
+       "$j.fn.dragDropFile"            : "libAddMedia/dragDropFile.js",
        "mvFirefogg"                    : "libAddMedia/mvFirefogg.js",
        "mvAdvFirefogg"                 : "libAddMedia/mvAdvFirefogg.js",
        "mvBaseUploadInterface" : "libAddMedia/mvBaseUploadInterface.js",
@@ -1232,8 +1232,8 @@ function mv_jqueryBindings() {
                        if( this.selector ){    
                                var _this = this;       
                                //load the dragger and "setup"
-                               $mw.load( ['$mw.dragDropFile'], function(){
-                                       $mw.dragDropFile( _this.selector );                                                     
+                               $mw.load( ['$j.fn.dragDropFile'], function(){
+                                       $j(_this.selector).dragDropFile();                                                      
                                }); 
                        }                                        
                }
@@ -1505,6 +1505,26 @@ function mv_jqueryBindings() {
                        )
                        return this;
                }
+               /**
+               * resize the dialog to fit the window
+               */
+               $.fn.dialogFitWindow = function(opt){                   
+                       var opt_default = {'hspace':50,'vspace':50};
+                       if(!opt)
+                               var opt={};                     
+                       $j.extend(opt, opt_default);
+                       $j( this.selector).dialog('option', 'width', $j(window).width() - opt.hspace );
+                       $j( this.selector).dialog('option', 'height', $j(window).height() - opt.vspace );
+                       $j( this.selector).dialog('option', 'position','center');
+                               //update the child position: (some of this should be pushed up-stream via dialog config options
+                       $j( this.selector +'~ .ui-dialog-buttonpane').css({
+                               'position':'absolute',
+                               'left':'0px',
+                               'right':'0px',
+                               'bottom':'0px',
+                       });                     
+               }
+               
                /**
                * addLoaderDialog
                *  small helper for putting a loading dialog box on top of everything
@@ -1514,7 +1534,7 @@ function mv_jqueryBindings() {
                */
                $.addLoaderDialog = function( msg_txt ){                        
                        $.addDialog( msg_txt, msg_txt + '<br>' + mv_get_loading_img() );                
-               }
+               }                                               
                
                $.addDialog = function ( title, msg_txt, btn ){
                        $('#mwe_tmp_loader').remove();
@@ -1767,7 +1787,8 @@ function do_request( req_url, callback ) {
                global_req_cb.push( callback );
                // Prepend json_ to feed_format if not already requesting json format (metavid specific)
                if( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 )
-                       req_url = req_url.replace( /feed_format=/, 'feed_format=json_' );
+                       req_url = req_url.replace( /feed_format=/, 'feed_format=json_' );               
+               
                loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length - 1) );
        }
 }
index ab870f7..88d835a 100644 (file)
 $messages = array();
 
 $messages['en'] = array(
+       /*
+        * js file /libAddMedia/dragDropFile.js
+        */
+       'mwe-upload-multi' => 'Upload {{PLURAL:$1|file|files}}',
+       'mwe-review-upload' => 'Review File {{PLURAL:$1|Upload|Uploads}}',
        /*
         * js file: /libClipEdit/mvClipEdit.js
         */
@@ -47,6 +52,7 @@ $messages['en'] = array(
        'mwe-close' => 'close',
        'mwe-improve_transcript' => 'Improve',
        'mwe-no_text_tracks_found' => 'No text tracks were found',
+       'mwe-subtitles' => '$1 Subtitles',
 
        /*
         * js file: /libSequencer/mvTimedEffectsEdit.js
index 7c0db4e..592f969 100644 (file)
@@ -63,7 +63,8 @@ ctrlBuilder.prototype = {
 
                //special case vars:
                if( ( embedObj.roe ||
-                               (embedObj.media_element.timedTextSources &&
+                         embedObj.wikiTitleKey ||
+                               ( embedObj.media_element.timedTextSources &&
                                embedObj.media_element.timedTextSources() )
                        )  && embedObj.show_meta_link  )
                        this.supports['closed_captions']=true;
@@ -155,7 +156,7 @@ ctrlBuilder.prototype = {
 
 
                //captions binding:
-               $j('#timed_text_'  + embedObj.id).unbind().btnBind().click(function(){
+               $tp.find('.timed-text').unbind().btnBind().click(function(){
                        $j('#' + embedObj.id).get(0).showTextInterface();
                });
 
@@ -400,7 +401,7 @@ ctrlBuilder.prototype = {
                'closed_captions':{
                        'w':23,
                        'o':function( ctrlObj ){
-                               return '<div title="' + gM('mwe-closed_captions') + '" id="timed_text_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton">'+
+                               return '<div title="' + gM('mwe-closed_captions') + '" class="ui-state-default ui-corner-all ui-icon_link rButton timed-text">'+
                                                        '<span class="ui-icon ui-icon-comment"></span>'+
                                                '</div>'
                        }
index d20c098..4609dae 100644 (file)
@@ -8,9 +8,10 @@ td{
 }
 </style>
 <script type="text/javascript" >
-var scriptLoaderURID = 't11';
+var scriptLoaderURID = 't14';
 //for just setting one or two to test at a time for debug
-var langKeyDebug = [ 'az', 'da', 'pt', 'fr', 'lv',c 'en'];
+var langKeyDebug = ['en'];
+//var langKeyDebug = [ 'az', 'da', 'pt', 'fr', 'lv', 'en'];
 
 //shortLangKey is an array of at least one language from every group in cldrConverter.php
 var langKeyGroups = ['en','az', 'da', 'pt', 'fr', 'lv', 'ga','hr','cy','mk','mt','pl','sl'];
@@ -180,7 +181,7 @@ js2AddOnloadHook( function(){
        function doLangTable( langSet ){                
                //build table output: 
                var msgTestSet = {                                                                                              
-                       'undelete_short': [ 0, 1, 2, 5, 21, 30 ],                       
+                       'mwe-upload-multi' : [ 0, 1, 2, 5, 21, 30 ],                    
                        //category-subcat-count' has two params:
                        'category-subcat-count' : [ 
                                [0,10], 
index 10a346e..5053ade 100644 (file)
@@ -3,11 +3,12 @@
 
 loadGM({       
        "undelete_short"  : "Undelete {{PLURAL:$1|one edit|$1 edits}}",
-       "category-subcat-count" : "{{PLURAL:$2|This category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}"        
+       "category-subcat-count" : "{{PLURAL:$2|This category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}",
+       "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}"  
 });
 
 $mw.lang.loadRS({
-       'PLURAL' : { "one":1 }  
+       'PLURAL' : { "one" : 1 }        
 });
 
 //define a class by the name of this file:  
index e7a2612..769b446 100644 (file)
@@ -21,7 +21,12 @@ function doPageSpecificRewrite() {
                        loadExternalJs( mwEmbedHostPath + '/editPage.js' + reqAguments );
                } );
        }
-
+       
+       //timed text dispaly:
+       if(wgPageName.indexOf("TimedText") === 0){
+               
+       }
+       
        // Firefogg integration
        if( wgPageName == "Special:Upload" ){           
                load_mv_embed( function() {
@@ -55,29 +60,38 @@ function doPageSpecificRewrite() {
                } );
        }
 }
-// will be deprecated in favor of updates to OggHandler
+// will be depreciated in favor of updates to OggHandler
 function rewrite_for_OggHandler( vidIdList ){
-       for( var i = 0; i < vidIdList.length; i++ ) {
-               var vidId = vidIdList[i];
+       function procVidId(vidId){
+               if( $j( '#'+vidId).length == 0){
+                       if(vidIdList.length != 0){
+                               setTimeout( function(){
+                                       procVidId( vidIdList.pop() )
+                               }, 1);
+                       }
+                       return ;
+               }
                // Grab the thumbnail and src of the video
                var pimg = $j( '#' + vidId + ' img' );
                var poster_attr = 'poster = "' + pimg.attr( 'src' ) + '" ';
                var pwidth = pimg.attr( 'width' );
                var pheight = pimg.attr( 'height' );
 
-               var type_attr = '';
+               var tag_type = 'video';
+               
                // Check for audio
                if( pwidth == '22' && pheight == '22' ) {
                        //set width to parent width:
                        pwidth = $j( '#' + vidId ).width();
                        pheight = '100';
-                       type_attr = 'type="audio/ogg"';
+                       tag_type = 'audio';
                        poster_attr = '';
                }
 
                // Parsed values:
                var src = '';
-               var duration = '';
+               var duration = '';              
+               var wikiTitleKey = $j( '#'+vidId + ' a').attr('href').replace('\/wiki\/', '');          
 
                var re = new RegExp( /videoUrl(&quot;:?\s*)*([^&]*)/ );
                src = re.exec( $j( '#'+vidId).html() )[2];
@@ -89,27 +103,42 @@ function rewrite_for_OggHandler( vidIdList ){
                offset = re.exec( $j( '#'+vidId).html() )[2];
                var offset_attr = offset ? 'startOffset="' + offset + '"' : '';
 
-               // Rewrite that video id (do async calls to avoid locking)
                if( src ) {
-                       // Replace the top div with the mv_embed based player:
-                       var vid_html = '<video id="vid_' + i +'" '+
+                       var html_out = '';
+                       
+                       var common_attr = ' id="vid_' + i +'" '+
+                                       'wikiTitleKey="' + wikiTitleKey + '" ' +
                                        'src="' + src + '" ' +
-                                       poster_attr + ' ' +
-                                       type_attr + ' ' +
-                                       offset_attr + ' ' +
-                                       'duration="' + duration + '" ' +
-                                       'style="width:' + pwidth + 'px;height:' +
-                                               pheight + 'px;"></video>';
+                                       'durationHint="' + duration + '" ' +
+                                       offset_attr + ' ';
+                                       
+                       if( tag_type == 'audio' ){
+                               html_out='<audio' + common_attr + '></audio>'
+                       }else{
+                               html_out='<video' + common_attr +
+                               poster_attr + ' ' +
+                               'style="width:' + pwidth + 'px;height:' +
+                               pheight + 'px;">'
+                               '</video>';
+                       }       
                        //set the video tag inner html and update the height
-                       $j( '#' + vidId ).html( vid_html )
+                       $j( '#' + vidId ).html( html_out )
                                .css('height', pheight + 30);
 
-               }
-
-               rewrite_by_id( 'vid_' + i );
-       }
+               }               
+               rewrite_by_id( 'vid_' + i, function(){
+                       if(vidIdList.length != 0){
+                               setTimeout( function(){
+                                       procVidId( vidIdList.pop() )
+                               }, 1);
+                       }
+               });
+       };
+       //proccess each item in the vidIdList (with setTimeout to avoid locking)
+       setTimeout( function(){
+               procVidId( vidIdList.pop() )
+       }, 1);
 }
-
 function getRemoteEmbedPath() {
        for( var i = 0; i < document.getElementsByTagName( 'script' ).length; i++ ) {
                var s = document.getElementsByTagName( 'script' )[i];