* some comment updates
authorMichael Dale <dale@users.mediawiki.org>
Tue, 10 Nov 2009 10:06:10 +0000 (10:06 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Tue, 10 Nov 2009 10:06:10 +0000 (10:06 +0000)
* added flag to disable script-loader in remoteMwEmbed.js

14 files changed:
js2/apiProxyPage.js
js2/editPage.js
js2/mwEmbed/example_usage/Add_Media_Wizard.html
js2/mwEmbed/jsScriptLoader.php
js2/mwEmbed/libAddMedia/dragDropFile.js
js2/mwEmbed/libAddMedia/mvAdvFirefogg.js
js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
js2/mwEmbed/libAddMedia/mvFirefogg.js
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libTimedText/mvTimeTextEdit.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/tests/testLang.html
js2/remoteMwEmbed.js
js2/uploadPage.js

index 327e5c6..79590cc 100644 (file)
@@ -1,11 +1,11 @@
 /*
 * mwProxy js2 page system.
 *
-* invokes the apiProxy system 
+* Invokes the apiProxy system 
 */
 
 /*
- * since this is proxy server set a pre-append debug flag to know which debug msgs are coming from where
+ * Since this is proxy server set a pre-append debug flag to know which debug msgs are coming from where
  */
  
 $mw.conf['debug_pre'] = 'Proxy';
@@ -13,13 +13,14 @@ $mw.conf['debug_pre'] = 'Proxy';
 if( !mwApiProxyConfig )
        var mwApiProxyConfig = {};
 
-//The default mwApiProxyConfig config 
-//(presently hard coded but should read from user and site config)  
+// The default mwApiProxyConfig config 
+// (presently hard coded but should read from user and site config)  
 var mwApiProxyDefaultConfig = {
                'master_whitelist'      : [  'en.wikipedia.org', 'localhost', '127.1.1.100' ],
                'master_blacklist'      : []                                    
 };
-//user_white_list should also be checked and configured at runtime.
+
+// User white_list should also be checked and configured at runtime.
 js2AddOnloadHook( function() {                         
        //build our configuration from the default and mwApiProxyConfig vars
        mwApiProxyConfig = $j.extend(true, mwApiProxyDefaultConfig,  mwApiProxyConfig); 
index 28279fe..c03bf06 100644 (file)
@@ -25,7 +25,7 @@ js2AddOnloadHook( function() {
        // kind of tricky, it would be nice to use run on ready "loader" call here
        var didWikiEditorBind = false;  
        
-       //setup the drag drop binding (will only work for html5 upload browsers) 
+       //Set-up the drag drop binding (will only work for html5 upload browsers) 
        //$j('textarea#wpTextbox1').dragFileUpload();
        
        //set up the add-media-wizard binding: 
@@ -46,7 +46,7 @@ js2AddOnloadHook( function() {
                    }
                );
        }               
-       //add to old toolbar if wikiEditor did not remove '#toolbar' from the page:    
+       //Add to old toolbar if wikiEditor did not remove '#toolbar' from the page:    
        setTimeout(function(){
                if( $j('#btn-add-media-wiz').length == 0 && $j( '#toolbar' ).length != 0 ){
                        js_log(' old toolbar bind:');
@@ -57,7 +57,7 @@ js2AddOnloadHook( function() {
                        );
                }else{
                        js_log('failed to bind via build section bind via target:');
-                       //make sure the wikieditor got binded: 
+                       //Make sure the wikieditor got binded: 
                        if( !didWikiEditorBind )
                                $j(".tool[rel='file']").unbind().addMediaWiz( amwConf );
                }
index 6f72706..5e9f893 100644 (file)
@@ -11,8 +11,8 @@
                        border:medium none;
                }
        </style>
-       <!--  <script type="text/javascript" src="../mv_embed.js?debug=true"></script> -->       
-       <script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mv_embed,remoteSearchDriver,$j.ui,$j.ui.resizable,$j.ui.draggable,$j.ui.dialog,$j.ui.tabs,$j.ui.sortable,$j.cookie,baseRemoteSearch&urid=1257728132531&debug=true&uselang=en"></script>            
+       <script type="text/javascript" src="../mv_embed.js?debug=true"></script>         
+       <!--<script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mv_embed,remoteSearchDriver,$j.ui,$j.ui.resizable,$j.ui.draggable,$j.ui.dialog,$j.ui.tabs,$j.ui.sortable,$j.cookie,baseRemoteSearch&urid=1257728132531&debug=true&uselang=en"></script> -->            
        <script type="text/javascript">
        js2AddOnloadHook(function(){            
                $j('#add_media_link').addMediaWiz( {
index e195e20..bc3ed7a 100644 (file)
@@ -3,17 +3,18 @@
  * This core jsScriptLoader class provides the script loader functionality
  * @file
  */
-// Check if we are being invoked in a MediaWiki context or stand alone usage:
 
-//setup the script local script cache directory (has to be hard coded rather than config based for fast non-mediawiki config hits
+
+//Setup the script local script cache directory (has to be hard coded rather than config based for fast non-mediawiki config hits
 $wgScriptCacheDirectory = realpath( dirname( __FILE__ ) ) . '/php/script-cache';
 
+// Check if we are being invoked in a MediaWiki context or stand alone usage:
 if ( !defined( 'MEDIAWIKI' ) && !defined( 'MW_CACHE_SCRIPT_CHECK' ) ){
        // Load noMediaWiki helper for quick cache result
        $myScriptLoader = new jsScriptLoader();
        if( $myScriptLoader->outputFromCache() )
                exit();
-       //else load up all the config and do normal stand alone ScriptLoader process:
+       //Else load up all the config and do normal stand alone ScriptLoader process:
        require_once( realpath( dirname( __FILE__ ) ) . '/php/noMediaWikiConfig.php' );
        $myScriptLoader->doScriptLoader();
 }
@@ -396,7 +397,7 @@ class jsScriptLoader {
                                return substr($str, 0, $inx['s']-1) . $translated . substr($str, $inx['e']+1);
                        }
                }
-               //return the js str unmodified if we did not transform with the localization.
+               //return the js str unmodified if we did not transform with the localisation.
                return $str;
        }
        static public function getLoadGmIndex( $str ){
@@ -535,7 +536,7 @@ class simpleFileCache {
                        readfile( $this->filename );
                        return true;
                }
-               //output without gzip:
+               // Output without gzip:
                if ( substr( $this->filename, - 3 ) == '.gz' ) {
                        readgzfile( $this->filename );
                } else {
index a19ea3e..35bf0f4 100644 (file)
@@ -43,10 +43,11 @@ loadGM({
 
                        $j('#multiple_file_input').remove();
 
-                       $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>');
+                       $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>'
+                       );
 
 
                        var cBtn = {};
index 612accc..66d2fcf 100644 (file)
@@ -73,16 +73,16 @@ var mvAdvFirefogg = function( iObj ){
        return this.init( iObj );
 }
 var default_mvAdvFirefogg_config = {
-       //which config groups to include
+       // Which config groups to include
        'config_groups'  : ['preset', 'range', 'quality', 'meta', 'advVideo', 'advAudio'],
 
-       //if you want to load any custom presets must follow the mvAdvFirefogg.presetConf json outline below
+       // If you want to load any custom presets must follow the mvAdvFirefogg.presetConf json outline below
        'custom_presets'        : {},
 
-       //any firefog config properties that may need to be excluded from options
+       // Any firefog config properties that may need to be excluded from options
        'exclude_settings' : [],
 
-       //the control container (where we put all the controls)
+       // The control container (where we put all the controls)
        'target_control_container':false
 }
 
@@ -90,49 +90,50 @@ mvAdvFirefogg.prototype = {
        //the global groupings and titles for for configuration options :
        config_groups : [ 'preset', 'range', 'quality', 'meta', 'advVideo', 'advAudio'],
        //list of pre-sets:
+
        //local instance encoder config:
-default_local_settings:{
-       'd'     : 'webvideo',
-       'type'  : 'select',
-       'selectVal': ['webvideo'],
-       'group' : "preset",
-       'pSet' : {
-               'custom':{
-                       'descKey': 'fogg-preset-custom',
-                       'conf': {}
-               },
-               'webvideo': {
-                       'desc': gM('fogg-webvideo-desc'),
-                       'conf': {
-                               'maxSize'      : 400,
-                               'videoBitrate' : 544,
-                               'audioBitrate' : 96,
-                               'noUpscaling'  : true,
-                       }
-               },
-               'savebandwith': {
-                       'desc': gM('fogg-savebandwith-desc'),
-                       'conf': {
-                               'maxSize'       : 200,
-                               'videoBitrate'  : 164,
-                               'audioBitrate'  : 32,
-                               'samplerate'    : 22050,
-                               'framerate'     : 15,
-                               'channels'      : 1,
-                               'noUpscaling'   : true
-                       }
-               },
-               'hqstream':{
-                       'desc': gM('fogg-highquality-desc'),
-                       'conf': {
-                               'maxSize'      : 1080,
-                               'videoQuality' : 6,
-                               'audioQuality' : 3,
-                               'noUpscaling'  : true,
-                       }
-               },
-       }
-},
+       default_local_settings:{
+               'd'     : 'webvideo',
+               'type'  : 'select',
+               'selectVal': ['webvideo'],
+               'group' : "preset",
+               'pSet' : {
+                       'custom':{
+                               'descKey': 'fogg-preset-custom',
+                               'conf': {}
+                       },
+                       'webvideo': {
+                               'desc': gM('fogg-webvideo-desc'),
+                               'conf': {
+                                       'maxSize'      : 400,
+                                       'videoBitrate' : 544,
+                                       'audioBitrate' : 96,
+                                       'noUpscaling'  : true,
+                               }
+                       },
+                       'savebandwith': {
+                               'desc': gM('fogg-savebandwith-desc'),
+                               'conf': {
+                                       'maxSize'       : 200,
+                                       'videoBitrate'  : 164,
+                                       'audioBitrate'  : 32,
+                                       'samplerate'    : 22050,
+                                       'framerate'     : 15,
+                                       'channels'      : 1,
+                                       'noUpscaling'   : true
+                               }
+                       },
+                       'hqstream':{
+                               'desc': gM('fogg-highquality-desc'),
+                               'conf': {
+                                       'maxSize'      : 1080,
+                                       'videoQuality' : 6,
+                                       'audioQuality' : 3,
+                                       'noUpscaling'  : true,
+                               }
+                       },
+               }
+       },
        local_settings: {},
 
        //core firefogg default encoder configuration
@@ -576,13 +577,13 @@ default_local_settings:{
                                                        //maintain source video aspect ratio:
                                                        if(_this.getClassId(this, 'slider_') == 'width'){
                                                                var hv = parseInt((_this.sourceFileInfo.video[0]['height']/_this.sourceFileInfo.video[0]['width'])* ui.value );
-                                                               //update the height value:        the new hight value is > that orginal the slider:
+                                                               //update the height value:        the new height value is > that original the slider:
                                                                if(hv > _this.updateInterfaceValue('height', hv))
                                                                        return false;
                                                        }
                                                        if(_this.getClassId(this, 'slider_') == 'height'){
                                                                var wv = parseInt((_this.sourceFileInfo.video[0]['width']/_this.sourceFileInfo.video[0]['height'])* ui.value );
-                                                               //update the height value:        the new hight value is > that orginal the slider:
+                                                               //update the height value:        the new height value is > that original the slider:
                                                                if(wv > _this.updateInterfaceValue('width', wv))
                                                                        return false;
                                                        }
@@ -724,7 +725,7 @@ default_local_settings:{
                if( this.encoder_settings['passthrough'] ){
                        js_log("in passthrough mode (hide control)");
                        //hide all controls
-                       //dispaly not encodable video
+                       //display not encodable video
                        $j(this.target_control_container).hide('slow');
                        $j(this.target_passthrough_mode).show('slow');
                        return ;
@@ -775,7 +776,7 @@ default_local_settings:{
                        }
                        setValues(k, val, maxVal);
                }
-               //audio stream settings, assumes for now thare is only one stream
+               //audio stream settings, assumes for now there is only one stream
                for(var i in this.sourceFileInfo.audio[0]){
                        var val = this.sourceFileInfo.audio[0][i];
                        var k = false;
index 79800b1..39de0e7 100644 (file)
@@ -1,9 +1,8 @@
 /**
- * the base Upload Interface for uploading.
+ * The base Upload Interface for uploading.
  *
- * this base uploader is optionally extended by Firefogg
+ * This base upload class is optionally extended by Firefogg
  *
- * @@todo: checkme: gM 'thumbnail-more' is used; only defined in MediaWiki core. Will that work properly?
  */
 loadGM({
        "mwe-upload-transcode-in-progress" : "Transcode and upload in progress (do not close this window)",
@@ -37,7 +36,7 @@ var default_bui_options = {
        'done_upload_cb': null,
        'target_edit_from':null,
 
-       //default upload mode is 'api' but if no api_url will try tp post
+       // Default upload mode is 'api'
        'upload_mode': 'api'
 
 }
@@ -46,80 +45,80 @@ var mvBaseUploadInterface = function( iObj ){
 }
 mvBaseUploadInterface.prototype = {
        parent_uploader:false,
-       formData:{}, //the form to be submitted
+       formData:{}, // The form data to be submitted
        warnings_sessionkey:null,
        chunks_supported:true,
        form_post_override:false,
        http_copy_upload : false,
        action_done:false,
-       //the edit token:
+       // The edit token:
        etoken:false,
        init: function( iObj ){
                if(!iObj)
                        iObj = {};
-               //inherit iObj properties:
+               // Inherit iObj properties:
                $j.extend( this, default_bui_options, iObj);            
                js_log( "init mvBaseUploadInterface:: " + this.api_url);                
        },
        setupForm:function(){
                js_log("Base::setupForm::");
                var _this = this;
-               //set up the local pointer to the edit form:
+               // Set up the local pointer to the edit form:
                _this.editForm = _this.getEditForm();           
                if( _this.editForm ){
                                                
-                       //if in api re-map the upload form to api: (we have to do this BEFORE the users selects a file) 
+                       // If in api re-map the upload form to api: (we have to do this BEFORE the users selects a file) 
                        if( _this.upload_mode == 'api'){
                                _this.doRemapFormToApi();
                        }                                       
                        
-                       //set up the org_onsubmit if not set:
+                       // Set up the org_onsubmit if not set:
                        if( typeof( _this.org_onsubmit ) == 'undefined' &&  _this.editForm.onsubmit )
                                _this.org_onsubmit = _this.editForm.onsubmit;   
                        
                        
-                       //set up the submit action:
+                       // Set up the submit action:
                        $j( _this.editForm ).submit( function(){
                                js_log('setupForm.onSubmit:');
                                                                
-                               //set the upload mode: 
+                               // Set the upload mode: 
                                _this.setWgUploadSelect();
                                
-                               //run the original onsubmit (if not run yet set flag to avoid excessive chaining )
+                               // Run the original onsubmit (if not run yet set flag to avoid excessive chaining )
                                if( typeof( _this.org_onsubmit ) == 'function' ){
                                        if( ! _this.org_onsubmit() ){
                                                //error in org submit return false;
                                                return false;
                                        }
                                }
-                               //check for post action override:
+                               // Check for post action override:
                                if( _this.form_post_override ){
                                        js_log('form_post_override is true do form proccesing:');
                                        return true;
                                }
-                               //get the input form data in flat json:
+                               // Get the input form data in flat json:
                                js_log('update formData::');
                                var tmpAryData = $j( _this.editForm ).serializeArray();
                                for(var i=0; i < tmpAryData.length; i++){
                                        if( tmpAryData[i]['name'] )
                                                _this.formData[ tmpAryData[i]['name'] ] = tmpAryData[i]['value'];
                                }
-                               //put into a try catch so we are sure to return false:
+                               // Put into a try catch so we are sure to return false:
                                try{
                                        debugger;
-                                       //get a clean loader:
+                                       // Get a clean loader:
                                        _this.dispProgressOverlay();
 
-                                       //for some unknown reason we have to drop down the #p-search z-index:
+                                       // For some unknown reason we have to drop down the #p-search z-index:
                                        $j('#p-search').css('z-index', 1);
 
-                                       //select upload mode:                                   
+                                       // Select upload mode:                                  
                                        _this.detectUploadMode();
                                }catch(e){
                                        js_log('::error in dispProgressOverlay or detectUploadMode');
                                }
                                
-                               //don't submit the form we will do the post in ajax
+                               // Don't submit the form we will do the post in ajax
                                return false;
                        });
                }               
@@ -130,7 +129,7 @@ mvBaseUploadInterface.prototype = {
        detectUploadMode:function( callback ){
                var _this = this;
                js_log('detectUploadMode::' +  _this.upload_mode);
-               //check the upload mode:
+               // Check the upload mode:
                if( _this.upload_mode == 'autodetect' ){
                        js_log('detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url);
                        if( ! _this.api_url )
@@ -164,8 +163,7 @@ mvBaseUploadInterface.prototype = {
                        _this.doUploadSwitch();
                }
        },
-       //@@NOTE this could probably be depricated to just have a special:upload page that uses api keys? 
-       // or maybe its usefull to seperate js and non-js submits
+       //@@NOTE this could probably be deprecated in favor of automated input
        doRemapFormToApi:function(){
                var _this = this;
                if( !_this.api_url )
index 98ab67b..c83d296 100644 (file)
@@ -27,51 +27,50 @@ var firefogg_install_links =  {
 };
 
 var default_firefogg_options = {
-       //what to do when finished uploading
+       // What to do when finished uploading
        'done_upload_cb':false,
-       //if firefoog is enabled
+       // If firefoog is enabled
        'fogg_enabled':false,
-       //the api url to upload to
+       // The api url to upload to
        'api_url':null,
-       //the passthrough flag (enables un-modified uploads)
+       // The passthrough flag (enables un-modified uploads)
        'passthrough': false,
-       //if we will be showing the encoder interface
+       // If we will be showing the encoder interface
        'encoder_interface': false,
-       //if we want to limit the library functionality to "only firefoog" (no upload or progress bars)
+       // If we want to limit the library functionality to "only firefoog" (no upload or progress bars)
        'only_fogg': false,
 
-
-       //callbacks:
+       // Callbacks:
        'new_source_cb': false, //called on source name update passes along source name
 
-       //target control container or form (can't be left null)
+       // Target control container or form (can't be left null)
        'selector': '',
 
-       //if not rewriting a form we are encoding local.
+       // If not rewriting a form we are encoding local.
        'form_rewrite': false,
 
-       //taget buttons:
+       // Target buttons:
        'target_btn_select_file': false,
        'target_btn_select_new_file': false,
 
        //'target_btn_select_url': false,
-
        'target_btn_save_local_file': false,
        'target_input_file_name': false,
 
 
-       //target install descriptions
+       // Target install descriptions
        'target_check_for_fogg': false,
        'target_installed': false,
        'target_please_install': false,
        'target_use_latest_fox': false,
-       //status:
+       
+       // Status:
        'target_passthrough_mode':false,
 
-       //if firefogg should take over the form submit action
+       // If firefogg should take over the form submit action
        'firefogg_form_action':true,
        
-       //if we should show a preview of encoding progress 
+       // If we should show a preview of encoding progress 
        'show_preview':false
 }
 
@@ -100,11 +99,11 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                if(!iObj)
                        iObj = {};
 
-               //if we have no api_url set upload to "post"
+               // If we have no api_url set upload to "post"
                if(!iObj.api_url)
                        iObj.upload_mode = 'post';
 
-               //inherit iObj properties:
+               // Inherit iObj properties:
                for(var i in default_firefogg_options){
                        if(iObj[i]){
                                this[i] = iObj[i];
@@ -112,11 +111,11 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                this[i] = default_firefogg_options[i];
                        }
                }
-               //check if we want to limit the usage:
+               // Check if we want to limit the usage:
                if(!this.only_fogg){
                        var myBUI = new mvBaseUploadInterface( iObj );
 
-                       //standard extends code:
+                       // Standard extends code:
                        for(var i in myBUI){
                                if(this[i]){
                                        this['pe_'+ i] = myBUI[i];
@@ -139,7 +138,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                _this.form_rewrite = true;
                        }
                }
-               //check if we are rewriting an input or a form:
+               // Check if we are rewriting an input or a form:
                if( this.form_rewrite ){
                        this.setupForm();
                }else{
@@ -147,7 +146,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        this.doControlBindings();
                }
 
-               //doRewrite is done:
+               // doRewrite is done:
                if(callback)
                        callback();
        },
@@ -157,10 +156,10 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                $j.each(default_firefogg_options, function(target, na){
                        if(target.substring(0, 6)=='target'){
                                //js_log('check for target html: ' + target);
-                               //check for the target if missing add to the output:
+                               // Check for the target if missing add to the output:
                                if( _this[target] === false){
                                        out += _this.getTargetHtml(target) + ' ';
-                                       //update the target selector
+                                       // Update the target selector
                                    _this[target] = _this.selector + ' .' + target;
                                }
                        }
@@ -179,7 +178,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        doControlBindings: function(){
                var _this = this;
 
-               //hide all targets:
+               // Hide all targets:
                var hide_target_list='';
                var coma='';
                $j.each( default_firefogg_options, function(target, na) {
@@ -188,20 +187,20 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                coma=',';
                        }
                });
+               
+               // Hide all but check-for-fogg
                $j( hide_target_list ).hide();
-               //now that the proper set of items has been hiiden show:
+               // Now that the proper set of items has been hiiden show:
                $j( _this.selector ).show();
-
-
-               //hide all but check-for-fogg
-               //check for firefogg
+               
+               // Check for firefogg
                if( _this.firefoggCheck() ){
 
-                       //if rewriting the form lets keep the text input around:
+                       // If rewriting the form lets keep the text input around:
                        if( _this.form_rewrite )
                                $j( _this.target_input_file_name ).show();
 
-                       //show select file:
+                       // Show select file:
                        $j( this.target_btn_select_file ).unbind(
                                ).attr('disabled', false
                                ).css({'display':'inline'}
@@ -215,7 +214,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                    })
 
                }else{
-                       //first check firefox version:
+                       // First check firefox version:
                        if(!( $j.browser.mozilla && $j.browser.version >= '1.9.1' )) {
                                js_log( 'show use latest::' + _this.target_use_latest_fox );
                                if( _this.target_use_latest_fox ){
@@ -227,11 +226,11 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                return ;
                        }
 
-                       //if rewriting form use upload msg text
+                       // If rewriting form use upload msg text
                        var upMsg = (_this.form_rewrite) ? gM('fogg-for_improved_uplods') : '';
                        $j( _this.target_please_install ).html( upMsg + gM('fogg-please_install', _this.getOSlink() )).css('padding', '10px').show();
                }
-               //setup the target save local file bindins:
+               // Setup the target save local file bindings:
                $j( _this.target_btn_save_local_file ).unbind().click(function(){
                        _this.saveLocalFogg();
                });
@@ -260,7 +259,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        return false;
                }
        },
-       //assume input target
+       // Assume input target
        setupForm: function(){
                js_log('firefogg::setupForm::');
                //to parent form setup if we want http updates
@@ -269,7 +268,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        this.pe_setupForm();
                }
 
-               //check if we have firefogg (if not just add a link and stop proccessing)
+               // Check if we have firefogg (if not just add a link and stop processing)
                if( !this.firefoggCheck() ){
                        //add some status indicators if not provided:
                        if(!this.target_please_install){
@@ -280,12 +279,12 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                $j(this.selector).after ( this.getTargetHtml('target_use_latest_fox') );
                                this.target_use_latest_fox = this.selector + ' ~ .target_use_latest_fox';
                        }
-                       //update download link:
+                       // Update download link:
                        this.doControlBindings();
                        return ;
                }
 
-               //change the file browser to type text: (can't directly change input from "file" to "text" so longer way:
+               // Change the file browser to type text: (can't directly change input from "file" to "text" so longer way:
                var inTag = '<input ';
                $j.each($j(this.selector).get(0).attributes, function(i, attr){
                        var val = attr.value;
@@ -302,26 +301,26 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                $j(this.selector).replaceWith(inTag);
 
                this.target_input_file_name = 'input[name=' + $j(this.selector).attr('name') + ']';
-               //update the selector to the control target:
+               
+               // Update the selector to the control target:
                this.selector = '#' + $j(this.selector).attr('name') +  "_fogg-control";
 
                this.doControlHTML();
-               //check for the other inline status indicator targets:
 
-               //update the bindings:
+               // Update the bindings:
                this.doControlBindings();
        },
-       //do firefogg specific additions: 
+       // Do firefogg specific additions: 
        dispProgressOverlay:function(){
                this.pe_dispProgressOverlay();                  
-               //if we are uploading video (not in passthrough mode show preview button)
+               // If we are uploading video (not in passthrough mode show preview button)
                if( this.fogg_enabled && ! this.encoder_settings['passthrough']  && ! this.http_copy_upload ){ 
                        this.doPreviewControl();        
                }
        },
        doPreviewControl:function(){
                var _this = this;
-               //prepend preview (if fogg)                             
+               // Prepend preview (if fogg)                            
                $j('#upProgressDialog').append(         
                        '<div style="clear:both;height:3em"/>'+                                                 
                        $j.btnHtml(gM('fogg-preview'), 'fogg_preview', 'triangle-1-e') + 
@@ -329,51 +328,51 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                '<canvas style="margin:auto;" id="fogg_preview_canvas" />' +
                        '</div>'
                );
-               //set initial state
+               // Set initial state
                if( _this.show_preview == true){
                        $j('#fogg_preview_canvas').show();
                }else{
-                       //update icon:
+                       // Update icon:
                        $j(this).children('.ui-icon')
                                .removeClass('ui-icon-triangle-1-s')
                                .addClass('ui-icon-triangle-1-e');                                                                      
-                       //update text:
+                       // Update text:
                        $j(this).children('.btnText').text( gM('fogg-preview') );                               
                        $j('#fogg_preview_canvas').hide();
                }
-               //apply preview binding:
+               // Apply preview binding:
                $j('#upProgressDialog .fogg_preview').btnBind().click( function(){
                        js_log("click .foog_preview" + $j(this).children('.ui-icon').attr('class') );
-                       //check state: 
+                       // Check state: 
                        if( $j(this).children('.ui-icon').hasClass('ui-icon-triangle-1-e') ){
                                _this.show_preview = true;                      
-                               //update icon:
+                               // Update icon:
                                $j(this).children('.ui-icon')
                                        .removeClass('ui-icon-triangle-1-e')
                                        .addClass('ui-icon-triangle-1-s'); 
-                               //update text
+                               // Update text
                                $j(this).children('.btnText').text( gM('fogg-hidepreview') );
                                 
-                               //show preview window                   
+                               // Show preview window                  
                                $j('#fogg_preview_canvas').show('fast');
                        }else{                                  
                                _this.show_preview = false;                                             
-                               //update icon:
+                               // Update icon:
                                $j(this).children('.ui-icon')
                                        .removeClass('ui-icon-triangle-1-s')
                                        .addClass('ui-icon-triangle-1-e');                                                                      
-                               //update text:
+                               // Update text:
                                $j(this).children('.btnText').text( gM('fogg-preview') );                               
                                
                                $j('#fogg_preview_canvas').hide('slow');
                        }
-                       //don't follow the #
+                       // Don't follow the #
                        return false; 
                });
        }, 
        doRenderPreview:function(){
                var _this = this;               
-               //set up the hidden video to pull frames from: 
+               // Set up the hidden video to pull frames from: 
                if( $j('#fogg_preview_vid').length == 0 )
                        $j('body').append('<video id="fogg_preview_vid" style="display:none"></video>');        
                var v = $j('#fogg_preview_vid').get(0);                                                 
@@ -394,21 +393,21 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                }               
                var previewI=null;
                function preview() {                            
-                       //initialize the video if not setup already:
+                       // Initialize the video if not setup already:
                        var v = $j('#fogg_preview_vid').get(0);                                         
                        if( v.src != _this.fogg.previewUrl ){           
                                js_log('init preview with url:' + _this.fogg.previewUrl);               
                                v.src = _this.fogg.previewUrl;
                                
-                               //set the video to seek to the end of the video
+                               // Set the video to seek to the end of the video
                                v.removeEventListener("loadedmetadata", seekToEnd, true);
                                v.addEventListener("loadedmetadata", seekToEnd, true);
                                
-                               //render a frame once seek is complete: 
+                               // Render a frame once seek is complete: 
                                v.removeEventListener("seeked", getFrame, true);
                                v.addEventListener("seeked", getFrame, true);
                                
-                               //refresh the video duration/meta:
+                               // Refresh the video duration/meta:
                                clearInterval(previewI);
                                var previewI = setInterval(function(){
                                        if (_this.fogg.status() != "encoding"){
@@ -426,7 +425,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        getEditForm:function(){
                if( this.target_edit_from )
                        return this.pe_getEditForm();
-               //else try to get the parent "from" of the file selector:
+               // Else try to get the parent "from" of the file selector:
                return $j(this.selector).parents('form:first').get(0);
        },
        selectFogg:function(){
@@ -438,17 +437,17 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        selectFoggActions:function(){
                var _this = this;
                js_log('videoSelectReady');
-               //if not already hidden hide select file and show "select new":
+               // If not already hidden hide select file and show "select new":
                $j(_this.target_btn_select_file).hide();
 
-               //show and setup binding for select new file:
+               // Show and setup binding for select new file:
                $j(_this.target_btn_select_new_file).show().unbind().click(function(){
                        //create new fogg instance:
                        _this.fogg = new Firefogg();
                        _this.selectFogg();
                });
 
-               //update if we are in passthrough mode or going to encode
+               // Update if we are in passthrough mode or going to encode
                if( _this.fogg.sourceInfo && _this.fogg.sourceFilename  ){
                        //update the source status
                        try{
@@ -457,22 +456,22 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                js_error('error could not parse fogg sourceInfo');
                        }
 
-                       //now setup encoder settings based source type:
+                       // Now setup encoder settings based source type:
                        _this.autoEncoderSettings();
 
-                       //if set to passthough update the interface (if not a form) 
+                       // If set to passthough update the interface (if not a form) 
                        if(_this.encoder_settings['passthrough'] == true && !_this.form_rewrite){
                                $j(_this.target_passthrough_mode).show();
                        }else{
                                $j(_this.target_passthrough_mode).hide();
-                               //if set to encoder expose the encode button:
+                               // If set to encoder expose the encode button:
                                if( !_this.form_rewrite ){
                                        $j(_this.target_btn_save_local_file).show();
                                }
                        }
                        //~otherwise the encoding will be triggered by the form~
 
-                       //do source name update callback:
+                       // Do source name update callback:
                        js_log(" should update: " + _this.target_input_file_name + ' to: ' + _this.fogg.sourceFilename );
                        $j(_this.target_input_file_name).val(_this.fogg.sourceFilename).show();
 
@@ -492,32 +491,32 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                }
        },
        saveLocalFogg:function(){
-          //request target location:
+          // Request target location:
           if(this.fogg){
                   if(!this.fogg.saveVideoAs() )
                           return false;
 
-                  //we have set a target now call the encode:
+                 // We have set a target now call the encode:
                  this.doEncode();
           }
        },
-       //simple auto encoder settings just enable passthough if file is not video or > 480 pixles tall
+       // Simple auto encoder settings just enable passthough if file is not video or > 480 pixles tall
        autoEncoderSettings:function(){
                var _this = this;
-               //grab the extension:
+               // Grab the extension:
                var sf = _this.fogg.sourceFilename;
                var ext = '';
                if(     sf.lastIndexOf('.') != -1)
                        ext = sf.substring( sf.lastIndexOf('.')+1 ).toLowerCase();              
 
-               //set to passthrough to true by default (images, arbitrary files that we want to send with http chunks)
+               // Set to passthrough to true by default (images, arbitrary files that we want to send with http chunks)
                this.encoder_settings['passthrough'] = true;
 
-               //see if we have video or audio:
+               // See if we have video or audio:
                if(  _this.isSourceAudio() || _this.isSourceVideo() )
                         _this.encoder_settings['passthrough'] = false;         
 
-               //special case see if we already have ogg video:
+               // Special case see if we already have ogg video:
                if( _this.isOggFormat() )
                        _this.encoder_settings['passthrough'] = true;
                
@@ -538,22 +537,22 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        },
        getProgressTitle:function(){
                js_log("fogg:getProgressTitle f:" + this.fogg_enabled  + ' rw:' + this.form_rewrite);
-               //return the parent if we don't have fogg turned on:
+               // Return the parent if we don't have fogg turned on:
                if(! this.fogg_enabled || !this.firefogg_form_action )
                        return this.pe_getProgressTitle();
                if( !this.form_rewrite )
                  return gM('fogg-transcoding');
-               //else return our upload+transcode msg:
+               // Else return our upload+transcode msg:
                return gM('mwe-upload-transcode-in-progress');
        },
        doUploadSwitch:function(){
                var _this = this;               
                js_log("firefogg: doUploadSwitch:: " + this.fogg_enabled + ' up mode:' +  _this.upload_mode);
-               //make sure firefogg is enabled otherwise do parent UploadSwich:
+               // Make sure firefogg is enabled otherwise do parent UploadSwich:
                if( !this.fogg_enabled || !this.firefogg_form_action )
                        return _this.pe_doUploadSwitch();
 
-               //check what mode to use firefogg in:
+               // Check what mode to use firefogg in:
                if( _this.upload_mode == 'post' ){
                        _this.doEncode();
                }else if( _this.upload_mode == 'api' ){ //if api mode and chunks supported do chunkUpload
@@ -562,16 +561,17 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
                }
        },
-       //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready
+       /**
+       * doChunkUpload
+       * does both uploading and encoding at the same time and uploads one meg chunks
+       */
        doChunkUpload : function(){
                js_log('firefogg::doChunkUpload');
                var _this = this;
                _this.action_done = false;
                
-               //extension should already be ogg but since its user editable,
-               //check again
-               //we are transcoding so we know it will be an ogg
-               //(should not be done for passthrough mode)
+               // File extension should already be ogg but since its user editable,
+               // (should not be needed for passthrough mode)
                var sf = _this.formData['filename'];
                var ext = '';
                if(     sf.lastIndexOf('.') != -1){
@@ -581,9 +581,9 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        var extreg = new RegExp(ext + '$', 'i');
                        _this.formData['filename'] = sf.replace(extreg, '.ogg');
                }
-               //add chunk response hook to build the resultURL when uploading chunks
+               // Add chunk response hook to build the resultURL when uploading chunks
 
-               //check for editToken:
+               // Check for editToken:
                if(!this.etoken){
                        js_log('missing token try ' + _this.formData['token']);
                        if( _this.formData['token']){
@@ -611,7 +611,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        doChunkWithFormData:function(){
                var _this = this;
                js_log("firefogg::doChunkWithFormData"  + _this.etoken);
-               //build the api url:
+               // Build the api url:
                var aReq ={
                        'action': 'upload',
                        'format': 'json',
@@ -633,10 +633,10 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                js_log('foggEncode: '+ JSON.stringify( _this.encoder_settings ) );
                _this.fogg.upload( JSON.stringify( _this.encoder_settings ),  _this.api_url ,  JSON.stringify( aReq ) );
 
-               //update upload status:
+               // Update upload status:
                _this.doUploadStatus();
        },
-       //doEncode and monitor progress:
+       // doEncode and monitor progress:
        doEncode : function(){
                var _this = this;
                _this.action_done = false;
@@ -644,10 +644,10 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                js_log('doEncode: with: ' +  JSON.stringify( _this.encoder_settings ) );
                _this.fogg.encode( JSON.stringify( _this.encoder_settings ) );
 
-                //show transcode status:
+                // Show transcode status:
                $j('#up-status-state').html( gM('mwe-upload-transcoded-status') );
 
-               //setup a local function for timed callback:
+               // Setup a local function for timed callback:
                var encodingStatus = function() {
                        var status = _this.fogg.status();
 
@@ -655,10 +655,10 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                _this.doRenderPreview();
                        }
 
-                       //update progress bar
+                       // Update progress bar
                        _this.updateProgress( _this.fogg.progress() );
 
-                       //loop to get new status if still encoding
+                       // Loop to get new status if still encoding
                        if( _this.fogg.state == 'encoding' ) {
                                setTimeout(encodingStatus, 500);
                        }else if ( _this.fogg.state == 'encoding done' ) { //encoding done, state can also be 'encoding failed
@@ -674,7 +674,8 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                var _this = this;
                js_log('::encodeDone::');
                _this.action_done = true;
-               //send to the post url:
+               
+               // Send to the post url:
                if( _this.form_rewrite && _this.upload_mode == 'post' ){
                        js_log('done with encoding do POST upload:' + _this.editForm.action);
                        // ignore warnings & set source type
@@ -685,16 +686,16 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        delete _this.formData[ 'file' ];
 
                        _this.fogg.post( _this.editForm.action, 'wpUploadFile', JSON.stringify( _this.formData ) );
-                       //update upload status:
+                       // Update upload status:
                        _this.doUploadStatus();
                }else{
                        js_log("done with encoding (no upload) ");                                              
-                       //set stuats to 100% for one second:
+                       // Set status to 100% for one second:
                        _this.updateProgress( 1 );                      
                        setTimeout(function(){
                                _this.updateProgressWin(gM('fogg-encoding-done'),       
                                        gM('fogg-encoding-done') + '<br>' +                             
-                                       //show the video at full resolution upto 720px wide
+                                       // Show the video at full resolution up-to 720px wide
                                        '<video controls="true" style="margin:auto" id="fogg_final_vid" src="' + 
                                                 _this.fogg.previewUrl + '"></video>'                                   
                                );
@@ -709,12 +710,12 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                                var vW = v.videoWidth;
                                                var vH = v.videoHeight;                                                                                         
                                        }
-                                       //reize the video:
+                                       // Resize the video:
                                        $j(v).css({
                                                'width' : vW,
                                                'height': vH                                    
                                        });
-                                       //if large video resize the dialog box:
+                                       // If large video resize the dialog box:
                                        if( vW + 5 > 400){ 
                                                //also resize the dialog box
                                                $j('#upProgressDialog').dialog('option', 'width', vW + 20);     
@@ -735,9 +736,9 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                $j( '#up-status-state' ).html( gM('mwe-uploaded-status')  );
 
                _this.oldResponseText = '';
-               //setup a local function for timed callback:
+               // Setup a local function for timed callback:
                var uploadStatus = function(){
-                       //get the response text:
+                       // Get the response text:
                        var response_text =  _this.fogg.responseText;
                        if(!response_text){
                                   try{
@@ -751,7 +752,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        if( _this.oldResponseText != response_text){
                                js_log('new result text:' + response_text + ' state:' + _this.fogg.state);
                                _this.oldResponseText = response_text;
-                               //try and parse the response text and check for errors
+                               // Try and parse the response text and check for errors
                                try{
                                        var apiResult = JSON.parse( response_text );
                                }catch(e){
@@ -763,7 +764,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                        }                                       
                                }
                                if(apiResult && _this.apiUpdateErrorCheck( apiResult ) === false){
-                                       //stop status update we have an error
+                                       // Stop status update we have an error
                                        _this.action_done = true;
                                        _this.fogg.cancel();
                                        return false;
@@ -775,17 +776,17 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                }
                        }
                        
-                       //update progress bar
+                       // Update progress bar
                        _this.updateProgress( _this.fogg.progress() );
 
-                       //loop to get new status if still uploading (could also be encoding if we are in chunk upload mode)
+                       // Loop to get new status if still uploading (could also be encoding if we are in chunk upload mode)
                        if( _this.fogg.state == 'encoding' || _this.fogg.state == 'uploading') {
                                setTimeout(uploadStatus, 100);
-                       }//check upload state
+                       }// Check upload state
                        else if( _this.fogg.state == 'upload done' ||
                                                 _this.fogg.state == 'done' ||
                                                 _this.fogg.state == 'encoding done' ) {
-                                  //if in "post" upload mode read the html response (should be depricated):
+                                  // If in "post" upload mode read the html response (should be deprecated):
                                   if( _this.upload_mode == 'api' ){
                                           if( apiResult && apiResult.resultUrl ){
                                                        var buttons ={};
@@ -794,28 +795,28 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                                        }
                                                        var go_to_url_txt = gM('mwe-go-to-resource');
                                                        if( typeof _this.done_upload_cb == 'function' ){
-                                                               //if done action return 'true'
+                                                               // If done action return 'true'
                                                                if( _this.done_upload_cb( _this.formData ) ){
-                                                                       //update status
+                                                                       // Update status
                                                                        _this.updateProgressWin( gM('mwe-successfulupload'),  gM( 'mwe-upload_done', apiResult.resultUrl),buttons);
                                                                }else{
-                                                                       //if done action returns 'false' //close progress window
+                                                                       // If done action returns 'false' //close progress window
                                                                        this.action_done = true;
                                                                $j('#upProgressDialog').empty().dialog('close');
                                                                }
                                                        }else{
-                                                               //update status (without done_upload_cb)
+                                                               // Update status (without done_upload_cb)
                                                                _this.updateProgressWin( gM('mwe-successfulupload'),  gM( 'mwe-upload_done', apiResult.resultUrl),buttons);
                                                        }
                                           }else{
-                                                  //done state with error? ..not really possible given how firefogg works
+                                                  // Done state with error? ..not really possible given how firefogg works
                                                   js_log(" Upload done in chunks mode, but no resultUrl!");
                                           }
                                   }else{
                                           js_log("Error:: not supported upload mode" +  _this.upload_mode);
                                   }
                        }else{
-                               //upload error:
+                               // Upload error:
                                js_log('Error:firefogg upload error: ' + _this.fogg.state );
                   }
           }
@@ -835,7 +836,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        $j(dlElm).empty().dialog('close');                     
                    }
                }
-               //dont' follow the link:
+               // Dont' follow the link:
                return false;
        }
 };
index 22c9167..cdcee2f 100644 (file)
@@ -1,11 +1,7 @@
 /*
- * a library for doing remote media searches
- *
- * initial targeted archives are:
-       the local wiki
-       wikimedia commons
-       metavid
-       and archive.org
+ * remoteSearchDriver
+ * Provides a base interface for the Add-Media-Wizard 
+ * supporting remote searching of http archives for free images/audio/video assets
  */
 
 loadGM({
@@ -54,7 +50,22 @@ loadGM({
        "mwe-ftype-png" : "PNG image file",
        "mwe-ftype-oga" : "Ogg audio file",
        "mwe-ftype-ogg" : "Ogg video file",
-       "mwe-ftype-unk" : "Unknown file format"
+       "mwe-ftype-unk" : "Unknown file format",
+       
+       "rsd-wiki_commons-title": "Wikimedia Commons",
+       "rsd-wiki_commons": "Wikimedia Commons, an archive of freely-licensed educational media content (images, sound and video clips)",
+       
+       "rsd-this_wiki-title" : "This Wiki",
+       "rsd-this_wiki-desc" : "The local wiki install",
+       
+       "rsd-archive_org-title": "Archive.org",
+       "rsd-archive_org-desc" : "The Internet Archive, a digital library of cultural artifacts",
+       
+       "rsd-flickr-title" : "Flickr.com",
+       "rsd-flickr-desc" : "Flickr.com, a online photo sharing site",
+       "rsd-metavid-title" : "Meavid.org",
+       "rsd-metavid-desc" : "Metavid a community archive of US House and Senate floor proceedings"
+       
 });
 
 var default_remote_search_options = {
@@ -68,12 +79,12 @@ var default_remote_search_options = {
        'caret_pos':null,
        'local_wiki_api_url':null,
 
-       //can be 'api', 'autodetect', 'remote_link'
+       // Can be 'api', 'autodetect', 'remote_link'
        'import_url_mode': 'api',
 
        'target_title':null,
        
-       //edit tools (can be an array of tools or keyword 'all')
+       // Edit tools (can be an array of tools or keyword 'all')
        'enabled_tools' : 'all',
        
 
@@ -81,7 +92,8 @@ var default_remote_search_options = {
        'target_render_area': null, //where output render should go:
        'instance_name': null, //a globally accessible callback instance name
        'default_query':null, //default search query
-       //specific to sequence profile
+       
+       //Specific to sequence profile
        'p_seq':null,
        'cFileNS':'File', //What is the canonical namespace prefix for images
                                          //@@todo (should get that from the api or in-page vars)
@@ -103,7 +115,7 @@ if(typeof stylepath == 'undefined')
        stylepath = '';
 
 /*
- *     base remoteSearch Driver interface
+ *     Base remoteSearch Driver interface
  */
 var remoteSearchDriver = function(iObj){
        return this.init( iObj );
@@ -132,10 +144,10 @@ remoteSearchDriver.prototype = {
                 *
 
                        @enabled: whether the search provider can be selected
-                       @checked: whether the search provider will show up as seleatable tab (todo: user preference)
+                       @checked: whether the search provider will show up as selectable tab
                        @d:        default: if the current cp should be displayed (only one should be the default)
                        @title:   the title of the search provider
-                       @desc:     can use html... todo: need to localize
+                       @desc:     can use html
                        @api_url: the url to query against given the library type:
                        @lib:      the search library to use corresponding to the
                                                search object ie: 'mediaWiki' = new mediaWikiSearchSearch()
@@ -150,22 +162,18 @@ remoteSearchDriver.prototype = {
                        @local_domains : sets of domains for which the content is local
                        //@@todo should query wgForeignFileRepos setting maybe interwikimap from the api
                 */
+               
                'this_wiki':{
                        'enabled': 1,
-                       'checked': 1,
-                       'title'  : 'This Wiki',
-                       'desc'   : '(should be updated with the proper text) maybe import from some config value',
+                       'checked': 1,                   
                        'api_url':  ( wgServer && wgScriptPath )? wgServer + wgScriptPath+ '/api.php': null,
                        'lib'    : 'mediaWiki',
                        'local'  : true,
                        'tab_img': false
-               },
+               },              
                'wiki_commons':{
                        'enabled': 1,
-                       'checked': 1,
-                       'title'  :'Wikimedia Commons',
-                       'desc'   : 'Wikimedia Commons is a media file repository making available public domain '+
-                                        'and freely-licensed educational media content (images, sound and video clips) to all.',
+                       'checked': 1,                   
                        'homepage': 'http://commons.wikimedia.org/wiki/Main_Page',
                        'api_url':'http://commons.wikimedia.org/w/api.php',
                        'lib'   :'mediaWiki',
@@ -184,9 +192,7 @@ remoteSearchDriver.prototype = {
                },
                'archive_org':{
                        'enabled':1,
-                       'checked':1,
-                       'title' : 'Archive.org',
-                       'desc'  : 'The Internet Archive, a digital library of cultural artifacts',
+                       'checked':1,                    
                        'homepage':'http://www.archive.org/about/about.php',
 
                        'api_url':'http://homeserver7.us.archive.org:8983/solr/select',
@@ -197,24 +203,20 @@ remoteSearchDriver.prototype = {
                },
                'flickr':{
                        'enabled':1,
-                       'checked':1,
-                       'title' : 'flickr.com',
-                       'desc'  : 'flickr.com, a online photo sharing site',
+                       'checked':1,            
                        'homepage':'http://www.flickr.com/about/',
 
                        'api_url':'http://www.flickr.com/services/rest/',
                        'lib'   : 'flickr',
                        'local' : false,
-                       //resources from fliker don't have a human parsable identieifer/title
+                       //resources from fliker don't have a human parsable identifier/title
                        'resource_prefix': '',
                        'tab_img':true
-               },
+               },                              
                'metavid':{
                        'enabled' : 1,
                        'checked' : 1,
-                       'title' : 'Metavid.org',
                        'homepage':'http://metavid.org/wiki/Metavid_Overview',
-                       'desc'  : 'Metavid hosts thousands of hours of US house and senate floor proceedings',
                        'api_url':'http://metavid.org/w/index.php?title=Special:MvExportSearch',
                        'lib'   : 'metavid',
                        'local' :false,                 //if local set to true we can use local
@@ -877,9 +879,9 @@ remoteSearchDriver.prototype = {
                                                o+='<li class="rsd_cp_tab">';
                                                o+='<a id="rsd_tab_' + cp_id + '" href="#tab-' + cp_id + '">';
                                                        if(cp.tab_img === true){
-                                                               o+='<img alt="' + cp.title +'" src="' + mv_embed_path +'/skins/common/remote_cp/' + cp_id + '_tab.png">';
+                                                               o+='<img alt="' + gM('rsd-' + cp_id + '-title' ) +'" src="' + mv_embed_path +'/skins/common/remote_cp/' + cp_id + '_tab.png">';
                                                        }else{
-                                                               o+= cp.title;
+                                                               o+= gM('rsd-' + cp_id + '-title' );
                                                        }
                                                o+='</a>';
                                                o+='</li>';
@@ -888,7 +890,7 @@ remoteSearchDriver.prototype = {
                                        tabc+='<div id="tab-'+ cp_id +'" class="rsd_results"/>';
 
                        }
-                       //do an upload tab if enabled:
+                       // Do an upload tab if enabled:
                        if( this.content_providers['upload'].enabled ){
                                o+='<li class="rsd_cp_tab" ><a id="rsd_tab_upload" href="#tab-upload">' + gM('mwe-upload_tab') + '</a></li>';
                                tabc+='<div id="tab-upload" />';
@@ -896,25 +898,25 @@ remoteSearchDriver.prototype = {
                                        selected_tab = inx++;
                        }
                        o+='</ul>';
-                       //output the tab content containers:
+                       // Output the tab content containers:
                        o+=tabc;
                o+='</div>'; //close tab container
 
-               //output the respective results holders
+               // Output the respective results holders
                $j('#rsd_results_container').html(o);
-               //setup bindings for tabs make them sortable: (@@todo remember order)
+               // Setup bindings for tabs make them sortable: (@@todo remember order)
                js_log('selected tab is: ' + selected_tab);
                $j("#rsd_tabs_container").tabs({
                        selected:selected_tab,
                        select: function(event, ui) {
                                _this.selectTab( $j(ui.tab).attr('id').replace('rsd_tab_', '') );
                        }
-               //add sorting
+               // Add sorting
                }).find(".ui-tabs-nav").sortable({axis:'x'});
                //@@todo store sorted repo 
 
        },
-       //resource title
+       // Resource title
        getResourceFromTitle : function( rTitle , callback){
                var _this = this;
                reqObj={
@@ -964,9 +966,9 @@ remoteSearchDriver.prototype = {
                }else{
                        var cp = this.content_providers[this.disp_item];
                        tab_target = '#tab-' + cp_id;
-                       //output the results bar / controls                     
+                       // Output the results bar / controls                    
                }                       
-               //empty the existing results:
+               // Empty the existing results:
                $j(tab_target).empty();
                //@@todo give the user upload control love 
                if(this.disp_item != 'upload'){
@@ -975,34 +977,34 @@ remoteSearchDriver.prototype = {
                
                var drawResultCount     = 0;
 
-               //output all the results for the current disp_item
+               // Output all the results for the current disp_item
                if( typeof cp['sObj'] != 'undefined' ){                 
                        $j.each(cp.sObj.resultsObj, function(rInx, rItem){
                                if( _this.result_display_mode == 'box' ){
                                        o+='<div id="mv_result_' + rInx + '" class="mv_clip_box_result" style="width:' +
                                                        _this.thumb_width + 'px;height:'+ (_this.thumb_width-20) +'px;position:relative;">';
-                                               //check for missing poster types for audio
+                                               // Check for missing poster types for audio
                                                if( rItem.mime=='audio/ogg' && !rItem.poster ){
                                                        rItem.poster = mv_skin_img_path + 'sound_music_icon-80.png';
                                                }
-                                               //get a thumb with proper resolution transform if possible:
+                                               // Get a thumb with proper resolution transform if possible:
                                                o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '__' + rInx +
                                                                '" style="width:' + _this.thumb_width + 'px;" src="' +
                                                                cp.sObj.getImageTransform( rItem, { 'width' : _this.thumb_width } )
                                                                + '">';
-                                               //add a linkback to resource page in upper right:
+                                               // Add a linkback to resource page in upper right:
                                                if( rItem.link )
                                                        o+='<div class="rsd_linkback ui-corner-all ui-state-default ui-widget-content" >' +                                                             
                                                                        '<a target="_new" title="' + gM('mwe-resource_description_page') +
                                                                        '" href="' + rItem.link + '">'+ gM('mwe-link') + '</a>' + 
                                                                '</div>';
                                                                
-                                               //add file type icon if known
+                                               // Add file type icon if known
                                                if( rItem.mime ){
                                                        o+= _this.getTypeIcon( rItem.mime );
                                                }               
                                                                
-                                               //add license icons if present
+                                               // Add license icons if present
                                                if( rItem.license )
                                                        o+= _this.getlicenseImgSet( rItem.license );
                                                                                                        
@@ -1013,7 +1015,7 @@ remoteSearchDriver.prototype = {
                                                                 _this.thumb_width + 'px;" src="' +
                                                                 cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } )
                                                                  + '">';
-                                               //add license icons if present
+                                               // Add license icons if present
                                                if( rItem.license )
                                                        o+= _this.getlicenseImgSet( rItem.license );
 
@@ -1024,13 +1026,13 @@ remoteSearchDriver.prototype = {
                                drawResultCount++;
                        });
                        js_log('append to: ' + '#tab-' + cp_id);
-                       //put in the tab output (plus clear the output)
+                       // Put in the tab output (plus clear the output)
                        $j(tab_target).append( o + '<div style="clear:both"/>');
                }
 
                js_log( 'did drawResultCount :: ' + drawResultCount + ' append: ' + $j('#rsd_q').val() );
 
-               //remove any old search res
+               // Remove any old search res
                $j('#rsd_no_search_res').remove();
                if( drawResultCount == 0 )
                        $j('#tab-' + cp_id).append( '<span style="padding:10px">' + gM( 'rsd_no_results', $j('#rsd_q').val() ) + '</span>');
@@ -1041,7 +1043,7 @@ remoteSearchDriver.prototype = {
                var _this = this;
                $j('.mv_clip_'+_this.result_display_mode+'_result').hover(function(){
                        $j(this).addClass('mv_clip_'+_this.result_display_mode+'_result_over');
-                       //also set the animated image if available
+                       // Also set the animated image if available
                        var res_id = $j(this).children('.rsd_res_item').attr('id');
                        var rObj = _this.getResourceFromId( res_id );
                        if( rObj.poster_ani )
@@ -1050,11 +1052,11 @@ remoteSearchDriver.prototype = {
                        $j(this).removeClass('mv_clip_'+_this.result_display_mode+'_result_over');
                        var res_id = $j(this).children('.rsd_res_item').attr('id');
                        var rObj = _this.getResourceFromId( res_id );
-                       //restore the original (non animated)
+                       // Restore the original (non animated)
                        if( rObj.poster_ani )
                                $j('#' + res_id ).attr('src', rObj.poster);
                });
-               //resource click action: (bring up the resource editor)
+               // Resource click action: (bring up the resource editor)
                $j('.rsd_res_item').unbind().click(function(){
                        var rObj = _this.getResourceFromId( $j(this).attr("id") );
                        _this.resourceEdit( rObj, this );
@@ -1064,9 +1066,9 @@ remoteSearchDriver.prototype = {
                var _this = this;
                if(!maxWidth)maxWidth=400;
                if(!overflow_style)overflow_style='overflow:auto;';
-               //remove any old instance:
+               // Remove any old instance:
                $j( _this.target_container ).find('#rsd_resource_edit').remove();
-               //add the edit layout window with loading place holders
+               // Add the edit layout window with loading place holders
                $j( _this.target_container ).append('<div id="rsd_resource_edit" '+
                        'style="position:absolute;top:0px;left:0px;bottom:0px;right:4px;background-color:#FFF;">' +
                                '<div id="clip_edit_ctrl" class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;'+
@@ -1082,24 +1084,24 @@ remoteSearchDriver.prototype = {
        resourceEdit:function( rObj, rsdElement){
                js_log('f:resourceEdit:' + rObj.title);
                var _this = this;
-               //remove any existing resource edit interface:
+               // Remove any existing resource edit interface:
                $j('#rsd_resource_edit').remove();
                //set the media type:
                if(rObj.mime.indexOf('image')!=-1){
-                       //set width to default image_edit_width
+                       // Set width to default image_edit_width
                        var maxWidth = _this.image_edit_width;
                        var mediaType = 'image';
                }else if(rObj.mime.indexOf('audio')!=-1){
                        var maxWidth = _this.video_edit_width;
                        var mediaType = 'audio';
                }else{
-                       //set to default video size:
+                       // Set to default video size:
                        var maxWidth = _this.video_edit_width;
                        var mediaType = 'video';
                }
-               //so that transcripts show ontop
+               // So that transcripts show ontop
                var overflow_style = ( mediaType =='video' )?'':'overflow:auto;';
-               //append to the top level of model window:
+               // Append to the top level of model window:
                _this.addResourceEditLoader(maxWidth, overflow_style);
                //update add media wizard title:
                $j( _this.target_container ).dialog( 'option', 'title', gM('mwe-add_media_wizard')+': '+ gM('rsd_resource_edit', rObj.title ) );
@@ -1109,7 +1111,7 @@ remoteSearchDriver.prototype = {
 
                $j('#rsd_edit_img').remove();//remove any existing rsd_edit_img
 
-               //left side holds the image right size the controls /
+               // Left side holds the image right size the controls /
                $j(rsdElement).clone().attr('id', 'rsd_edit_img').appendTo('#clip_edit_disp').css({
                        'position':'absolute',
                        'top':'40%',
@@ -1118,14 +1120,14 @@ remoteSearchDriver.prototype = {
                        'opacity':0
                });
                
-               //try and keep aspect ratio for the thumbnail that we clicked:          
+               // Try and keep aspect ratio for the thumbnail that we clicked:         
                var tRatio = $j(rsdElement).height() / $j(rsdElement).width();
 
                if(     ! tRatio )
                        var tRatio = 1; //set ratio to 1 if tRatio did not work. 
 
                js_log('Set from ' +  tRatio + ' to init thumbimage to ' + maxWidth + ' x ' + parseInt( tRatio * maxWidth) );
-               //scale up image and to swap with high res version
+               // Scale up image and to swap with high res version
                $j('#rsd_edit_img').animate({
                        'opacity':1,
                        'top':'5px',
@@ -1139,13 +1141,13 @@ remoteSearchDriver.prototype = {
                                $j('.mv_loading_img').remove();
                        });
                }
-               //also fade in the container:
+               // Also fade in the container:
                $j('#rsd_resource_edit').animate({
                        'opacity':1,
                        'background-color':'#FFF',
                        'z-index':99
                });
-               //do load the media Editor
+               // Do load the media Editor
                _this.doMediaEdit( rObj , mediaType );
        },
        loadHQImg:function(rObj, size, target_img_id, callback){
@@ -1161,7 +1163,7 @@ remoteSearchDriver.prototype = {
                        // See if we need to animate some transition
                        if( size.width != imObj.width ){
                                js_log('loadHQImg:size mismatch: ' + size.width + ' != ' + imObj.width );
-                               //set the target id to the new size:
+                               // Set the target id to the new size:
                                $j('#'+target_img_id).animate( {
                                        'width':imObj.width + 'px',
                                        'height':imObj.height + 'px'
@@ -1170,12 +1172,12 @@ remoteSearchDriver.prototype = {
                                js_log('using req size: ' + imObj.width + 'x' + imObj.height);
                                $j('#'+target_img_id).animate( {'width':imObj.width+'px', 'height' : imObj.height + 'px'});
                        }
-                       //don't swap it in until its loaded:
+                       // Don't swap it in until its loaded:
                        var img = new Image();
-                       // load the image image:
+                       // Load the image image:
                        $j(img).load(function () {
                                         $j('#'+target_img_id).attr('src', rObj.edit_url );
-                                        //let the caller know we are done and what size we ended up with:
+                                        // Let the caller know we are done and what size we ended up with:
                                         callback();
                                }).error(function () {
                                        js_log("Error with:  " +  rObj.edit_url);
@@ -1187,15 +1189,15 @@ remoteSearchDriver.prototype = {
                js_log('cancelClipEditCB');
                var b_target =   _this.target_container + '~ .ui-dialog-buttonpane';
                $j('#rsd_resource_edit').remove();
-               //remove preview if its 'on'
+               // Remove preview if its 'on'
                $j('#rsd_preview_display').remove();
-               //restore the resource container:
+               // Restore the resource container:
                $j('#rsd_results_container').show();
                
-               //restore the title:
+               // Restore the title:
                $j( _this.target_container ).dialog( 'option', 'title', gM('mwe-add_media_wizard'));
                js_log("should update: " + b_target + ' with: cancel');
-               //restore the buttons:          
+               // Restore the buttons:         
                $j(b_target).html( $j.btnHtml( gM('mwe-cancel') , 'mv_cancel_rsd', 'close'))
                        .children('.mv_cancel_rsd')
                        .btnBind()
@@ -1204,7 +1206,9 @@ remoteSearchDriver.prototype = {
                        })
 
        },
-       /*set-up the control actions for clipEdit with relevant callbacks */
+       /* getClipEditControlActions
+       * Set-up the control actions for clipEdit with relevant callbacks 
+       */
        getClipEditControlActions:function( cp ){
                var _this = this;
                var cConf= {};
@@ -1212,7 +1216,7 @@ remoteSearchDriver.prototype = {
                cConf['insert'] = function(rObj){
                        _this.insertResource(rObj);
                }
-               //if not directly inserting the resource is support a preview option:
+               // If not directly inserting the resource is support a preview option:
                if( _this.import_url_mode != 'remote_link'){
                        cConf['preview'] = function(rObj){
                                _this.previewResource( rObj )
@@ -1223,7 +1227,7 @@ remoteSearchDriver.prototype = {
                }
                return cConf;
        },
-       //loads the media editor:
+       // Loads the media editor:
        doMediaEdit:function( rObj , mediaType){
                var _this = this;
                var cp = rObj.pSobj.cp;
@@ -1239,29 +1243,29 @@ remoteSearchDriver.prototype = {
                        'controlActionsCb'      : _this.getClipEditControlActions( cp ),
                        'enabled_tools'         : _this.enabled_tools
                };
-               //set the base clip edit lib class req set:
+               // Set the base clip edit lib class req set:
                var clibs = ['mvClipEdit'];
                
                if( mediaType == 'image'){
-                       //display the mvClipEdit obj once we are done loading:
+                       // Display the mvClipEdit obj once we are done loading:
                        mvJsLoader.doLoad( clibs, function(){
-                               //run the image clip tools
+                               // Run the image clip tools
                                _this.cEdit = new mvClipEdit( mvClipInit );
                        });
                }else if( mediaType == 'video' || mediaType == 'audio'){
                        js_log('media type:: ' + mediaType);
-                       //get any additional embedding helper meta data prior to doing the actual embed
+                       // Get any additional embedding helper meta data prior to doing the actual embed
                        // normally this meta should be provided in the search result (but archive.org has another query for more media meta)
                        rObj.pSobj.getEmbedTimeMeta( rObj, function(){
-                               //make sure we have the embedVideo libs:
+                               // Make sure we have the embedVideo libs:
                                var runFlag = false;
                                mvJsLoader.embedVideoCheck( function(){
-                                       //strange concurency issue with callbacks 
+                                       // Strange concurrency issue with callbacks 
                                        //@@todo try and figure out why this callback is fired twice
                                        if(!runFlag){
                                                runFlag = true;
                                        }else{
-                                               js_log('only run embed vid once');
+                                               js_log('Error: embedVideoCheck run twice');
                                                return false;
                                        }
                                        js_log('append html: ' + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) );
@@ -1271,17 +1275,17 @@ remoteSearchDriver.prototype = {
                                                })
                                        );
                                        js_log("about to call rewrite_by_id::embed_vid");                                       
-                                       //rewrite by id
+                                       // Rewrite by id
                                        rewrite_by_id('embed_vid', function(){
-                                               //grab any information that we got from the ROE xml or parsed from the media file
+                                               // Grab any information that we got from the ROE xml or parsed from the media file
                                                rObj.pSobj.getEmbedObjParsedInfo( rObj, 'embed_vid' );
-                                               //add the re-sizable to the doLoad request:
+                                               // Add the re-sizable to the doLoad request:
                                                clibs.push( '$j.ui.resizable');
                                                clibs.push( '$j.fn.hoverIntent');                                               
                                                mvJsLoader.doLoad(clibs, function(){
-                                                       //make sure the rsd_edit_img is hidden:
+                                                       // Make sure the rsd_edit_img is hidden:
                                                        $j('#rsd_edit_img').remove();
-                                                       //run the image clip tools
+                                                       // Run the image clip tools
                                                        _this.cEdit = new mvClipEdit( mvClipInit );
                                                });
                                        });
@@ -1293,7 +1297,7 @@ remoteSearchDriver.prototype = {
                if( cp.local ){
                        return true;
                }else{
-                       //check if we can embed the content locally per a domain name check:
+                       // Check if we can embed the content locally per a domain name check:
                        var local_host = parseUri( this.local_wiki_api_url ).host;
                        if( cp.local_domains ) {
                                for(var i=0;i < cp.local_domains.length; i++){
@@ -1307,9 +1311,9 @@ remoteSearchDriver.prototype = {
        },
        checkImportResource:function( rObj, cir_callback){
                var _this = this;               
-               //add a loader ontop:
+               // Add a loader ontop:
                $j.addLoaderDialog( gM('mwe-checking-resource') );              
-               //extend the callback with close dialog
+               // Extend the callback with close dialog
                var org_cir_callback = cir_callback;
                cir_callback = function( rObj ){
                        var cat = org_cir_callback;                     
@@ -1322,17 +1326,17 @@ remoteSearchDriver.prototype = {
                var cp = rObj.pSobj.cp;
                var _this = this;
 
-               //update base target_resource_title:
+               // Update base target_resource_title:
                rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,'')
 
                //check if local repository
                //or if import mode if just "linking" (we should already have the 'url'
 
                if( this.checkRepoLocal( cp ) || this.import_url_mode == 'remote_link'){                
-                       //local repo jump directly to check Import Resource callback:
+                       // Local repo jump directly to check Import Resource callback:
                         cir_callback( rObj );
                }else{                                          
-                       //check if the file is local (can be shared repo)  
+                       // Check if the file is local (can be shared repo)  
                        if( cp.check_shared ){                  
                                _this.checkForFile(rObj.target_resource_title, function(imagePage){                             
                                        if( imagePage && imagePage['imagerepository'] == 'shared' ){                                            
@@ -1727,7 +1731,7 @@ remoteSearchDriver.prototype = {
                if( this.content_providers[this.disp_item] ){
                        var cp = this.content_providers[this.disp_item];
                        about_desc ='<span style="position:relative;top:0px;font-style:italic;">' +
-                                       '<i>' + gM('mwe-results_from', [cp.homepage, cp.title]) + '</i></span>';
+                                       '<i>' + gM('mwe-results_from', [cp.homepage, gM('rsd-' + this.disp_item + '-title' ) ]) + '</i></span>';
                        $j('#tab-'+this.disp_item).append( '<div id="rds_results_bar">'+
                                '<span style="float:left;top:0px;font-style:italic;">'+
                                        gM('rsd_layout')+' '+
index c591383..f1aabad 100644 (file)
@@ -25,140 +25,126 @@ js2AddOnloadHook( function() {
       return srtData;
   }
   function getVideoTitle() {
-    var videoTitle = wgPageName.split('.');
+    var videoTitle = wgTitle.split('.');
     videoTitle.pop();
     videoTitle.pop();
     videoTitle = videoTitle.join('.').replace('TimedText:', 'File:');
     return videoTitle;
   }
-
-  var availableSubtitles = {};
-  var langData = {};
-
-  function addLanguageSelect(ttoolbar) {
-    var apprefix = wgPageName.split('.');
-    apprefix.pop();
-    var currentLanguage = apprefix.pop();
-    apprefix = apprefix.join('.');
+  function uploadSubtitles() {
     do_api_req({
       'data': {
         'meta' : 'siteinfo',
         'siprop' : 'languages'
       }
-    }, function( langDataRaw ) {
-      var lagRaw = langDataRaw.query.languages;
-      for(var j in lagRaw){
-        var code = lagRaw[j].code;
-        var language = lagRaw[j]['*'];
-        langData[ code ] = language;
-      }
-      do_api_req({
-               'data': {
-                                       'list' : 'allpages',
-                       'apprefix' : apprefix.replace("TimedText:", ""),
-                                       'apnamespace' : 102
-               }
-      }, function( subData ) {
-             for(var i in subData.query.allpages){
-                     var subPage = subData.query.allpages[i];
-                     var langKey = subPage.title.split('.');
-                     var extension = langKey.pop();
-                     langKey = langKey.pop();
-                     availableSubtitles[langKey] = subPage.title;
-        }
-        var select = $j('<select>');
-        var haveOtherLanguages = 0;
-        for(var i in availableSubtitles){
-          haveOtherLanguages++;
-          var opt = $j('<option>')
-              .html(langData[ i ] + '('+i+')')
-              .click(function(i) {
-                return function() {
-                  document.location.href = wgArticlePath.replace('/$1', '?title=' + availableSubtitles[i] + '&action=edit');
-                }}(i));
-          if(currentLanguage == i) {
-            opt.attr('selected', 'selcted');
+      }, function( langDataRaw ) {
+        var apprefix = wgTitle.split('.');
+        apprefix.pop();
+        apprefix.pop();
+        apprefix = apprefix.join('.');
+                         do_api_req({
+                                         'data': {
+                                                 'list' : 'allpages',
+                                                 'apprefix' : apprefix
+                                         }
+                         }, function( subData ) {
+                           var availableSubtitles = {};
+                                       for(var i in subData.query.allpages){
+                                               var subPage = subData.query.allpages[i];
+                                               var langKey = subPage.title.split('.');
+                                               var extension = langKey.pop();
+                                               langKey = langKey.pop();
+                                               availableSubtitles[langKey] = subPage.title;
           }
-          select.append(opt);
-        }
-        if (haveOtherLanguages > 1) {
-          ttoolbar.append(" " +gM('mwe-select-other-language')+": ");
-          ttoolbar.append(select);
-        }
-      });
-    });
-  }
+          var langData = {};
+          var languageSelect = '<select id="timed_text_language">';
 
-  function uploadSubtitles() {
-    var languageSelect = '<select id="timed_text_language">';
-    for(code in langData) {
-      var language = langData[ code ];
-      languageSelect += '<option value="'+code+'">';
-      if (availableSubtitles[code]) {
-        languageSelect += language+'('+code+') +';
-      } else {
-        languageSelect += language+'('+code+') -';
-      }
-      languageSelect += '</option>';
-    }
-    languageSelect += '/</select>';
-    var cBtn = {};
-    cBtn[ gM('mwe-cancel') ] = function(){
-      $j(this).dialog('close');
-    }
-    cBtn[ gM('mwe-ok') ] = function(){
-      var file = $j('#timed_text_file_upload');
-      var langKey = file[0].files[0].name.split('.');
-      var extension = langKey.pop();
-      langKey = langKey.pop();
-      var mimeTypes = {
-          'srt': 'text/x-srt',
-          'cmml': 'text/cmml'
-      }
-      if( !mimeTypes[ extension ] ){
-        js_log('Error: unknown extension:'+ extension);
-      }
-      //get language from form
-      langKey = $j('#timed_text_language').val();
-      if(extension == "srt") {
-        var srt = getSubtitle(file[0]);
-        $j(this).html("saving...<br>"+mv_get_loading_img());
-        $j('.ui-dialog-buttonpane').remove();
-        var editToken = $j('input[name=wpEditToken]').val();
-        var title = wgPageName.split('.');
-        title.pop();
-        title.pop();
-        title = title.join('.') + '.' + langKey + '.srt';
-        do_api_req({
-          'data': {
-            'action' : 'edit',
-            'title' : title,
-            'text' : srt,
-            'token': editToken
+          var lagRaw = langDataRaw.query.languages;
+          for(var j in lagRaw){
+            var code = lagRaw[j].code;
+            var language = lagRaw[j]['*'];
+            langData[ code ] = language;
+            languageSelect += '<option value="'+code+'">';
+            if (availableSubtitles[code]) {
+              languageSelect += language+'('+code+') +';
+            } else {
+              languageSelect += language+'('+code+') -';
+            }
+            languageSelect += '</option>';
           }
-        }, function(dialog) {
-            return function( result ) {
-              document.location.href = wgArticlePath.replace('/$1', '?title=' + title + '&action=edit');
-              $j(dialog).dialog('close');
-           }}(this)
-        );
-      } else {
-        $j(this).html(gM("mwe-error-only-srt"));
-      }
-    }
-    $j.addDialog(gM("mwe-add-subs-file-title"),
-       '<input type="file" id="timed_text_file_upload"></input><br />' + languageSelect,
-       cBtn);
-    $j('#timed_text_file_upload').change(function(ev) {
-      var langKey = this.files[0].name.split('.');
-      var extension = langKey.pop();
-      langKey = langKey.pop();
-      $j('#timed_text_language').val( langKey );
+          languageSelect += '/</select>';
+          var cBtn = {};
+          cBtn[ gM('mwe-cancel') ] = function(){
+            $j(this).dialog('close');
+          }
+          cBtn[ gM('mwe-ok') ] = function(){
+               //get language from form
+            langKey = $j('#timed_text_language').val();
+            var title = wgTitle.split('.');
+            title.pop();
+            title.pop();
+            title = title.join('.') + '.' + langKey + '.srt';
+            
+            var file = $j('#timed_text_file_upload');
+            if( file[0].files[0]){
+               //no file to upload just jump to the lang key: 
+               document.location.href = wgArticlePath.replace('/$1', '?title=' + title + '&action=edit');
+               return ;
+            }
+            var langKey = file[0].files[0].name.split('.');
+            var extension = langKey.pop();
+            langKey = langKey.pop();
+            var mimeTypes = {
+                'srt': 'text/x-srt',
+                'cmml': 'text/cmml'
+            }
+            if( !mimeTypes[ extension ] ){
+              js_log('Error: unknown extension:'+ extension);
+            }
+            
+
+            if(extension == "srt") {
+              var srt = getSubtitle(file[0]);
+              $j(this).html("saving...");
+              $j('.ui-dialog-buttonpane').remove();
+
+              var editToken = $j('input[name=wpEditToken]').val();
+            
+              do_api_req({
+                'data': {
+                  'action' : 'edit',
+                  'title' : title,
+                  'text' : srt,
+                  'token': editToken
+                }
+              }, function(dialog) {
+                  return function( result ) {
+                    document.location.href = wgArticlePath.replace('/$1', '?title=' + title + '&action=edit');
+                    $j(dialog).dialog('close');
+                 }}(this)
+              );
+            } else {
+              $j(this).html(gM("mwe-error-only-srt"));
+            }
+          }
+          $j.addDialog(gM("mwe-add-subs-file-title"),
+             '<input type="file" id="timed_text_file_upload"></input><br />' + languageSelect,
+             cBtn);
+          $j('#timed_text_file_upload').change(function(ev) {
+               if( this.files[0] ){
+                   var langKey = this.files[0].name.split('.');
+                   var extension = langKey.pop();
+                   langKey = langKey.pop();
+                   $j('#timed_text_language').val( langKey );
+            }
+          });
+      });
     });
   }
-  $j('#toolbar').hide();
+  var tselect = ($j('#wikiEditor-ui-top').length != 0)?'#wikiEditor-ui-top':'#toolbar';
+  $j(tselect).hide();
   var ttoolbar = $j('<div>');
-  $j('#toolbar').after(ttoolbar);
+  $j(tselect).after(ttoolbar);
 
   var button = $j('<button>');
   button.click(uploadSubtitles)
@@ -170,6 +156,6 @@ js2AddOnloadHook( function() {
   button.click(function() { document.location.href = wgArticlePath.replace('$1', getVideoTitle()); })
   button.text(gM("mwe-watch-video"));
   ttoolbar.append(button);
-  addLanguageSelect(ttoolbar);
+
 });
 
index 4d8255e..ad0998c 100644 (file)
@@ -320,7 +320,7 @@ if( !mv_embed_path ) {
        $.lang.gMsgSwap = function( key , args ){
                if(! gMsg[ key ])
                        return '&lt;' + key + '&gt;';// Missing key placeholder
-               //get the messege string:
+               //get the messeage string:
                var ms = gMsg[ key ];
 
                //replace values
@@ -351,7 +351,7 @@ if( !mv_embed_path ) {
        /**
        * Add Supported Magic Words to parser
        */
-       //set the setupflag to false:
+       // Set the setupflag to false:
        $.lang.doneSetup=false;
        $.lang.magicSetup = function(){
                if(!$.lang.doneSetup){
@@ -522,16 +522,15 @@ if( !mv_embed_path ) {
                // JavaScript does not let you choose the precision when rounding
                var p = Math.pow(10,round);
                var size = Math.round( size * p ) / p;
-               //@@todo we need a formatNum and we need to request some special packaged info to deal with that case.
                return gM( msg , size );
        };
        
        $.lang.formatNumber = function( num ){
                /*
-                       addSeparatorsNF
-               Str: The number to be formatted, as a string or number.         
-               outD: The decimal character for the output, such as ',' for the number 100,2
-               sep: The separator character for the output, such as ',' for the number 1,000.2
+               *       addSeparatorsNF
+               * @param Str: The number to be formatted, as a string or number.                
+               * @param outD: The decimal character for the output, such as ',' for the number 100,2
+               * @param sep: The separator character for the output, such as ',' for the number 1,000.2
                */ 
                function addSeparatorsNF(nStr, outD, sep){
                        nStr += '';
@@ -568,9 +567,7 @@ if( !mv_embed_path ) {
        /**
         * parser addMagic
         *
-        * lets you add a set of magic keys and associated callback functions
-        * callback: @param ( Object Template )
-        * callback: @return the transformed template output
+        * Lets you add a set of magic keys and associated callback functions
         *
         * @param object magicSet key:callback
         */
@@ -603,7 +600,7 @@ if( !mv_embed_path ) {
                                 */
 
                                // ~ probably a better algorithm out there / should mirror php parser flow ~
-                               //       (we are already running white-space issues ie php parse strips whitespace diffrently)
+                               //       (we are already running white-space issues ie php parse strips whitespace differently)
                                
                                // ... but I am having fun with recursion so here it is...
                                // or at least mirror: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
@@ -627,7 +624,7 @@ if( !mv_embed_path ) {
                                                }
                                                if(!node['t'])
                                                        node['t']='';
-                                               //dont put closures into output:
+                                               //don't put closures into output:
                                                if( txt[a] &&  txt[a]!='}' )
                                                                node['t'] += txt[a];
                                                                
@@ -730,7 +727,7 @@ if( !mv_embed_path ) {
                        },
                        
                        /*
-                        * parsed template api ~losely based off of ~POM~
+                        * parsed template api ~loosely based off of ~POM~
                         * http://www.mediawiki.org/wiki/Extension:Page_Object_Model
                         */
                        
@@ -762,10 +759,10 @@ if( !mv_embed_path ) {
                        /**
                         * Returns the transformed wikitext
                         * 
-                        * Build output from swappable index 
+                        * Build output from swapable index 
                         *              (all transforms must be expanded in parse stage and linearly rebuilt)  
                         * Alternatively we could build output using a place-holder & replace system 
-                        *              (this lets us be slightly more slopy with ordering and indexes, but probably slower)
+                        *              (this lets us be slightly more sloppy with ordering and indexes, but probably slower)
                         * 
                         * Ideal: we build a 'wiki DOM' 
                         *              When editing you update the data structure directly
@@ -827,7 +824,7 @@ function mv_set_loading(target, load_id){
 }
 
 /**
-* mvJsLoader class handles initialization and js file loads
+* mvJsLoader class handles initialisation and js file loads
 */
 var mvJsLoader = {
        libreq : {},
@@ -1028,7 +1025,7 @@ var mvJsLoader = {
                        }
                        if( _this.jQuerySetupFlag == false){
                                //js_log('setup mv_embed jQuery bindings');
-                               //setup our global settings using the (jQuery helper)
+                               // Setup our global settings using the (jQuery helper)
 
                                // Set up the skin path
                                _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' + $mw.conf['jui_skin'] + '/';
@@ -1076,13 +1073,12 @@ var mvJsLoader = {
                                ]
                        ];
                        
-                       //add any requested skins (suports multiple skins per single page)
+                       //add any requested skins (supports multiple skins per single page)
                        if( $mw.skin_list ){
                                for(var i in $mw.skin_list  ){
                                        depReq[0].push( $mw.skin_list[i] + 'Config' );
                                }
-                       }
-                               
+                       }                               
 
                        // Add PNG fix if needed:
                        if( $j.browser.msie || $j.browser.version < 7 )
@@ -1192,7 +1188,7 @@ function js2AddOnloadHook( func ) {
                }
        });
 }
-// Deprecated mwAddOnloadHook in favor of js2 naming (for clear separation of js2 code from old MW code
+// Deprecated mwAddOnloadHook in favour of js2 naming (for clear separation of js2 code from old MW code
 var mwAddOnloadHook = js2AddOnloadHook;
 /*
  * This function allows for targeted rewriting
@@ -1228,8 +1224,8 @@ window.onload = function () {
  * Store all the mwEmbed jQuery-specific bindings
  * (set up after jQuery is available).
  *
- * These functions are genneraly are loaders that do the dynamic mapping of
- * dependencies for a given commponet
+ * These functions are generally are loaders that do the dynamic mapping of
+ * dependencies for a given component
  * 
  *
  */
@@ -1404,7 +1400,7 @@ function mv_jqueryBindings() {
                                }
                                return sElm['firefogg'];
                        } else {
-                               // Avoid concurency
+                               // Avoid concurrency
                                sElm['firefogg'] = 'loading';
                        }
                        // Add the selector
@@ -2005,7 +2001,7 @@ if ( typeof DOMParser == "undefined" ) {
 * Utility functions
 */
 function js_log( string ) {
-       ///add any prepend debug strings if nessesary (used for cross browser)
+       // Add any prepend debug strings if necessary (used for cross browser)
        if( $mw.conf['debug_pre'] )
                string = $mw.conf['debug_pre']+ string;
                        
index 4609dae..afbb91e 100644 (file)
@@ -10,11 +10,9 @@ td{
 <script type="text/javascript" >
 var scriptLoaderURID = 't14';
 //for just setting one or two to test at a time for debug
-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'];
+//var langKeyDebug = ['sl']; //pl
+var langKeyDebug = [ 'az', 'da', 'pt', 'fr', 'lv', 'en'];
+//var langKeyDebug = ['en','az', 'da', 'pt', 'fr', 'lv', 'ga','hr','cy','mk','mt','pl','sl'];
 
 //longlangKey is every language we have a much more verbose test
 var langKeyAll = [
@@ -181,7 +179,7 @@ js2AddOnloadHook( function(){
        function doLangTable( langSet ){                
                //build table output: 
                var msgTestSet = {                                                                                              
-                       'mwe-upload-multi' : [ 0, 1, 2, 5, 21, 30 ],                    
+                       'undelete_short' : [ 0, 1, 2, 5, 21, 30 ],                      
                        //category-subcat-count' has two params:
                        'category-subcat-count' : [ 
                                [0,10], 
index 604cd7e..5d5e8a6 100644 (file)
@@ -6,6 +6,7 @@
 var urlparts = getRemoteEmbedPath();
 var mwEmbedHostPath = urlparts[0];
 var mwRemoteVersion = '1.05';
+var mwUseScriptLoader = true;
 
 reqArguments = urlparts[1];
 
@@ -19,7 +20,7 @@ for(var i=0;i< reqParts.length; i++){
 }
 
 addOnloadHook( function(){
-       //only do rewrites if MV_EMBED / js2 is "off"
+       // Only do rewrites if MV_EMBED / js2 is "off"
        if( typeof MV_EMBED_VERSION == 'undefined' ) {
                doPageSpecificRewrite();
        }
@@ -33,7 +34,7 @@ function doPageSpecificRewrite() {
                } );
        }
        
-       //timed text display:
+       // Timed text display:
        if(wgPageName.indexOf("TimedText") === 0){              
                load_mv_embed(function(){
                        $mw.load( ['mvTimeTextEdit'],function(){
@@ -75,7 +76,7 @@ function doPageSpecificRewrite() {
                } );
        }
 }
-// will be depreciated in favor of updates to OggHandler
+// This will be depreciated in favour of updates to OggHandler
 function rewrite_for_OggHandler( vidIdList ){
        function procVidId( vidId ){
                //don't process empty vids
@@ -169,9 +170,9 @@ function getRemoteEmbedPath() {
 function load_mv_embed( callback ) {   
        // Inject mv_embed if needed
        if( typeof $mw == 'undefined' ) {       
-               if( reqParam['uselang'] || reqParam['useloader'] ){
+               if( ( reqParam['uselang'] || reqParam['useloader'] ) && mwUseScriptLoader){
                        var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mv_embed';
-                       //add jQuery too if we need it: 
+                       // Add jQuery too if we need it: 
                        if(typeof window.jQuery == 'undefined'){
                                rurl+= ',window.jQuery';
                        }
@@ -185,8 +186,7 @@ function load_mv_embed( callback ) {
 
                        if(reqParam['uselang'] )
                                rurl+='&uselang=' + reqParam['uselang'];
-                               
-                       //do import url:  
+                                                       
                        importScriptURI(rurl); 
                }else{
                        importScriptURI( mwEmbedHostPath + '/mwEmbed/mv_embed.js' + reqArguments );
@@ -203,4 +203,4 @@ function check_for_mv_embed( callback ) {
        } else {
                callback();
        }
-}
\ No newline at end of file
+}
index 1676cea..4eb54b6 100644 (file)
@@ -73,7 +73,7 @@ var mwUploadHelper = {
        /**
        * Set the upload radio buttons
        *
-       * boolean set
+       * @boolean set
        */
        toggleUpType: function( set ) {
                $j( '#wpSourceTypeFile' ).attr( 'checked', set );
@@ -137,4 +137,4 @@ var mwUploadHelper = {
                        'warn_target': '#wpDestFile-warning'
                } );
        }
-}
\ No newline at end of file
+}