Run patched version of stylize.php (http://pywiki.pastey.net/128379 for diff) on...
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Thu, 12 Nov 2009 17:54:12 +0000 (17:54 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Thu, 12 Nov 2009 17:54:12 +0000 (17:54 +0000)
The script had some trouble processing some of the regular expressions. Those were put back to their original formatting. Some were updated manually, others were not.

36 files changed:
js2/ajaxcategories.js
js2/apiProxyPage.js
js2/editPage.js
js2/js2stopgap.js
js2/mwEmbed/libAddMedia/dragDropFile.js
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
js2/mwEmbed/libAddMedia/simpleUploadForm.js
js2/mwEmbed/libClipEdit/mvClipEdit.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/libEmbedVideo/flowplayerEmbed.js
js2/mwEmbed/libEmbedVideo/genericEmbed.js
js2/mwEmbed/libEmbedVideo/htmlEmbed.js
js2/mwEmbed/libEmbedVideo/javaEmbed.js
js2/mwEmbed/libEmbedVideo/kplayerEmbed.js
js2/mwEmbed/libEmbedVideo/nativeEmbed.js
js2/mwEmbed/libEmbedVideo/omtkEmbed.js
js2/mwEmbed/libEmbedVideo/vlcEmbed.js
js2/mwEmbed/libMwApi/mw.proxy.js
js2/mwEmbed/libSequencer/mvFirefoggRender.js
js2/mwEmbed/libSequencer/mvPlayList.js
js2/mwEmbed/libSequencer/mvSequencer.js
js2/mwEmbed/libSequencer/mvTimedEffectsEdit.js
js2/mwEmbed/libSequencer/seqRemoteSearchDriver.js
js2/mwEmbed/libTimedText/mvTextInterface.js
js2/mwEmbed/libTimedText/mvTimeTextEdit.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/skins/ctrlBuilder.js
js2/mwEmbed/skins/kskin/kskin.js
js2/mwEmbed/tests/testLang.js
js2/remoteMwEmbed.js
js2/uploadPage.js

index b37cd62..b46d8b3 100644 (file)
@@ -13,25 +13,25 @@ loadGM( {
 } );
 
 var ajaxCategories = {
-       handleAddLink : function(e) {
+       handleAddLink : function( e ) {
                e.preventDefault();
 
                // Make sure the suggestion plugin is loaded. Load everything else while we're at it
                mvJsLoader.doLoad(
                        ['$j.ui', '$j.ui.dialog', '$j.fn.suggestions'],
                        function() {
-                               $j('#mw-addcategory-prompt').toggle();
+                               $j( '#mw-addcategory-prompt' ).toggle();
 
-                               $j('#mw-addcategory-input').suggestions( {
+                               $j( '#mw-addcategory-input' ).suggestions( {
                                        'fetch':ajaxCategories.fetchSuggestions,
                                        'cancel': function() {
                                                var req = ajaxCategories.request;
-                                               if (req.abort)
+                                               if ( req.abort )
                                                        req.abort();
                                        }
                                } );
 
-                               $j('#mw-addcategory-input').suggestions();
+                               $j( '#mw-addcategory-input' ).suggestions();
                        }
                );
        },
@@ -44,7 +44,7 @@ var ajaxCategories = {
                                'action': 'query',
                                'list': 'allpages',
                                'apnamespace': 14,
-                               'apprefix': $j(this).val(),
+                               'apprefix': $j( this ).val(),
                                'format': 'json'
                        },
                        dataType: 'json',
@@ -53,27 +53,27 @@ var ajaxCategories = {
                                var pages = data.query.allpages;
                                var titleArr = [];
 
-                               $j.each(pages, function(i, page) {
+                               $j.each( pages, function( i, page ) {
                                        var title = page.title.split( ':', 2 )[1];
-                                       titleArr.push(title);
+                                       titleArr.push( title );
                                } );
 
-                               $j(that).suggestions( 'suggestions', titleArr );
+                               $j( that ).suggestions( 'suggestions', titleArr );
                        }
-               });
+               } );
 
                ajaxCategories.request = request;
        },
 
        reloadCategoryList : function( response ) {
-               var holder = $j('<div/>');
+               var holder = $j( '<div/>' );
 
                holder.load(
-                       window.location.href+' .catlinks',
+                       window.location.href + ' .catlinks',
                        function() {
-                               $j('.catlinks').replaceWith( holder.find('.catlinks') );
+                               $j( '.catlinks' ).replaceWith( holder.find( '.catlinks' ) );
                                ajaxCategories.setupAJAXCategories();
-                               ajaxCategories.removeProgressIndicator( $j('.catlinks') );
+                               ajaxCategories.removeProgressIndicator( $j( '.catlinks' ) );
                        }
                );
        },
@@ -85,31 +85,31 @@ var ajaxCategories = {
                        function() {
                                // Produce a confirmation dialog
 
-                               var dialog = $j('<div/>');
+                               var dialog = $j( '<div/>' );
 
-                               dialog.addClass('mw-ajax-confirm-dialog');
-                               dialog.attr( 'title', gM('ajax-confirm-title') );
+                               dialog.addClass( 'mw-ajax-confirm-dialog' );
+                               dialog.attr( 'title', gM( 'ajax-confirm-title' ) );
 
                                // Intro text.
-                               var confirmIntro = $j('<p/>');
-                               confirmIntro.text( gM('ajax-confirm-prompt') );
-                               dialog.append(confirmIntro);
+                               var confirmIntro = $j( '<p/>' );
+                               confirmIntro.text( gM( 'ajax-confirm-prompt' ) );
+                               dialog.append( confirmIntro );
 
                                // Summary of the action to be taken
-                               var summaryHolder = $j('<p/>');
-                               var summaryLabel = $j('<strong/>');
-                               summaryLabel.text(gM('ajax-confirm-actionsummary')+" " );
+                               var summaryHolder = $j( '<p/>' );
+                               var summaryLabel = $j( '<strong/>' );
+                               summaryLabel.text( gM( 'ajax-confirm-actionsummary' ) + " " );
                                summaryHolder.text( actionSummary );
                                summaryHolder.prepend( summaryLabel );
-                               dialog.append(summaryHolder);
+                               dialog.append( summaryHolder );
 
                                // Reason textbox.
-                               var reasonBox = $j('<input type="text" size="45" />');
-                               reasonBox.addClass('mw-ajax-confirm-reason');
-                               dialog.append(reasonBox);
+                               var reasonBox = $j( '<input type="text" size="45" />' );
+                               reasonBox.addClass( 'mw-ajax-confirm-reason' );
+                               dialog.append( reasonBox );
 
                                // Submit button
-                               var submitButton = $j('<input type="button"/>');
+                               var submitButton = $j( '<input type="button"/>' );
                                submitButton.val( gM( 'ajax-confirm-save' ) );
 
                                var submitFunction = function() {
@@ -120,21 +120,21 @@ var ajaxCategories = {
                                                reasonBox.val(),
                                                function() {
                                                        doneFn();
-                                                       dialog.dialog('close');
+                                                       dialog.dialog( 'close' );
                                                        ajaxCategories.removeProgressIndicator( dialog );
                                                }
                                        );
                                };
 
-                               var buttons = {};
-                               buttons[gM('ajax-confirm-save')] = submitFunction;
+                               var buttons = { };
+                               buttons[gM( 'ajax-confirm-save' )] = submitFunction;
                                var dialogOptions = {
                                        'AutoOpen' : true,
                                        'buttons' : buttons,
                                        'width' : 450
                                };
 
-                               $j('#catlinks').prepend(dialog);
+                               $j( '#catlinks' ).prepend( dialog );
                                dialog.dialog( dialogOptions );
                        }
                );
@@ -151,19 +151,19 @@ var ajaxCategories = {
                        'format':'json'
                };
 
-               $j.get(wgScriptPath+'/api.php', getTokenVars,
+               $j.get( wgScriptPath + '/api.php', getTokenVars,
                        function( reply ) {
                                var infos = reply.query.pages;
                                $j.each(
                                        infos,
-                                       function(pageid, data) {
+                                       function( pageid, data ) {
                                                var token = data.edittoken;
                                                var timestamp = data.revisions[0].timestamp;
                                                var oldText = data.revisions[0]['*'];
 
-                                               var newText = fn(oldText);
+                                               var newText = fn( oldText );
 
-                                               if (newText === false) return;
+                                               if ( newText === false ) return;
 
                                                var postEditVars = {
                                                        'action':'edit',
@@ -175,7 +175,7 @@ var ajaxCategories = {
                                                        'format':'json'
                                                };
 
-                                               $j.post( wgScriptPath+'/api.php', postEditVars, doneFn, 'json' );
+                                               $j.post( wgScriptPath + '/api.php', postEditVars, doneFn,       'json' );
                                        }
                                );
                        }
@@ -183,35 +183,35 @@ var ajaxCategories = {
        },
 
        addProgressIndicator : function( elem ) {
-               var indicator = $j('<div/>');
+               var indicator = $j( '<div/>' );
 
-               indicator.addClass('mw-ajax-loader');
+               indicator.addClass( 'mw-ajax-loader' );
 
                elem.append( indicator );
        },
 
        removeProgressIndicator : function( elem ) {
-               elem.find('.mw-ajax-loader').remove();
+               elem.find( '.mw-ajax-loader' ).remove();
        },
 
-       handleCategoryAdd : function(e) {
+       handleCategoryAdd : function( e ) {
                // Grab category text
-               var category = $j('#mw-addcategory-input').val();
-               var appendText = "\n[["+wgFormattedNamespaces[14]+":"+category+"]]\n";
-               var summary = gM('ajax-add-category-summary', category);
+               var category = $j( '#mw-addcategory-input' ).val();
+               var appendText = "\n[[" + wgFormattedNamespaces[14] + ":" + category + "]]\n";
+               var summary = gM( 'ajax-add-category-summary', category );
 
                ajaxCategories.confirmEdit(
                        wgPageName,
-                       function(oldText) { return oldText+appendText },
+                       function( oldText ) { return oldText + appendText },
                        summary,
                        ajaxCategories.reloadCategoryList
                );
        },
 
-       handleDeleteLink : function(e) {
+       handleDeleteLink : function( e ) {
                e.preventDefault();
 
-               var category = $j(this).parent().find('a').text();
+               var category = $j( this ).parent().find( 'a' ).text();
 
                // Build a regex that matches legal invocations of that category.
 
@@ -219,37 +219,37 @@ var ajaxCategories = {
                //  Shouldn't have any real impact, can't be exploited or anything, so we'll
                //  leave it for now.
                var categoryNSFragment = '';
-               $j.each(wgNamespaceIds, function( name, id ) {
-                       if (id == 14) {
+               $j.each( wgNamespaceIds, function( name, id ) {
+                       if ( id == 14 ) {
                                // Allow the first character to be any case
-                               var firstChar = name.charAt(0);
-                               firstChar = '['+firstChar.toUpperCase()+firstChar.toLowerCase()+']';
-                               categoryNSFragment += '|'+firstChar+name.substr(1);
+                               var firstChar = name.charAt( 0 );
+                               firstChar = '[' + firstChar.toUpperCase() + firstChar.toLowerCase() + ']';
+                               categoryNSFragment += '|' + firstChar + name.substr( 1 );
                        }
                } );
-               categoryNSFragment = categoryNSFragment.substr(1); // Remove leading |
+               categoryNSFragment = categoryNSFragment.substr( 1 ); // Remove leading |
 
                // Build the regex
                var titleFragment = category;
 
-               firstChar = category.charAt(0);
-               firstChar = '['+firstChar.toUpperCase()+firstChar.toLowerCase()+']';
-               titleFragment = firstChar+category.substr(1);
-               var categoryRegex = '\\[\\['+categoryNSFragment+':'+titleFragment+'(\\|[^\\]]*)?\\]\\]';
+               firstChar = category.charAt( 0 );
+               firstChar = '[' + firstChar.toUpperCase() + firstChar.toLowerCase() + ']';
+               titleFragment = firstChar + category.substr( 1 );
+               var categoryRegex = '\\[\\[' + categoryNSFragment + ':' + titleFragment + '(\\|[^\\]]*)?\\]\\]';
                categoryRegex = new RegExp( categoryRegex, 'g' );
 
-               var summary = gM('ajax-remove-category-summary', category);
+               var summary = gM( 'ajax-remove-category-summary', category );
 
                ajaxCategories.confirmEdit(
                        wgPageName,
-                       function(oldText) {
-                               var newText = oldText.replace(categoryRegex, '');
+                       function( oldText ) {
+                               var newText = oldText.replace( categoryRegex, '' );
 
-                               if (newText == oldText) {
-                                       var error = gM('ajax-remove-category-error');
+                               if ( newText == oldText ) {
+                                       var error = gM( 'ajax-remove-category-error' );
                                        ajaxCategories.showError( error );
-                                       ajaxCategories.removeProgressIndicator( $j('.mw-ajax-confirm-dialog') );
-                                       $j('.mw-ajax-confirm-dialog').dialog('close');
+                                       ajaxCategories.removeProgressIndicator( $j( '.mw-ajax-confirm-dialog' ) );
+                                       $j( '.mw-ajax-confirm-dialog' ).dialog( 'close' );
                                        return false;
                                }
 
@@ -260,66 +260,66 @@ var ajaxCategories = {
        },
 
        showError : function( str ) {
-               var dialog = $j('<div/>');
-               dialog.text(str);
+               var dialog = $j( '<div/>' );
+               dialog.text( str );
 
-               $j('#bodyContent').append(dialog);
+               $j( '#bodyContent' ).append( dialog );
 
-               var buttons = {};
-               buttons[gM('ajax-error-dismiss')] = function(e) {
-                       dialog.dialog('close');
+               var buttons = { };
+               buttons[gM( 'ajax-error-dismiss' )] = function( e ) {
+                       dialog.dialog( 'close' );
                };
                var dialogOptions = {
                        'buttons' : buttons,
                        'AutoOpen' : true,
-                       'title' : gM('ajax-error-title')
+                       'title' : gM( 'ajax-error-title' )
                };
 
-               dialog.dialog(dialogOptions);
+               dialog.dialog( dialogOptions );
        },
 
        setupAJAXCategories : function() {
                // Only do it for articles.
                if ( !wgIsArticle ) return;
 
-               var clElement = $j('.catlinks');
+               var clElement = $j( '.catlinks' );
 
                // Unhide hidden category holders.
                clElement.removeClass( 'catlinks-allhidden' );
 
-               var addLink = $j('<a/>');
+               var addLink = $j( '<a/>' );
                addLink.addClass( 'mw-ajax-addcategory' );
 
                // Create [Add Category] link
                addLink.text( gM( 'ajax-add-category' ) );
-               addLink.attr('href', '#');
+               addLink.attr( 'href', '#' );
                addLink.click( ajaxCategories.handleAddLink );
-               clElement.append(addLink);
+               clElement.append( addLink );
 
                // Create add category prompt
-               var promptContainer = $j('<div id="mw-addcategory-prompt"/>');
-               var promptTextbox = $j('<input type="text" size="45" id="mw-addcategory-input"/>');
-               var addButton = $j('<input type="button" id="mw-addcategory-button"/>' );
-               addButton.val( gM('ajax-add-category-submit') );
+               var promptContainer = $j( '<div id="mw-addcategory-prompt"/>' );
+               var promptTextbox = $j( '<input type="text" size="45" id="mw-addcategory-input"/>' );
+               var addButton = $j( '<input type="button" id="mw-addcategory-button"/>' );
+               addButton.val( gM( 'ajax-add-category-submit' ) );
 
                promptTextbox.keypress( ajaxCategories.handleCategoryInput );
                addButton.click( ajaxCategories.handleCategoryAdd );
 
-               promptContainer.append(promptTextbox);
-               promptContainer.append(addButton);
+               promptContainer.append( promptTextbox );
+               promptContainer.append( addButton );
                promptContainer.hide();
 
                // Create delete link for each category.
-               $j('.catlinks div span a').each( function(e) {
+               $j( '.catlinks div span a' ).each( function( e ) {
                        // Create a remove link
-                       var deleteLink = $j('<a class="mw-remove-category" href="#"/>');
+                       var deleteLink = $j( '<a class="mw-remove-category" href="#"/>' );
 
-                       deleteLink.click(ajaxCategories.handleDeleteLink);
+                       deleteLink.click( ajaxCategories.handleDeleteLink );
 
-                       $j(this).after(deleteLink);
+                       $j( this ).after( deleteLink );
                } );
 
-               clElement.append(promptContainer);
+               clElement.append( promptContainer );
        }
 };
 
index 7e37959..f113a5d 100644 (file)
  
 mw.conf['debug_pre'] = 'Proxy';
  
-if( !mwApiProxyConfig )
-       var mwApiProxyConfig = {};
+if ( !mwApiProxyConfig )
+       var mwApiProxyConfig = { };
 
 // 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'      : []                                    
+               'master_blacklist'      : []
 };
 
 // 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); 
-       $j.apiProxy( 'server', mwApiProxyConfig );      
-});
+js2AddOnloadHook( function() {
+       // build our configuration from the default and mwApiProxyConfig vars
+       mwApiProxyConfig = $j.extend( true, mwApiProxyDefaultConfig,  mwApiProxyConfig );
+       $j.apiProxy( 'server', mwApiProxyConfig );
+} );
index 0e93231..15c47f9 100644 (file)
@@ -4,10 +4,10 @@
  */
 
 // Setup configuration vars (if not set already)
-if( !mwAddMediaConfig )
-       var mwAddMediaConfig = {};
+if ( !mwAddMediaConfig )
+       var mwAddMediaConfig = { };
 
-//The default editPage AMW config
+// The default editPage AMW config
 var defaultAddMediaConfig = {
                'profile': 'mediawiki_edit',
                'target_textbox': '#wpTextbox1',
@@ -21,35 +21,35 @@ var defaultAddMediaConfig = {
 };
 
 js2AddOnloadHook( function() {
-       js_log("edit page js2AddOnloadHook::");
+       js_log( "edit page js2AddOnloadHook::" );
        var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig );
        // kind of tricky, it would be nice to use run on ready "loader" call here
-       var didWikiEditorBind = false;  
+       var didWikiEditorBind = false;
        
-       //Set-up the drag drop binding (will only work for html5 upload browsers) 
-       //$j('textarea#wpTextbox1').dragFileUpload();
-       
-       //set up the add-media-wizard binding: 
-       if( typeof $j.wikiEditor != 'undefined' ) {
-                       //the below seems to be broken :(
+       // Set-up the drag drop binding (will only work for html5 upload browsers) 
+       // $j('textarea#wpTextbox1').dragFileUpload();
+
+       // set up the add-media-wizard binding: 
+       if ( typeof $j.wikiEditor != 'undefined' ) {
+                       // the below seems to be broken :(
                        $j( 'textarea#wpTextbox1' ).bind( 'wikiEditor-toolbar-buildSection-main',
                    function( e, section ) {
                        didWikiEditorBind = true;
                        if ( typeof section.groups.insert.tools.file !== 'undefined' ) {
                            section.groups.insert.tools.file.action = {
                                'type': 'callback',
-                               'execute': function() { 
-                                       js_log('click add media wiz');
+                               'execute': function() {
+                                       js_log( 'click add media wiz' );
                                        $j.addMediaWiz( amwConf );
                                }
                            };
                        }
                    }
                );
-       }               
-       //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 ){
+       }
+       // 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( 'Do old toolbar bind:' );
                        didWikiEditorBind = true;
                        $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
@@ -57,13 +57,13 @@ js2AddOnloadHook( function() {
                        $j( '#btn-add-media-wiz' ).addMediaWiz(
                                amwConf
                        );
-               }else{                  
-                       //Make sure the wikieditor got binded: 
-                       if( !didWikiEditorBind ){
+               } else {
+                       // Make sure the wikieditor got binded: 
+                       if ( !didWikiEditorBind ) {
                                js_log( 'Failed to bind via build section bind via target:' );
-                               $j(".tool[rel='file']").unbind().addMediaWiz( amwConf );
+                               $j( ".tool[rel='file']" ).unbind().addMediaWiz( amwConf );
                        }
                }
-       }, 120)
+       }, 120 )
 
-});
+} );
index c4e248b..5b9f5bc 100644 (file)
@@ -9,9 +9,9 @@
  * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
  * Revision: 6246
  */
-(function(){
+( function() {
 
-var 
+var
        // Will speed up references to window, and allows munging its name.
        window = this,
        // Will speed up references to undefined, and allows munging its name.
@@ -30,7 +30,7 @@ var
        // (both of which we optimize for)
        quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
        // Is it a simple selector
-       isSimple = /^.[^:#\[\.,]*$/;
+       isSimple = / ^ .[ ^ :# \[\.,]*$/;
 
 jQuery.fn = jQuery.prototype = {
        init: function( selector, context ) {
@@ -50,7 +50,7 @@ jQuery.fn = jQuery.prototype = {
                        var match = quickExpr.exec( selector );
 
                        // Verify a match, and that no context was specified for #id
-                       if ( match && (match[1] || !context) ) {
+                       if ( match && ( match[1] || !context ) ) {
 
                                // HANDLE: $(html) -> $(array)
                                if ( match[1] )
@@ -88,9 +88,9 @@ jQuery.fn = jQuery.prototype = {
                        this.context = selector.context;
                }
 
-               return this.setArray(jQuery.isArray( selector ) ?
+               return this.setArray( jQuery.isArray( selector ) ?
                        selector :
-                       jQuery.makeArray(selector));
+                       jQuery.makeArray( selector ) );
        },
 
        // Start with an empty selector
@@ -128,7 +128,7 @@ jQuery.fn = jQuery.prototype = {
                ret.context = this.context;
 
                if ( name === "find" )
-                       ret.selector = this.selector + (this.selector ? " " : "") + selector;
+                       ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
                else if ( name )
                        ret.selector = this.selector + "." + name + "(" + selector + ")";
 
@@ -174,12 +174,12 @@ jQuery.fn = jQuery.prototype = {
                                return this[0] && jQuery[ type || "attr" ]( this[0], name );
 
                        else {
-                               options = {};
+                               options = { };
                                options[ name ] = value;
                        }
 
                // Check to see if we're setting style values
-               return this.each(function(i){
+               return this.each( function( i ) {
                        // Set all the styles
                        for ( name in options )
                                jQuery.attr(
@@ -188,30 +188,30 @@ jQuery.fn = jQuery.prototype = {
                                                this,
                                        name, jQuery.prop( this, options[ name ], type, i, name )
                                );
-               });
+               } );
        },
 
        css: function( key, value ) {
                // ignore negative width and height values
-               if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
+               if ( ( key == 'width' || key == 'height' ) && parseFloat( value ) < 0 )
                        value = undefined;
                return this.attr( key, value, "curCSS" );
        },
 
        text: function( text ) {
                if ( typeof text !== "object" && text != null )
-                       return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+                       return this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( text ) );
 
                var ret = "";
 
-               jQuery.each( text || this, function(){
-                       jQuery.each( this.childNodes, function(){
+               jQuery.each( text || this, function() {
+                       jQuery.each( this.childNodes, function() {
                                if ( this.nodeType != 8 )
                                        ret += this.nodeType != 1 ?
                                                this.nodeValue :
                                                jQuery.fn.text( [ this ] );
-                       });
-               });
+                       } );
+               } );
 
                return ret;
        },
@@ -219,60 +219,60 @@ jQuery.fn = jQuery.prototype = {
        wrapAll: function( html ) {
                if ( this[0] ) {
                        // The elements to wrap the target around
-                       var wrap = jQuery( html, this[0].ownerDocument ).clone();
+                       var wrap = jQuery( html, this[0].ownerDocument ). clone ();
 
                        if ( this[0].parentNode )
                                wrap.insertBefore( this[0] );
 
-                       wrap.map(function(){
+                       wrap.map( function() {
                                var elem = this;
 
                                while ( elem.firstChild )
                                        elem = elem.firstChild;
 
                                return elem;
-                       }).append(this);
+                       } ).append( this );
                }
 
                return this;
        },
 
        wrapInner: function( html ) {
-               return this.each(function(){
+               return this.each( function() {
                        jQuery( this ).contents().wrapAll( html );
-               });
+               } );
        },
 
        wrap: function( html ) {
-               return this.each(function(){
+               return this.each( function() {
                        jQuery( this ).wrapAll( html );
-               });
+               } );
        },
 
        append: function() {
-               return this.domManip(arguments, true, function(elem){
-                       if (this.nodeType == 1)
+               return this.domManip( arguments, true, function( elem ) {
+                       if ( this.nodeType == 1 )
                                this.appendChild( elem );
-               });
+               } );
        },
 
        prepend: function() {
-               return this.domManip(arguments, true, function(elem){
-                       if (this.nodeType == 1)
+               return this.domManip( arguments, true, function( elem ) {
+                       if ( this.nodeType == 1 )
                                this.insertBefore( elem, this.firstChild );
-               });
+               } );
        },
 
        before: function() {
-               return this.domManip(arguments, false, function(elem){
+               return this.domManip( arguments, false, function( elem ) {
                        this.parentNode.insertBefore( elem, this );
-               });
+               } );
        },
 
        after: function() {
-               return this.domManip(arguments, false, function(elem){
+               return this.domManip( arguments, false, function( elem ) {
                        this.parentNode.insertBefore( elem, this.nextSibling );
-               });
+               } );
        },
 
        end: function() {
@@ -292,16 +292,16 @@ jQuery.fn = jQuery.prototype = {
                        jQuery.find( selector, this[0], ret );
                        return ret;
                } else {
-                       return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
+                       return this.pushStack( jQuery.unique( jQuery.map( this, function( elem ) {
                                return jQuery.find( selector, elem );
-                       })), "find", selector );
+                       } ) ), "find", selector );
                }
        },
 
-       clone: function( events ) {
+       clone : function( events ) {
                // Do the clone
-               var ret = this.map(function(){
-                       if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
+               var ret = this.map( function() {
+                       if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc( this ) ) {
                                // IE copies events bound via attachEvent when
                                // using cloneNode. Calling detachEvent on the
                                // clone will also remove the events from the orignal
@@ -312,21 +312,21 @@ jQuery.fn = jQuery.prototype = {
                                // the name attribute on an input).
                                var html = this.outerHTML;
                                if ( !html ) {
-                                       var div = this.ownerDocument.createElement("div");
-                                       div.appendChild( this.cloneNode(true) );
+                                       var div = this.ownerDocument.createElement( "div" );
+                                       div.appendChild( this.cloneNode( true ) );
                                        html = div.innerHTML;
                                }
 
-                               return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
+                               return jQuery.clean( [ html.replace( / jQuery\d+="(?:\d+|null)"/g, "" ).replace( /^\s*/, "" ) ] )[0];
                        } else
-                               return this.cloneNode(true);
-               });
+                               return this.cloneNode( true );
+               } );
 
                // Copy the events from the original to the clone
                if ( events === true ) {
-                       var orig = this.find("*").andSelf(), i = 0;
+                       var orig = this.find( "*" ).andSelf(), i = 0;
 
-                       ret.find("*").andSelf().each(function(){
+                       ret.find( "*" ).andSelf().each( function() {
                                if ( this.nodeName !== orig[i].nodeName )
                                        return;
 
@@ -339,7 +339,7 @@ jQuery.fn = jQuery.prototype = {
                                }
 
                                i++;
-                       });
+                       } );
                }
 
                // Return the cloned set
@@ -349,30 +349,30 @@ jQuery.fn = jQuery.prototype = {
        filter: function( selector ) {
                return this.pushStack(
                        jQuery.isFunction( selector ) &&
-                       jQuery.grep(this, function(elem, i){
+                       jQuery.grep( this, function( elem, i ) {
                                return selector.call( elem, i );
-                       }) ||
+                       } ) ||
 
-                       jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
+                       jQuery.multiFilter( selector, jQuery.grep( this, function( elem ) {
                                return elem.nodeType === 1;
-                       }) ), "filter", selector );
+                       } ) ), "filter", selector );
        },
 
        closest: function( selector ) {
-               var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
+               var pos = jQuery.expr.match.POS.test( selector ) ? jQuery( selector ) : null,
                        closer = 0;
 
-               return this.map(function(){
+               return this.map( function() {
                        var cur = this;
                        while ( cur && cur.ownerDocument ) {
-                               if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
-                                       jQuery.data(cur, "closest", closer);
+                               if ( pos ? pos.index( cur ) > - 1 : jQuery( cur ).is( selector ) ) {
+                                       jQuery.data( cur, "closest", closer );
                                        return cur;
                                }
                                cur = cur.parentNode;
                                closer++;
                        }
-               });
+               } );
        },
 
        not: function( selector ) {
@@ -384,9 +384,9 @@ jQuery.fn = jQuery.prototype = {
                                selector = jQuery.multiFilter( selector, this );
 
                var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
-               return this.filter(function() {
+               return this.filter( function() {
                        return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
-               });
+               } );
        },
 
        add: function( selector ) {
@@ -395,7 +395,7 @@ jQuery.fn = jQuery.prototype = {
                        typeof selector === "string" ?
                                jQuery( selector ) :
                                jQuery.makeArray( selector )
-               )));
+               ) ) );
        },
 
        is: function( selector ) {
@@ -407,12 +407,12 @@ jQuery.fn = jQuery.prototype = {
        },
 
        val: function( value ) {
-               if ( value === undefined ) {                    
+               if ( value === undefined ) {
                        var elem = this[0];
 
                        if ( elem ) {
-                               if( jQuery.nodeName( elem, 'option' ) )
-                                       return (elem.attributes.value || {}).specified ? elem.value : elem.text;
+                               if ( jQuery.nodeName( elem, 'option' ) )
+                                       return ( elem.attributes.value || { } ).specified ? elem.value : elem.text;
                                
                                // We need to handle select boxes special
                                if ( jQuery.nodeName( elem, "select" ) ) {
@@ -431,7 +431,7 @@ jQuery.fn = jQuery.prototype = {
 
                                                if ( option.selected ) {
                                                        // Get the specifc value for the option
-                                                       value = jQuery(option).val();
+                                                       value = jQuery( option ).val();
 
                                                        // We don't need an array for one selects
                                                        if ( one )
@@ -442,11 +442,11 @@ jQuery.fn = jQuery.prototype = {
                                                }
                                        }
 
-                                       return values;                          
+                                       return values;
                                }
 
                                // Everything else, we just grab the value
-                               return (elem.value || "").replace(/\r/g, "");
+                               return ( elem.value || "" ).replace( /\r/g, "" );
 
                        }
 
@@ -456,35 +456,35 @@ jQuery.fn = jQuery.prototype = {
                if ( typeof value === "number" )
                        value += '';
 
-               return this.each(function(){
+               return this.each( function() {
                        if ( this.nodeType != 1 )
                                return;
 
-                       if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
-                               this.checked = (jQuery.inArray(this.value, value) >= 0 ||
-                                       jQuery.inArray(this.name, value) >= 0);
+                       if ( jQuery.isArray( value ) && / radio | checkbox / .test( this.type ) )
+                               this.checked = ( jQuery.inArray( this.value, value ) >= 0 ||
+                                       jQuery.inArray( this.name, value ) >= 0 );
 
                        else if ( jQuery.nodeName( this, "select" ) ) {
-                               var values = jQuery.makeArray(value);
+                               var values = jQuery.makeArray( value );
 
-                               jQuery( "option", this ).each(function(){
-                                       this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
-                                               jQuery.inArray( this.text, values ) >= 0);
-                               });
+                               jQuery( "option", this ).each( function() {
+                                       this.selected = ( jQuery.inArray( this.value, values ) >= 0 ||
+                                               jQuery.inArray( this.text, values ) >= 0 );
+                               } );
 
                                if ( !values.length )
-                                       this.selectedIndex = -1;
+                                       this.selectedIndex = - 1;
 
                        } else
                                this.value = value;
-               });
+               } );
        },
 
        html: function( value ) {
                return value === undefined ?
-                       (this[0] ?
-                               this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
-                               null) :
+                       ( this[0] ?
+                               this[0].innerHTML.replace( / jQuery\d+="(?:\d+|null)"/g, "" ) :
+                               null ) :
                        this.empty().append( value );
        },
 
@@ -493,18 +493,18 @@ jQuery.fn = jQuery.prototype = {
        },
 
        eq: function( i ) {
-               return this.slice( i, +i + 1 );
+               return this.slice( i, + i + 1 );
        },
 
        slice: function() {
                return this.pushStack( Array.prototype.slice.apply( this, arguments ),
-                       "slice", Array.prototype.slice.call(arguments).join(",") );
+                       "slice", Array.prototype.slice.call( arguments ).join( "," ) );
        },
 
        map: function( callback ) {
-               return this.pushStack( jQuery.map(this, function(elem, i){
+               return this.pushStack( jQuery.map( this, function( elem, i ) {
                        return callback.call( elem, i, elem );
-               }));
+               } ) );
        },
 
        andSelf: function() {
@@ -513,14 +513,14 @@ jQuery.fn = jQuery.prototype = {
 
        domManip: function( args, table, callback ) {
                if ( this[0] ) {
-                       var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
-                               scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
+                       var fragment = ( this[0].ownerDocument || this[0] ).createDocumentFragment(),
+                               scripts = jQuery.clean( args, ( this[0].ownerDocument || this[0] ), fragment ),
                                first = fragment.firstChild;
 
                        if ( first )
                                for ( var i = 0, l = this.length; i < l; i++ )
-                                       callback.call( root(this[i], first), this.length > 1 || i > 0 ?
-                                                       fragment.cloneNode(true) : fragment );
+                                       callback.call( root( this[i], first ), this.length > 1 || i > 0 ?
+                                                       fragment.cloneNode( true ) : fragment );
                
                        if ( scripts )
                                jQuery.each( scripts, evalScript );
@@ -529,9 +529,9 @@ jQuery.fn = jQuery.prototype = {
                return this;
                
                function root( elem, cur ) {
-                       return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
-                               (elem.getElementsByTagName("tbody")[0] ||
-                               elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+                       return table && jQuery.nodeName( elem, "table" ) && jQuery.nodeName( cur, "tr" ) ?
+                               ( elem.getElementsByTagName( "tbody" )[0] ||
+                               elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) ) :
                                elem;
                }
        }
@@ -542,11 +542,11 @@ jQuery.fn.init.prototype = jQuery.fn;
 
 function evalScript( i, elem ) {
        if ( elem.src )
-               jQuery.ajax({
+               jQuery.ajax( {
                        url: elem.src,
                        async: false,
                        dataType: "script"
-               });
+               } );
 
        else
                jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
@@ -555,25 +555,25 @@ function evalScript( i, elem ) {
                elem.parentNode.removeChild( elem );
 }
 
-function now(){
-       return +new Date;
+function now() {
+       return + new Date;
 }
 
 jQuery.extend = jQuery.fn.extend = function() {
        // copy reference to target object
-       var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
+       var target = arguments[0] || { }, i = 1, length = arguments.length, deep = false, options;
 
        // Handle a deep copy situation
        if ( typeof target === "boolean" ) {
                deep = target;
-               target = arguments[1] || {};
+               target = arguments[1] || { };
                // skip the boolean and the target
                i = 2;
        }
 
        // Handle case when target is a string or something (possible in deep copy)
-       if ( typeof target !== "object" && !jQuery.isFunction(target) )
-               target = {};
+       if ( typeof target !== "object" && !jQuery.isFunction( target ) )
+               target = { };
 
        // extend jQuery itself if only one argument is passed
        if ( length == i ) {
@@ -583,7 +583,7 @@ jQuery.extend = jQuery.fn.extend = function() {
 
        for ( ; i < length; i++ )
                // Only deal with non-null/undefined values
-               if ( (options = arguments[ i ]) != null )
+               if ( ( options = arguments[ i ] ) != null )
                        // Extend the base object
                        for ( var name in options ) {
                                var src = target[ name ], copy = options[ name ];
@@ -594,7 +594,7 @@ jQuery.extend = jQuery.fn.extend = function() {
 
                                // Recurse if we're merging object values
                                if ( deep && copy && typeof copy === "object" && !copy.nodeType )
-                                       target[ name ] = jQuery.extend( deep, 
+                                       target[ name ] = jQuery.extend( deep,
                                                // Never move original objects, clone them
                                                src || ( copy.length != null ? [ ] : { } )
                                        , copy );
@@ -610,12 +610,12 @@ jQuery.extend = jQuery.fn.extend = function() {
 };
 
 // exclude the following css properties to add px
-var    exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
+var    exclude = / z - ? index | font - ? weight | opacity | zoom | line - ? height / i,
        // cache defaultView
-       defaultView = document.defaultView || {},
+       defaultView = document.defaultView || { },
        toString = Object.prototype.toString;
 
-jQuery.extend({
+jQuery.extend( {
        noConflict: function( deep ) {
                window.$ = _$;
 
@@ -629,11 +629,11 @@ jQuery.extend({
        // Since version 1.3, DOM methods and functions like alert
        // aren't supported. They return false on IE (#2968).
        isFunction: function( obj ) {
-               return toString.call(obj) === "[object Function]";
+               return toString.call( obj ) === "[object Function]";
        },
 
        isArray: function( obj ) {
-               return toString.call(obj) === "[object Array]";
+               return toString.call( obj ) === "[object Array]";
        },
 
        // check if an element is in a (or is an) XML document
@@ -644,11 +644,11 @@ jQuery.extend({
 
        // Evalulates a script in a global context
        globalEval: function( data ) {
-               if ( data && /\S/.test(data) ) {
+               if ( data && /\S/.test( data ) ) {
                        // Inspired by code by Andrea Giammarchi
                        // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
-                       var head = document.getElementsByTagName("head")[0] || document.documentElement,
-                               script = document.createElement("script");
+                       var head = document.getElementsByTagName( "head" )[0] || document.documentElement,
+                               script = document.createElement( "script" );
 
                        script.type = "text/javascript";
                        if ( jQuery.support.scriptEval )
@@ -689,7 +689,7 @@ jQuery.extend({
                                                break;
                        } else
                                for ( var value = object[0];
-                                       i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
+                                       i < length && callback.call( value, i, value ) !== false; value = object[++i] ) { }
                }
 
                return object;
@@ -709,31 +709,31 @@ jQuery.extend({
        className: {
                // internal only, use addClass("class")
                add: function( elem, classNames ) {
-                       jQuery.each((classNames || "").split(/\s+/), function(i, className){
+                       jQuery.each( ( classNames || "" ).split( /\s+/ ), function( i, className ) {
                                if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
-                                       elem.className += (elem.className ? " " : "") + className;
-                       });
+                                       elem.className += ( elem.className ? " " : "" ) + className;
+                       } );
                },
 
                // internal only, use removeClass("class")
                remove: function( elem, classNames ) {
-                       if (elem.nodeType == 1)
+                       if ( elem.nodeType == 1 )
                                elem.className = classNames !== undefined ?
-                                       jQuery.grep(elem.className.split(/\s+/), function(className){
+                                       jQuery.grep( elem.className.split( /\s+/ ), function( className ) {
                                                return !jQuery.className.has( classNames, className );
-                                       }).join(" ") :
+                                       } ).join( " " ) :
                                        "";
                },
 
                // internal only, use hasClass("class")
                has: function( elem, className ) {
-                       return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
+                       return elem && jQuery.inArray( className, ( elem.className || elem ).toString().split( /\s+/ ) ) > -1;
                }
        },
 
        // A method for quickly swapping in/out CSS properties to get correct calculations
        swap: function( elem, options, callback ) {
-               var old = {};
+               var old = { };
                // Remember the old values, and insert the new ones
                for ( var name in options ) {
                        old[ name ] = elem.style[ name ];
@@ -759,12 +759,12 @@ jQuery.extend({
 
                                jQuery.each( which, function() {
                                        if ( !extra )
-                                               val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+                                               val -= parseFloat( jQuery.curCSS( elem, "padding" + this, true ) ) || 0;
                                        if ( extra === "margin" )
-                                               val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
+                                               val += parseFloat( jQuery.curCSS( elem, "margin" + this, true ) ) || 0;
                                        else
-                                               val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
-                               });
+                                               val -= parseFloat( jQuery.curCSS( elem, "border" + this + "Width", true ) ) || 0;
+                               } );
                        }
 
                        if ( elem.offsetWidth !== 0 )
@@ -772,7 +772,7 @@ jQuery.extend({
                        else
                                jQuery.swap( elem, props, getWH );
 
-                       return Math.max(0, Math.round(val));
+                       return Math.max( 0, Math.round( val ) );
                }
 
                return jQuery.curCSS( elem, name, force );
@@ -791,7 +791,7 @@ jQuery.extend({
                }
 
                // Make sure we're using the right name for getting the float value
-               if ( name.match( /float/i ) )
+               if ( name.match( / float / i ) )
                        name = styleFloat;
 
                if ( !force && style && style[ name ] )
@@ -800,10 +800,10 @@ jQuery.extend({
                else if ( defaultView.getComputedStyle ) {
 
                        // Only "float" is needed here
-                       if ( name.match( /float/i ) )
+                       if ( name.match( / float / i ) )
                                name = "float";
 
-                       name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
+                       name = name.replace( / ( [A - Z] ) / g, "-$1" ).toLowerCase();
 
                        var computedStyle = defaultView.getComputedStyle( elem, null );
 
@@ -815,9 +815,9 @@ jQuery.extend({
                                ret = "1";
 
                } else if ( elem.currentStyle ) {
-                       var camelCase = name.replace(/\-(\w)/g, function(all, letter){
+                       var camelCase = name.replace( /\-(\w)/g, function( all, letter ) {
                                return letter.toUpperCase();
-                       });
+                       } );
 
                        ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
 
index 35bf0f4..dad7b04 100644 (file)
@@ -1,39 +1,39 @@
 /* firefox 3.6 drag-drop uploading
 */
-loadGM({
+loadGM( {
        "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}",
        "mwe-review-upload": "Review file {{PLURAL:$1|upload|uploads}}"
-});
+} );
 
-(function($){
+( function( $ ) {
        $.fn.dragDropFile = function () {
-               js_log("drag drop: " + this.selector);
-               //setup drag binding and highlight
-               var dC = $j( this.selector ).get(0);
-               dC.addEventListener("dragenter",
-                       function(event){
-                               $j(dC).css('border', 'solid red');
+               js_log( "drag drop: " + this.selector );
+               // setup drag binding and highlight
+               var dC = $j( this.selector ).get( 0 );
+               dC.addEventListener( "dragenter",
+                       function( event ) {
+                               $j( dC ).css( 'border', 'solid red' );
                                event.stopPropagation();
                                event.preventDefault();
-                       }, false);
-               dC.addEventListener("dragleave",
-                       function(event){
-                               //default textbox css (should be an easy way to do this)
-                               $j(dC).css('border', '');
+                       }, false );
+               dC.addEventListener( "dragleave",
+                       function( event ) {
+                               // default textbox css (should be an easy way to do this)
+                               $j( dC ).css( 'border', '' );
                                event.stopPropagation();
                                event.preventDefault();
-                       }, false);
-               dC.addEventListener("dragover",
-                       function(event){
+                       }, false );
+               dC.addEventListener( "dragover",
+                       function( event ) {
                                event.stopPropagation();
                                event.preventDefault();
-                       }, false);
-               dC.addEventListener("drop",
-                       function( event ){
+                       }, false );
+               dC.addEventListener( "drop",
+                       function( event ) {
                                doDrop( event );
-                               //handle the drop loader and call event
-                       }, false);
-               function doDrop(event){
+                               // handle the drop loader and call event
+                       }, false );
+               function doDrop( event ) {
                        var dt = event.dataTransfer,
                                files = dt.files,
                                fileCount = files.length;
@@ -41,47 +41,47 @@ loadGM({
                        event.stopPropagation();
                        event.preventDefault();
 
-                       $j('#multiple_file_input').remove();
+                       $j( '#multiple_file_input' ).remove();
 
-                       $j('body').append('<div title="' + gM('mwe-upload-multi', fileCount) + '" ' +
+                       $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 = {};
-                       cBtn[ gM('mwe-cancel') ] = function(){
-                               $j(this).dialog('close');
+                       var cBtn = { };
+                       cBtn[ gM( 'mwe-cancel' ) ] = function() {
+                               $j( this ).dialog( 'close' );
                        }
-                       cBtn[ gM('mwe-upload-multi', fileCount) ] = function(){
-                               alert('do multiple file upload');
+                       cBtn[ gM( 'mwe-upload-multi', fileCount ) ] = function() {
+                               alert( 'do multiple file upload' );
                        }
-                       //open up the dialog
-                       $j('#multiple_file_input').dialog({
+                       // open up the dialog
+                       $j( '#multiple_file_input' ).dialog( {
                                bgiframe: true,
                                autoOpen: true,
                                modal: true,
                                draggable:false,
                                resizable:false,
                                buttons:cBtn
-                       });
-                       $j('#multiple_file_input').dialogFitWindow();
-                       $j(window).resize(function(){
-                               $j('#multiple_file_input').dialogFitWindow();
-                       });
-                       //add the inital table / title:
-                       $j('#multiple_file_input').html('<h3>' + gM('mwe-review-upload') + '</h3>'+
-                               '<table width="100%" border="1" class="table_list" style="border:none;"></table>');
-                       $j.each(files, function(i, file){
-                               if(file.fileSize < 64048576) {
-                                       $j('#multiple_file_input .table_list').append(
+                       } );
+                       $j( '#multiple_file_input' ).dialogFitWindow();
+                       $j( window ).resize( function() {
+                               $j( '#multiple_file_input' ).dialogFitWindow();
+                       } );
+                       // add the inital table / title:
+                       $j( '#multiple_file_input' ).html( '<h3>' + gM( 'mwe-review-upload' ) + '</h3>' +
+                               '<table width="100%" border="1" class="table_list" style="border:none;"></table>' );
+                       $j.each( files, function( i, file ) {
+                               if ( file.fileSize < 64048576 ) {
+                                       $j( '#multiple_file_input .table_list' ).append(
                                                '<tr>' +
-                                                       '<td width="300" style="padding:5px"><img width="250" src="'+ file.getAsDataURL() +'">' +'</td>'+
+                                                       '<td width="300" style="padding:5px"><img width="250" src="' + file.getAsDataURL() + '">' + '</td>' +
                                                        '<td valign="top">' +
-                                                               'File Name: <input name="file['+i+'][title]" value="' + file.name + '"><br>'+
-                                                               'File Desc: <textarea style="width:300px;" name="file['+i+'][desc]"></textarea><br>'+
-                                                       '</td>'+
+                                                               'File Name: <input name="file[' + i + '][title]" value="' + file.name + '"><br>' +
+                                                               'File Desc: <textarea style="width:300px;" name="file[' + i + '][desc]"></textarea><br>' +
+                                                       '</td>' +
                                                '</tr>'
                                        );
                                        /*$j.addDialog( "upload this image", '<img width="300" src="' + files[i].getAsDataURL() + '">' +
@@ -89,11 +89,11 @@ loadGM({
                                                '<br>size: ' + files[i].fileSize + '</br>' +
                                                '<br>mime: ' + files[i].mediaType + '</br>');
                                        */
-                                       //do the add-media-wizard with the upload tab
+                                       // do the add-media-wizard with the upload tab
                                } else {
-                                       alert("file is too big, needs to be below 64mb");
+                                       alert( "file is too big, needs to be below 64mb" );
                                }
-                       });
+                       } );
                }
        }
-})(jQuery);
+} )( jQuery );
index 6442b5c..34f32cd 100644 (file)
@@ -4,7 +4,7 @@
  * supporting remote searching of http archives for free images/audio/video assets
  */
 
-loadGM({
+loadGM( {
        "mwe-add_media_wizard" : "Add media wizard",
        "mwe-media_search" : "Media search",
        "rsd_box_layout" : "Box layout",
@@ -66,15 +66,15 @@ loadGM({
        "rsd-metavid-title" : "Metavid.org",
        "rsd-metavid-desc" : "Metavid.org, a community archive of US House and Senate floor proceedings"
        
-});
+} );
 
 var default_remote_search_options = {
        'profile':'mediawiki_edit',
-       'target_container':null, //the div that will hold the search interface
+       'target_container':null, // the div that will hold the search interface
 
-       'target_invocation': null, //the button or link that will invoke the search interface
+       'target_invocation': null, // the button or link that will invoke the search interface
 
-       'default_provider_id':'all', //all or one of the content_providers ids
+       'default_provider_id':'all', // all or one of the content_providers ids
 
        'caret_pos':null,
        'local_wiki_api_url':null,
@@ -89,48 +89,48 @@ var default_remote_search_options = {
        
 
        'target_textbox':null,
-       '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
+       '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
        'p_seq':null,
-       'cFileNS':'File', //What is the canonical namespace prefix for images
-                                         //@@todo (should get that from the api or in-page vars)
-       
+       'cFileNS':'File', // What is the canonical namespace prefix for images
+                                         // @@todo (should get that from the api or in-page vars)
+
        'upload_api_target': 'local', // can be local or the url or remote
        'upload_api_name' : null,
-       'upload_api_proxy_frame': null, //a page that will request mw.proxy.server
-       
-       'enabled_cps':'all', //can be keyword 'all' or an array of enabled content provider keys
-               
-       'disp_item':null //sets the default display item:
+       'upload_api_proxy_frame': null, // a page that will request mw.proxy.server
+
+       'enabled_cps':'all', // can be keyword 'all' or an array of enabled content provider keys
+
+       'disp_item':null // sets the default display item:
 }
 
-if(typeof wgServer == 'undefined')
+if ( typeof wgServer == 'undefined' )
        wgServer = '';
-if(typeof wgScriptPath == 'undefined')
+if ( typeof wgScriptPath == 'undefined' )
        wgScriptPath = '';
-if(typeof stylepath == 'undefined')
+if ( typeof stylepath == 'undefined' )
        stylepath = '';
 
 /*
  *     Base remoteSearch Driver interface
  */
-var remoteSearchDriver = function(iObj){
+var remoteSearchDriver = function( iObj ) {
        return this.init( iObj );
 }
 remoteSearchDriver.prototype = {
        results_cleared:false,
-       //here we define the set of possible media content providers:
-       main_search_options:{
-               'selprovider':{
+       // here we define the set of possible media content providers:
+       main_search_options: {
+               'selprovider': {
                        'title': 'Select Providers'
                },
-               'advanced_search':{
+               'advanced_search': {
                        'title': 'Advanced Options'
                }
-       },      
+       },
        /** the default content providers list.
         *
         * (should be note that special tabs like "upload" and "combined" don't go into the content providers list:
@@ -138,7 +138,7 @@ remoteSearchDriver.prototype = {
         *
         * @@todo we will want to load more per user-preference and per category lookup
         */
-       content_providers:{
+       content_providers: {
                /*content_providers documentation:
                 *  @@todo we should move the bulk of the configuration to each file
                 *
@@ -163,36 +163,36 @@ remoteSearchDriver.prototype = {
                        //@@todo should query wgForeignFileRepos setting maybe interwikimap from the api
                 */
                
-               'this_wiki':{
+               'this_wiki': {
                        'enabled': 1,
-                       'checked': 1,                   
-                       'api_url':  ( wgServer && wgScriptPath )? wgServer + wgScriptPath+ '/api.php': null,
+                       'checked': 1,
+                       'api_url':  ( wgServer && wgScriptPath ) ? wgServer + wgScriptPath + '/api.php': null,
                        'lib'    : 'mediaWiki',
                        'local'  : true,
                        'tab_img': false
-               },              
-               'wiki_commons':{
+               },
+               'wiki_commons': {
                        'enabled': 1,
-                       'checked': 1,                   
+                       'checked': 1,
                        'homepage': 'http://commons.wikimedia.org/wiki/Main_Page',
                        'api_url':'http://commons.wikimedia.org/w/api.php',
                        'lib'   :'mediaWiki',
-                       'resource_prefix': 'WC_', //prefix on imported resources (not applicable if the repository is local)
-                       
-                       //if we should check for shared repository asset ( generally only applicable to commons )
+                       'resource_prefix': 'WC_', // prefix on imported resources (not applicable if the repository is local)
+
+                       // if we should check for shared repository asset ( generally only applicable to commons )
                        'check_shared':true,
 
-                       //list all the domains where commons is local?
+                       // list all the domains where commons is local?
                        // probably should set this some other way by doing an api query
                        // or by seeding this config when calling the remote search?
-                       'local_domains': ['wikimedia','wikipedia','wikibooks'],
-                       //specific to wiki commons config:
-                       'search_title':false, //disable title search
+                       'local_domains': ['wikimedia', 'wikipedia', 'wikibooks'],
+                       // specific to wiki commons config:
+                       'search_title':false, // disable title search
                        'tab_img':true
                },
-               'archive_org':{
+               'archive_org': {
                        'enabled':1,
-                       'checked':1,                    
+                       'checked':1,
                        'homepage':'http://www.archive.org/about/about.php',
 
                        'api_url':'http://homeserver7.us.archive.org:8983/solr/select',
@@ -201,118 +201,118 @@ remoteSearchDriver.prototype = {
                        'resource_prefix': 'AO_',
                        'tab_img':true
                },
-               'flickr':{
+               'flickr': {
                        'enabled':1,
-                       'checked':1,            
+                       '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 identifier/title
+                       // resources from fliker don't have a human parsable identifier/title
                        'resource_prefix': '',
                        'tab_img':true
-               },                              
-               'metavid':{
+               },
+               'metavid': {
                        'enabled' : 1,
                        'checked' : 1,
                        'homepage':'http://metavid.org/wiki/Metavid_Overview',
                        'api_url':'http://metavid.org/w/index.php?title=Special:MvExportSearch',
                        'lib'   : 'metavid',
-                       'local' :false,                 //if local set to true we can use local
-                       'resource_prefix': 'MV_', //what prefix to use on imported resources
+                       'local' :false,                 // if local set to true we can use local
+                       'resource_prefix': 'MV_', // what prefix to use on imported resources
 
                        'local_domains': ['metavid'], // if the domain name contains metavid
                                                                           // no need to import metavid content to metavid sites
 
                        'stream_import_key': 'mv_ogg_low_quality', // which stream to import, could be mv_ogg_high_quality
-                                                                                                         //or flash stream, see ROE xml for keys
+                                                                                                         // or flash stream, see ROE xml for keys
 
-                       'remote_embed_ext': false, //if running the remoteEmbed extension no need to copy local
-                                                                          //syntax will be [remoteEmbed:roe_url link title]
+                       'remote_embed_ext': false, // if running the remoteEmbed extension no need to copy local
+                                                                          // syntax will be [remoteEmbed:roe_url link title]
                        'tab_img':true
                },
-               //special cp "upload"
-               'upload':{
+               // special cp "upload"
+               'upload': {
                        'enabled':1,
                        'checked':1,
                        'title' :'Upload'
                }
-       },      
-       //some default layout values:
+       },
+       // some default layout values:
        thumb_width                     : 80,
        image_edit_width        : 400,
        video_edit_width        : 400,
-       insert_text_pos         : 0,      //insert at the start (will be overwritten by the user cursor pos)
-       result_display_mode : 'box', //box or list
+       insert_text_pos         : 0,      // insert at the start (will be overwritten by the user cursor pos)
+       result_display_mode : 'box', // box or list
 
        cUpLoader                       : null,
        cEdit                           : null,
        proxySetupDone          : null,
-       dmodalCss                       : {},
+       dmodalCss                       : { },
 
-       init: function( options ){
+       init: function( options ) {
                var _this = this;
-               js_log('remoteSearchDriver:init');
+               js_log( 'remoteSearchDriver:init' );
                
-               //merge in the options:  
-               //@@todo for cleaner config we should set _this.opt to the provided options) 
-               $j.extend( _this, default_remote_search_options, options);                      
+               // merge in the options:  
+               // @@todo for cleaner config we should set _this.opt to the provided options) 
+               $j.extend( _this, default_remote_search_options, options );
                
-               //Quick fix for cases where people put ['all'] instead of 'all' for enabled_cps
-               if( _this.enabled_cps.length == 1 && _this.enabled_cps[0] == 'all')
+               // Quick fix for cases where people put ['all'] instead of 'all' for enabled_cps
+               if ( _this.enabled_cps.length == 1 && _this.enabled_cps[0] == 'all' )
                        _this.enabled_cps = 'all';
                
-               //modify the content provider config based on options:          
-               for(var i in this.content_providers){           
-                       if(     _this.enabled_cps == 'all' && !this.disp_item  ){       
+               // modify the content provider config based on options:                 
+               for ( var i in this.content_providers ) {
+                       if (    _this.enabled_cps == 'all' && !this.disp_item  ) {
                                this.disp_item = i;
-                               //end the for loop (no need to idorate if enabled_cps == 'all'
+                               // end the for loop (no need to idorate if enabled_cps == 'all'
                                break;
-                       }else{
-                               if( $j.inArray( i, _this.enabled_cps ) != -1 ){
-                                       //if no default display set to first enabled cp: 
-                                       if( !this.disp_item )
+                       } else {
+                               if ( $j.inArray( i, _this.enabled_cps ) != - 1 ) {
+                                       // if no default display set to first enabled cp: 
+                                       if ( !this.disp_item )
                                                this.disp_item = i;
                                        this.content_providers[i].enabled = true;
-                               }else{
-                                       if( _this.enabled_cps != 'all' ){
+                               } else {
+                                       if ( _this.enabled_cps != 'all' ) {
                                                this.content_providers[i].enabled = false;
                                        }
-                               }               
+                               }
                        }
                }
                        
-               //set the upload target name if unset
-               if( _this.upload_api_target == 'local' &&  ! _this.upload_api_name && typeof wgSiteName != 'undefined')
+               // set the upload target name if unset
+               if ( _this.upload_api_target == 'local' &&  ! _this.upload_api_name && typeof wgSiteName != 'undefined' )
                        _this.upload_api_name =  wgSiteName;
                        
-               //if the upload_api_proxy_frame is set _this.upload_api_target to "proxy"
-               if( _this.upload_api_proxy_frame )
+               // if the upload_api_proxy_frame is set _this.upload_api_target to "proxy"
+               if ( _this.upload_api_proxy_frame )
                        _this.upload_api_target = 'proxy';
                
-               //map "local" to the local api                  
-               if( _this.upload_api_target == 'local' ){
-                       if( ! _this.local_wiki_api_url ){
-                               $j('#tab-upload').html( gM( 'rsd_config_error', 'missing_local_api_url' ) );
+               // map "local" to the local api                         
+               if ( _this.upload_api_target == 'local' ) {
+                       if ( ! _this.local_wiki_api_url ) {
+                               $j( '#tab-upload' ).html( gM( 'rsd_config_error', 'missing_local_api_url' ) );
                                return false;
-                       }else{
+                       } else {
                                _this.upload_api_target = _this.local_wiki_api_url;
                        }
-               }               
+               }
                                                
-               //set up the target invocation:
-               if( $j( this.target_invocation ).length==0 ){
-                       js_log("RemoteSearchDriver:: no target invocation provided (will have to run your own doInitDisplay() )");
-               }else{
-                       if( this.target_invocation ){
-                               $j(this.target_invocation).css('cursor','pointer').attr('title', gM('mwe-add_media_wizard')).click(function(){
+               // set up the target invocation:
+               if ( $j( this.target_invocation ).length == 0 ) {
+                       js_log( "RemoteSearchDriver:: no target invocation provided (will have to run your own doInitDisplay() )" );
+               } else {
+                       if ( this.target_invocation ) {
+                               $j( this.target_invocation ).css( 'cursor', 'pointer' ).attr( 'title', gM( 'mwe-add_media_wizard' ) ).click( function() {
                                        _this.doInitDisplay();
-                               });
+                               } );
                        }
                }
        },
-       //define the licenses
+       // define the licenses
        // ... this will get complicated quick...
        // (just look at complexity for creative commons without excessive "duplicate data")
        // ie cc_by could be "by/3.0/us/" or "by/2.1/jp/" to infinitum...
@@ -321,10 +321,10 @@ remoteSearchDriver.prototype = {
        // but we will have to abstract into another class let content providers provide license urls
        // and we have to clone the license object and allow local overrides
 
-       licenses:{
-               //for now only support creative commons type licenses
-               //used page: http://creativecommons.org/licenses/
-               'cc':{
+       licenses: {
+               // for now only support creative commons type licenses
+               // used page: http://creativecommons.org/licenses/
+               'cc': {
                        'base_img_url':'http://upload.wikimedia.org/wikipedia/commons/thumb/',
                        'base_license_url': 'http://creativecommons.org/licenses/',
                        'licenses':[
@@ -337,20 +337,20 @@ remoteSearchDriver.prototype = {
                                'by-sa',
                                'pd'
                        ],
-                       'license_img':{
-                               'by':{
+                       'license_img': {
+                               'by': {
                                        'im':'1/11/Cc-by_new_white.svg/20px-Cc-by_new_white.svg.png'
                                },
-                               'nc':{
+                               'nc': {
                                        'im':'2/2f/Cc-nc_white.svg/20px-Cc-nc_white.svg.png'
                                },
-                               'nd':{
+                               'nd': {
                                        'im':'b/b3/Cc-nd_white.svg/20px-Cc-nd_white.svg.png'
                                },
-                               'sa':{
+                               'sa': {
                                        'im':'d/df/Cc-sa_white.svg/20px-Cc-sa_white.svg.png'
                                },
-                               'pd':{
+                               'pd': {
                                        'im':'5/51/Cc-pd-new_white.svg/20px-Cc-pd-new_white.svg.png'
                                }
                        }
@@ -360,36 +360,36 @@ remoteSearchDriver.prototype = {
         * getlicenseImgSet
         * @param license_key  the license key (ie "by-sa" or "by-nc-sa" etc)
         */
-       getlicenseImgSet: function( licenseObj ){
-               //js_log('output images: '+ imgs);
-               return '<div class="rsd_license" title="'+ licenseObj.title + '" >' +
-                                       '<a target="_new" href="'+ licenseObj.lurl +'" ' +
-                                       'title="' + licenseObj.title + '">'+
+       getlicenseImgSet: function( licenseObj ) {
+               // js_log('output images: '+ imgs);
+               return '<div class="rsd_license" title="' + licenseObj.title + '" >' +
+                                       '<a target="_new" href="' + licenseObj.lurl + '" ' +
+                                       'title="' + licenseObj.title + '">' +
                                                        licenseObj.img_html +
-                                       '</a>'+
+                                       '</a>' +
                                  '</div>';
-       },      
+       },
        /*
         * getLicenceKeyFromKey
         * @param license_key the key of the license (must be defined in: this.licenses.cc.licenses)
         */
-       getLicenceFromKey:function( license_key , force_url){   
-               //set the current license pointer:
+       getLicenceFromKey:function( license_key , force_url ) {
+               // set the current license pointer:
                var cl = this.licenses.cc;
-               var title = gM('mwe-cc_title');
+               var title = gM( 'mwe-cc_title' );
                var imgs = '';
-               var license_set = license_key.split('-');
-               for(var i=0;i < license_set.length; i++){
+               var license_set = license_key.split( '-' );
+               for ( var i = 0; i < license_set.length; i++ ) {
                        var lkey =       license_set[i];
-                       if(! cl.license_img[ lkey ] ){
-                               js_log("MISSING::" + lkey );
+                       if ( ! cl.license_img[ lkey ] ) {
+                               js_log( "MISSING::" + lkey );
                        }
                        
-                       title += ' ' + gM( 'mwe-cc_' + lkey + '_title');
-                       imgs +='<img class="license_desc" width="20" src="' 
+                       title += ' ' + gM( 'mwe-cc_' + lkey + '_title' );
+                       imgs += '<img class="license_desc" width="20" src="'
                                + cl.base_img_url +     cl.license_img[ lkey ].im + '">';
                }
-               var url = (force_url) ? force_url : cl.base_license_url + cl.licenses[ license_key ];
+               var url = ( force_url ) ? force_url : cl.base_license_url + cl.licenses[ license_key ];
                return {
                        'title'         : title,
                        'img_html'      : imgs,
@@ -401,31 +401,31 @@ remoteSearchDriver.prototype = {
         * getLicenceKeyFromUrl
         * @param licence_url the url of the license
         */
-       getLicenceFromUrl: function( license_url ){
-               //check for some pre-defined url types:
-               if( license_url == 'http://www.usa.gov/copyright.shtml' ||
+       getLicenceFromUrl: function( license_url ) {
+               // check for some pre-defined url types:
+               if ( license_url == 'http://www.usa.gov/copyright.shtml' ||
                        license_url == 'http://creativecommons.org/licenses/publicdomain' )
-                       return this.getLicenceFromKey('pd' , license_url);
+                       return this.getLicenceFromKey( 'pd' , license_url );
                        
                
-               //js_log("getLicenceFromUrl::" + license_url);                          
-               //first do a direct lookup check:
-               for(var j =0; j < this.licenses.cc.licenses.length; j++){
+               // js_log("getLicenceFromUrl::" + license_url);                         
+               // first do a direct lookup check:
+               for ( var j = 0; j < this.licenses.cc.licenses.length; j++ ) {
                        var jL = this.licenses.cc.licenses[ j ];
-                       //special 'pd' case: 
-                       if( jL == 'pd'){
+                       // special 'pd' case: 
+                       if ( jL == 'pd' ) {
                                var keyCheck = 'publicdomain';
-                       }else{
+                       } else {
                                var keyCheck = jL;
-                       }                       
-                       if( parseUri(license_url).path.indexOf('/'+ keyCheck +'/') != -1){
-                               return this.getLicenceFromKey(jL , license_url);
                        }
-               };                              
-               //could not find it return mwe-unknown_license
+                       if ( parseUri( license_url ).path.indexOf( '/' + keyCheck + '/' ) != - 1 ) {
+                               return this.getLicenceFromKey( jL , license_url );
+                       }
+               };
+               // could not find it return mwe-unknown_license
                return {
-                       'title'         : gM('mwe-unknown_license'),
-                       'img_html'      : '<span>' + gM('mwe-unknown_license') + '</span>',
+                       'title'         : gM( 'mwe-unknown_license' ),
+                       'img_html'      : '<span>' + gM( 'mwe-unknown_license' ) + '</span>',
                        'lurl'          : license_url
                };
        },
@@ -433,9 +433,9 @@ remoteSearchDriver.prototype = {
        * getTypeIcon
        * @param str mime type of the requested file
        */
-       getTypeIcon:function( mimetype) {
+       getTypeIcon:function( mimetype ) {
                var typestr = 'unk';
-               switch( mimetype ){
+               switch( mimetype ) {
                        case 'image/svg+xml':
                                typestr = 'svg';
                        break;
@@ -453,275 +453,275 @@ remoteSearchDriver.prototype = {
                        break;
                }
                
-               if(typestr=='unk'){
-                       js_log("unkown ftype: " + mimetype );
+               if ( typestr == 'unk' ) {
+                       js_log( "unkown ftype: " + mimetype );
                        return '';
-               }               
+               }
                         
-               return '<div class="rsd_file_type ui-corner-all ui-state-default ui-widget-content" title="' + gM('mwe-ftype-' + typestr) + '">' +
+               return '<div class="rsd_file_type ui-corner-all ui-state-default ui-widget-content" title="' + gM( 'mwe-ftype-' + typestr ) + '">' +
                                        typestr  +
                                '</div>'
        },
-       doInitDisplay:function(){
+       doInitDisplay:function() {
                var _this = this;
                
-               //try and get the text selection:       
+               // try and get the text selection:      
                _this.getTexboxSelection();
                
-               //setup the parent container:
+               // setup the parent container:
                this.init_modal();
-               //fill in the html:
+               // fill in the html:
                this.init_interface_html();
-               //bind actions:
+               // bind actions:
                this.add_interface_bindings();
 
-               //update the target binding to just un-hide the dialog:
-               if( this.target_invocation ){
-                       $j(this.target_invocation).unbind().click(function(){
-                               js_log("doInitDisplay:target_invocation: click doReDisp");
+               // update the target binding to just un-hide the dialog:
+               if ( this.target_invocation ) {
+                       $j( this.target_invocation ).unbind().click( function() {
+                               js_log( "doInitDisplay:target_invocation: click doReDisp" );
                                 _this.doReDisplay();
-                        });
+                        } );
                 }
        },
-       doReDisplay: function(){
+       doReDisplay: function() {
                var _this = this;
-               js_log("doReDisplay::");
-               //update the base text:
+               js_log( "doReDisplay::" );
+               // update the base text:
                _this.getTexboxSelection();
-               if( _this.default_query !=  $j('#rsd_q').val() ){
-                       $j('#rsd_q').val( _this.default_query );
+               if ( _this.default_query !=  $j( '#rsd_q' ).val() ) {
+                       $j( '#rsd_q' ).val( _this.default_query );
                        _this.runSearch();
                }
-               //$j(_this.target_container).dialog("open");
-               $j(_this.target_container).parents('.ui-dialog').fadeIn('slow');
-               //re-center the dialog:
-               $j(_this.target_container).dialog('option', 'position','center');
+               // $j(_this.target_container).dialog("open");
+               $j( _this.target_container ).parents( '.ui-dialog' ).fadeIn( 'slow' );
+               // re-center the dialog:
+               $j( _this.target_container ).dialog( 'option', 'position', 'center' );
        },
-       //gets the in and out points for insert position or grabs the selected text for search
-       getTexboxSelection:function(){          
-               if(this.target_textbox){
-                       //get the selection text:
-                       var ts = $j(this.target_textbox).textSelection();
-                       if(ts!=''){
+       // gets the in and out points for insert position or grabs the selected text for search
+       getTexboxSelection:function() {
+               if ( this.target_textbox ) {
+                       // get the selection text:
+                       var ts = $j( this.target_textbox ).textSelection();
+                       if ( ts != '' ) {
                                this.default_query = ts;
                        }
-                       //get the caretPos / value
-                       this.caret_pos={};
-                       this.caret_pos.text = $j(this.target_textbox).val();            
-                       this.caret_pos.s = $j(this.target_textbox).getCaretPosition();
+                       // get the caretPos / value
+                       this.caret_pos = { };
+                       this.caret_pos.text = $j( this.target_textbox ).val();
+                       this.caret_pos.s = $j( this.target_textbox ).getCaretPosition();
                }
-       },      
-       init_modal:function(){
-               js_log("init_modal");
-               var _this = this;       
-               //add the parent target_container if not provided or missing
-               if(!_this.target_container || $j(_this.target_container).length==0){
+       },
+       init_modal:function() {
+               js_log( "init_modal" );
+               var _this = this;
+               // add the parent target_container if not provided or missing
+               if ( !_this.target_container || $j( _this.target_container ).length == 0 ) {
                        _this.target_container = '#rsd_modal_target';
-                       $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:3em;left:0px;bottom:3em;right:0px;" title="' + gM('mwe-add_media_wizard') + '" ></div>');                    
-                       //js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id'));
-                       //js_log('added target id:' + $j(_this.target_container).attr('id'));
-                       //get layout
-                       js_log( 'width: ' + $j(window).width() +  ' height: ' + $j(window).height());
-                       var cBtn = {};
-                       cBtn[ gM('mwe-cancel') ] = function(){
+                       $j( 'body' ).append( '<div id="rsd_modal_target" style="position:absolute;top:3em;left:0px;bottom:3em;right:0px;" title="' + gM( 'mwe-add_media_wizard' ) + '" ></div>' );
+                       // js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id'));
+                       // js_log('added target id:' + $j(_this.target_container).attr('id'));
+                       // get layout
+                       js_log( 'width: ' + $j( window ).width() +  ' height: ' + $j( window ).height() );
+                       var cBtn = { };
+                       cBtn[ gM( 'mwe-cancel' ) ] = function() {
                                _this.cancelClipEditCB();
-                       }                                               
+                       }
                        
-                       $j(_this.target_container).dialog({
+                       $j( _this.target_container ).dialog( {
                                bgiframe: true,
                                autoOpen: true,
                                modal: true,
                                draggable:false,
                                resizable:false,
-                               buttons:cBtn,                                                           
+                               buttons:cBtn,
                                close: function() {
-                                       //if we are 'editing' a item close that 
-                                       //@@todo maybe prompt the user?                                         
-                                       _this.cancelClipEditCB();                                                                                                                       
-                                       $j(this).parents('.ui-dialog').fadeOut('slow');                         
+                                       // if we are 'editing' a item close that 
+                                       // @@todo maybe prompt the user?                                        
+                                       _this.cancelClipEditCB();
+                                       $j( this ).parents( '.ui-dialog' ).fadeOut( 'slow' );
                                }
-                       });                             
-                       $j(_this.target_container).dialogFitWindow();
-                       $j(window).resize(function(){
-                               $j(_this.target_container).dialogFitWindow();
-                       });                     
+                       } );
+                       $j( _this.target_container ).dialogFitWindow();
+                       $j( window ).resize( function() {
+                               $j( _this.target_container ).dialogFitWindow();
+                       } );
                        
-                       //add cancel callback and updated button with icon
-                       _this.cancelClipEditCB();                                       
+                       // add cancel callback and updated button with icon
+                       _this.cancelClipEditCB();
                }
        },
-       //sets up the initial html interface
-       init_interface_html:function(){
-               js_log('init_interface_html');
+       // sets up the initial html interface
+       init_interface_html:function() {
+               js_log( 'init_interface_html' );
                var _this = this;
-               var dq = (this.default_query)? this.default_query : '';
-               js_log('f::init_interface_html');
+               var dq = ( this.default_query ) ? this.default_query : '';
+               js_log( 'f::init_interface_html' );
 
                var o = '<div class="rsd_control_container" style="width:100%">' +
-                                       '<form id="rsd_form" action="javascript:return false;" method="GET">'+
-                                               '<input class="ui-widget-content ui-corner-all" type="text" tabindex="1" value="' + dq + '" maxlength="512" id="rsd_q" name="rsd_q" '+
-                                                       'size="20" autocomplete="off"/> '+
-                                               $j.btnHtml( gM('mwe-media_search'), 'rms_search_button', 'search') +
+                                       '<form id="rsd_form" action="javascript:return false;" method="GET">' +
+                                               '<input class="ui-widget-content ui-corner-all" type="text" tabindex="1" value="' + dq + '" maxlength="512" id="rsd_q" name="rsd_q" ' +
+                                                       'size="20" autocomplete="off"/> ' +
+                                               $j.btnHtml( gM( 'mwe-media_search' ), 'rms_search_button', 'search' ) +
                                        '</form>';
-               //close up the control container:
-               o+='</div>';
+               // close up the control container:
+               o += '</div>';
 
-               //search provider tabs based on "checked" and "enabled" and "combined tab"
-               o+='<div id="rsd_results_container" style="top:0px;bottom:0px;left:0px;right:0px;"></div>';
-               $j(this.target_container).html( o );
+               // search provider tabs based on "checked" and "enabled" and "combined tab"
+               o += '<div id="rsd_results_container" style="top:0px;bottom:0px;left:0px;right:0px;"></div>';
+               $j( this.target_container ).html( o );
 
-               //add simple styles:
-               $j(this.target_container + ' .rms_search_button').btnBind().click(function(){                   
+               // add simple styles:
+               $j( this.target_container + ' .rms_search_button' ).btnBind().click( function() {
                        _this.runSearch();
-               });
+               } );
 
-               //draw the tabs:
+               // draw the tabs:
                this.drawTabs();
-               //run the default search:
-               if( this.default_query )
+               // run the default search:
+               if ( this.default_query )
                        this.runSearch();
        },
-       add_interface_bindings:function(){
+       add_interface_bindings:function() {
                var _this = this;
-               js_log("f:add_interface_bindings:");
+               js_log( "f:add_interface_bindings:" );
 
 
-               $j('#mso_selprovider,#mso_selprovider_close').unbind().click(function(){
-                       if($j('#rsd_options_bar:hidden').length !=0 ){
-                               $j('#rsd_options_bar').animate({
+               $j( '#mso_selprovider,#mso_selprovider_close' ).unbind().click( function() {
+                       if ( $j( '#rsd_options_bar:hidden' ).length != 0 ) {
+                               $j( '#rsd_options_bar' ).animate( {
                                        'height':'110px',
                                        'opacity':1
-                               }, "normal");
-                       }else{
-                               $j('#rsd_options_bar').animate({
+                               }, "normal" );
+                       } else {
+                               $j( '#rsd_options_bar' ).animate( {
                                        'height':'0px',
                                        'opacity':0
-                               }, "normal", function(){
-                                       $j(this).hide();
-                               });
+                               }, "normal", function() {
+                                       $j( this ).hide();
+                               } );
                        }
-               });
-               //set form bindings
-               $j('#rsd_form').unbind().submit(function(){
+               } );
+               // set form bindings
+               $j( '#rsd_form' ).unbind().submit( function() {
                        _this.runSearch();
-                       //don't submit the form
+                       // don't submit the form
                        return false;
-               });
+               } );
        },
-       doUploadInteface:function(){
-               js_log("doUploadInteface::");
+       doUploadInteface:function() {
+               js_log( "doUploadInteface::" );
                var _this = this;
-               //set it to loading:
-               mv_set_loading('#tab-upload');
-               //do things async to keep interface snappy
-               setTimeout(function(){
-                       //check if we need to setup the proxy::
-                       if( _this.upload_api_target == 'proxy' ){
-                               _this.setupProxy( function(){
+               // set it to loading:
+               mv_set_loading( '#tab-upload' );
+               // do things async to keep interface snappy
+               setTimeout( function() {
+                       // check if we need to setup the proxy::
+                       if ( _this.upload_api_target == 'proxy' ) {
+                               _this.setupProxy( function() {
                                        _this.getUploadForm();
-                               });                                                                                                             
-                       }else{                          
+                               } );
+                       } else {
                                _this.getUploadForm();
-                       }                                                       
-               },1);
+                       }
+               }, 1 );
        },
-       getUploadForm:function(){
+       getUploadForm:function() {
                var _this = this;
-               mvJsLoader.doLoad(['$j.fn.simpleUploadForm'],function(){
-                       //get extends info about the file
+               mvJsLoader.doLoad( ['$j.fn.simpleUploadForm'], function() {
+                       // get extends info about the file
                        var cp = _this.content_providers['this_wiki'];
                        
-                       //check for "this_wiki" enabled
+                       // check for "this_wiki" enabled
                        /*if(!cp.enabled){
                                $j('#tab-upload').html('error this_wiki not enabled (can\'t get uploaded file info)');
                                return false;
                        }*/
        
-                       //load  this_wiki search system to grab the rObj
-                       _this.loadSearchLib(cp, function(){
-                               //do basic layout form on left upload "bin" on right
-                               $j('#tab-upload').html('<table>' +
+                       // load  this_wiki search system to grab the rObj
+                       _this.loadSearchLib( cp, function() {
+                               // do basic layout form on left upload "bin" on right
+                               $j( '#tab-upload' ).html( '<table>' +
                                '<tr>' +
                                        '<td valign="top" style="width:350px; padding-right: 12px;">' +
-                                               '<h4>' + gM('mwe-upload_a_file', _this.upload_api_name ) + '</h4>' +
+                                               '<h4>' + gM( 'mwe-upload_a_file', _this.upload_api_name ) + '</h4>' +
                                                '<div id="upload_form">' +
                                                        mv_get_loading_img() +
                                                '</div>' +
                                        '</td>' +
                                        '<td valign="top" id="upload_bin_cnt">' +
-                                       '<h4>' + gM('mwe-your_recent_uploads', _this.upload_api_name) + '</h4>' +
+                                       '<h4>' + gM( 'mwe-your_recent_uploads', _this.upload_api_name ) + '</h4>' +
                                                '<div id="upload_bin">' +
                                                        mv_get_loading_img() +
-                                               '</div>'+
+                                               '</div>' +
                                        '</td>' +
                                '</tr>' +
-                               '</table>');
+                               '</table>' );
        
        
-                               //fill in the user page:
-                               if(typeof wgUserName != 'undefined' && wgUserName){                                             
-                                       //load the upload bin with anything the current user has uploaded
-                                       cp.sObj.getUserRecentUploads( wgUserName, function(){
+                               // fill in the user page:
+                               if ( typeof wgUserName != 'undefined' && wgUserName ) {
+                                       // load the upload bin with anything the current user has uploaded
+                                       cp.sObj.getUserRecentUploads( wgUserName, function() {
                                                _this.drawOutputResults();
-                                       });
-                               }else{
-                                       $j('#upload_bin_cnt').empty();
+                                       } );
+                               } else {
+                                       $j( '#upload_bin_cnt' ).empty();
                                }
        
-                               //deal with the api form upload form directly:
-                               $j('#upload_form').simpleUploadForm({
+                               // deal with the api form upload form directly:
+                               $j( '#upload_form' ).simpleUploadForm( {
                                        "api_target" :  _this.upload_api_target,
-                                       "ondone_cb"     : function( resultData ){
-                                               var wTitle = resultData['filename'];    
-                                               //add a loading div
+                                       "ondone_cb"     : function( resultData ) {
+                                               var wTitle = resultData['filename'];
+                                               // add a loading div
                                                _this.addResourceEditLoader();
-                                               //@@note: we have most of what we need in resultData imageinfo
-                                               cp.sObj.addByTitle( wTitle, function( rObj ){                                                           
-                                                       //redraw ( with added result if new )
+                                               // @@note: we have most of what we need in resultData imageinfo
+                                               cp.sObj.addByTitle( wTitle, function( rObj ) {
+                                                       // redraw ( with added result if new )
                                                        _this.drawOutputResults();
-                                                       //pull up resource editor:                                                                      
-                                                       _this.resourceEdit( rObj, $j('#res_upload__' + rObj.id).get(0) );                                                                       
-                                               });
-                                               //return false to close progress window:
+                                                       // pull up resource editor:                                                                     
+                                                       _this.resourceEdit( rObj, $j( '#res_upload__' + rObj.id ).get( 0 ) );
+                                               } );
+                                               // return false to close progress window:
                                                return false;
                                        }
-                               });             
-                       }); //load searchLibs
-               }); //load simpleUploadForm
+                               } );
+                       } ); // load searchLibs
+               } ); // load simpleUploadForm
        },
-       runSearch: function( restPage ){
-               js_log("f:runSearch::" + this.disp_item);
+       runSearch: function( restPage ) {
+               js_log( "f:runSearch::" + this.disp_item );
 
                var draw_direct_flag = true;
                        
-               //check if its the special upload tab case:
-               if( this.disp_item == 'upload'){
+               // check if its the special upload tab case:
+               if ( this.disp_item == 'upload' ) {
                        this.doUploadInteface();
                        return true;
                }
                
-               //else do runSearch                                     
+               // else do runSearch                                    
                var cp = this.content_providers[this.disp_item];
 
-               //check if we need to update:
-               if( typeof cp.sObj != 'undefined' ){
-                       if(cp.sObj.last_query == $j('#rsd_q').val() && cp.sObj.last_offset == cp.offset){
-                               js_log('last query is: ' + cp.sObj.last_query + ' matches: ' +  $j('#rsd_q').val() );
-                       }else{
-                               js_log('last query is: ' + cp.sObj.last_query + ' not match: ' +  $j('#rsd_q').val() );
+               // check if we need to update:
+               if ( typeof cp.sObj != 'undefined' ) {
+                       if ( cp.sObj.last_query == $j( '#rsd_q' ).val() && cp.sObj.last_offset == cp.offset ) {
+                               js_log( 'last query is: ' + cp.sObj.last_query + ' matches: ' +  $j( '#rsd_q' ).val() );
+                       } else {
+                               js_log( 'last query is: ' + cp.sObj.last_query + ' not match: ' +  $j( '#rsd_q' ).val() );
                                draw_direct_flag = false;
                        }
-               }else{
+               } else {
                        draw_direct_flag = false;
                }
-               if( !draw_direct_flag ){
-                       //see if we should reset the paging
-                       if( restPage ){
+               if ( !draw_direct_flag ) {
+                       // see if we should reset the paging
+                       if ( restPage ) {
                                cp.sObj.offset = cp.offset = 0;
                        }
                
-                       //set the content to loading while we do the search:
-                       $j('#tab-' + this.disp_item).html( mv_get_loading_img() );
+                       // set the content to loading while we do the search:
+                       $j( '#tab-' + this.disp_item ).html( mv_get_loading_img() );
 
                        // Make sure the search library is loaded and issue the search request
                        this.getLibSearchResults( cp );
@@ -729,50 +729,50 @@ remoteSearchDriver.prototype = {
        },
        // Issue a api request & cache the result
        // this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | instead of 'autodetect' or 'none'
-       checkForCopyURLSupport:function ( callback ){
+       checkForCopyURLSupport:function ( callback ) {
                var _this = this;
-               js_log('checkForCopyURLSupport:: ');            
+               js_log( 'checkForCopyURLSupport:: ' );
                
                // See if we already have the import mode:
-               if( this.import_url_mode != 'autodetect'){
-                       js_log('import mode: ' + _this.import_url_mode);
+               if ( this.import_url_mode != 'autodetect' ) {
+                       js_log( 'import mode: ' + _this.import_url_mode );
                        callback();
                }
                // If we don't have the local wiki api defined we can't auto-detect use "link"
-               if( ! _this.upload_api_target ){
-                       js_log('import mode: remote link (no import_wiki_api_url)');
+               if ( ! _this.upload_api_target ) {
+                       js_log( 'import mode: remote link (no import_wiki_api_url)' );
                        _this.import_url_mode = 'remote_link';
                        callback();
                }
-               if( this.import_url_mode == 'autodetect' ){
+               if ( this.import_url_mode == 'autodetect' ) {
                        do_api_req( {
                                'url': _this.upload_api_target,
-                               'data': { 
-                                       'action':'paraminfo', 
-                                       'modules':'upload' 
+                               'data': {
+                                       'action':'paraminfo',
+                                       'modules':'upload'
                                }
-                       }, function(data){                              
-                               //jump right into api checks: 
-                               for( var i in data.paraminfo.modules[0].parameters ){
+                       }, function( data ) {
+                               // jump right into api checks: 
+                               for ( var i in data.paraminfo.modules[0].parameters ) {
                                        var pname = data.paraminfo.modules[0].parameters[i].name;
-                                       if( pname == 'url' ){
+                                       if ( pname == 'url' ) {
                                                js_log( 'Autodetect Upload Mode: api: copy by url:: ' );
-                                               //check permission  too:
-                                               _this.checkForCopyURLPermission(function( canCopyUrl ){
-                                                       if(canCopyUrl){
+                                               // check permission  too:
+                                               _this.checkForCopyURLPermission( function( canCopyUrl ) {
+                                                       if ( canCopyUrl ) {
                                                                _this.import_url_mode = 'api';
-                                                               js_log('import mode: ' + _this.import_url_mode);
+                                                               js_log( 'import mode: ' + _this.import_url_mode );
                                                                callback();
-                                                       }else{
+                                                       } else {
                                                                _this.import_url_mode = 'none';
-                                                               js_log('import mode: ' + _this.import_url_mode);
+                                                               js_log( 'import mode: ' + _this.import_url_mode );
                                                                callback();
                                                        }
-                                               });
+                                               } );
                                                break;
                                        }
                                }
-                       });
+                       } );
                }
        },
        /*
@@ -780,470 +780,470 @@ remoteSearchDriver.prototype = {
         * not really necessary the api request to upload will return appropriate error if the user lacks permission. or $wgAllowCopyUploads is set to false
         * (use this function if we want to issue a warning up front)
         */
-       checkForCopyURLPermission:function( callback ){
+       checkForCopyURLPermission:function( callback ) {
                var _this = this;
-               //do api check:
+               // do api check:
                do_api_req( {
-                               'data':{ 'action' : 'query', 'meta' : 'userinfo', 'uiprop' : 'rights' },
+                               'data': { 'action' : 'query', 'meta' : 'userinfo', 'uiprop' : 'rights' },
                                'url': _this.upload_api_target,
                                'userinfo' : true
-               }, function(data){
-                       for( var i in data.query.userinfo.rights){
+               }, function( data ) {
+                       for ( var i in data.query.userinfo.rights ) {
                                var right = data.query.userinfo.rights[i];
-                               //js_log('checking: ' + right ) ;
-                               if(right == 'upload_by_url'){
+                               // js_log('checking: ' + right ) ;
+                               if ( right == 'upload_by_url' ) {
                                        callback( true );
-                                       return true; //break out of the function
+                                       return true; // break out of the function
                                }
                        }
                        callback( false );
-               });
+               } );
        },
-       getLibSearchResults:function( cp ){
+       getLibSearchResults:function( cp ) {
                var _this = this;
 
-               //first check if we should even run the search at all (can we import / insert into the page? )
-               if( !this.checkRepoLocal( cp ) && this.import_url_mode == 'autodetect' ){
-                       //cp is not local check if we can support the import mode:
-                       this.checkForCopyURLSupport( function(){
+               // first check if we should even run the search at all (can we import / insert into the page? )
+               if ( !this.checkRepoLocal( cp ) && this.import_url_mode == 'autodetect' ) {
+                       // cp is not local check if we can support the import mode:
+                       this.checkForCopyURLSupport( function() {
                                _this.getLibSearchResults( cp );
-                       });
+                       } );
                        return false;
-               }else if( !this.checkRepoLocal( cp ) && this.import_url_mode == 'none'){
-                       if(  this.disp_item == 'combined' ){
-                               //combined results are harder to error handle just ignore that repo
+               } else if ( !this.checkRepoLocal( cp ) && this.import_url_mode == 'none' ) {
+                       if (  this.disp_item == 'combined' ) {
+                               // combined results are harder to error handle just ignore that repo
                                cp.sObj.loading = false;
-                       }else{
-                               $j('#tab-' + this.disp_item).html( '<div style="padding:10px">'+ gM('mwe-no_import_by_url') +'</div>');
+                       } else {
+                               $j( '#tab-' + this.disp_item ).html( '<div style="padding:10px">' + gM( 'mwe-no_import_by_url' ) + '</div>' );
                        }
                        return false;
                }
-               _this.loadSearchLib(cp, function(){
+               _this.loadSearchLib( cp, function() {
                        // Do the search
                        cp.sObj.getSearchResults();
                        _this.checkResultsDone();
-               });
+               } );
        },
-       loadSearchLib:function(cp, callback){
-               var _this = this;               
-               //set up the library req:
+       loadSearchLib:function( cp, callback ) {
+               var _this = this;
+               // set up the library req:
                mvJsLoader.doLoad( [
                        'baseRemoteSearch',
                        cp.lib + 'Search'
-               ], function(){
-                       js_log("loaded lib:: " + cp.lib );
-                       //else we need to run the search:
+               ], function() {
+                       js_log( "loaded lib:: " + cp.lib );
+                       // else we need to run the search:
                        var iObj = {
-                               'cp'  : cp, 
+                               'cp'  : cp,
                                'rsd' : _this
                        };
-                       eval('cp.sObj = new ' + cp.lib + 'Search( iObj );' );
-                       if(!cp.sObj){
-                               js_log('Error: could not find search lib for ' + cp_id);
+                       eval( 'cp.sObj = new ' + cp.lib + 'Search( iObj );' );
+                       if ( !cp.sObj ) {
+                               js_log( 'Error: could not find search lib for ' + cp_id );
                                return false;
                        }
 
-                       //inherit defaults if not set:
-                       cp.limit = (cp.limit) ? cp.limit : cp.sObj.limit;
-                       cp.offset = (cp.offset) ? cp.offset : cp.sObj.offset;
+                       // inherit defaults if not set:
+                       cp.limit = ( cp.limit ) ? cp.limit : cp.sObj.limit;
+                       cp.offset = ( cp.offset ) ? cp.offset : cp.sObj.offset;
                        callback();
-               });
+               } );
        },
        /* check for all the results to finish */
-       checkResultsDone: function(){
-               //js_log('rsd:checkResultsDone');
+       checkResultsDone: function() {
+               // js_log('rsd:checkResultsDone');
                var _this = this;
                var loading_done = true;
 
-               for(var cp_id in  this.content_providers){
+               for ( var cp_id in  this.content_providers ) {
                        var cp = this.content_providers[ cp_id ];
-                       if(typeof cp['sObj'] != 'undefined'){
-                               if( cp.sObj.loading )
+                       if ( typeof cp['sObj'] != 'undefined' ) {
+                               if ( cp.sObj.loading )
                                        loading_done = false;
                        }
                }
-               if( loading_done ){
+               if ( loading_done ) {
                        this.drawOutputResults();
-               }else{
-                       //make sure the instance name is up-to-date refrerance to _this;
-                       eval( _this.instance_name + ' = _this');
-                       setTimeout( _this.instance_name + '.checkResultsDone()', 50);
+               } else {
+                       // make sure the instance name is up-to-date refrerance to _this;
+                       eval( _this.instance_name + ' = _this' );
+                       setTimeout( _this.instance_name + '.checkResultsDone()', 50 );
                }
        },
-       drawTabs: function(){
+       drawTabs: function() {
                var _this = this;
-               //add the tabs to the rsd_results container:
-               var o='<div id="rsd_tabs_container" style="width:100%;">';
+               // add the tabs to the rsd_results container:
+               var o = '<div id="rsd_tabs_container" style="width:100%;">';
                var selected_tab = 0;
-               var inx =0;
-               o+= '<ul>';
+               var inx = 0;
+               o += '<ul>';
                        var tabc = '';
-                       for(var cp_id in  this.content_providers){
+                       for ( var cp_id in  this.content_providers ) {
                                        var cp = this.content_providers[cp_id];
-                                       if( cp.enabled && cp.checked && cp.api_url){
-                                               //add selected default if set
-                                               if( this.disp_item == cp_id)
-                                                       selected_tab=inx;
-
-                                               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="' + gM('rsd-' + cp_id + '-title' ) +'" src="' + mv_embed_path +'/skins/common/remote_cp/' + cp_id + '_tab.png">';
-                                                       }else{
-                                                               o+= gM('rsd-' + cp_id + '-title' );
+                                       if ( cp.enabled && cp.checked && cp.api_url ) {
+                                               // add selected default if set
+                                               if ( this.disp_item == cp_id )
+                                                       selected_tab = inx;
+
+                                               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="' + gM( 'rsd-' + cp_id + '-title' ) + '" src="' + mv_embed_path + '/skins/common/remote_cp/' + cp_id + '_tab.png">';
+                                                       } else {
+                                                               o += gM( 'rsd-' + cp_id + '-title' );
                                                        }
-                                               o+='</a>';
-                                               o+='</li>';
+                                               o += '</a>';
+                                               o += '</li>';
                                                inx++;
                                        }
-                                       tabc+='<div id="tab-'+ cp_id +'" class="rsd_results"/>';
+                                       tabc += '<div id="tab-' + cp_id + '" class="rsd_results"/>';
 
                        }
                        // 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" />';
-                               if(this.disp_item == 'upload')
+                       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" />';
+                               if ( this.disp_item == 'upload' )
                                        selected_tab = inx++;
                        }
-                       o+='</ul>';
+                       o += '</ul>';
                        // Output the tab content containers:
-                       o+=tabc;
-               o+='</div>'; //close tab container
+                       o += tabc;
+               o += '</div>'; // close tab container
 
                // Output the respective results holders
-               $j('#rsd_results_container').html(o);
+               $j( '#rsd_results_container' ).html( o );
                // Setup bindings for tabs make them sortable: (@@todo remember order)
-               js_log('selected tab is: ' + selected_tab);
-               $j("#rsd_tabs_container").tabs({
+               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_', '') );
+                       select: function( event, ui ) {
+                               _this.selectTab( $j( ui.tab ).attr( 'id' ).replace( 'rsd_tab_', '' ) );
                        }
                // Add sorting
-               }).find(".ui-tabs-nav").sortable({axis:'x'});
-               //@@todo store sorted repo 
+               } ).find( ".ui-tabs-nav" ).sortable( { axis:'x' } );
+               // @@todo store sorted repo 
 
        },
        // Resource title
-       getResourceFromTitle : function( rTitle , callback){
+       getResourceFromTitle : function( rTitle , callback ) {
                var _this = this;
-               reqObj={
+               reqObj = {
                        'action':'query',
                        'titles': _this.cFileNS + ':' + rTitle
                };
                do_api_req( {
                        'data':reqObj,
                        'url':this.local_wiki_api_url
-                       }, function(data){
-                               //@@todo propagate the rObj
-                               var rObj = {};
+                       }, function( data ) {
+                               // @@todo propagate the rObj
+                               var rObj = { };
                        }
                );
        },
-       //@@todo we could load the id with the content provider id to find the object faster...
-       getResourceFromId:function( rid ){
-               //js_log('getResourceFromId:' + rid );
-               //strip out /res/ if preset:
-               rid = rid.replace(/res_/, '');
-               //js_log("looking at: " + rid);
-               p = rid.split('__');
+       // @@todo we could load the id with the content provider id to find the object faster...
+       getResourceFromId:function( rid ) {
+               // js_log('getResourceFromId:' + rid );
+               // strip out /res/ if preset:
+               rid = rid.replace( / res_ / , '' );
+               // js_log("looking at: " + rid);
+               p = rid.split( '__' );
                var cp_id = p[0];
                var rid = p[1];
                
-               //Set the upload helper cp_id (to render recent uploads by this user)
-               if(cp_id == 'upload')
+               // Set the upload helper cp_id (to render recent uploads by this user)
+               if ( cp_id == 'upload' )
                        cp_id = 'this_wiki';
 
                var cp = this.content_providers[cp_id];
-               if(cp && cp['sObj'] && cp.sObj.resultsObj[rid]){
+               if ( cp && cp['sObj'] && cp.sObj.resultsObj[rid] ) {
                        return cp.sObj.resultsObj[rid];
                }
-               js_log("ERROR: could not find " + rid);
+               js_log( "ERROR: could not find " + rid );
                return false;
        },
-       drawOutputResults: function(){
-               js_log('f:drawOutputResults::' + this.disp_item);
+       drawOutputResults: function() {
+               js_log( 'f:drawOutputResults::' + this.disp_item );
                var _this = this;
-               var o='';               
+               var o = '';
                
                var cp_id = this.disp_item;
                var tab_target = '';
-               if(this.disp_item == 'upload'){
+               if ( this.disp_item == 'upload' ) {
                        tab_target = '#upload_bin';
-                       var cp = _this.content_providers['this_wiki'];          
-               }else{
+                       var cp = _this.content_providers['this_wiki'];
+               } else {
                        var cp = this.content_providers[this.disp_item];
                        tab_target = '#tab-' + cp_id;
                        // Output the results bar / controls                    
-               }                       
+               }
                // Empty the existing results:
-               $j(tab_target).empty();
-               //@@todo give the user upload control love 
-               if(this.disp_item != 'upload'){
+               $j( tab_target ).empty();
+               // @@todo give the user upload control love 
+               if ( this.disp_item != 'upload' ) {
                        _this.setResultBarControl();
                }
                
                var drawResultCount     = 0;
 
                // 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;">';
+               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
-                                               if( rItem.mime=='audio/ogg' && !rItem.poster ){
+                                               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:
-                                               o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '__' + rInx +
+                                               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:
-                                               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>' + 
+                                               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
-                                               if( rItem.mime ){
-                                                       o+= _this.getTypeIcon( rItem.mime );
-                                               }               
+                                               if ( rItem.mime ) {
+                                                       o += _this.getTypeIcon( rItem.mime );
+                                               }
                                                                
                                                // Add license icons if present
-                                               if( rItem.license )
-                                                       o+= _this.getlicenseImgSet( rItem.license );
+                                               if ( rItem.license )
+                                                       o += _this.getlicenseImgSet( rItem.license );
                                                                                                        
-                                       o+='</div>';
-                               }else if(_this.result_display_mode == 'list'){
-                                       o+='<div id="mv_result_' + rInx + '" class="mv_clip_list_result" style="width:90%">';
-                                               o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '__' + rInx +'" style="float:left;width:' +
+                                       o += '</div>';
+                               } else if ( _this.result_display_mode == 'list' ) {
+                                       o += '<div id="mv_result_' + rInx + '" class="mv_clip_list_result" style="width:90%">';
+                                               o += '<img title="' + rItem.title + '" class="rsd_res_item" id="res_' + cp_id + '__' + rInx + '" style="float:left;width:' +
                                                                 _this.thumb_width + 'px;" src="' +
-                                                                cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } )
+                                                                cp.sObj.getImageTransform( rItem, { 'width':_this.thumb_width } )
                                                                  + '">';
                                                // Add license icons if present
-                                               if( rItem.license )
-                                                       o+= _this.getlicenseImgSet( rItem.license );
+                                               if ( rItem.license )
+                                                       o += _this.getlicenseImgSet( rItem.license );
 
-                                               o+= rItem.desc ;
-                                       o+='<div style="clear:both" />';
-                                       o+='</div>';
+                                               o += rItem.desc ;
+                                       o += '<div style="clear:both" />';
+                                       o += '</div>';
                                }
                                drawResultCount++;
-                       });
-                       js_log('append to: ' + '#tab-' + cp_id);
+                       } );
+                       js_log( 'append to: ' + '#tab-' + cp_id );
                        // Put in the tab output (plus clear the output)
-                       $j(tab_target).append( o + '<div style="clear:both"/>');
+                       $j( tab_target ).append( o + '<div style="clear:both"/>' );
                }
 
-               js_log( 'did drawResultCount :: ' + drawResultCount + ' append: ' + $j('#rsd_q').val() );
+               js_log( 'did drawResultCount :: ' + drawResultCount + ' append: ' + $j( '#rsd_q' ).val() );
 
                // 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>');
+               $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>' );
 
                this.addResultBindings();
        },
-       addResultBindings:function(){
+       addResultBindings:function() {
                var _this = this;
-               $j('.mv_clip_'+_this.result_display_mode+'_result').hover(function(){
-                       $j(this).addClass('mv_clip_'+_this.result_display_mode+'_result_over');
+               $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
-                       var res_id = $j(this).children('.rsd_res_item').attr('id');
+                       var res_id = $j( this ).children( '.rsd_res_item' ).attr( 'id' );
                        var rObj = _this.getResourceFromId( res_id );
-                       if( rObj.poster_ani )
-                               $j('#' + res_id ).attr('src', rObj.poster_ani);
-               },function(){
-                       $j(this).removeClass('mv_clip_'+_this.result_display_mode+'_result_over');
-                       var res_id = $j(this).children('.rsd_res_item').attr('id');
+                       if ( rObj.poster_ani )
+                               $j( '#' + res_id ).attr( 'src', rObj.poster_ani );
+               }, function() {
+                       $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)
-                       if( rObj.poster_ani )
-                               $j('#' + res_id ).attr('src', rObj.poster);
-               });
+                       if ( rObj.poster_ani )
+                               $j( '#' + res_id ).attr( 'src', rObj.poster );
+               } );
                // Resource click action: (bring up the resource editor)
-               $j('.rsd_res_item').unbind().click(function(){
-                       var rObj = _this.getResourceFromId( $j(this).attr("id") );
+               $j( '.rsd_res_item' ).unbind().click( function() {
+                       var rObj = _this.getResourceFromId( $j( this ).attr( "id" ) );
                        _this.resourceEdit( rObj, this );
-               });
+               } );
        },
-       addResourceEditLoader:function(maxWidth, overflow_style){
+       addResourceEditLoader:function( maxWidth, overflow_style ) {
                var _this = this;
-               if(!maxWidth)maxWidth=400;
-               if(!overflow_style)overflow_style='overflow:auto;';
+               if ( !maxWidth )maxWidth = 400;
+               if ( !overflow_style )overflow_style = 'overflow:auto;';
                // Remove any old instance:
-               $j( _this.target_container ).find('#rsd_resource_edit').remove();
+               $j( _this.target_container ).find( '#rsd_resource_edit' ).remove();
                // Add the edit layout window with loading place holders
-               $j( _this.target_container ).append('<div id="rsd_resource_edit" '+
+               $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;'+
-                                       'left:2px;top:5px;bottom:10px;width:' + ( maxWidth + 5 ) + 'px;overflow:auto;padding:5px;">'+
+                               '<div id="clip_edit_ctrl" class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;' +
+                                       'left:2px;top:5px;bottom:10px;width:' + ( maxWidth + 5 ) + 'px;overflow:auto;padding:5px;">' +
                                                mv_get_loading_img() +
-                               '</div>'+
-                               '<div id="clip_edit_disp" class="ui-widget ui-widget-content ui-corner-all"' +  
-                                       'style="position:absolute;' + overflow_style + ';left:'+ ( maxWidth + 20 ) +'px;right:0px;top:5px;bottom:10px;padding:5px;>' +
-                                               mv_get_loading_img('position:absolute;top:30px;left:30px') +
-                               '</div>'+                       
-               '</div>');
+                               '</div>' +
+                               '<div id="clip_edit_disp" class="ui-widget ui-widget-content ui-corner-all"' +
+                                       'style="position:absolute;' + overflow_style + ';left:' + ( maxWidth + 20 ) + 'px;right:0px;top:5px;bottom:10px;padding:5px;>' +
+                                               mv_get_loading_img( 'position:absolute;top:30px;left:30px' ) +
+                               '</div>' +
+               '</div>' );
        },
-       resourceEdit:function( rObj, rsdElement){
-               js_log('f:resourceEdit:' + rObj.title);
+       resourceEdit:function( rObj, rsdElement ) {
+               js_log( 'f:resourceEdit:' + rObj.title );
                var _this = this;
                // Remove any existing resource edit interface:
-               $j('#rsd_resource_edit').remove();
-               //set the media type:
-               if(rObj.mime.indexOf('image')!=-1){
+               $j( '#rsd_resource_edit' ).remove();
+               // set the media type:
+               if ( rObj.mime.indexOf( 'image' ) != - 1 ) {
                        // Set width to default image_edit_width
                        var maxWidth = _this.image_edit_width;
                        var mediaType = 'image';
-               }else if(rObj.mime.indexOf('audio')!=-1){
+               } else if ( rObj.mime.indexOf( 'audio' ) != - 1 ) {
                        var maxWidth = _this.video_edit_width;
                        var mediaType = 'audio';
-               }else{
+               } else {
                        // Set to default video size:
                        var maxWidth = _this.video_edit_width;
                        var mediaType = 'video';
                }
                // So that transcripts show ontop
-               var overflow_style = ( mediaType =='video' )?'':'overflow:auto;';
+               var overflow_style = ( mediaType == 'video' ) ? '':'overflow:auto;';
                // 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 ) );
-               js_log('did append to: '+ _this.target_container );
+               _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 ) );
+               js_log( 'did append to: ' + _this.target_container );
 
-               $j('#rsd_resource_edit').css('opacity',0);
+               $j( '#rsd_resource_edit' ).css( 'opacity', 0 );
 
-               $j('#rsd_edit_img').remove();//remove any existing rsd_edit_img
+               $j( '#rsd_edit_img' ).remove();// remove any existing rsd_edit_img
 
                // Left side holds the image right size the controls /
-               $j(rsdElement).clone().attr('id', 'rsd_edit_img').appendTo('#clip_edit_disp').css({
+               $j( rsdElement ). clone ().attr( 'id', 'rsd_edit_img' ).appendTo( '#clip_edit_disp' ).css( {
                        'position':'absolute',
                        'top':'40%',
                        'left':'20%',
                        'cursor':'default',
                        'opacity':0
-               });
+               } );
                
                // Try and keep aspect ratio for the thumbnail that we clicked:         
-               var tRatio = $j(rsdElement).height() / $j(rsdElement).width();
+               var tRatio = $j( rsdElement ).height() / $j( rsdElement ).width();
 
-               if    ! tRatio )
-                       var tRatio = 1; //set ratio to 1 if tRatio did not work. 
+               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) );
+               js_log( 'Set from ' +  tRatio + ' to init thumbimage to ' + maxWidth + ' x ' + parseInt( tRatio * maxWidth ) );
                // Scale up image and to swap with high res version
-               $j('#rsd_edit_img').animate({
+               $j( '#rsd_edit_img' ).animate( {
                        'opacity':1,
                        'top':'5px',
                        'left':'5px',
                        'width': maxWidth + 'px',
-                       'height': parseInt( tRatio * maxWidth)  + 'px'
-               }, "slow"); // do it slow to give it a chance to finish loading the HQ version
+                       'height': parseInt( tRatio * maxWidth )  + 'px'
+               }, "slow" ); // do it slow to give it a chance to finish loading the HQ version
 
-               if( mediaType == 'image' ){
-                       _this.loadHQImg(rObj, {'width':maxWidth}, 'rsd_edit_img', function(){
-                               $j('.mv_loading_img').remove();
-                       });
+               if ( mediaType == 'image' ) {
+                       _this.loadHQImg( rObj, { 'width':maxWidth }, 'rsd_edit_img', function() {
+                               $j( '.mv_loading_img' ).remove();
+                       } );
                }
                // Also fade in the container:
-               $j('#rsd_resource_edit').animate({
+               $j( '#rsd_resource_edit' ).animate( {
                        'opacity':1,
                        'background-color':'#FFF',
                        'z-index':99
-               });
+               } );
                // Do load the media Editor
                _this.doMediaEdit( rObj , mediaType );
        },
-       loadHQImg:function(rObj, size, target_img_id, callback){
+       loadHQImg:function( rObj, size, target_img_id, callback ) {
                // Get the HQ image url:
-               rObj.pSobj.getImageObj( rObj, size, function( imObj ){
+               rObj.pSobj.getImageObj( rObj, size, function( imObj ) {
                        rObj['edit_url'] = imObj.url;
 
-                       js_log("edit url: " + rObj.edit_url);
+                       js_log( "edit url: " + rObj.edit_url );
                        // Update the rObj
                        rObj['width'] = imObj.width;
                        rObj['height'] = imObj.height;
 
                        // See if we need to animate some transition
-                       if( size.width != imObj.width ){
-                               js_log('loadHQImg:size mismatch: ' + size.width + ' != ' + imObj.width );
+                       if ( size.width != imObj.width ) {
+                               js_log( 'loadHQImg:size mismatch: ' + size.width + ' != ' + imObj.width );
                                // Set the target id to the new size:
-                               $j('#'+target_img_id).animate( {
+                               $j( '#' + target_img_id ).animate( {
                                        'width':imObj.width + 'px',
                                        'height':imObj.height + 'px'
-                               });
-                       }else{
-                               js_log('using req size: ' + imObj.width + 'x' + imObj.height);
-                               $j('#'+target_img_id).animate( {'width':imObj.width+'px', 'height' : imObj.height + 'px'});
+                               } );
+                       } else {
+                               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:
                        var img = new Image();
                        // Load the image image:
-                       $j(img).load(function () {
-                                        $j('#'+target_img_id).attr('src', rObj.edit_url );
+                       $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:
                                         callback();
-                               }).error(function () {
-                                       js_log("Error with:  " +  rObj.edit_url);
-                               }).attr('src', rObj.edit_url);
-                       });
+                               } ).error( function () {
+                                       js_log( "Error with:  " +  rObj.edit_url );
+                               } ).attr( 'src', rObj.edit_url );
+                       } );
        },
-       cancelClipEditCB:function(){
-               var _this = this;               
-               js_log('cancelClipEditCB');
+       cancelClipEditCB:function() {
+               var _this = this;
+               js_log( 'cancelClipEditCB' );
                var b_target =   _this.target_container + '~ .ui-dialog-buttonpane';
-               $j('#rsd_resource_edit').remove();
+               $j( '#rsd_resource_edit' ).remove();
                // Remove preview if its 'on'
-               $j('#rsd_preview_display').remove();
+               $j( '#rsd_preview_display' ).remove();
                // Restore the resource container:
-               $j('#rsd_results_container').show();
+               $j( '#rsd_results_container' ).show();
                
                // Restore the title:
-               $j( _this.target_container ).dialog( 'option', 'title', gM('mwe-add_media_wizard'));
-               js_log("should update: " + b_target + ' with: cancel');
+               $j( _this.target_container ).dialog( 'option', 'title', gM( 'mwe-add_media_wizard' ) );
+               js_log( "should update: " + b_target + ' with: cancel' );
                // Restore the buttons:         
-               $j(b_target).html( $j.btnHtml( gM('mwe-cancel') , 'mv_cancel_rsd', 'close'))
-                       .children('.mv_cancel_rsd')
+               $j( b_target ).html( $j.btnHtml( gM( 'mwe-cancel' ) , 'mv_cancel_rsd', 'close' ) )
+                       .children( '.mv_cancel_rsd' )
                        .btnBind()
-                       .click(function(){
-                               $j( _this.target_container).dialog('close');                            
-                       })
+                       .click( function() {
+                               $j( _this.target_container ).dialog( 'close' );
+                       } )
 
        },
        /* getClipEditControlActions
        * Set-up the control actions for clipEdit with relevant callbacks 
        */
-       getClipEditControlActions:function( cp ){
+       getClipEditControlActions:function( cp ) {
                var _this = this;
-               var cConf= {};
+               var cConf = { };
 
-               cConf['insert'] = function(rObj){
-                       _this.insertResource(rObj);
+               cConf['insert'] = function( rObj ) {
+                       _this.insertResource( rObj );
                }
                // If not directly inserting the resource is support a preview option:
-               if( _this.import_url_mode != 'remote_link'){
-                       cConf['preview'] = function(rObj){
+               if ( _this.import_url_mode != 'remote_link' ) {
+                       cConf['preview'] = function( rObj ) {
                                _this.previewResource( rObj )
                        };
                }
-               cConf['cancel'] = function(){
+               cConf['cancel'] = function() {
                        _this.cancelClipEditCB()
                }
                return cConf;
        },
        // Loads the media editor:
-       doMediaEdit:function( rObj , mediaType){
+       doMediaEdit:function( rObj , mediaType ) {
                var _this = this;
                var cp = rObj.pSobj.cp;
-               js_log('remoteSearchDriver::doMediaEdit: ' + mediaType);
+               js_log( 'remoteSearchDriver::doMediaEdit: ' + mediaType );
                
                var mvClipInit = {
-                       'rObj' : rObj, //the resource object
+                       'rObj' : rObj, // the resource object
                        'parent_ct'                     : 'rsd_modal_target',
                        'clip_disp_ct'          : 'clip_edit_disp',
                        'control_ct'            : 'clip_edit_ctrl',
@@ -1255,593 +1255,593 @@ remoteSearchDriver.prototype = {
                // Set the base clip edit lib class req set:
                var clibs = ['mvClipEdit'];
                
-               if( mediaType == 'image'){
+               if ( mediaType == 'image' ) {
                        // Display the mvClipEdit obj once we are done loading:
-                       mvJsLoader.doLoad( clibs, function(){
+                       mvJsLoader.doLoad( clibs, function() {
                                // Run the image clip tools
                                _this.cEdit = new mvClipEdit( mvClipInit );
-                       });
-               }else if( mediaType == 'video' || mediaType == 'audio'){
-                       js_log('media type:: ' + mediaType);
+                       } );
+               } else if ( mediaType == 'video' || mediaType == 'audio' ) {
+                       js_log( 'media type:: ' + mediaType );
                        // 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(){
+                       rObj.pSobj.getEmbedTimeMeta( rObj, function() {
                                // Make sure we have the embedVideo libs:
                                var runFlag = false;
-                               mvJsLoader.embedVideoCheck( function(){
+                               mvJsLoader.embedVideoCheck( function() {
                                        // Strange concurrency issue with callbacks 
-                                       //@@todo try and figure out why this callback is fired twice
-                                       if(!runFlag){
+                                       // @@todo try and figure out why this callback is fired twice
+                                       if ( !runFlag ) {
                                                runFlag = true;
-                                       }else{
-                                               js_log('Error: embedVideoCheck run twice');
+                                       } else {
+                                               js_log( 'Error: embedVideoCheck run twice' );
                                                return false;
                                        }
-                                       js_log('append html: ' + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) );
-                                       $j('#clip_edit_disp').html(
+                                       js_log( 'append html: ' + rObj.pSobj.getEmbedHTML( rObj, { id:'embed_vid' } ) );
+                                       $j( '#clip_edit_disp' ).html(
                                                rObj.pSobj.getEmbedHTML( rObj, {
                                                        id : 'embed_vid'
-                                               })
+                                               } )
                                        );
-                                       js_log("about to call rewrite_by_id::embed_vid");                                       
+                                       js_log( "about to call rewrite_by_id::embed_vid" );
                                        // Rewrite by id
-                                       rewrite_by_id('embed_vid', function(){
+                                       rewrite_by_id( 'embed_vid', function() {
                                                // 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:
-                                               clibs.push( '$j.ui.resizable');
-                                               clibs.push( '$j.fn.hoverIntent');                                               
-                                               mvJsLoader.doLoad(clibs, function(){
+                                               clibs.push( '$j.ui.resizable' );
+                                               clibs.push( '$j.fn.hoverIntent' );
+                                               mvJsLoader.doLoad( clibs, function() {
                                                        // Make sure the rsd_edit_img is hidden:
-                                                       $j('#rsd_edit_img').remove();
+                                                       $j( '#rsd_edit_img' ).remove();
                                                        // Run the image clip tools
                                                        _this.cEdit = new mvClipEdit( mvClipInit );
-                                               });
-                                       });
-                               });
-                       });
+                                               } );
+                                       } );
+                               } );
+                       } );
                }
        },
-       checkRepoLocal:function( cp ){
-               if( cp.local ){
+       checkRepoLocal:function( cp ) {
+               if ( cp.local ) {
                        return true;
-               }else{
+               } else {
                        // 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++){
+                       if ( cp.local_domains ) {
+                               for ( var i = 0; i < cp.local_domains.length; i++ ) {
                                        var ld = cp.local_domains[i];
-                                        if( local_host.indexOf( ld ) != -1)
+                                        if ( local_host.indexOf( ld ) != - 1 )
                                                 return true;
                                }
                        }
                        return false;
                }
        },
-       checkImportResource:function( rObj, cir_callback){
-               var _this = this;               
+       checkImportResource:function( rObj, cir_callback ) {
+               var _this = this;
                // Add a loader ontop:
-               $j.addLoaderDialog( gM('mwe-checking-resource') );              
+               $j.addLoaderDialog( gM( 'mwe-checking-resource' ) );
                // Extend the callback with close dialog
                var org_cir_callback = cir_callback;
-               cir_callback = function( rObj ){
-                       var cat = org_cir_callback;                     
-                       $j.closeLoaderDialog();                         
-                       if( typeof org_cir_callback == 'function'){
+               cir_callback = function( rObj ) {
+                       var cat = org_cir_callback;
+                       $j.closeLoaderDialog();
+                       if ( typeof org_cir_callback == 'function' ) {
                                org_cir_callback( rObj );
                        }
-               }                       
-               //@@todo get the localized File/Image namespace name or do a general {NS}:Title
+               }
+               // @@todo get the localized File/Image namespace name or do a general {NS}:Title
                var cp = rObj.pSobj.cp;
                var _this = this;
 
                // Update base target_resource_title:
-               rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,'')
+               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'
+               // 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'){                
+               if ( this.checkRepoLocal( cp ) || this.import_url_mode == 'remote_link' ) {
                        // Local repo jump directly to check Import Resource callback:
                         cir_callback( rObj );
-               }else{                                          
+               } else {
                        // 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' ){                                            
+                       if ( cp.check_shared ) {
+                               _this.checkForFile( rObj.target_resource_title, function( imagePage ) {
+                                       if ( imagePage && imagePage['imagerepository'] == 'shared' ) {
                                                cir_callback( rObj );
-                                       }else{
+                                       } else {
                                                _this.checkPrefixNameImport( rObj, cir_callback );
                                        }
-                               });
-                       }else{
-                               _this.checkPrefixNameImport(rObj, cir_callback);
+                               } );
+                       } else {
+                               _this.checkPrefixNameImport( rObj, cir_callback );
                        }
                }
        },
-       checkPrefixNameImport: function(rObj, cir_callback){
-               js_log('::checkPrefixNameImport:: ');
+       checkPrefixNameImport: function( rObj, cir_callback ) {
+               js_log( '::checkPrefixNameImport:: ' );
                var cp = rObj.pSobj.cp;
-               var _this = this;               
-               //update target_resource_title with resource repository prefix:
-               rObj.target_resource_title = cp.resource_prefix + rObj.target_resource_title;                                                   
-               //check if the file exists: 
-               _this.checkForFile( rObj.target_resource_title, function( imagePage ){          
-                       if( imagePage ){
-                               //update to local src
+               var _this = this;
+               // update target_resource_title with resource repository prefix:
+               rObj.target_resource_title = cp.resource_prefix + rObj.target_resource_title;
+               // check if the file exists: 
+               _this.checkForFile( rObj.target_resource_title, function( imagePage ) {
+                       if ( imagePage ) {
+                               // update to local src
                                rObj.local_src = imagePage['imageinfo'][0].url;
-                               //@@todo maybe  update poster too?
-                               rObj.local_poster = imagePage['imageinfo'][0].thumburl;                         
-                               //update the title: 
-                               rObj.target_resource_title = imagePage.title.replace(/File:|Image:/,'');
+                               // @@todo maybe  update poster too?
+                               rObj.local_poster = imagePage['imageinfo'][0].thumburl;
+                               // update the title: 
+                               rObj.target_resource_title = imagePage.title.replace( / File: | Image: / , '' );
                                cir_callback( rObj );
-                       }else{
-                               //close the dialog and display the import interface: 
+                       } else {
+                               // close the dialog and display the import interface: 
                                $j.closeLoaderDialog();
-                               _this.doImportInterface(rObj, cir_callback);
+                               _this.doImportInterface( rObj, cir_callback );
                        }
-               });                                             
-       },      
-       doImportInterface : function( rObj, callback){          
-               var _this = this;                                       
-               js_log("doImportInterface:: update:"+ _this.cFileNS + ':' + rObj.target_resource_title);
-               //update the rObj with import info
+               } );
+       },
+       doImportInterface : function( rObj, callback ) {
+               var _this = this;
+               js_log( "doImportInterface:: update:" + _this.cFileNS + ':' + rObj.target_resource_title );
+               // update the rObj with import info
                rObj.pSobj.updateDataForImport( rObj );
 
-               //setup the resource description from resource description:
-               var wt = '{{Information '+"\n";
+               // setup the resource description from resource description:
+               var wt = '{{Information ' + "\n";
 
-               if( rObj.desc ){
+               if ( rObj.desc ) {
                        wt += '|Description= ' + rObj.desc + "\n";
-               }else{
-                       wt += '|Description= ' + gM('mwe-missing_desc_see_source', rObj.link ) + "\n";
+               } else {
+                       wt += '|Description= ' + gM( 'mwe-missing_desc_see_source', rObj.link ) + "\n";
                }
 
-               //output search specific info
-               wt+='|Source=' + rObj.pSobj.getImportResourceDescWiki( rObj ) + "\n";
+               // output search specific info
+               wt += '|Source=' + rObj.pSobj.getImportResourceDescWiki( rObj ) + "\n";
 
-               if( rObj.author )
-                       wt+='|Author=' + rObj.author +"\n";
+               if ( rObj.author )
+                       wt += '|Author=' + rObj.author + "\n";
 
-               if( rObj.date )
-                       wt+='|Date=' + rObj.date +"\n";
+               if ( rObj.date )
+                       wt += '|Date=' + rObj.date + "\n";
 
-               //add the Permision info:
-               wt+='|Permission=' + rObj.pSobj.getPermissionWikiTag( rObj ) +"\n";
+               // add the Permision info:
+               wt += '|Permission=' + rObj.pSobj.getPermissionWikiTag( rObj ) + "\n";
 
-               if( rObj.other_versions )
-                       wt+='|other_versions=' + rObj.other_versions + "\n";
+               if ( rObj.other_versions )
+                       wt += '|other_versions=' + rObj.other_versions + "\n";
 
-               wt+='}}';
+               wt += '}}';
 
-               //get any extra categories or helpful links
-               wt+= rObj.pSobj.getExtraResourceDescWiki( rObj );
+               // get any extra categories or helpful links
+               wt += rObj.pSobj.getExtraResourceDescWiki( rObj );
 
 
-               $j('#rsd_resource_import').remove();//remove any old resource imports
+               $j( '#rsd_resource_import' ).remove();// remove any old resource imports
 
-               //@@ show user dialog to import the resource
-               $j( _this.target_container ).append('<div id="rsd_resource_import" '+
+               // @@ show user dialog to import the resource
+               $j( _this.target_container ).append( '<div id="rsd_resource_import" ' +
                'class="ui-state-highlight ui-widget-content ui-state-error" ' +
                'style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;z-index:5">' +
-                       '<h3 style="color:red;padding:5px;">' + gM('mwe-resource-needs-import', [rObj.title, _this.upload_api_name] ) + '</h3>' +
+                       '<h3 style="color:red;padding:5px;">' + gM( 'mwe-resource-needs-import', [rObj.title, _this.upload_api_name] ) + '</h3>' +
                                '<div id="rsd_preview_import_container" style="position:absolute;width:50%;bottom:0px;left:5px;overflow:auto;top:30px;">' +
                                        rObj.pSobj.getEmbedHTML( rObj, {
-                                               'id': _this.target_container + '_rsd_pv_vid', 
+                                               'id': _this.target_container + '_rsd_pv_vid',
                                                'max_height':'220',
                                                'only_poster':true
-                                       }) + //get embedHTML with small thumb:
-                                       '<br style="clear both">'+
-                                       '<strong>'+gM('mwe-resource_page_desc') +'</strong>'+
-                                       '<div id="rsd_import_desc" style="display:inline;">'+
-                                               mv_get_loading_img('position:absolute;top:5px;left:5px') +
-                                       '</div>'+
-                               '</div>'+
+                                       } ) + // get embedHTML with small thumb:
+                                       '<br style="clear both">' +
+                                       '<strong>' + gM( 'mwe-resource_page_desc' ) + '</strong>' +
+                                       '<div id="rsd_import_desc" style="display:inline;">' +
+                                               mv_get_loading_img( 'position:absolute;top:5px;left:5px' ) +
+                                       '</div>' +
+                               '</div>' +
                                '<div id="rds_edit_import_container" style="position:absolute;left:50%;' +
-                                       'bottom:0px;top:30px;right:0px;overflow:auto;">'+
-                                       '<strong>' + gM('mwe-local_resource_title') + '</strong><br>'+
-                                       '<input type="text" size="30" value="' + rObj.target_resource_title + '" /><br>'+
-                                       '<strong>' + gM('mwe-edit_resource_desc') + '</strong>' +
+                                       'bottom:0px;top:30px;right:0px;overflow:auto;">' +
+                                       '<strong>' + gM( 'mwe-local_resource_title' ) + '</strong><br>' +
+                                       '<input type="text" size="30" value="' + rObj.target_resource_title + '" /><br>' +
+                                       '<strong>' + gM( 'mwe-edit_resource_desc' ) + '</strong>' +
                                        '<textarea id="rsd_import_ta" id="mv_img_desc" style="width:90%;" rows="8" cols="50">' +
                                                wt +
                                        '</textarea><br>' +
                                        '<input type="checkbox" value="true" id="wpWatchthis" name="wpWatchthis" tabindex="7"/>' +
-                                       '<label for="wpWatchthis">'+gM('mwe-watch_this_page')+'</label><br><br><br>' +
-                               '</div>'+
-                               //output the rendered and non-rendered version of description for easy switching:
-               '</div>');
-               var bPlaneTarget = _this.target_container +'~ .ui-dialog-buttonpane';
-               $j(bPlaneTarget).html (
-                       //add the btns to the bottom: 
-                       $j.btnHtml(gM('mwe-do_import_resource'), 'rsd_import_doimport', 'check' ) + ' ' +
+                                       '<label for="wpWatchthis">' + gM( 'mwe-watch_this_page' ) + '</label><br><br><br>' +
+                               '</div>' +
+                               // output the rendered and non-rendered version of description for easy switching:
+               '</div>' );
+               var bPlaneTarget = _this.target_container + '~ .ui-dialog-buttonpane';
+               $j( bPlaneTarget ).html (
+                       // add the btns to the bottom: 
+                       $j.btnHtml( gM( 'mwe-do_import_resource' ), 'rsd_import_doimport', 'check' ) + ' ' +
        
-                       $j.btnHtml(gM('mwe-update_preview'), 'rsd_import_apreview', 'refresh' ) + ' '+
+                       $j.btnHtml( gM( 'mwe-update_preview' ), 'rsd_import_apreview', 'refresh' ) + ' ' +
        
-                       $j.btnHtml(gM('mwe-cancel_import'), 'rsd_import_acancel', 'close' ) + ' '
-               ).addClass('ui-state-error');
-               
-               //add hover:
+                       $j.btnHtml( gM( 'mwe-cancel_import' ), 'rsd_import_acancel', 'close' ) + ' '
+               ).addClass( 'ui-state-error' );
                
-               //update video tag (if a video) 
-               if( rObj.mime.indexOf('video/') !== -1 )
-                       rewrite_by_id( $j(_this.target_container).attr('id') + '_rsd_pv_vid');
+               // add hover:
+
+               // update video tag (if a video) 
+               if ( rObj.mime.indexOf( 'video/' ) !== - 1 )
+                       rewrite_by_id( $j( _this.target_container ).attr( 'id' ) + '_rsd_pv_vid' );
                
-               //load the preview text:
-               _this.getParsedWikiText( wt, _this.cFileNS +':'+ rObj.target_resource_title, function( o ){
-                       $j('#rsd_import_desc').html(o);
-               });
-               //add bindings:
-               $j( bPlaneTarget + ' .rsd_import_apreview').btnBind().click(function(){
-                       js_log("do preview asset");
-                       $j('#rsd_import_desc').html( mv_get_loading_img() );                    
-                       //load the preview text:
-                       _this.getParsedWikiText( $j('#rsd_import_ta').val(), _this.cFileNS +':'+ rObj.target_resource_title, function( o ){
-                               js_log('got updated preview: ');
-                               $j('#rsd_import_desc').html(o);
-                       });
-               });
-               $j( bPlaneTarget + ' .rsd_import_doimport').btnBind().click(function(){
-                       js_log("do import asset:" + _this.import_url_mode);
-                       //check import mode:                                    
-                       if( _this.import_url_mode == 'api' ){
-                               if( _this.upload_api_target == 'proxy' ){;
-                                       _this.setupProxy( function(){
-                                               _this.doImportAPI( rObj , callback);
-                                       });                                                                                             
-                               }else{
-                                       _this.doImportAPI( rObj , callback);
+               // load the preview text:
+               _this.getParsedWikiText( wt, _this.cFileNS + ':' + rObj.target_resource_title, function( o ) {
+                       $j( '#rsd_import_desc' ).html( o );
+               } );
+               // add bindings:
+               $j( bPlaneTarget + ' .rsd_import_apreview' ).btnBind().click( function() {
+                       js_log( "do preview asset" );
+                       $j( '#rsd_import_desc' ).html( mv_get_loading_img() );
+                       // load the preview text:
+                       _this.getParsedWikiText( $j( '#rsd_import_ta' ).val(), _this.cFileNS + ':' + rObj.target_resource_title, function( o ) {
+                               js_log( 'got updated preview: ' );
+                               $j( '#rsd_import_desc' ).html( o );
+                       } );
+               } );
+               $j( bPlaneTarget + ' .rsd_import_doimport' ).btnBind().click( function() {
+                       js_log( "do import asset:" + _this.import_url_mode );
+                       // check import mode:                                   
+                       if ( _this.import_url_mode == 'api' ) {
+                               if ( _this.upload_api_target == 'proxy' ) { ;
+                                       _this.setupProxy( function() {
+                                               _this.doImportAPI( rObj , callback );
+                                       } );
+                               } else {
+                                       _this.doImportAPI( rObj , callback );
                                }
-                       }else{
-                               js_log("Error: import mode is not form or API (can not copy asset)");
+                       } else {
+                               js_log( "Error: import mode is not form or API (can not copy asset)" );
                        }
-               });
-               $j( bPlaneTarget + ' .rsd_import_acancel').btnBind().click(function(){
-                       $j('#rsd_resource_import').fadeOut("fast",function(){
-                               $j(this).remove();
-                               //restore buttons (from the clipEdit object::)
+               } );
+               $j( bPlaneTarget + ' .rsd_import_acancel' ).btnBind().click( function() {
+                       $j( '#rsd_resource_import' ).fadeOut( "fast", function() {
+                               $j( this ).remove();
+                               // restore buttons (from the clipEdit object::)
                                _this.cEdit.updateInsertControlActions();
-                               $j(bPlaneTarget).removeClass('ui-state-error');
-                       });                     
-               });                                                                     
-       },                      
+                               $j( bPlaneTarget ).removeClass( 'ui-state-error' );
+                       } );
+               } );
+       },
        /** 
         * sets up the proxy for the remote inserts
         */
-       setupProxy:function(callback){
+       setupProxy:function( callback ) {
                var _this = this;
                
-               if( _this.proxySetupDone ){
-                       if(callback) 
+               if ( _this.proxySetupDone ) {
+                       if ( callback )
                                callback();
                        return ;
                }
-               //setup the the proxy via mv_embed  $j.apiProxy loader:
-               if( ! _this.upload_api_proxy_frame ){
-                       js_log("Error:: remote api but no proxy frame target");
+               // setup the the proxy via mv_embed  $j.apiProxy loader:
+               if ( ! _this.upload_api_proxy_frame ) {
+                       js_log( "Error:: remote api but no proxy frame target" );
                        return false;
-               }else{                  
+               } else {
                        $j.apiProxy(
                                'client',
                                {
-                                       'server_frame' : _this.upload_api_proxy_frame                                                                   
-                               },function(){
+                                       'server_frame' : _this.upload_api_proxy_frame
+                               }, function() {
                                        _this.proxySetupDone = true
-                                       if(callback) 
+                                       if ( callback )
                                                callback();
-                               }                       
-                       );      
+                               }
+                       );
                }
        },
-       checkForFile:function( fName, callback){
-               js_log("checkForFile::" + fName );
-               var _this = this;        
-               reqObj={
+       checkForFile:function( fName, callback ) {
+               js_log( "checkForFile::" + fName );
+               var _this = this;
+               reqObj = {
                                'action':'query',
                                'titles': _this.cFileNS + ':' + fName,
                                'prop'          : 'imageinfo',
                                'iiprop'        : 'url',
                                'iiurlwidth': '400'
-               };                      
-               //first check the api for imagerepository
+               };
+               // first check the api for imagerepository
                do_api_req( {
                        'data':reqObj,
                        'url':this.local_wiki_api_url
-                       },function(data){
-                               if( data.query.pages ){                         
-                                       for(var i in data.query.pages){         
-                                               for(var j in data.query.pages[i]){
-                                                       if(j == 'missing' && data.query.pages[i].imagerepository != 'shared'){
-                                                               js_log(fName + " not found");
+                       }, function( data ) {
+                               if ( data.query.pages ) {
+                                       for ( var i in data.query.pages ) {
+                                               for ( var j in data.query.pages[i] ) {
+                                                       if ( j == 'missing' && data.query.pages[i].imagerepository != 'shared' ) {
+                                                               js_log( fName + " not found" );
                                                                callback( false );
                                                                return ;
-                                                       }                                                               
-                                               }               
-                                               //else page is found: 
-                                               js_log(fName + "  found");
-                                               callback( data.query.pages[i] );                                                
+                                                       }
+                                               }
+                                               // else page is found: 
+                                               js_log( fName + "  found" );
+                                               callback( data.query.pages[i] );
                                        }
                                }
                        }
                );
        },
-       doImportAPI:function(rObj, cir_callback){
+       doImportAPI:function( rObj, cir_callback ) {
                var _this = this;
-               js_log(":doImportAPI:");
-               $j.addLoaderDialog( gM('mwe-importing_asset') );                
-               //baseUploadInterface
-               mvJsLoader.doLoad([
+               js_log( ":doImportAPI:" );
+               $j.addLoaderDialog( gM( 'mwe-importing_asset' ) );
+               // baseUploadInterface
+               mvJsLoader.doLoad( [
                        'mvBaseUploadInterface',
                        '$j.ui.progressbar'
-               ],function(){
-                       js_log('mvBaseUploadInterface ready');
-                       //initiate a upload object ( similar to url copy ):
-                       myUp = new mvBaseUploadInterface({
+               ], function() {
+                       js_log( 'mvBaseUploadInterface ready' );
+                       // initiate a upload object ( similar to url copy ):
+                       myUp = new mvBaseUploadInterface( {
                                'api_url' : _this.upload_api_target,
-                               'done_upload_cb':function(){
-                                       js_log('doImportAPI:: run callback::' );
-                                       //we have finished the upload:
-                               
-                                       //close up the rsd_resource_import
-                                       $j('#rsd_resource_import').remove();
-                                       //return the parent callback:
-                                       return cir_callback();                                  
+                               'done_upload_cb':function() {
+                                       js_log( 'doImportAPI:: run callback::' );
+                                       // we have finished the upload:
+
+                                       // close up the rsd_resource_import
+                                       $j( '#rsd_resource_import' ).remove();
+                                       // return the parent callback:
+                                       return cir_callback();
                                }
-                       });
-                       //get the edit token if we have it handy
-                       _this.getEditToken(function( token ){
+                       } );
+                       // get the edit token if we have it handy
+                       _this.getEditToken( function( token ) {
                                myUp.etoken = token;
                                
-                               //close the loader now that we are ready to present the progress dialog::
+                               // close the loader now that we are ready to present the progress dialog::
                                $j.closeLoaderDialog();
                                                                
-                               myUp.doHttpUpload({
+                               myUp.doHttpUpload( {
                                        'url'       : rObj.src,
                                        'filename'  : rObj.target_resource_title,
-                                       'comment'   : $j('#rsd_import_ta').val()
-                               });
-                       })
+                                       'comment'   : $j( '#rsd_import_ta' ).val()
+                               } );
+                       } )
 
 
-               });
+               } );
        },
-       getEditToken:function(callback){
+       getEditToken:function( callback ) {
                var _this = this;
-               if( _this.upload_api_target != 'proxy'){
-                       //(if not a proxy) first try to get the token from the page:
-                       var etoken = $j("input[name='wpEditToken']").val();
-                       if(etoken){
+               if ( _this.upload_api_target != 'proxy' ) {
+                       // (if not a proxy) first try to get the token from the page:
+                       var etoken = $j( "input[name='wpEditToken']" ).val();
+                       if ( etoken ) {
                                callback( etoken );
                                return ;
                        }
                }
-               //@@todo try to load over ajax if( _this.local_wiki_api_url ) is set
+               // @@todo try to load over ajax if( _this.local_wiki_api_url ) is set
                // (your on the api domain but are inserting from a normal page view)
-               get_mw_token(null, _this.upload_api_target, function(token){
+               get_mw_token( null, _this.upload_api_target, function( token ) {
                        callback( token );
-               });             
-       },      
-       previewResource:function( rObj ){
+               } );
+       },
+       previewResource:function( rObj ) {
                var _this = this;
-               this.checkImportResource( rObj, function(){
-                       //put another window ontop:
-                       $j( _this.target_container ).append('<div id="rsd_preview_display"' +
+               this.checkImportResource( rObj, function() {
+                       // put another window ontop:
+                       $j( _this.target_container ).append( '<div id="rsd_preview_display"' +
                                        'style="position:absolute;overflow:hidden;z-index:4;top:0px;bottom:0px;right:0px;left:0px;background-color:#FFF;">' +
-                                               mv_get_loading_img('top:30px;left:30px') +
-                                       '</div>');
+                                               mv_get_loading_img( 'top:30px;left:30px' ) +
+                                       '</div>' );
 
-                       var bPlaneTarget = _this.target_container +'~ .ui-dialog-buttonpane';
-                       var pTitle = $j( _this.target_container ).dialog('option', 'title');
+                       var bPlaneTarget = _this.target_container + '~ .ui-dialog-buttonpane';
+                       var pTitle = $j( _this.target_container ).dialog( 'option', 'title' );
 
-                       //update title:
-                       $j( _this.target_container ).dialog('option', 'title', gM('mwe-preview_insert_resource', rObj.title) );
+                       // update title:
+                       $j( _this.target_container ).dialog( 'option', 'title', gM( 'mwe-preview_insert_resource', rObj.title ) );
 
-                       //update buttons preview:
-                       $j(bPlaneTarget).html( $j.btnHtml( gM('rsd_do_insert'), 'preview_do_insert', 'check') + ' ' )
-                               .children('.preview_do_insert')
-                               .click(function(){
+                       // update buttons preview:
+                       $j( bPlaneTarget ).html( $j.btnHtml( gM( 'rsd_do_insert' ), 'preview_do_insert', 'check' ) + ' ' )
+                               .children( '.preview_do_insert' )
+                               .click( function() {
                                        _this.insertResource( rObj );
-                               });
-                       //update cancel button
-                       $j(bPlaneTarget).append('<a href="#" class="preview_close">Do More Modification</a>')
-                               .children('.preview_close')
-                               .click(function(){
-                                       $j('#rsd_preview_display').remove();
-                                       //restore title:
-                                       $j( _this.target_container ).dialog('option', 'title', pTitle);
-                                       //restore buttons (from the clipEdit object::)
+                               } );
+                       // update cancel button
+                       $j( bPlaneTarget ).append( '<a href="#" class="preview_close">Do More Modification</a>' )
+                               .children( '.preview_close' )
+                               .click( function() {
+                                       $j( '#rsd_preview_display' ).remove();
+                                       // restore title:
+                                       $j( _this.target_container ).dialog( 'option', 'title', pTitle );
+                                       // restore buttons (from the clipEdit object::)
                                        _this.cEdit.updateInsertControlActions();
-                               });
+                               } );
 
-                       //update the preview_wtext
+                       // update the preview_wtext
                        _this.updatePreviewText( rObj );
-                       _this.getParsedWikiText(_this.preview_wtext, _this.target_title,
-                               function(phtml){
-                                       $j('#rsd_preview_display').html( phtml );
-                                       //update the display of video tag items (if any)
-                                       mwdomReady(true);
+                       _this.getParsedWikiText( _this.preview_wtext, _this.target_title,
+                               function( phtml ) {
+                                       $j( '#rsd_preview_display' ).html( phtml );
+                                       // update the display of video tag items (if any)
+                                       mwdomReady( true );
                                }
                        );
-               });
+               } );
        },
-       updatePreviewText:function( rObj ){
+       updatePreviewText:function( rObj ) {
                var _this = this;
 
-               if( _this.import_url_mode == 'remote_link' ){
-                       _this.cur_embed_code = rObj.pSobj.getEmbedHTML(rObj);
-               }else{
+               if ( _this.import_url_mode == 'remote_link' ) {
+                       _this.cur_embed_code = rObj.pSobj.getEmbedHTML( rObj );
+               } else {
                        _this.cur_embed_code = rObj.pSobj.getEmbedWikiCode( rObj );
                }
 
-               //insert at start if textInput cursor has not been set (ie == length)
-               if( _this.caret_pos &&  _this.caret_pos.text){
-                       if( _this.caret_pos.text.length == _this.caret_pos.s)
-                               _this.caret_pos.s=0;
-                       _this.preview_wtext = _this.caret_pos.text.substring(0, _this.caret_pos.s) +
+               // insert at start if textInput cursor has not been set (ie == length)
+               if ( _this.caret_pos &&  _this.caret_pos.text ) {
+                       if ( _this.caret_pos.text.length == _this.caret_pos.s )
+                               _this.caret_pos.s = 0;
+                       _this.preview_wtext = _this.caret_pos.text.substring( 0, _this.caret_pos.s ) +
                                                                        _this.cur_embed_code +
                                                                   _this.caret_pos.text.substring( _this.caret_pos.s );
-               }else{
-                  _this.preview_wtext =  $j(_this.target_textbox).val() +  _this.cur_embed_code;
+               } else {
+                  _this.preview_wtext =  $j( _this.target_textbox ).val() +  _this.cur_embed_code;
                }
-               //check for missing </refrences>
-               if( _this.preview_wtext.indexOf('<references/>') ==-1 &&  _this.preview_wtext.indexOf('<ref>') != -1 )
+               // check for missing </refrences>
+               if ( _this.preview_wtext.indexOf( '<references/>' ) == - 1 &&  _this.preview_wtext.indexOf( '<ref>' ) != - 1 )
                         _this.preview_wtext =  _this.preview_wtext + '<references/>';
        },
-       getParsedWikiText:function( wikitext, title,  callback ){
+       getParsedWikiText:function( wikitext, title,  callback ) {
                do_api_req( {
-                       'data':{'action':'parse',
+                       'data': { 'action':'parse',
                                        'text':wikitext
                                   },
                        'url':this.local_wiki_api_url
-                       },function(data){
+                       }, function( data ) {
                                callback( data.parse.text['*'] );
                        }
                );
        },
-       insertResource:function( rObj){
-               js_log('insertResource: ' + rObj.title);                                        
+       insertResource:function( rObj ) {
+               js_log( 'insertResource: ' + rObj.title );
                
                var _this = this
-               //dobule check that the resource is present:
-               this.checkImportResource( rObj, function(){
+               // dobule check that the resource is present:
+               this.checkImportResource( rObj, function() {
                        _this.updatePreviewText( rObj );
-                       $j(_this.target_textbox).val( _this.preview_wtext );
+                       $j( _this.target_textbox ).val( _this.preview_wtext );
 
-                       //update the render area (if present)
-                       if(_this.target_render_area && _this.cur_embed_code){
-                                //output with some padding:
-                                $j(_this.target_render_area).append( _this.cur_embed_code + '<div style="clear:both;height:10px">')
+                       // update the render area (if present)
+                       if ( _this.target_render_area && _this.cur_embed_code ) {
+                                // output with some padding:
+                                $j( _this.target_render_area ).append( _this.cur_embed_code + '<div style="clear:both;height:10px">' )
                                 
-                                //update the player if video or audio:
-                                if( rObj.mime.indexOf('audio')!=-1 ||
-                                        rObj.mime.indexOf('video')!=-1 ||
-                                        rObj.mime.indexOf('/ogg') !=-1){
-                                        mvJsLoader.embedVideoCheck(function(){
+                                // update the player if video or audio:
+                                if ( rObj.mime.indexOf( 'audio' ) != - 1 ||
+                                        rObj.mime.indexOf( 'video' ) != - 1 ||
+                                        rObj.mime.indexOf( '/ogg' ) != - 1 ) {
+                                        mvJsLoader.embedVideoCheck( function() {
                                                mv_video_embed();
-                                        });
+                                        } );
                                 }
                        }
                        _this.closeAll();
-               });
+               } );
        },
-       closeAll:function(){
+       closeAll:function() {
                 var _this = this;
-                js_log("close all:: "  + _this.target_container);
+                js_log( "close all:: "  + _this.target_container );
                 _this.cancelClipEditCB();
-                $j(_this.target_container).dialog('close');
+                $j( _this.target_container ).dialog( 'close' );
        },
-       setResultBarControl:function( ){
+       setResultBarControl:function( ) {
                var _this = this;
                var box_dark_url         = mv_skin_img_path + 'box_layout_icon_dark.png';
                var box_light_url        = mv_skin_img_path + 'box_layout_icon.png';
                var list_dark_url        = mv_skin_img_path + 'list_layout_icon_dark.png';
                var list_light_url       = mv_skin_img_path + 'list_layout_icon.png';
 
-               var about_desc ='';
-               if( this.content_providers[this.disp_item] ){
+               var about_desc = '';
+               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, 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')+' '+
+                       about_desc = '<span style="position:relative;top:0px;font-style:italic;">' +
+                                       '<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' ) + ' ' +
                                        '<img id="msc_box_layout" ' +
-                                               'title = "' + gM('rsd_box_layout') + '" '+
-                                               'src = "' +  ( (_this.result_display_mode=='box')?box_dark_url:box_light_url ) + '" ' +
+                                               'title = "' + gM( 'rsd_box_layout' ) + '" ' +
+                                               'src = "' +  ( ( _this.result_display_mode == 'box' ) ? box_dark_url:box_light_url ) + '" ' +
                                                'style="width:20px;height:20px;cursor:pointer;"> ' +
-                                       '<img id="msc_list_layout" '+
-                                               'title = "' + gM('rsd_list_layout') + '" '+
-                                               'src = "' +  ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) + '" '+
-                                               'style="width:20px;height:20px;cursor:pointer;">'+
+                                       '<img id="msc_list_layout" ' +
+                                               'title = "' + gM( 'rsd_list_layout' ) + '" ' +
+                                               'src = "' +  ( ( _this.result_display_mode == 'list' ) ? list_dark_url:list_light_url ) + '" ' +
+                                               'style="width:20px;height:20px;cursor:pointer;">' +
                                        about_desc +
-                               '</span>'+
-                               '<span id="rsd_paging_ctrl" style="float:right;"></span>'+
+                               '</span>' +
+                               '<span id="rsd_paging_ctrl" style="float:right;"></span>' +
                                '</div>'
                        );
-                       //get paging with bindings:
-                       this.getPaging('#rsd_paging_ctrl');
-
-                       $j('#msc_box_layout').hover(function(){
-                               $j(this).attr("src", box_dark_url );
-                       }, function(){
-                               $j(this).attr("src",  ( (_this.result_display_mode=='box')?box_dark_url:box_light_url ) );
-                       }).click(function(){
-                               $j(this).attr("src", box_dark_url);
-                               $j('#msc_list_layout').attr("src", list_light_url);
-                               _this.setDispMode('box');
-                       });
-
-                       $j('#msc_list_layout').hover(function(){
-                               $j(this).attr("src", list_dark_url);
-                       }, function(){
-                               $j(this).attr("src", ( (_this.result_display_mode=='list')?list_dark_url:list_light_url ) );
-                       }).click(function(){
-                               $j(this).attr("src", list_dark_url);
-                               $j('#msc_box_layout').attr("src", box_light_url);
-                               _this.setDispMode('list');
-                       });
+                       // get paging with bindings:
+                       this.getPaging( '#rsd_paging_ctrl' );
+
+                       $j( '#msc_box_layout' ).hover( function() {
+                               $j( this ).attr( "src", box_dark_url );
+                       }, function() {
+                               $j( this ).attr( "src",  ( ( _this.result_display_mode == 'box' ) ? box_dark_url:box_light_url ) );
+                       } ).click( function() {
+                               $j( this ).attr( "src", box_dark_url );
+                               $j( '#msc_list_layout' ).attr( "src", list_light_url );
+                               _this.setDispMode( 'box' );
+                       } );
+
+                       $j( '#msc_list_layout' ).hover( function() {
+                               $j( this ).attr( "src", list_dark_url );
+                       }, function() {
+                               $j( this ).attr( "src", ( ( _this.result_display_mode == 'list' ) ? list_dark_url:list_light_url ) );
+                       } ).click( function() {
+                               $j( this ).attr( "src", list_dark_url );
+                               $j( '#msc_box_layout' ).attr( "src", box_light_url );
+                               _this.setDispMode( 'list' );
+                       } );
                }
        },
-       getPaging:function(target){
+       getPaging:function( target ) {
                var _this = this;
                var cp_id = this.disp_item;
-               if( this.disp_item == 'upload'){
+               if ( this.disp_item == 'upload' ) {
                        var cp = _this.content_providers['this_wiki'];
-               }else{          
+               } else {
                        var cp = this.content_providers[ this.disp_item ];
-               }               
-               js_log('getPaging:'+ cp_id + ' len: ' + cp.sObj.num_results);
-               var to_num = ( cp.limit > cp.sObj.num_results )?
-                                               (parseInt( cp.offset ) + parseInt( cp.sObj.num_results ) ):
-                                               ( parseInt( cp.offset ) + parseInt( cp.limit) );
-               var out = '';                           
+               }
+               js_log( 'getPaging:' + cp_id + ' len: ' + cp.sObj.num_results );
+               var to_num = ( cp.limit > cp.sObj.num_results ) ?
+                                               ( parseInt( cp.offset ) + parseInt( cp.sObj.num_results ) ):
+                                               ( parseInt( cp.offset ) + parseInt( cp.limit ) );
+               var out = '';
                
-               //@@todo we should instead support the wiki number format template system instead of inline calls
-               if( cp.sObj.num_results != 0 ){ 
-                       if( cp.sObj.num_results  >  cp.limit){          
-                               out+= gM( 'rsd_results_desc_total', [(cp.offset+1), to_num, mw.lang.formatNumber( cp.sObj.num_results )] );
-                       }else{          
-                               out+= gM( 'rsd_results_desc', [(cp.offset+1), to_num] );
+               // @@todo we should instead support the wiki number format template system instead of inline calls
+               if ( cp.sObj.num_results != 0 ) {
+                       if ( cp.sObj.num_results  >  cp.limit ) {
+                               out += gM( 'rsd_results_desc_total', [( cp.offset + 1 ), to_num, mw.lang.formatNumber( cp.sObj.num_results )] );
+                       } else {
+                               out += gM( 'rsd_results_desc', [( cp.offset + 1 ), to_num] );
                        }
                }
-               //check if we have more results (next prev link)
-               if(  cp.offset >=  cp.limit )
-                       out+=' <a href="#" id="rsd_pprev">' + gM('rsd_results_prev') + ' ' + cp.limit + '</a>';
+               // check if we have more results (next prev link)
+               if (  cp.offset >=  cp.limit )
+                       out += ' <a href="#" id="rsd_pprev">' + gM( 'rsd_results_prev' ) + ' ' + cp.limit + '</a>';
 
-               if( cp.sObj.more_results )
-                       out+=' <a href="#" id="rsd_pnext">' + gM('rsd_results_next') + ' ' + cp.limit + '</a>';
+               if ( cp.sObj.more_results )
+                       out += ' <a href="#" id="rsd_pnext">' + gM( 'rsd_results_next' ) + ' ' + cp.limit + '</a>';
 
-               $j(target).html(out);
+               $j( target ).html( out );
                
-               //set bindings
-               $j('#rsd_pnext').click(function(){
+               // set bindings
+               $j( '#rsd_pnext' ).click( function() {
                        cp.offset += cp.limit;
                        _this.runSearch( false );
-               });
+               } );
                
-               $j('#rsd_pprev').click(function(){
+               $j( '#rsd_pprev' ).click( function() {
                        cp.offset -= cp.limit;
-                       if(cp.offset<0)
-                               cp.offset=0;
-                       _this.runSearch( false);
-               });
+                       if ( cp.offset < 0 )
+                               cp.offset = 0;
+                       _this.runSearch( false );
+               } );
 
                return;
 
        },
-       selectTab:function( selected_cp_id ){
-               js_log('select tab: ' + selected_cp_id);
+       selectTab:function( selected_cp_id ) {
+               js_log( 'select tab: ' + selected_cp_id );
                this.disp_item = selected_cp_id;
-               if( this.disp_item == 'upload' ){
+               if ( this.disp_item == 'upload' ) {
                        this.doUploadInteface();
-               }else{                  
-                       //update the search results:
+               } else {
+                       // update the search results:
                        this.runSearch();
                }
        },
-       setDispMode:function(mode){
-               js_log('setDispMode:' + mode);
-               this.result_display_mode=mode;
-               //run /update search display:
+       setDispMode:function( mode ) {
+               js_log( 'setDispMode:' + mode );
+               this.result_display_mode = mode;
+               // run /update search display:
                this.drawOutputResults();
        }
 };
index c67befd..ab17900 100644 (file)
-//archive.org uses solr engine: 
-//more about solr here:  
-//http://lucene.apache.org/solr/
+// archive.org uses solr engine: 
+// more about solr here:  
+// http://lucene.apache.org/solr/
 
-var archiveOrgSearch = function ( iObj){
+var archiveOrgSearch = function ( iObj ) {
        return this.init( iObj );
 }
 archiveOrgSearch.prototype = {
        // Archive.org constants: 
        dnUrl:'http://www.archive.org/download/',
        dtUrl:'http://www.archive.org/details/',
-       init:function( iObj ){
+       init:function( iObj ) {
                // Init base class and inherit: 
                var baseSearch = new baseRemoteSearch( iObj );
-               for(var i in baseSearch){
-                       if(typeof this[i] =='undefined'){
+               for ( var i in baseSearch ) {
+                       if ( typeof this[i] == 'undefined' ) {
                                this[i] = baseSearch[i];
-                       }else{
-                               this['parent_'+i] =  baseSearch[i];
+                       } else {
+                               this['parent_' + i] =  baseSearch[i];
                        }
                }
                // Inherit the cp settings for 
        },
-       getSearchResults:function(){
-               //call parent: 
-               this.parent_getSearchResults();         
-               var _this = this;                               
-               js_log('f:getSearchResults for:' + $j('#rsd_q').val() );                
-               //build the query var
-               var q = $j('#rsd_q').val();
-               //@@todo check advanced options: include audio and images media types
-               //for now force (Ogg video) & url based license
-               q+=' format:(Ogg video)';
-               q+=' licenseurl:(http\\:\\/\\/*)';
+       getSearchResults:function() {
+               // call parent: 
+               this.parent_getSearchResults();
+               var _this = this;
+               js_log( 'f:getSearchResults for:' + $j( '#rsd_q' ).val() );
+               // build the query var
+               var q = $j( '#rsd_q' ).val();
+               // @@todo check advanced options: include audio and images media types
+               // for now force (Ogg video) & url based license
+               q += ' format:(Ogg video)';
+               q += ' licenseurl:(http\\:\\/\\/*)';
                var reqObj = {
-                       'q': q, //just search for video atm
-                       'fl':"description,title,identifier,licenseurl,format,license,thumbnail",                        
-                       'wt':'json',                    
+                       'q': q, // just search for video atm
+                       'fl':"description,title,identifier,licenseurl,format,license,thumbnail",
+                       'wt':'json',
                        'rows' : this.cp.limit,
-                       'start' : this.cp.offset                                                
-               }                                                                       
+                       'start' : this.cp.offset
+               }
                do_api_req( {
-                       'data':reqObj, 
+                       'data':reqObj,
                        'url':this.cp.api_url,
                        'jsonCB':'json.wrf'
-                       }, function(data){                              
-                               _this.addResults( data);
+                       }, function( data ) {
+                               _this.addResults( data );
                                _this.loading = false;
                        }
                );
        },
-       addResults:function( data ){            
-               var _this = this;                       
-               if(data.response && data.response.docs){
-                       //set result info: 
+       addResults:function( data ) {
+               var _this = this;
+               if ( data.response && data.response.docs ) {
+                       // set result info: 
                        this.num_results = data.response.numFound;
                
-                       for(var resource_id in data.response.docs){                             
-                               var resource = data.response.docs[resource_id];                         
+                       for ( var resource_id in data.response.docs ) {
+                               var resource = data.response.docs[resource_id];
                                var rObj = {
-                                       //@@todo we should add .ogv or oga if video or audio:
+                                       // @@todo we should add .ogv or oga if video or audio:
                                        'titleKey'       :  resource.identifier + '.ogg',
-                                       'resourceKey':  resource.identifier,                            
-                                       'link'           : _this.dtUrl + resource.identifier,                           
+                                       'resourceKey':  resource.identifier,
+                                       'link'           : _this.dtUrl + resource.identifier,
                                        'title'          : resource.title,
-                                       'poster'         : _this.dnUrl + resource.identifier+'/format=thumbnail',
-                                       'poster_ani' : _this.dnUrl + resource.identifier+'/format=Animated+Gif',
+                                       'poster'         : _this.dnUrl + resource.identifier + '/format=thumbnail',
+                                       'poster_ani' : _this.dnUrl + resource.identifier + '/format=Animated+Gif',
                                        'thumbwidth' : 160,
-                                       'thumbheight': 110,                     
+                                       'thumbheight': 110,
                                        'desc'           : resource.description,
-                                       'src'             : _this.dnUrl + resource.identifier+'/format=Ogg+video',
+                                       'src'             : _this.dnUrl + resource.identifier + '/format=Ogg+video',
                                        'mime'            : 'application/ogg',
-                                       //set the license: (rsd is a pointer to the parent remoteSearchDriver )          
+                                       // set the license: (rsd is a pointer to the parent remoteSearchDriver )                 
                                        'license'         : this.rsd.getLicenceFromUrl( resource.licenseurl ),
-                                       'pSobj'          :_this                         
+                                       'pSobj'          :_this
                                        
-                               };                                                                                                                                                                                                               
-                               this.resultsObj[ resource_id ] = rObj;                                                          
+                               };
+                               this.resultsObj[ resource_id ] = rObj;
                        }
-               }               
+               }
        },
-       //getTitleKey:function(rObj){
+       // getTitleKey:function(rObj){
        //      return rObj['stream_name'] + '__' + rObj['start_time'].replace(/:/g,'.') + '_to_' + rObj['end_time'].replace(/:/g,'.') + '.ogg';;
-       //}
-       getEmbedTimeMeta:function(rObj, callback){
+       // }
+       getEmbedTimeMeta:function( rObj, callback ) {
                var _this = this;
                do_api_req( {
-                       'data':{'avinfo':1},
-                       'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'                      
-               },function(data){                                                                                       
-                       if(data['length'])
+                       'data': { 'avinfo':1 },
+                       'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'
+               }, function( data ) {
+                       if ( data['length'] )
                                rObj.duration = data['length'];
-                       if(data['width'])
+                       if ( data['width'] )
                                rObj.width = data['width'];
-                       if(data['height'])
+                       if ( data['height'] )
                                rObj.height = data['height'];
                                                                   
                        callback();
-               });
+               } );
        },
-       getEmbedHTML: function( rObj , options) {
-               js_log('getEmbedHTML:: ' + rObj.poster );
-               if(!options)
-                       options ={};
-               var id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
-               if( rObj.duration ){
-                       var src = rObj.src + '?t=0:0:0/'+ seconds2npt( rObj.duration );
-               }else{
+       getEmbedHTML: function( rObj , options ) {
+               js_log( 'getEmbedHTML:: ' + rObj.poster );
+               if ( !options )
+                       options = { };
+               var id_attr = ( options['id'] ) ? ' id = "' + options['id'] + '" ': '';
+               if ( rObj.duration ) {
+                       var src = rObj.src + '?t=0:0:0/' + seconds2npt( rObj.duration );
+               } else {
                        var src = rObj.src;
                }
-               if(rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg' || rObj.mime=='video/ogg'){
+               if ( rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg' || rObj.mime == 'video/ogg' ) {
                        return '<video ' + id_attr + ' src="' + src + '" poster="' + rObj.poster + '" type="video/ogg"></video>';
                }
        }
index 9fb234a..7879615 100644 (file)
@@ -1,8 +1,8 @@
-//base remote search obj
+// base remote search obj
 
-loadGM({
+loadGM( {
        "mwe-imported_from" : "$1 imported from [$2 $3]. See the original [$4 resource page] for more information."
-})
+} )
 // @key is name of rObj variable
 // @value is where to find the value in the item xml
 //
@@ -19,228 +19,228 @@ var rsd_default_rss_item_mapping = {
        'title'         : 'title',
        'link'          : 'link',
        'desc'          : 'description',
-       //multiple items
+       // multiple items
        'category'  : '.media:category@label|url'
 }
 
-var baseRemoteSearch = function(iObj) {
-       return this.init(iObj);
+var baseRemoteSearch = function( iObj ) {
+       return this.init( iObj );
 };
 baseRemoteSearch.prototype = {
 
        completed_req:0,
        num_req:0,
 
-       resultsObj:{},
+       resultsObj: { },
 
-       //default search result values for paging:
+       // default search result values for paging:
        offset                   :0,
        limit                   : 30,
        more_results    : false,
        num_results             : 0,
 
-       //init the object:
-       init: function( iObj ){
-               js_log('mvBaseRemoteSearch:init');
-               for(var i in iObj){
+       // init the object:
+       init: function( iObj ) {
+               js_log( 'mvBaseRemoteSearch:init' );
+               for ( var i in iObj ) {
                        this[i] = iObj[i];
                }
                return this;
        },
-       getSearchResults:function(){
-               //empty out the current results before issuing a request
-               this.resultsObj = {};
-               //do global getSearchResults bindings
-               this.last_query = $j('#rsd_q').val();
+       getSearchResults:function() {
+               // empty out the current results before issuing a request
+               this.resultsObj = { };
+               // do global getSearchResults bindings
+               this.last_query = $j( '#rsd_q' ).val();
                this.last_offset = this.cp.offset;
-               //set the loading flag:         
-               this.loading=true;
-       },      
+               // set the loading flag:                
+               this.loading = true;
+       },
        /*
        * Parses and adds video rss based input format
        * @param $data XML data to parse
        * @param provider_url    the source url (used to generate absolute links)
        */
-       addRSSData:function( data , provider_url ){
-               js_log('f:addRSSData');
+       addRSSData:function( data , provider_url ) {
+               js_log( 'f:addRSSData' );
                var _this = this;
                var http_host = '';
                var http_path = '';
-               if(provider_url){
+               if ( provider_url ) {
                        pUrl =  parseUri( provider_url );
-                       http_host = pUrl.protocol +'://'+ pUrl.authority;
+                       http_host = pUrl.protocol + '://' + pUrl.authority;
                        http_path = pUrl.directory;
                }
-               var items = data.getElementsByTagName('item');
-               //js_log('found ' + items.length );
-               $j.each(items, function(inx, item){
-                       var rObj = {};
-                       for(var i in rsd_default_rss_item_mapping){
-                               var selector = rsd_default_rss_item_mapping[i].split('@');
-
-                               var flag_multiple = (  selector[0].substr(0,1) == '.' ) ? true : false;
-                               if( flag_multiple ){
+               var items = data.getElementsByTagName( 'item' );
+               // js_log('found ' + items.length );
+               $j.each( items, function( inx, item ) {
+                       var rObj = { };
+                       for ( var i in rsd_default_rss_item_mapping ) {
+                               var selector = rsd_default_rss_item_mapping[i].split( '@' );
+
+                               var flag_multiple = (  selector[0].substr( 0, 1 ) == '.' ) ? true : false;
+                               if ( flag_multiple ) {
                                        rObj[i] = new Array();
-                                       var tag_name = selector[0].substr(1);
-                               }else{
+                                       var tag_name = selector[0].substr( 1 );
+                               } else {
                                        var tag_name = selector[0];
                                }
 
                                var attr_name = null;
-                               if( typeof selector[1] != 'undefined'){
+                               if ( typeof selector[1] != 'undefined' ) {
                                        attr_name = selector[1];
-                                       if( attr_name.indexOf('|') != -1 )
-                                               attr_name = attr_name.split('|');
+                                       if ( attr_name.indexOf( '|' ) != - 1 )
+                                               attr_name = attr_name.split( '|' );
                                }
 
-                               $j.each( item.getElementsByTagName( tag_name ), function ( inx, node ){
+                               $j.each( item.getElementsByTagName( tag_name ), function ( inx, node ) {
                                        var tag_val = '';
-                                       if( node!=null && attr_name == null ){
-                                               if( node.childNodes[0] != null){
-                                                       //trim and strip html:
-                                                       tag_val = $j.trim( node.firstChild.nodeValue ).replace(/(<([^>]+)>)/ig,"");
+                                       if ( node != null && attr_name == null ) {
+                                               if ( node.childNodes[0] != null ) {
+                                                       // trim and strip html:
+                                                       tag_val = $j.trim( node.firstChild.nodeValue ).replace( / ( < ( [ ^ > ] + ) > ) / ig, "" );
                                                }
                                        }
-                                       if( node!=null && attr_name != null){
-                                               if( typeof attr_name == 'string' ){
+                                       if ( node != null && attr_name != null ) {
+                                               if ( typeof attr_name == 'string' ) {
                                                        tag_val = $j.trim( $j( node ).attr( attr_name ) );
-                                               }else{
-                                                       var attr_vals = {};
-                                                       for( var j in attr_name ){
-                                                               if( $j(node).attr( attr_name[j] ).length != 0)
-                                                                       attr_vals[ attr_name[j] ] = $j.trim( $j(node).attr( attr_name[j]) ).replace(/(<([^>]+)>)/ig,"");
+                                               } else {
+                                                       var attr_vals = { };
+                                                       for ( var j in attr_name ) {
+                                                               if ( $j( node ).attr( attr_name[j] ).length != 0 )
+                                                                       attr_vals[ attr_name[j] ] = $j.trim( $j( node ).attr( attr_name[j] ) ).replace( / ( < ( [ ^ > ] + ) > ) / ig, "" );
                                                        }
                                                        tag_val = attr_vals ;
                                                }
                                        }
-                                       if(flag_multiple){
-                                               rObj[i].push( tag_val)
-                                       }else{
+                                       if ( flag_multiple ) {
+                                               rObj[i].push( tag_val )
+                                       } else {
                                                rObj[i] = tag_val;
                                        }
-                               });
+                               } );
 
 
                        } // done with property loop
 
 
-                       //make relative urls absolute:
-                       var url_param = new Array('src', 'poster');
-                       for(var j=0; j < url_param.length; j++){
+                       // make relative urls absolute:
+                       var url_param = new Array( 'src', 'poster' );
+                       for ( var j = 0; j < url_param.length; j++ ) {
                                var p = url_param[j];
-                               if(typeof rObj[p] != 'undefined'){
-                                       if( rObj[p].substr(0,1)=='/' ){
+                               if ( typeof rObj[p] != 'undefined' ) {
+                                       if ( rObj[p].substr( 0, 1 ) == '/' ) {
                                                rObj[p] = http_host + rObj[p];
                                        }
-                                       if( parseUri( rObj[i] ).host ==  rObj[p]){
+                                       if ( parseUri( rObj[i] ).host ==  rObj[p] ) {
                                                rObj[p] = http_host + http_path + rObj[p];
                                        }
                                }
                        }
-                       //force a mime type for now.. in the future generalize for other RSS feeds and conversions
+                       // force a mime type for now.. in the future generalize for other RSS feeds and conversions
                        rObj['mime'] = 'video/ogg';
-                       //add pointer to parent search obj:( this.cp.limit )? this.cp.limit : this.limit,
+                       // add pointer to parent search obj:( this.cp.limit )? this.cp.limit : this.limit,
 
                        rObj['pSobj'] = _this;
-                       //add the result to the result set:
+                       // add the result to the result set:
                        _this.resultsObj[ inx ] = rObj;
                        _this.num_results++;
-               });
+               } );
        },
-       getEmbedHTML: function( rObj , options) {
-               if(!options)
-                       options = {};
-               //set up the output var with the default values: 
-               var outOpt = { 'width': rObj.width, 'height': rObj.height};
-               if( options['max_height'] ){                    
-                       outOpt.height = (options.max_height > rObj.height) ? rObj.height : options.max_height;  
-                       outOpt.width = (rObj.width / rObj.height) *outOpt.height;                       
-               }                                               
-               options.style_attr = 'style="width:' + outOpt.width + 'px;height:' + outOpt.height +'px"';
-               options.id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
+       getEmbedHTML: function( rObj , options ) {
+               if ( !options )
+                       options = { };
+               // set up the output var with the default values: 
+               var outOpt = { 'width': rObj.width, 'height': rObj.height };
+               if ( options['max_height'] ) {
+                       outOpt.height = ( options.max_height > rObj.height ) ? rObj.height : options.max_height;
+                       outOpt.width = ( rObj.width / rObj.height ) * outOpt.height;
+               }
+               options.style_attr = 'style="width:' + outOpt.width + 'px;height:' + outOpt.height + 'px"';
+               options.id_attr = ( options['id'] ) ? ' id = "' + options['id'] + '" ': '';
                
-               if( rObj.mime.indexOf('image') != -1 ){
+               if ( rObj.mime.indexOf( 'image' ) != - 1 ) {
                        return this.getImageEmbedHTML( rObj, options );
-               }else{
-                       js_log("ERROR:: no embed code for mime type: " + rObj.mime);
+               } else {
+                       js_log( "ERROR:: no embed code for mime type: " + rObj.mime );
                        return ' Error missing embed code ';
                }
        },
-       getImageEmbedHTML:function( rObj, options ) {   
-               //if crop is null do base output: 
+       getImageEmbedHTML:function( rObj, options ) {
+               // if crop is null do base output: 
                var imgHtml = '<img ' + options.id_attr + ' src="' + rObj.edit_url  + '"' + options.style_attr + ' >';
-               if( rObj.crop == null)
+               if ( rObj.crop == null )
                        return imgHtml
-               //else do crop output:  
-                       return '<div style="width:'+rObj.crop.w +'px;height: ' + rObj.crop.h +'px;overflow:hidden;position:relative">' +
-                                               '<div style="position:relative;top:-' + rObj.crop.y +'px;left:-' + rObj.crop.x +'px">'+
-                                                       imgHtml + 
-                                               '</div>'+
+               // else do crop output: 
+                       return '<div style="width:' + rObj.crop.w + 'px;height: ' + rObj.crop.h + 'px;overflow:hidden;position:relative">' +
+                                               '<div style="position:relative;top:-' + rObj.crop.y + 'px;left:-' + rObj.crop.x + 'px">' +
+                                                       imgHtml +
+                                               '</div>' +
                                        '</div>';
        },
-       //by default just return the existing image with callback
-       getImageObj:function( rObj, size, callback){
-               callback( {'url':rObj.poster} );
+       // by default just return the existing image with callback
+       getImageObj:function( rObj, size, callback ) {
+               callback( { 'url':rObj.poster } );
        },
-       //by default just return the rObj.desc
-       getInlineDescWiki:function( rObj ){
-               //return striped html  & trim white space
-               if(rObj.desc)
-                       return $j.trim( rObj.desc.replace(/(<([^>]+)>)/ig,"") );
-               //no desc avaliable:
+       // by default just return the rObj.desc
+       getInlineDescWiki:function( rObj ) {
+               // return striped html  & trim white space
+               if ( rObj.desc )
+                       return $j.trim( rObj.desc.replace( / ( < ( [ ^ > ] + ) > ) / ig, "" ) );
+               // no desc avaliable:
                return '';
        },
-       //default license permission wiki text is cc based template mapping (does not confirm the templates actually exist)
-       getPermissionWikiTag: function( rObj ){
-               if(!rObj.license)
-                       return '';//no license info
-               //check that its a defined creative commons licnese key:
-               if(  this.rsd.licenses.cc.licenses[ rObj.license.key ] != 'undefined' ){
+       // default license permission wiki text is cc based template mapping (does not confirm the templates actually exist)
+       getPermissionWikiTag: function( rObj ) {
+               if ( !rObj.license )
+                       return '';// no license info
+               // check that its a defined creative commons licnese key:
+               if (  this.rsd.licenses.cc.licenses[ rObj.license.key ] != 'undefined' ) {
                        return '{{Cc-' + rObj.license.key + '}}';
-               }else if( rObj.license.lurl ) {
+               } else if ( rObj.license.lurl ) {
                        return '{{Template:External_License|' + rObj.license.lurl + '}}';
                }
 
        },
-       getImportResourceDescWiki:function(rObj){
-               return gM('mwe-imported_from', [rObj.title,  this.cp.homepage, this.cp.title, rObj.link]);
+       getImportResourceDescWiki:function( rObj ) {
+               return gM( 'mwe-imported_from', [rObj.title,  this.cp.homepage, this.cp.title, rObj.link] );
        },
-       //for thigns like categories and the like
-       getExtraResourceDescWiki:function( rObj ){
+       // for thigns like categories and the like
+       getExtraResourceDescWiki:function( rObj ) {
                return '';
        },
-       //by default just return the poster (clients can overide)
-       getImageTransform:function(rObj, opt){
+       // by default just return the poster (clients can overide)
+       getImageTransform:function( rObj, opt ) {
                return rObj.poster;
        },
-       getEmbedObjParsedInfo:function(rObj, eb_id){
+       getEmbedObjParsedInfo:function( rObj, eb_id ) {
                return rObj;
        },
-       getEmbedTimeMeta:function(rObj, callback){
+       getEmbedTimeMeta:function( rObj, callback ) {
                callback();
        },
-       getEmbedWikiCode:function(rObj){
-               var layout = ( rObj.layout)? rObj.layout:"right"
-               var o= '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|'+layout;
+       getEmbedWikiCode:function( rObj ) {
+               var layout = ( rObj.layout ) ? rObj.layout:"right"
+               var o = '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|' + layout;
 
-               if(!rObj.target_width && rObj.width){
-                       rObj.target_width = (rObj.width < 640)? rObj.width: '640';
+               if ( !rObj.target_width && rObj.width ) {
+                       rObj.target_width = ( rObj.width < 640 ) ? rObj.width: '640';
                }
 
-               if(rObj.target_width)
-                       o+='|' + rObj.target_width + 'px';
+               if ( rObj.target_width )
+                       o += '|' + rObj.target_width + 'px';
 
-               if( rObj.inlineDesc )
-                       o+='|' + rObj.inlineDesc;
+               if ( rObj.inlineDesc )
+                       o += '|' + rObj.inlineDesc;
 
-               o+=']]';
+               o += ']]';
                return o;
        },
-       updateTargetResourceTitle:function(rObj){
-               rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,'');
+       updateTargetResourceTitle:function( rObj ) {
+               rObj.target_resource_title = rObj.titleKey.replace( / File: | Image: / , '' );
                rObj.target_resource_title = this.cp.resource_prefix + rObj.target_resource_title;
        },
-       updateDataForImport:function( rObj ){
+       updateDataForImport:function( rObj ) {
                return rObj;
        }
 }
index 9c95d9a..eb320c9 100644 (file)
@@ -15,141 +15,141 @@ http://www.flickr.com/services/rest/?method=flickr.test.echo&format=json&api_key
        (8) United States Government Work
 */
 
-var flickrSearch = function ( iObj){
+var flickrSearch = function ( iObj ) {
        return this.init( iObj );
 }
 flickrSearch.prototype = {
        dtUrl : 'http://www.flickr.com/photos/',
-       //@@todo probably would be good to read the api-key from configuration
-       apikey : '2867787a545cc66c0bce6f2e57aca1d1', 
-       //what licence we are interested in
-       _licence_keys: '4,5,7,8',       
-       _srctypes: ['t','sq','s','m','o'],
-       licenceMap:{
+       // @@todo probably would be good to read the api-key from configuration
+       apikey : '2867787a545cc66c0bce6f2e57aca1d1',
+       // what licence we are interested in
+       _licence_keys: '4,5,7,8',
+       _srctypes: ['t', 'sq', 's', 'm', 'o'],
+       licenceMap: {
                '4' : 'http://creativecommons.org/licenses/by/3.0/',
                '5'     : 'http://creativecommons.org/licenses/by-sa/3.0/',
                '7'     : 'http://www.flickr.com/commons/usage/',
                '8' : 'http://www.usa.gov/copyright.shtml'
        },
-       init:function( iObj ){
-               //init base class and inherit: 
+       init:function( iObj ) {
+               // init base class and inherit: 
                var baseSearch = new baseRemoteSearch( iObj );
-               for(var i in baseSearch){
-                       if(typeof this[i] =='undefined'){
+               for ( var i in baseSearch ) {
+                       if ( typeof this[i] == 'undefined' ) {
                                this[i] = baseSearch[i];
-                       }else{
-                               this['parent_'+i] =  baseSearch[i];
+                       } else {
+                               this['parent_' + i] =  baseSearch[i];
                        }
                }
-               //inherit the cp settings for 
+               // inherit the cp settings for 
        },
-       getSearchResults:function(){            
+       getSearchResults:function() {
                var _this = this;
-               js_log("flickr::getSearchResults");
-               //call parent (sets loading sate and other setup stuff) 
+               js_log( "flickr::getSearchResults" );
+               // call parent (sets loading sate and other setup stuff) 
                this.parent_getSearchResults();
-               //setup the flickr request: 
+               // setup the flickr request: 
                var reqObj = {
-                       'method':'flickr.photos.search', 
+                       'method':'flickr.photos.search',
                        'format':'json',
-                       'license':this._licence_keys,                                           
-                       'api_key':this.apikey,  
+                       'license':this._licence_keys,
+                       'api_key':this.apikey,
                        'per_page': this.cp.limit,
                        'page' : this.cp.offset,
-                       'text': $j('#rsd_q').val(),
-                       'extras' :      'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_m, url_o'        
-               }                                                                       
+                       'text': $j( '#rsd_q' ).val(),
+                       'extras' :      'license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_m, url_o'
+               }
                do_api_req( {
                        'data': reqObj,
                        'url':this.cp.api_url,
                        'jsonCB':'jsoncallback',
-               },      function( data ){
-                       _this.addResults( data);
+               },      function( data ) {
+                       _this.addResults( data );
                        _this.loading = false;
-               });
+               } );
        },
-       addResults:function( data ){
-               var _this = this;                       
-               if(data.photos && data.photos.photo){                   
-                       //set result info: 
-                       this.num_results = data.photos.total;   
-                       if( this.num_results > this.cp.offset + this.cp.limit ){
+       addResults:function( data ) {
+               var _this = this;
+               if ( data.photos && data.photos.photo ) {
+                       // set result info: 
+                       this.num_results = data.photos.total;
+                       if ( this.num_results > this.cp.offset + this.cp.limit ) {
                                this.more_results = true;
-                       }               
-                       for(var resource_id in data.photos.photo){                              
-                               var resource = data.photos.photo[resource_id];  
+                       }
+                       for ( var resource_id in data.photos.photo ) {
+                               var resource = data.photos.photo[resource_id];
                        
                                var rObj = {
                                        'titleKey'       : resource.title + '.jpg',
                                        'resourceKey': resource.id,
-                                       'link'           : _this.dtUrl + resource.pathalias + '/'+ resource.id,                         
+                                       'link'           : _this.dtUrl + resource.pathalias + '/' + resource.id,
                                        'title'          : resource.title,
                                        'thumbwidth' : resource.width_t,
-                                       'thumbheight': resource.height_t,                       
-                                       'desc'           : resource.title,                                      
-                                       //set the license: (rsd is a pointer to the parent remoteSearchDriver )          
+                                       'thumbheight': resource.height_t,
+                                       'desc'           : resource.title,
+                                       // set the license: (rsd is a pointer to the parent remoteSearchDriver )                 
                                        'license'        : this.rsd.getLicenceFromUrl( _this.licenceMap[ resource.license ] ),
-                                       'pSobj'          : _this,       
-                                       //assume image/jpeg for "photos"
-                                       'mime'           : 'image/jpeg'                                 
-                               };                                              
-                               //set all the provided srcs:
-                               rObj['srcSet'] = {}; 
-                               for( var i in _this._srctypes){
+                                       'pSobj'          : _this,
+                                       // assume image/jpeg for "photos"
+                                       'mime'           : 'image/jpeg'
+                               };
+                               // set all the provided srcs:
+                               rObj['srcSet'] = { };
+                               for ( var i in _this._srctypes ) {
                                        var st = _this._srctypes[i];
-                                       //if resource has a url add it to the srcSet:   
-                                       if( resource['url_' + st] ){                            
+                                       // if resource has a url add it to the srcSet:  
+                                       if ( resource['url_' + st] ) {
                                                rObj['srcSet'][st] = {
                                                        'h': resource['height_' + st],
                                                        'w': resource['width_' + st],
                                                        'src': resource['url_' + st]
                                                }
-                                               //set src to the largest 
+                                               // set src to the largest 
                                                rObj['src'] = resource['url_' + st];
                                        }
-                               }       
+                               }
                                                                                                                                                                                                                                                        
                                _this.resultsObj[ resource_id ] = rObj;
                        }
                }
        },
-       //return image transform via callback 
-       getImageObj:function( rObj, size, callback){    
-               if( size.width ){
-                       var skey = this.getSrcTypeKey(rObj, size.width )        
-                       callback ({
+       // return image transform via callback 
+       getImageObj:function( rObj, size, callback ) {
+               if ( size.width ) {
+                       var skey = this.getSrcTypeKey( rObj, size.width )
+                       callback ( {
                                'url' : rObj.srcSet[ skey ].src,
                                'width' : rObj.srcSet[ skey ].w,
                                'height' : rObj.srcSet[ skey ].h
-                       });             
+                       } );
+               }
+       },
+       getImageTransform:function( rObj, opt ) {
+               if ( opt.width ) {
+                       return rObj.srcSet[ this.getSrcTypeKey( rObj, opt.width ) ].src;
                }
-       },      
-       getImageTransform:function(rObj, opt){
-               if( opt.width ){
-                       return rObj.srcSet[ this.getSrcTypeKey(rObj, opt.width) ].src;
-               }               
        },
-       getSrcTypeKey:function(rObj, width ){
-               if( width <= 75 ){                              
-                       if( rObj.srcSet['sq'] )
-                               return 'sq';                    
-               }else if( width <= 100 ){
-                       if( rObj.srcSet['t'] )
+       getSrcTypeKey:function( rObj, width ) {
+               if ( width <= 75 ) {
+                       if ( rObj.srcSet['sq'] )
+                               return 'sq';
+               } else if ( width <= 100 ) {
+                       if ( rObj.srcSet['t'] )
                                return 't';
-               }else if( width <= 240 ){
-                       if( rObj.srcSet['s'] )
+               } else if ( width <= 240 ) {
+                       if ( rObj.srcSet['s'] )
                                return 's';
-               }else if( width <= 500 ){
-                       if( rObj.srcSet['m'] )
+               } else if ( width <= 500 ) {
+                       if ( rObj.srcSet['m'] )
                                return 'm';
-               }else{
-                       if( rObj.srcSet['o'] )
+               } else {
+                       if ( rObj.srcSet['o'] )
                                return 'o';
                }
-               //original was missing return medium or small
-               if( rObj.srcSet['m'] )
+               // original was missing return medium or small
+               if ( rObj.srcSet['m'] )
                        return 'm';
-               if( rObj.srcSet['s'] )
+               if ( rObj.srcSet['s'] )
                        return 's';
                
        }
index 1740e3d..27113c9 100644 (file)
-var mediaWikiSearch = function( iObj ) {               
+var mediaWikiSearch = function( iObj ) {
        return this.init( iObj );
 };
 mediaWikiSearch.prototype = {
-       init:function( iObj ){
-               //init base class and inherit: 
+       init:function( iObj ) {
+               // init base class and inherit: 
                var baseSearch = new baseRemoteSearch( iObj );
-               for(var i in baseSearch){
-                       if(typeof this[i] =='undefined'){
+               for ( var i in baseSearch ) {
+                       if ( typeof this[i] == 'undefined' ) {
                                this[i] = baseSearch[i];
-                       }else{
-                               this['parent_'+i] =  baseSearch[i];
+                       } else {
+                               this['parent_' + i] =  baseSearch[i];
                        }
                }
-               //inherit the cp settings for 
-       },      
-       //returns a rObj by title 
-       addByTitle:function( title , callback, redirect_count){         
-               js_log("AddByTitle::" + title);
-               var _this = this;               
-               if(!redirect_count)
-                       redirect_count=0;
-               if(redirect_count > 5){
-                       js_log('Error: addByTitle too many redirects');
+               // inherit the cp settings for 
+       },
+       // returns a rObj by title 
+       addByTitle:function( title , callback, redirect_count ) {
+               js_log( "AddByTitle::" + title );
+               var _this = this;
+               if ( !redirect_count )
+                       redirect_count = 0;
+               if ( redirect_count > 5 ) {
+                       js_log( 'Error: addByTitle too many redirects' );
                        callback( false );
                        return false;
                }
                var reqObj = {
                        'action':'query',
-                       'titles':'File:'+title, 
+                       'titles':'File:' + title,
                        'prop':'imageinfo|revisions|categories',
                        'iiprop':'url|mime|size',
                        'iiurlwidth': parseInt( this.rsd.thumb_width ),
-                       'rvprop':'content'      
+                       'rvprop':'content'
                }
                do_api_req( {
-                       'data':reqObj, 
-                       'url':this.cp.api_url 
-                       }, function(data){      
-                               //check for redirect
-                               for(var i in data.query.pages){
-                                       var page = data.query.pages[i];                                 
-                                       if(page.revisions[0]['*'] && page.revisions[0]['*'].indexOf('#REDIRECT') === 0){
-                                               var re = new RegExp(/[^\[]*\[\[([^\]]*)/);
+                       'data':reqObj,
+                       'url':this.cp.api_url
+                       }, function( data ) {
+                               // check for redirect
+                               for ( var i in data.query.pages ) {
+                                       var page = data.query.pages[i];
+                                       if ( page.revisions[0]['*'] && page.revisions[0]['*'].indexOf( '#REDIRECT' ) === 0 ) {
+                                               var re = new RegExp( /[^\[]*\[\[([^\]]*)/ );
                                                var pt = page.revisions[0]['*'].match( re );
-                                               if( pt[1] ){
-                                                       _this.addByTitle( pt[1], callback, redirect_count++);
+                                               if ( pt[1] ) {
+                                                       _this.addByTitle( pt[1], callback, redirect_count++ );
                                                        return ;
-                                               }else{
-                                                       js_log('Error: addByTitle could not proccess redirect');
+                                               } else {
+                                                       js_log( 'Error: addByTitle could not proccess redirect' );
                                                        callback( false );
                                                        return false;
                                                }
                                        }
                                }
-                               //if not a redirect do the callback directly:   
-                               callback( _this.addSingleResult(data) );                        
+                               // if not a redirect do the callback directly:  
+                               callback( _this.addSingleResult( data ) );
                        }
-               );                      
+               );
        },
-       clearResults:function(){
-               this.resultsObj = {};           
-               this.last_query ='';
+       clearResults:function() {
+               this.resultsObj = { };
+               this.last_query = '';
        },
-       //update the resultObj with recently uploaded items by current User:
-       getUserRecentUploads:function(wgUser, callback){
+       // update the resultObj with recently uploaded items by current User:
+       getUserRecentUploads:function( wgUser, callback ) {
                var _this = this;
-               do_api_req({
-                       'data':{
+               do_api_req( {
+                       'data': {
                                'action':'query',
                                'list':'recentchanges',
-                               'rcnamespace':6, //only files
+                               'rcnamespace':6, // only files
                                'rcuser': wgUser,
-                               'rclimit':15, //get last 15 uploaded files                              
+                               'rclimit':15, // get last 15 uploaded files                             
                        },
                        'url':this.cp.api_url
-               },function(data){                       
-                       var titleSet = {};
+               }, function( data ) {
+                       var titleSet = { };
                        var titleStr = ''
                        var pound = '';
-                       //loop over the data and group by title
-                       if(data.query && data.query.recentchanges){     
-                               for(var i in data.query.recentchanges){
+                       // loop over the data and group by title
+                       if ( data.query && data.query.recentchanges ) {
+                               for ( var i in data.query.recentchanges ) {
                                        var rc = data.query.recentchanges[i];
-                                       if( !titleSet[ rc.title ] ){
-                                               titleSet[ rc.title ]=true;
-                                               titleStr+= pound + rc.title;
-                                               pound ='|';
+                                       if ( !titleSet[ rc.title ] ) {
+                                               titleSet[ rc.title ] = true;
+                                               titleStr += pound + rc.title;
+                                               pound = '|';
                                        }
                                }
-                       }                                       
-                       //now run the actual query ( too bad we can't use recentchanges as a generator )
-                       //bug 20563
-                       do_api_req({
+                       }
+                       // now run the actual query ( too bad we can't use recentchanges as a generator )
+                       // bug 20563
+                       do_api_req( {
                                'data' : {
                                        'action'        : 'query',
-                                       'titles'        : titleStr,     
+                                       'titles'        : titleStr,
                                        'prop'          : 'imageinfo|revisions|categories',
                                        'iiprop'        : 'url|mime|size',
                                        'iiurlwidth': parseInt( _this.rsd.thumb_width ),
-                                       'rvprop':'content'      
+                                       'rvprop':'content'
                                },
                                'url':_this.cp.api_url
-                       },function(data){                               
+                       }, function( data ) {
                                _this.clearResults();
-                               _this.addResults(data);
-                               if(callback)
+                               _this.addResults( data );
+                               if ( callback )
                                        callback();
-                       });                     
-               });
-       },      
-       getSearchResults:function(){
-               //call parent: 
+                       } );
+               } );
+       },
+       getSearchResults:function() {
+               // call parent: 
                this.parent_getSearchResults();
-               //set local ref:
+               // set local ref:
                var _this = this;
                                
-               js_log('f:getSearchResults for:' + $j('#rsd_q').val() );                
-               //do two queries against the Image / File / MVD namespace:
-                                                                                
-               //build the image request object: 
+               js_log( 'f:getSearchResults for:' + $j( '#rsd_q' ).val() );
+               // do two queries against the Image / File / MVD namespace:
+
+               // build the image request object: 
                var reqObj = {
-                       'action':'query',                        
+                       'action':'query',
                        'generator':'search',
-                       'gsrsearch':  $j('#rsd_q').val(),  
-                       'gsrnamespace':6, //(only search the "file" namespace (audio, video, images)
+                       'gsrsearch':  $j( '#rsd_q' ).val(),
+                       'gsrnamespace':6, // (only search the "file" namespace (audio, video, images)
                        'gsrwhat':'title',
                        'gsrlimit':  this.cp.limit,
                        'gsroffset': this.cp.offset,
@@ -131,61 +131,61 @@ mediaWikiSearch.prototype = {
                        'iiprop':'url|mime|size',
                        'iiurlwidth': parseInt( this.rsd.thumb_width ),
                        'rvprop':'content'
-               };                              
-               //set up the number of request: 
-               this.completed_req=0;
-               this.num_req=1;         
-               //setup the number of requests result flag:                                                                                      
-               //also do a request for page titles (would be nice if api could query both at the same time) 
-               reqObj['gsrwhat']='text';
+               };
+               // set up the number of request: 
+               this.completed_req = 0;
+               this.num_req = 1;
+               // setup the number of requests result flag:                                                                                     
+               // also do a request for page titles (would be nice if api could query both at the same time) 
+               reqObj['gsrwhat'] = 'text';
                do_api_req( {
-                       'data':reqObj, 
-                       'url':this.cp.api_url 
-                       }, function(data){
-                               js_log('mediaWikiSearch: got data response'); 
-                               //parse the return data
-                               _this.addResults( data);
-                               //_this.checkRequestDone(); //only need if we do two queries one for title one for text
+                       'data':reqObj,
+                       'url':this.cp.api_url
+                       }, function( data ) {
+                               js_log( 'mediaWikiSearch: got data response' );
+                               // parse the return data
+                               _this.addResults( data );
+                               // _this.checkRequestDone(); //only need if we do two queries one for title one for text
                                _this.loading = false;
-               });                     
-       },      
-       //same as below but returns your rObj for convenience 
-       addSingleResult:function( data ){
-               return this.addResults(data, true);
+               } );
+       },
+       // same as below but returns your rObj for convenience 
+       addSingleResult:function( data ) {
+               return this.addResults( data, true );
        },
-       addResults:function( data, returnFirst ){       
-               js_log("f:addResults");
-               var _this = this                
-               //check if we have 
-               if( typeof data['query-continue'] != 'undefined'){
-                       if( typeof data['query-continue'].search != 'undefined')
-                               this.more_results = true;                       
+       addResults:function( data, returnFirst ) {
+               js_log( "f:addResults" );
+               var _this = this
+               // check if we have 
+               if ( typeof data['query-continue'] != 'undefined' ) {
+                       if ( typeof data['query-continue'].search != 'undefined' )
+                               this.more_results = true;
                }
-               //make sure we have pages to idorate:   
-               if(data.query && data.query.pages){
-                       for(var page_id in  data.query.pages){
+               // make sure we have pages to idorate:  
+               if ( data.query && data.query.pages ) {
+                       for ( var page_id in  data.query.pages ) {
                                var page =  data.query.pages[ page_id ];
                                
-                               //make sure the reop is shared (don't show for now it confusing things)
-                               //@@todo support remote repository better
-                               if( page.imagerepository == 'shared'){
+                               // make sure the reop is shared (don't show for now it confusing things)
+                               // @@todo support remote repository better
+                               if ( page.imagerepository == 'shared' ) {
                                        continue;
                                }
                                
-                               //make sure the page is not a redirect
-                               if(page.revisions && page.revisions[0] && 
-                                       page.revisions[0]['*'] && page.revisions[0]['*'].indexOf('#REDIRECT') === 0){
-                                       //skip page is redirect 
+                               // make sure the page is not a redirect
+                               if ( page.revisions && page.revisions[0] &&
+                                       page.revisions[0]['*'] && page.revisions[0]['*'].indexOf( '#REDIRECT' ) === 0 ) {
+                                       // skip page is redirect 
                                        continue;
-                               }                                                               
-                               //skip if its an empty or missing imageinfo: 
-                               if( !page.imageinfo )
+                               }
+                               // skip if its an empty or missing imageinfo: 
+                               if ( !page.imageinfo )
                                        continue;
                                var rObj =      {
                                        'id'             : page_id,
                                        'titleKey'       : page.title,
-                                       'link'           : page.imageinfo[0].descriptionurl,                            
-                                       'title'          : page.title.replace(/File:|.jpg|.png|.svg|.ogg|.ogv|.oga/ig, ''),
+                                       'link'           : page.imageinfo[0].descriptionurl,
+                                       'title'          : page.title.replace( / File: | .jpg | .png | .svg | .ogg | .ogv | .oga / ig, '' ),
                                        'poster'         : page.imageinfo[0].thumburl,
                                        'thumbwidth' : page.imageinfo[0].thumbwidth,
                                        'thumbheight': page.imageinfo[0].thumbheight,
@@ -193,13 +193,13 @@ mediaWikiSearch.prototype = {
                                        'orgheight'      : page.imageinfo[0].height,
                                        'mime'           : page.imageinfo[0].mime,
                                        'src'            : page.imageinfo[0].url,
-                                       'desc'           : page.revisions[0]['*'],              
-                                       //add pointer to parent search obj:
-                                       'pSobj'          :_this,                        
-                                       'meta':{
+                                       'desc'           : page.revisions[0]['*'],
+                                       // add pointer to parent search obj:
+                                       'pSobj'          :_this,
+                                       'meta': {
                                                'categories':page.categories
                                        }
-                               };      
+                               };
                                /*
                                 //to use once we get the wiki-text parser in shape
                                var pObj = mw.parser.pNew( rObj.desc );
@@ -207,162 +207,162 @@ mediaWikiSearch.prototype = {
                                var tmplInfo = pObj.templates( 'information' );                         
                                */
                                
-                               //attempt to parse out the description current user desc from the commons template: 
-                               //@@todo these could be combined to a single regEx
+                               // attempt to parse out the description current user desc from the commons template: 
+                               // @@todo these could be combined to a single regEx
                                // or better improve the wiki-text parsing and use above 
-                               var desc = rObj.desc.match(/\|\s*description\s*=\s*(([^\n]*\n)*)\|\s*source=/i);
-                               if( desc && desc[1] ){                                  
-                                       rObj.desc = $j.trim( desc[1] );                                 
-                                       //attempt to get the user language if set: 
-                                       if( typeof wgUserLanguage != 'undefined' && wgUserLanguage ){           
-                                               //for some reason the RegExp object is not happy:
-                                               var reg = new RegExp( '\{\{\s*' + wgUserLanguage + '([^=]*)=([^\}]*)\}\}', 'gim' );                                             
+                               var desc = rObj.desc.match( /\|\s*description\s*=\s*(([^\n]*\n)*)\|\s*source=/i );
+                               if ( desc && desc[1] ) {
+                                       rObj.desc = $j.trim( desc[1] );
+                                       // attempt to get the user language if set: 
+                                       if ( typeof wgUserLanguage != 'undefined' && wgUserLanguage ) {
+                                               // for some reason the RegExp object is not happy:
+                                               var reg = new RegExp( '\{\{\s*' + wgUserLanguage + '([^=]*)=([^\}]*)\}\}', 'gim' );
                                                var langMatch = reg.exec( rObj.desc );
-                                               if(langMatch && langMatch[2]){
+                                               if ( langMatch && langMatch[2] ) {
                                                        rObj.desc = langMatch[2];
-                                               }else{                                                                                  
-                                                       //try simple lang template form:
+                                               } else {
+                                                       // try simple lang template form:
                                                        var reg = new RegExp( '\{\{\s*' + wgUserLanguage + '\\|([^\}]*)\}\}', 'gim' );
-                                                       var langMatch = reg.exec( rObj.desc );                                                                                                                                                                          
-                                                       if(langMatch && langMatch[1]){
+                                                       var langMatch = reg.exec( rObj.desc );
+                                                       if ( langMatch && langMatch[1] ) {
                                                                rObj.desc = langMatch[1];
-                                                       }                                               
+                                                       }
                                                }
-                                       }                                                                               
+                                       }
                                }
                                                                                
-                               //likely a audio clip if no poster and type application/ogg 
-                               //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio" 
-                               if( ! rObj.poster && rObj.mime == 'application/ogg' ){                                  
+                               // likely a audio clip if no poster and type application/ogg 
+                               // @@todo we should return audio/ogg for the mime type or some other way to specify its "audio" 
+                               if ( ! rObj.poster && rObj.mime == 'application/ogg' ) {
                                        rObj.mime = 'audio/ogg';
                                }
-                               //add to the resultObj
+                               // add to the resultObj
                                this.resultsObj[page_id] = rObj;
                                
-                               //if returnFirst flag:
-                               if(returnFirst)
+                               // if returnFirst flag:
+                               if ( returnFirst )
                                        return this.resultsObj[page_id];
                                
                                
-                               this.num_results++;     
-                               //for(var i in this.resultsObj[page_id]){
+                               this.num_results++;
+                               // for(var i in this.resultsObj[page_id]){
                                //      js_log('added: '+ i +' '+ this.resultsObj[page_id][i]);
-                               //}
+                               // }
                        }
-               }else{
-                       js_log('no results:' + data);
-               }       
-       },      
-       //check request done used for when we have multiple requests to check before formating results. 
-       checkRequestDone:function(){
-               //display output if done: 
+               } else {
+                       js_log( 'no results:' + data );
+               }
+       },
+       // check request done used for when we have multiple requests to check before formating results. 
+       checkRequestDone:function() {
+               // display output if done: 
                this.completed_req++;
-               if(this.completed_req == this.num_req){
+               if ( this.completed_req == this.num_req ) {
                        this.loading = 0;
                }
-       },      
-       getImageObj:function( rObj, size, callback ){                                   
-               if( rObj.mime=='application/ogg' )
-                       return callback( {'url':rObj.src, 'poster' : rObj.url } );              
+       },
+       getImageObj:function( rObj, size, callback ) {
+               if ( rObj.mime == 'application/ogg' )
+                       return callback( { 'url':rObj.src, 'poster' : rObj.url } );
                
-               //his could be depreciated if thumb.php improves
+               // his could be depreciated if thumb.php improves
                var reqObj = {
                        'action':'query',
                        'format':'json',
                        'titles':rObj.titleKey,
                        'prop':'imageinfo',
-                       'iiprop':'url|size|mime' 
+                       'iiprop':'url|size|mime'
                }
-               //set the width: 
-               if(size.width)
-                       reqObj['iiurlwidth']= size.width;                                
-                js_log('going to do req: ' + this.cp.api_url + ' ' + reqObj );
+               // set the width: 
+               if ( size.width )
+                       reqObj['iiurlwidth'] = size.width;
+                js_log( 'going to do req: ' + this.cp.api_url + ' ' + reqObj );
                do_api_req( {
-                       'data':reqObj, 
+                       'data':reqObj,
                        'url' : this.cp.api_url
-                       }, function(data){                                                              
-                               var imObj = {};
-                               for(var page_id in  data.query.pages){
+                       }, function( data ) {
+                               var imObj = { };
+                               for ( var page_id in  data.query.pages ) {
                                        var iminfo =  data.query.pages[ page_id ].imageinfo[0];
-                                       //store the orginal width:                               
-                                       imObj['org_width']=iminfo.width;
-                                       //check if thumb size > than image size and is jpeg or png (it will not scale well above its max res)                           
-                                       if( ( iminfo.mime=='image/jpeg' || iminfo=='image/png' ) &&
-                                               iminfo.thumbwidth > iminfo.width ){              
+                                       // store the orginal width:                              
+                                       imObj['org_width'] = iminfo.width;
+                                       // check if thumb size > than image size and is jpeg or png (it will not scale well above its max res)                          
+                                       if ( ( iminfo.mime == 'image/jpeg' || iminfo == 'image/png' ) &&
+                                               iminfo.thumbwidth > iminfo.width ) {
                                                imObj['url'] = iminfo.url;
                                                imObj['width'] = iminfo.width;
-                                               imObj['height'] = iminfo.height;                                        
-                                       }else{                                  
-                                               imObj['url'] = iminfo.thumburl;                                 
+                                               imObj['height'] = iminfo.height;
+                                       } else {
+                                               imObj['url'] = iminfo.thumburl;
                                                imObj['width'] = iminfo.thumbwidth;
                                                imObj['height'] = iminfo.thumbheight;
                                        }
                                }
-                               js_log('getImageObj: get: ' + size.width + ' got url:' + imObj.url);                    
-                               callback( imObj ); 
-               });
+                               js_log( 'getImageObj: get: ' + size.width + ' got url:' + imObj.url );
+                               callback( imObj );
+               } );
        },
-       //the insert image function   
-       insertImage:function( cEdit ){
-               if(!cEdit)
-                       var cEdit = _this.cEdit;                
+       // the insert image function   
+       insertImage:function( cEdit ) {
+               if ( !cEdit )
+                       var cEdit = _this.cEdit;
        },
-       getEmbedHTML: function( rObj , options) {               
-               if(!options)
-                       options = {};   
-               this.parent_getEmbedHTML( rObj, options);
-               //check for image output:
-               if( rObj.mime.indexOf('image') != -1 ){
-                       return this.getImageEmbedHTML( rObj, options );         
+       getEmbedHTML: function( rObj , options ) {
+               if ( !options )
+                       options = { };
+               this.parent_getEmbedHTML( rObj, options );
+               // check for image output:
+               if ( rObj.mime.indexOf( 'image' ) != - 1 ) {
+                       return this.getImageEmbedHTML( rObj, options );
                }
-               //for video and audio output:           
-               var ahtml='';
-               if( rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg' ){
-                       ahtml = options.id_attr + 
+               // for video and audio output:          
+               var ahtml = '';
+               if ( rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg' ) {
+                       ahtml = options.id_attr +
                                                ' src="' + rObj.src + '" ' +
                                                options.style_attr +
-                                               ' poster="'+  rObj.poster + '" '                                                                                
-                       if(rObj.mime.indexOf('application/ogg')!=-1){
-                               return '<video ' + ahtml + '></video>'; 
+                                               ' poster="' +  rObj.poster + '" '
+                       if ( rObj.mime.indexOf( 'application/ogg' ) != - 1 ) {
+                               return '<video ' + ahtml + '></video>';
                        }
                                        
-                       if(rObj.mime.indexOf('audio/ogg')!=-1){
+                       if ( rObj.mime.indexOf( 'audio/ogg' ) != - 1 ) {
                                return '<audio ' + ahtml + '></audio>';
                        }
-               }                                               
+               }
                js_log( 'ERROR:unsupored mime type: ' + rObj.mime );
        },
-       getInlineDescWiki:function( rObj ){                                             
+       getInlineDescWiki:function( rObj ) {
                var desc = this.parent_getInlineDescWiki( rObj );
                
-               //strip categories for inline Desc: (should strip license tags too but not as easy)
-               desc = desc.replace(/\[\[Category\:[^\]]*\]\]/, '');
+               // strip categories for inline Desc: (should strip license tags too but not as easy)
+               desc = desc.replace( /\[\[Category\:[^\]]*\]\]/, '' );
                
-               //just grab the description tag for inline desc:
-               var descMatch = new RegExp(/Description=(\{\{en\|)?([^|]*|)/);                  
-               var dparts = desc.match(descMatch);             
+               // just grab the description tag for inline desc:
+               var descMatch = new RegExp( /Description=(\{\{en\|)?([^|]*|)/ );
+               var dparts = desc.match( descMatch );
                                
-               if( dparts && dparts.length > 1){       
-                       desc = (dparts.length == 2) ? dparts[1] : dparts[2].replace('}}','');
-                       desc = (desc.substr(0,2) == '1=') ?desc.substr(2): desc;
-                       return desc;     
+               if ( dparts && dparts.length > 1 ) {
+                       desc = ( dparts.length == 2 ) ? dparts[1] : dparts[2].replace( '}}', '' );
+                       desc = ( desc.substr( 0, 2 ) == '1=' ) ? desc.substr( 2 ): desc;
+                       return desc;
                }
-               //else return the title since we could not find the desc:
-               js_log('Error: No Description Tag, Using::' + desc );
+               // else return the title since we could not find the desc:
+               js_log( 'Error: No Description Tag, Using::' + desc );
                return desc;
        },
-       //returns the inline wikitext for insertion (template based crops for now) 
-       getEmbedWikiCode: function( rObj ){             
-                       //set default layout to right justified
-                       var layout = ( rObj.layout)? rObj.layout:"right"
-                       //if crop is null do base output: 
-                       if( rObj.crop == null)
-                               return this.parent_getEmbedWikiCode( rObj );                                                                                    
-                       //using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop
-                       //@@todo should be replaced with server side cropping 
+       // returns the inline wikitext for insertion (template based crops for now) 
+       getEmbedWikiCode: function( rObj ) {
+                       // set default layout to right justified
+                       var layout = ( rObj.layout ) ? rObj.layout:"right"
+                       // if crop is null do base output: 
+                       if ( rObj.crop == null )
+                               return this.parent_getEmbedWikiCode( rObj );
+                       // using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop
+                       // @@todo should be replaced with server side cropping 
                        return '{{Preview Crop ' + "\n" +
                                                '|Image   = ' + rObj.target_resource_title + "\n" +
-                                               '|bSize   = ' + rObj.width + "\n" + 
+                                               '|bSize   = ' + rObj.width + "\n" +
                                                '|cWidth  = ' + rObj.crop.w + "\n" +
                                                '|cHeight = ' + rObj.crop.h + "\n" +
                                                '|oTop  = ' + rObj.crop.y + "\n" +
index 221ace9..9590a2e 100644 (file)
 /*
 * API modes (implementations should call these objects which inherit the mvBaseRemoteSearch
 */
-loadGM({
+loadGM( {
        "mwe-stream_title" : "$1 $2 to $3"
-});
-var metavidSearch = function(iObj) {
-       return this.init(iObj);
+} );
+var metavidSearch = function( iObj ) {
+       return this.init( iObj );
 };
 metavidSearch.prototype = {
-       reqObj:{  //set up the default request paramaters
+       reqObj: {  // set up the default request paramaters
                'order':'recent',
                'feed_format':'rss'
        },
-       init:function( iObj ){
-               //init base class and inherit:
+       init:function( iObj ) {
+               // init base class and inherit:
                var baseSearch = new baseRemoteSearch( iObj );
-               for(var i in baseSearch){
-                       if(typeof this[i] =='undefined'){
+               for ( var i in baseSearch ) {
+                       if ( typeof this[i] == 'undefined' ) {
                                this[i] = baseSearch[i];
-                       }else{
-                               this['parent_'+i] =  baseSearch[i];
+                       } else {
+                               this['parent_' + i] =  baseSearch[i];
                        }
                }
        },
-       getSearchResults:function(){
-               //call parent:
+       getSearchResults:function() {
+               // call parent:
                this.parent_getSearchResults();
-               //set local ref:
-               var _this = this;               
-               js_log('metavidSearch::getSearchResults()');
-               //proccess all options
+               // set local ref:
+               var _this = this;
+               js_log( 'metavidSearch::getSearchResults()' );
+               // proccess all options
                var url = this.cp.api_url;
-               //add on the req_param
-               for(var i in this.reqObj){
+               // add on the req_param
+               for ( var i in this.reqObj ) {
                        url += '&' + i + '=' + this.reqObj[i];
                }
-               url += '&f[0][t]=match&f[0][v]=' + $j('#rsd_q').val();
-               //add offset limit:
-               url+='&limit=' + this.cp.limit;
-               url+='&offset=' + this.cp.offset;
+               url += '&f[0][t]=match&f[0][v]=' + $j( '#rsd_q' ).val();
+               // add offset limit:
+               url += '&limit=' + this.cp.limit;
+               url += '&offset=' + this.cp.offset;
 
-               do_request(url, function(data){
+               do_request( url, function( data ) {
 
-                       js_log('mvSearch: got data response');
-                       //should have an xml rss data object:
+                       js_log( 'mvSearch: got data response' );
+                       // should have an xml rss data object:
                        _this.addRSSData( data , url );
 
-                       //do some metavid specific pos processing on the rObj data:
-                       for(var i in _this.resultsObj){
+                       // do some metavid specific pos processing on the rObj data:
+                       for ( var i in _this.resultsObj ) {
                                var rObj = _this.resultsObj[i];
                                var proe = parseUri( rObj['roe_url'] );
-                               rObj['start_time'] = proe.queryKey['t'].split('/')[0];
-                               rObj['end_time'] = proe.queryKey['t'].split('/')[1];
+                               rObj['start_time'] = proe.queryKey['t'].split( '/' )[0];
+                               rObj['end_time'] = proe.queryKey['t'].split( '/' )[1];
                                rObj['stream_name'] = proe.queryKey['stream_name'];
 
-                               //all metavid content is public domain:
+                               // all metavid content is public domain:
                                rObj['license'] = _this.rsd.getLicenceFromKey( 'pd' );
 
-                               //transform the title into a wiki_safe title:
-                               //rObj['titleKey'] = proe.queryKey['stream_name'] + '_' + rObj['start_time'].replace(/:/g,'.') + '_' + rObj['end_time'].replace(/:/g,'.') + '.ogg';
+                               // transform the title into a wiki_safe title:
+                               // rObj['titleKey'] = proe.queryKey['stream_name'] + '_' + rObj['start_time'].replace(/:/g,'.') + '_' + rObj['end_time'].replace(/:/g,'.') + '.ogg';
                                rObj['titleKey'] =       _this.getTitleKey( rObj );
 
-                               //default width of metavid clips:
-                               rObj['target_width'] = 400;                                     
+                               // default width of metavid clips:
+                               rObj['target_width'] = 400;
                        }
-                       //done loading:
-                       _this.loading=0;
-               });
+                       // done loading:
+                       _this.loading = 0;
+               } );
        },
-       getTitleKey:function( rObj ){
-               return rObj['stream_name'] + '_part_' + rObj['start_time'].replace(/:/g,'.') + '_to_' + rObj['end_time'].replace(/:/g,'.') + '.ogv';
+       getTitleKey:function( rObj ) {
+               return rObj['stream_name'] + '_part_' + rObj['start_time'].replace( / : / g, '.' ) + '_to_' + rObj['end_time'].replace( / : / g, '.' ) + '.ogv';
        },
-       getTitle:function( rObj ){
-               var sn = rObj['stream_name'].replace(/_/g, ' ');
-               sn = sn.charAt(0).toUpperCase() + sn.substr(1);
-               return gM('mwe-stream_title', [ sn, rObj.start_time, rObj.end_time ]);
+       getTitle:function( rObj ) {
+               var sn = rObj['stream_name'].replace( / _ / g, ' ' );
+               sn = sn.charAt( 0 ).toUpperCase() + sn.substr( 1 );
+               return gM( 'mwe-stream_title', [ sn, rObj.start_time, rObj.end_time ] );
        },
-       //metavid descption tied to public domain license key (government produced content)
-       getPermissionWikiTag:function( rObj ){
+       // metavid descption tied to public domain license key (government produced content)
+       getPermissionWikiTag:function( rObj ) {
                return '{{PD-USGov}}';
        },
-       getExtraResourceDescWiki:function( rObj ){
+       getExtraResourceDescWiki:function( rObj ) {
                var o = "\n";
-               //check for person
-               if(  rObj.person && rObj.person['label'])
+               // check for person
+               if (  rObj.person && rObj.person['label'] )
                        o += '* featuring [[' + rObj.person['label'] + ']]' + "\n";
 
-               if( rObj.parent_clip )
-                       o += '* part of longer [' + rObj.parent_clip + ' video clip]'+ "\n";
+               if ( rObj.parent_clip )
+                       o += '* part of longer [' + rObj.parent_clip + ' video clip]' + "\n";
 
-               if( rObj.person && rObj.person['url'] && rObj.person['label'] )
-                       o += '* also see speeches by [' +  $j.trim( rObj.person.url ) + ' ' + rObj.person['label'] + ']'+ "\n";
+               if ( rObj.person && rObj.person['url'] && rObj.person['label'] )
+                       o += '* also see speeches by [' +  $j.trim( rObj.person.url ) + ' ' + rObj.person['label'] + ']' + "\n";
 
-               //check for bill:
-               if( rObj.bill && rObj.bill['label'] && rObj.bill['url'])
-                       o += '* related to bill: [[' + rObj.bill['label'] + ']] more bill [' + rObj.bill['url'] + ' video clips]'+ "\n";
+               // check for bill:
+               if ( rObj.bill && rObj.bill['label'] && rObj.bill['url'] )
+                       o += '* related to bill: [[' + rObj.bill['label'] + ']] more bill [' + rObj.bill['url'] + ' video clips]' + "\n";
                return o;
        },
-       //format is "quote" followed by [[name of person]]
-       getInlineDescWiki:function( rObj ){
+       // format is "quote" followed by [[name of person]]
+       getInlineDescWiki:function( rObj ) {
                var o = this.parent_getInlineDescWiki( rObj );
-               //add in person if found
-               if( rObj.person &&  rObj.person['label'] ){
-                       o = $j.trim(  o.replace(rObj.person['label'], '') );
-                       //trim leading :
-                       if(o.substr(0,1)==':')
-                               o =  o.substr(1);
-                       //add quotes and person at the end:
+               // add in person if found
+               if ( rObj.person &&  rObj.person['label'] ) {
+                       o = $j.trim(  o.replace( rObj.person['label'], '' ) );
+                       // trim leading :
+                       if ( o.substr( 0, 1 ) == ':' )
+                               o =  o.substr( 1 );
+                       // add quotes and person at the end:
                        var d = this.getDateFromLink( rObj.link );
-                       o ='"' + o + '" [[' + rObj.person['label'] + ']] on ' + d.toDateString();
+                       o = '"' + o + '" [[' + rObj.person['label'] + ']] on ' + d.toDateString();
                }
-               //could do ref or direct link:
+               // could do ref or direct link:
                o += ' \'\'[' + $j.trim( rObj.link ) + ' source clip]\'\' ';
 
-               //var o= '"' + o + '" by [[' + rObj.person['label'] + ']] '+
+               // var o= '"' + o + '" by [[' + rObj.person['label'] + ']] '+
                //              '<ref>[' + rObj.link + ' Metavid Source Page] for ' + rObj.title +'</ref>';
                return o;
        },
-       //give an updated start and end time updates the title and url
-       applyVideoAdj: function( rObj ){
-               js_log('mv ApplyVideoAdj::');
-               //update the titleKey:
+       // give an updated start and end time updates the title and url
+       applyVideoAdj: function( rObj ) {
+               js_log( 'mv ApplyVideoAdj::' );
+               // update the titleKey:
                rObj['titleKey'] =       this.getTitleKey( rObj );
 
-               //update the title:
+               // update the title:
                rObj['title'] = this.getTitle( rObj );
 
-               //update the interface:
-               js_log('update title to: ' + rObj['title']);
-               $j('#rsd_resource_title').html( gM('rsd_resource_edit', rObj['title'] ) );
+               // update the interface:
+               js_log( 'update title to: ' + rObj['title'] );
+               $j( '#rsd_resource_title' ).html( gM( 'rsd_resource_edit', rObj['title'] ) );
 
-               //if the video is "roe" based select the ogg stream
-               if( rObj.roe_url && rObj.pSobj.cp.stream_import_key){
-                       var source = $j('#embed_vid').get(0).media_element.getSourceById( rObj.pSobj.cp.stream_import_key );
-                       if(!source){
-                               js_error('Error::could not find source: ' +  rObj.pSobj.cp.stream_import_key);
-                       }else{
+               // if the video is "roe" based select the ogg stream
+               if ( rObj.roe_url && rObj.pSobj.cp.stream_import_key ) {
+                       var source = $j( '#embed_vid' ).get( 0 ).media_element.getSourceById( rObj.pSobj.cp.stream_import_key );
+                       if ( !source ) {
+                               js_error( 'Error::could not find source: ' +  rObj.pSobj.cp.stream_import_key );
+                       } else {
                                rObj['src'] = source.getURI();
-                               js_log("g src_key: " + rObj.pSobj.cp.stream_import_key + ' src:' + rObj['src']) ;
+                               js_log( "g src_key: " + rObj.pSobj.cp.stream_import_key + ' src:' + rObj['src'] ) ;
                                return true;
                        }
                }
        },
-       getEmbedHTML:function( rObj , options ){
-           if(!options)
-                    options={};
-               var id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
-               var style_attr = (options['max_width'])?' style="width:'+options['max_width']+'px;"':'';
-               //@@maybe check type here ?
-               if(options['only_poster']){
-                       return '<img ' + id_attr + ' src="' + rObj['poster']+'" ' + style_attr + '>';
-               }else{
+       getEmbedHTML:function( rObj , options ) {
+           if ( !options )
+                    options = { };
+               var id_attr = ( options['id'] ) ? ' id = "' + options['id'] + '" ': '';
+               var style_attr = ( options['max_width'] ) ? ' style="width:' + options['max_width'] + 'px;"':'';
+               // @@maybe check type here ?
+               if ( options['only_poster'] ) {
+                       return '<img ' + id_attr + ' src="' + rObj['poster'] + '" ' + style_attr + '>';
+               } else {
                        return '<video ' + id_attr + ' roe="' + rObj['roe_url'] + '"></video>';
                }
        },
-       getImageTransform:function( rObj, opt ){
-               if( opt.width <= 80 ){
+       getImageTransform:function( rObj, opt ) {
+               if ( opt.width <= 80 ) {
                        return getURLParamReplace( rObj.poster, { 'size' : "icon" } )
-               }else if( opt.width <= 160 ){
+               } else if ( opt.width <= 160 ) {
                        return getURLParamReplace( rObj.poster, { 'size' : "small" } )
-               }else if( opt.width <= 320 ){
+               } else if ( opt.width <= 320 ) {
                        return getURLParamReplace( rObj.poster, { 'size' : 'medium' } )
-               }else if( opt.width <= 512 ){
+               } else if ( opt.width <= 512 ) {
                        return getURLParamReplace( rObj.poster, { 'size' : 'large' } )
-               }else{
+               } else {
                        return getURLParamReplace( rObj.poster, { 'size' : 'full' } )
                }
        },
-       getEmbedObjParsedInfo:function(rObj, eb_id){
-               var sources = $j('#'+eb_id).get(0).media_element.getSources();
-               rObj.other_versions ='*[' + rObj['roe_url'] + ' XML of all Video Formats and Timed Text]'+"\n";
-               for(var i in sources){
+       getEmbedObjParsedInfo:function( rObj, eb_id ) {
+               var sources = $j( '#' + eb_id ).get( 0 ).media_element.getSources();
+               rObj.other_versions = '*[' + rObj['roe_url'] + ' XML of all Video Formats and Timed Text]' + "\n";
+               for ( var i in sources ) {
                        var cur_source = sources[i];
-                       //rObj.other_versions += '*['+cur_source.getURI() +' ' + cur_source.title +']' + "\n";
-                       if( cur_source.id ==  this.cp.target_source_id)
+                       // rObj.other_versions += '*['+cur_source.getURI() +' ' + cur_source.title +']' + "\n";
+                       if ( cur_source.id ==  this.cp.target_source_id )
                                rObj['url'] = cur_source.getURI();
                }
-               //js_log('set url to: ' + rObj['url']);
+               // js_log('set url to: ' + rObj['url']);
                return rObj;
        },
-       //update rObj for import:
-       updateDataForImport:function( rObj ){
-               rObj['author']='US Government';
-               //convert data to UTC type date:
+       // update rObj for import:
+       updateDataForImport:function( rObj ) {
+               rObj['author'] = 'US Government';
+               // convert data to UTC type date:
                var d = this.getDateFromLink( rObj.link );
                rObj['date'] =   d.toDateString();
-               rObj['license_template_tag']='PD-USGov';
-               //update based on new start time:
-               js_log('url is: ' + rObj.src + ' ns: ' + rObj.start_time + ' ne:' + rObj.end_time);
+               rObj['license_template_tag'] = 'PD-USGov';
+               // update based on new start time:
+               js_log( 'url is: ' + rObj.src + ' ns: ' + rObj.start_time + ' ne:' + rObj.end_time );
 
                return rObj;
        },
-       getDateFromLink:function( link ){
-               var dateExp = new RegExp(/_([0-9]+)\-([0-9]+)\-([0-9]+)/);
-               var dParts = link.match (dateExp);
+       getDateFromLink:function( link ) {
+               var dateExp = new RegExp( /_([0-9]+)\-([0-9]+)\-([0-9]+)/ );
+               var dParts = link.match ( dateExp );
                var d = new Date();
-               var year_full = (dParts[3].length==2)?'20'+dParts[3].toString():dParts[3];
-               d.setFullYear(year_full, dParts[1]-1, dParts[2]);
+               var year_full = ( dParts[3].length == 2 ) ? '20' + dParts[3].toString():dParts[3];
+               d.setFullYear( year_full, dParts[1] - 1, dParts[2] );
                return d;
        }
 }
index 53b9999..bb442f6 100644 (file)
@@ -4,7 +4,7 @@
  *
  */
 
-loadGM({
+loadGM( {
        "mwe-select_file" : "Select file",
        "mwe-more_licence_options" : "For more licence options, view the <a href=\"$1\">normal upload page<\/a>",
        "mwe-select_ownwork" : "I am uploading entirely my own work, and licencing it under:",
@@ -15,7 +15,7 @@ loadGM({
        "mwe-error_not_loggedin" : "You do not appear to be logged in or do not have upload privileges.",
        "mwe-watch-this-file" : "Watch this file",
        "mwe-ignore-any-warnings" : "Ignore any warnings"
-});
+} );
 
 var default_form_options = {
        'enable_fogg'    : true,
@@ -24,127 +24,127 @@ var default_form_options = {
        'ondone_cb' : null
 };
 
-(function($) {
-       $.fn.simpleUploadForm = function( opt , callback){
+( function( $ ) {
+       $.fn.simpleUploadForm = function( opt , callback ) {
                var _this = this;
-               //set the options:
-               for(var i in default_form_options){
-                       if(!opt[i])
+               // set the options:
+               for ( var i in default_form_options ) {
+                       if ( !opt[i] )
                                opt[i] = default_form_options[i];
                }
 
-               //first do a reality check on the options:
-               if( !opt.api_target ){
-                       $(this.selector).html('Error: Missing api target');
+               // first do a reality check on the options:
+               if ( !opt.api_target ) {
+                       $( this.selector ).html( 'Error: Missing api target' );
                        return false;
                }
 
-               //@@todo this is just a proof of concept
-               //much todo to improved this web form
-               get_mw_token('File:MyRandomFileTokenCheck', opt.api_target, function(eToken){
-                       if( !eToken || eToken == '+\\' ){
-                               $(this.selector).html( gM('mwe-error_not_loggedin') );
+               // @@todo this is just a proof of concept
+               // much todo to improved this web form
+               get_mw_token( 'File:MyRandomFileTokenCheck', opt.api_target, function( eToken ) {
+                       if ( !eToken || eToken == '+\\' ) {
+                               $( this.selector ).html( gM( 'mwe-error_not_loggedin' ) );
                                return false;
                        }
 
-                       //build an upload form:
-                       var o = '<div>'+
+                       // build an upload form:
+                       var o = '<div>' +
                                                '<form id="suf-upload" enctype="multipart/form-data" action="' + opt.api_target + '" method="post">'  +
-                                               //hidden input:
-                                               '<input type="hidden" name="action" value="upload">'+
-                                               '<input type="hidden" name="format" value="jsonfm">'+
-                                               '<input type="hidden" name="token" value="'+ eToken +'">' +
+                                               // hidden input:
+                                               '<input type="hidden" name="action" value="upload">' +
+                                               '<input type="hidden" name="format" value="jsonfm">' +
+                                               '<input type="hidden" name="token" value="' + eToken + '">' +
                        
-                                               //form name set:
-                                               '<label for="wpUploadFile">' + gM('mwe-select_file') + '</label><br>'+
+                                               // form name set:
+                                               '<label for="wpUploadFile">' + gM( 'mwe-select_file' ) + '</label><br>' +
                                                '<input id="wpUploadFile" type="file" style="display: inline;" name="wpUploadFile" size="15"/><br>' +
                        
-                                               '<label for="wpDestFile">' +gM('mwe-destfilename') + '</label><br>'+
-                                               '<input id="wpDestFile" type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+
+                                               '<label for="wpDestFile">' + gM( 'mwe-destfilename' ) + '</label><br>' +
+                                               '<input id="wpDestFile" type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>' +
                        
-                                               '<label for="wpUploadDescription">' + gM('mwe-summary') + ':</label><br>' +
-                                               '<textarea id="wpUploadDescription" cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>'+
+                                               '<label for="wpUploadDescription">' + gM( 'mwe-summary' ) + ':</label><br>' +
+                                               '<textarea id="wpUploadDescription" cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>' +
                                                
-                                               '<input type="checkbox" value="true" id="wpWatchthis" name="watch" tabindex="7"/>'+
-                                               '<label for="wpWatchthis">'+ gM('mwe-watch-this-file') +'</label>'+
+                                               '<input type="checkbox" value="true" id="wpWatchthis" name="watch" tabindex="7"/>' +
+                                               '<label for="wpWatchthis">' + gM( 'mwe-watch-this-file' ) + '</label>' +
                                                
-                                               '<input type="checkbox" value="true" id="wpIgnoreWarning" name="ignorewarnings" tabindex="8"/>'+
-                                               '<label for="wpIgnoreWarning">' + gM('mwe-ignore-any-warnings') + '</label></br>'+
+                                               '<input type="checkbox" value="true" id="wpIgnoreWarning" name="ignorewarnings" tabindex="8"/>' +
+                                               '<label for="wpIgnoreWarning">' + gM( 'mwe-ignore-any-warnings' ) + '</label></br>' +
                                                
                                                '<div id="wpDestFile-warning"></div>' +
-                                               '<div style="clear:both;"></div>' +'<p>' + 
+                                               '<div style="clear:both;"></div>' + '<p>' +
                        
-                                               gM('mwe-select_ownwork') + '<br>' +
-                                               '<input type="checkbox" id="wpLicence" name="wpLicence" value="cc-by-sa">' + gM('mwe-licence_cc-by-sa') + '</p>' +
+                                               gM( 'mwe-select_ownwork' ) + '<br>' +
+                                               '<input type="checkbox" id="wpLicence" name="wpLicence" value="cc-by-sa">' + gM( 'mwe-licence_cc-by-sa' ) + '</p>' +
                        
-                                               '<input type="submit" accesskey="s" value="' + gM('mwe-upload') + '" name="wpUploadBtn" id="wpUploadBtn"  tabindex="9"/>' +
-                                               //close the form and div
+                                               '<input type="submit" accesskey="s" value="' + gM( 'mwe-upload' ) + '" name="wpUploadBtn" id="wpUploadBtn"  tabindex="9"/>' +
+                                               // close the form and div
                                                '</form>' +
                                '</div>';
 
-                       //set the target with the form output:
+                       // set the target with the form output:
                        $( _this.selector ).html( o );
-                       //by default dissable:
-                       $j('#wpUploadBtn').attr('disabled', 'disabled');
+                       // by default dissable:
+                       $j( '#wpUploadBtn' ).attr( 'disabled', 'disabled' );
 
-                       //set up basic licence binding:
-                       $j('#wpLicence').click(function(){
-                               if( $j(this).is(':checked') ){
-                                       $j('#wpUploadBtn').removeAttr('disabled');
-                               }else{
-                                       $j('#wpUploadBtn').attr('disabled', 'disabled');
+                       // set up basic licence binding:
+                       $j( '#wpLicence' ).click( function() {
+                               if ( $j( this ).is( ':checked' ) ) {
+                                       $j( '#wpUploadBtn' ).removeAttr( 'disabled' );
+                               } else {
+                                       $j( '#wpUploadBtn' ).attr( 'disabled', 'disabled' );
                                }
-                       });
-                       //do destination fill:
-                       //@@should integrate with doDestinationFill on upload page
-                       $j("#wpUploadFile").change(function(){
-                               var path = $j(this).val();
+                       } );
+                       // do destination fill:
+                       // @@should integrate with doDestinationFill on upload page
+                       $j( "#wpUploadFile" ).change( function() {
+                               var path = $j( this ).val();
                                // Find trailing part
-                               var slash = path.lastIndexOf('/');
-                               var backslash = path.lastIndexOf('\\');
+                               var slash = path.lastIndexOf( '/' );
+                               var backslash = path.lastIndexOf( '\\' );
                                var fname;
-                               if (slash == -1 && backslash == -1) {
+                               if ( slash == - 1 && backslash == - 1 ) {
                                        fname = path;
-                               } else if (slash > backslash) {
-                                       fname = path.substring(slash+1, 10000);
+                               } else if ( slash > backslash ) {
+                                       fname = path.substring( slash + 1, 10000 );
                                } else {
-                                       fname = path.substring(backslash+1, 10000);
+                                       fname = path.substring( backslash + 1, 10000 );
                                }
-                               fname = fname.charAt(0).toUpperCase().concat(fname.substring(1,10000)).replace(/ /g, '_');
+                               fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / / g, '_' );
                                // Output result
-                               $j("#wpDestFile").val( fname );
-                               //do destination check
-                               $j("#wpDestFile").doDestCheck({
+                               $j( "#wpDestFile" ).val( fname );
+                               // do destination check
+                               $j( "#wpDestFile" ).doDestCheck( {
                                        'warn_target':'#wpDestFile-warning'
-                               });
-                       });
+                               } );
+                       } );
 
 
-                       //do destination check:
-                       $j("#wpDestFile").change(function(){
-                               $j("#wpDestFile").doDestCheck({
+                       // do destination check:
+                       $j( "#wpDestFile" ).change( function() {
+                               $j( "#wpDestFile" ).doDestCheck( {
                                        'warn_target':'#wpDestFile-warning'
-                               });
-                       });
+                               } );
+                       } );
 
-                       if(typeof opt.ondone_cb == 'undefined')
+                       if ( typeof opt.ondone_cb == 'undefined' )
                                opt.ondone_cb = false;
 
-                       //set up the binding per the config
-                       if( opt.enable_fogg ){
-                               $j("#wpUploadFile").firefogg({
-                                       //an api url (we won't submit directly to action of the form)
+                       // set up the binding per the config
+                       if ( opt.enable_fogg ) {
+                               $j( "#wpUploadFile" ).firefogg( {
+                                       // an api url (we won't submit directly to action of the form)
                                        'api_url' : opt.api_target,
                                        'form_rewrite': true,
                                        'target_edit_from' : '#suf-upload',
-                                       'new_source_cb' : function( orgFilename, oggName ){
-                                               $j("#wpDestFile").val( oggName ).doDestCheck({
+                                       'new_source_cb' : function( orgFilename, oggName ) {
+                                               $j( "#wpDestFile" ).val( oggName ).doDestCheck( {
                                                        warn_target: "#wpDestFile-warning"
-                                               });
+                                               } );
                                        },
                                        'done_upload_cb' : opt.ondone_cb
-                               });
+                               } );
                        }
-               });
+               } );
        }
-})(jQuery);
+} )( jQuery );
index 0a3fe88..7ff9aff 100644 (file)
@@ -5,8 +5,8 @@
        'overlays':0,            //should allow setting "locked to clip" overlay tracks
        'audio':0                       //should allow controlling the audio volume (with keyframes)
 */
-//set gMsg object:
-loadGM({
+// set gMsg object:
+loadGM( {
        "mwe-crop" : "Crop image",
        "mwe-apply_crop" : "Apply crop to image",
        "mwe-reset_crop" : "Reset crop",
@@ -32,251 +32,251 @@ loadGM({
        "mwe-inline-description" : "Caption",
        "mwe-edit-video-tools" : "Edit video tools:",
        "mwe-duration" : "Duration:"
-});
+} );
 
 var default_clipedit_values = {
        'rObj': null,            // the resource object
-       'clip_disp_ct':null,//target clip disp
-       'control_ct':null,       //control container
-       'media_type': null, //media type
-       'parent_ct': null,       //parent container
+       'clip_disp_ct':null,// target clip disp
+       'control_ct':null,       // control container
+       'media_type': null, // media type
+       'parent_ct': null,       // parent container
 
-       'p_rsdObj': null,       //parent remote search object
-       'p_seqObj': null,        //parent sequence Object
+       'p_rsdObj': null,       // parent remote search object
+       'p_seqObj': null,        // parent sequence Object
 
-       'controlActionsCb' : null, //the object that configures control Action callbacks
-       
-       //The set of tools to enable (by default 'all' else an array of tools from mvClipEdit.toolset list below: 
+       'controlActionsCb' : null, // the object that configures control Action callbacks
+
+       // The set of tools to enable (by default 'all' else an array of tools from mvClipEdit.toolset list below: 
        'enabled_tools': 'all',
-       'edit_action': null, //the requested edit action
-       'profile': 'inpage' //the given profile either "inpage" or "sequence"
+       'edit_action': null, // the requested edit action
+       'profile': 'inpage' // the given profile either "inpage" or "sequence"
 }
-var mvClipEdit = function(iObj) {
-       return this.init(iObj);
+var mvClipEdit = function( iObj ) {
+       return this.init( iObj );
 };
 mvClipEdit.prototype = {
 
-       selTool:null, //selected tool
-       crop: null, //the crop values
+       selTool:null, // selected tool
+       crop: null, // the crop values
        base_img_src:null,
        toolset : ['crop', 'layout'],
        
-       init:function( iObj){
-               //init object:
-               for(var i in default_clipedit_values){
-                       if( iObj[i] ){
+       init:function( iObj ) {
+               // init object:
+               for ( var i in default_clipedit_values ) {
+                       if ( iObj[i] ) {
                                this[i] = iObj[i];
                        }
                }
 
-               //if media type was not supplied detect for resource if possible:
-               //@@todo more advanced detection.
-               if(!this.media_type && this.rObj && this.rObj.type ){
-                       if( this.rObj.type.indexOf("image/") === 0){
+               // if media type was not supplied detect for resource if possible:
+               // @@todo more advanced detection.
+               if ( !this.media_type && this.rObj && this.rObj.type ) {
+                       if ( this.rObj.type.indexOf( "image/" ) === 0 ) {
                                this.media_type = 'image';
-                       }else if( this.rObj.type.indexOf("video/") === 0){
+                       } else if ( this.rObj.type.indexOf( "video/" ) === 0 ) {
                                this.media_type = 'video';
-                       }else if( this.rObj.type.indexOf("text/") === 0){
+                       } else if ( this.rObj.type.indexOf( "text/" ) === 0 ) {
                                this.media_type = 'template';
                        }
                }
-               //display control:
-               if(this.profile == 'sequence'){
+               // display control:
+               if ( this.profile == 'sequence' ) {
                        this.doEditTypesMenu();
                        this.doDisplayEdit();
-               }else{
-                       //check the media_type:
-                       //js_log('mvClipEdit:: media type:' + this.media_type + ' base width: ' + this.rObj.width + ' bh: ' + this.rObj.height);
-                       //could seperate out into media Types objects for now just call method
-                       if(this.media_type == 'image'){
+               } else {
+                       // check the media_type:
+                       // js_log('mvClipEdit:: media type:' + this.media_type + ' base width: ' + this.rObj.width + ' bh: ' + this.rObj.height);
+                       // could seperate out into media Types objects for now just call method
+                       if ( this.media_type == 'image' ) {
                                this.setUpImageCtrl();
-                       }else if(this.media_type=='video'){
+                       } else if ( this.media_type == 'video' ) {
                                this.setUpVideoCtrl();
                        }
                }
        },
 
-       //master edit types object:
-       //maybe we should refactor these into their own classes
-       //more refactor each media type should be its own class inheriting the shared baseEditType object
-       edit_types:{
-               'duration':{
-                       'media':['image','template'],
-                       'doEdit':function( _this, target ){
-                               function doUpdateDur( inputElm ){
-                                       js_log("update duration:" + $j( inputElm ).val() );
-                                       //update the parent sequence object:
+       // master edit types object:
+       // maybe we should refactor these into their own classes
+       // more refactor each media type should be its own class inheriting the shared baseEditType object
+       edit_types: {
+               'duration': {
+                       'media':['image', 'template'],
+                       'doEdit':function( _this, target ) {
+                               function doUpdateDur( inputElm ) {
+                                       js_log( "update duration:" + $j( inputElm ).val() );
+                                       // update the parent sequence object:
                                        _this.rObj.dur = smilParseTime( $j( inputElm ).val() );
-                                       //update the playlist:
+                                       // update the playlist:
                                        _this.p_seqObj.do_refresh_timeline( true );
                                }
                                                        
-                               $j(target).html(
-                                               '<label for="ce_dur">' + gM('mwe-duration') + '</label>' +
-                                               '<input name="ce_dur" tabindex="1" maxlength="11" value="'+
-                                                       seconds2npt( _this.rObj.getDuration() )+
-                                                       '" size="10"/>'+
+                               $j( target ).html(
+                                               '<label for="ce_dur">' + gM( 'mwe-duration' ) + '</label>' +
+                                               '<input name="ce_dur" tabindex="1" maxlength="11" value="' +
+                                                       seconds2npt( _this.rObj.getDuration() ) +
+                                                       '" size="10"/>' +
                                        '</div>'
-                               ).children("input[name='ce_dur']").change(function(){
-                                        doUpdateDur(this);                                     
-                               });
-                               //Strange can't chain this binding for some reason...
-                               $j(target).find("input[name='ce_dur']").upDownTimeInputBind( doUpdateDur );
+                               ).children( "input[name='ce_dur']" ).change( function() {
+                                        doUpdateDur( this );
+                               } );
+                               // Strange can't chain this binding for some reason...
+                               $j( target ).find( "input[name='ce_dur']" ).upDownTimeInputBind( doUpdateDur );
                        }
                },
-               'inoutpoints':{
+               'inoutpoints': {
                        'media':['video'],
-                       'doEdit':function( _this, target ){
-                               //do clock mouse scroll duration editor
-                               var end_ntp = ( _this.rObj.embed.end_ntp) ? _this.rObj.embed.end_ntp : _this.rObj.embed.getDuration();
-                               if(!end_ntp)
+                       'doEdit':function( _this, target ) {
+                               // do clock mouse scroll duration editor
+                               var end_ntp = ( _this.rObj.embed.end_ntp ) ? _this.rObj.embed.end_ntp : _this.rObj.embed.getDuration();
+                               if ( !end_ntp )
                                        end_ntp = seconds2npt( _this.rObj.dur );
 
-                               var start_ntp = (_this.rObj.embed.start_ntp) ? _this.rObj.embed.start_ntp : seconds2npt( 0 );
-                               if(!start_ntp)
+                               var start_ntp = ( _this.rObj.embed.start_ntp ) ? _this.rObj.embed.start_ntp : seconds2npt( 0 );
+                               if ( !start_ntp )
                                        seconds2npt( 0 );
-                               //make sure we have an end time                         
-                               if( end_ntp ){                          
-                                       $j(target).html(
-                                               _this.getSetInOutHtml({
+                               // make sure we have an end time                                
+                               if ( end_ntp ) {
+                                       $j( target ).html(
+                                               _this.getSetInOutHtml( {
                                                        'start_ntp'     : start_ntp,
                                                        'end_ntp'       : end_ntp
-                                               })
+                                               } )
                                        );
                                        _this.setInOutBindings();
                                }
                        }
                },
-               'fileopts':{
-                       'media':['image','video','template'],
-                       'doEdit':function(_this, target ){
-                               //if media type is template we have to query to get its URI to get its parameters
-                               if(_this.media_type == 'template' && !_this.rObj.tVars){
-                                       mv_set_loading('#sub_cliplib_ic');
-                                       var reqObj ={   
+               'fileopts': {
+                       'media':['image', 'video', 'template'],
+                       'doEdit':function( _this, target ) {
+                               // if media type is template we have to query to get its URI to get its parameters
+                               if ( _this.media_type == 'template' && !_this.rObj.tVars ) {
+                                       mv_set_loading( '#sub_cliplib_ic' );
+                                       var reqObj = {
                                                'action':'query',
                                                'prop':'revisions',
                                                'titles': _this.rObj.uri,
                                                'rvprop':'content'
                                        };
-                                       //get the interface uri from the plObject
+                                       // get the interface uri from the plObject
                                        var api_url = _this.p_seqObj.plObj.interface_url;
-                                       //first check
+                                       // first check
                                        do_api_req( {
                                                'data':reqObj,
                                                'url':api_url
-                                               }, function(data){
-                                                       if(typeof data.query.pages == 'undefined')
-                                                               return _this.doEditOpts(target);
-                                                       for(var i in data.query.pages){
+                                               }, function( data ) {
+                                                       if ( typeof data.query.pages == 'undefined' )
+                                                               return _this.doEditOpts( target );
+                                                       for ( var i in data.query.pages ) {
                                                                var page = data.query.pages[i];
-                                                               if(!page['revisions'] || !page['revisions'][0]['*']){
-                                                                       return _this.doEditOpts(target);
-                                                               }else{
+                                                               if ( !page['revisions'] || !page['revisions'][0]['*'] ) {
+                                                                       return _this.doEditOpts( target );
+                                                               } else {
                                                                        var template_rev = page['revisions'][0]['*'];
                                                                }
                                                        }
                                                        var pObj = mw.parser.pNew( template_rev );
                                                        _this.rObj.tVars = pObj.getTemplateVars();
-                                                       //run the editor now that we have updated the tVars:                                                                                                    
-                                                       _this.doEditOpts(target);
+                                                       // run the editor now that we have updated the tVars:                                                                                                   
+                                                       _this.doEditOpts( target );
                                                }
                                        );
-                               }else{
-                                       _this.doEditOpts(target);
+                               } else {
+                                       _this.doEditOpts( target );
                                }
                        }
                },
-               'overlays':{
-                       'media':['image','video'],
-                       'doEdit':function(_this, target){
-                               //do clock mouse scroll duration editor
-                               $j(target).html('<h3>Current Overlays:</h3>Add,Remove,Modify');
+               'overlays': {
+                       'media':['image', 'video'],
+                       'doEdit':function( _this, target ) {
+                               // do clock mouse scroll duration editor
+                               $j( target ).html( '<h3>Current Overlays:</h3>Add,Remove,Modify' );
                        }
                },
-               'audio':{
-                       'media':['image','video', 'template'],
-                       'doEdit':function(_this, target){
-                               //do clock mouse scroll duration editor
-                               $j(target).html('<h3>Audio Volume:</h3>');
+               'audio': {
+                       'media':['image', 'video', 'template'],
+                       'doEdit':function( _this, target ) {
+                               // do clock mouse scroll duration editor
+                               $j( target ).html( '<h3>Audio Volume:</h3>' );
                        }
                }
        },
-       doEditOpts:function(target){
+       doEditOpts:function( target ) {
                var _this = this;
-               //add html for rObj resource:
-               var o=  '<table>' +
+               // add html for rObj resource:
+               var o = '<table>' +
+                               '<tr>' +
+                                       '<td colspan="2"><b>' + gM( 'mwe-edit_properties' ) + '</b></td>' +
+                               '</tr>' +
                                '<tr>' +
-                                       '<td colspan="2"><b>'+gM('mwe-edit_properties')+'</b></td>'+
-                               '</tr>'+
-                               '<tr>'+
                                        '<td>' +
-                                               gM('mwe-custom_title') +
-                                       '</td>'+
+                                               gM( 'mwe-custom_title' ) +
+                                       '</td>' +
                                        '<td><input type="text" size="15" maxwidth="255" value="';
-                                               if(_this.rObj.title != null)
-                                                       o+=_this.rObj.title;
-                                               o+='">'+
-                                       '</td>'+
+                                               if ( _this.rObj.title != null )
+                                                       o += _this.rObj.title;
+                                               o += '">' +
+                                       '</td>' +
                                '</tr>';
-               if( _this.rObj.tVars){
+               if ( _this.rObj.tVars ) {
                        var existing_p = _this.rObj.params;
                        var testing_a = _this.rObj.tVars;
-                       //debugger;
-                       o+= '<tr>'+
-                                       '<td colspan="2"><b>' + gM('mwe-template_properties') + '</b></td>'+
+                       // debugger;
+                       o += '<tr>' +
+                                       '<td colspan="2"><b>' + gM( 'mwe-template_properties' ) + '</b></td>' +
                                '</tr>';
-                       for(var i =0; i < _this.rObj.tVars.length ; i++){
-                               o+='<tr>'+
+                       for ( var i = 0; i < _this.rObj.tVars.length ; i++ ) {
+                               o += '<tr>' +
                                        '<td>' +
                                                _this.rObj.tVars[i] +
                                        '</td>' +
-                                       '<td><input name="'+_this.rObj.tVars[i]+'" class="ic_tparam" type="text" size="15" maxwidth="255" value="';
-                               if(_this.rObj.params[ _this.rObj.tVars[i] ]){
-                                       o+= _this.rObj.params[ _this.rObj.tVars[i] ];
+                                       '<td><input name="' + _this.rObj.tVars[i] + '" class="ic_tparam" type="text" size="15" maxwidth="255" value="';
+                               if ( _this.rObj.params[ _this.rObj.tVars[i] ] ) {
+                                       o += _this.rObj.params[ _this.rObj.tVars[i] ];
                                }
-                               o+='">'+
-                                       '</td>'+
+                               o += '">' +
+                                       '</td>' +
                                '</tr>';
                        }
                }
-               if(typeof wgArticlePath != 'undefined' ){
-                       var res_src = wgArticlePath.replace(/\$1/, _this.rObj.uri );
+               if ( typeof wgArticlePath != 'undefined' ) {
+                       var res_src = wgArticlePath.replace( /\$1/, _this.rObj.uri );
                        var res_title = _this.rObj.uri;
-               }else{
-                       //var res_page =
+               } else {
+                       // var res_page =
                        var res_src = _this.rObj.src;
-                       var res_title = parseUri(_this.rObj.src).file;
+                       var res_title = parseUri( _this.rObj.src ).file;
                }
-               o+=     '<tr>'+
-                                       '<td colspan="2"><b>'+gM('mwe-other_properties')+'</b></td>'+
-                               '</tr>'+
-                               '<tr>'+
+               o +=    '<tr>' +
+                                       '<td colspan="2"><b>' + gM( 'mwe-other_properties' ) + '</b></td>' +
+                               '</tr>' +
+                               '<tr>' +
                                        '<td>' +
-                                               gM('mwe-resource_page') +
+                                               gM( 'mwe-resource_page' ) +
+                                       '</td>' +
+                                       '<td><a href="' + res_src  + '" ' +
+                                               ' target="new">' +
+                                                       res_title + '</a>' +
                                        '</td>' +
-                                       '<td><a href="' + res_src  +'" '+
-                                               ' target="new">'+
-                                                       res_title + '</a>'+
-                                       '</td>'+
                                '</tr>';
-               o+='</table>';
+               o += '</table>';
 
-               $j(target).html ( o );
+               $j( target ).html ( o );
 
-               //add update bindings
-               $j(target + ' .ic_tparam').change(function(){
-                       js_log("updated tparam::" + $j(this).attr("name"));
-                       //update param value:
-                       _this.rObj.params[ $j(this).attr("name") ] = $j(this).val();
-                       //re-parse & update template
+               // add update bindings
+               $j( target + ' .ic_tparam' ).change( function() {
+                       js_log( "updated tparam::" + $j( this ).attr( "name" ) );
+                       // update param value:
+                       _this.rObj.params[ $j( this ).attr( "name" ) ] = $j( this ).val();
+                       // re-parse & update template
                        var template_wiki_text = '{{' + _this.rObj.uri;
-                       for(var i =0;i < _this.rObj.tVars.length ; i++){
+                       for ( var i = 0; i < _this.rObj.tVars.length ; i++ ) {
 
-                               template_wiki_text += "\n|"+_this.rObj.tVars[i] + ' = ' +  _this.rObj.params[ _this.rObj.tVars[i] ]  ;
+                               template_wiki_text += "\n|" + _this.rObj.tVars[i] + ' = ' +  _this.rObj.params[ _this.rObj.tVars[i] ]  ;
                        }
                        template_wiki_text += "\n}}";
-                       var reqObj ={
+                       var reqObj = {
                                        'action':'parse',
                                        'title' : _this.p_seqObj.plObj.mTitle,
                                        'text'  :       template_wiki_text
@@ -284,304 +284,304 @@ mvClipEdit.prototype = {
                        $j( _this.rObj.embed ).html( mv_get_loading_img() );
 
                        var api_url = _this.p_seqObj.plObj.interface_url;
-                       do_api_req({
+                       do_api_req( {
                                'data':reqObj,
                                'url':api_url
-                       },function(data){
-                               if(data.parse.text['*']){
-                                       //update the target
+                       }, function( data ) {
+                               if ( data.parse.text['*'] ) {
+                                       // update the target
                                        $j( _this.rObj.embed ).html( data.parse.text['*'] );
                                }
-                       })
-               })
+                       } )
+               } )
 
-               //update doFocusBindings
-               if( _this.p_seqObj )
+               // update doFocusBindings
+               if ( _this.p_seqObj )
                        _this.p_seqObj.doFocusBindings();
        },
-       doEditTypesMenu:function(){
+       doEditTypesMenu:function() {
                var _this = this;
-               //add in subMenus if set
-               //check for submenu and add to item container
-               var o='';
-               var tabc ='';
-               o+= '<div id="mv_submenu_clipedit">';
-               o+='<ul>';
+               // add in subMenus if set
+               // check for submenu and add to item container
+               var o = '';
+               var tabc = '';
+               o += '<div id="mv_submenu_clipedit">';
+               o += '<ul>';
                var first_tab = false;
-               $j.each(this.edit_types, function(sInx, editType){
-                       //check if the given editType is valid for our given media type
+               $j.each( this.edit_types, function( sInx, editType ) {
+                       // check if the given editType is valid for our given media type
                        var include = false;
-                       for(var i =0; i < editType.media.length;i++){
-                               if( editType.media[i] == _this.media_type){
+                       for ( var i = 0; i < editType.media.length; i++ ) {
+                               if ( editType.media[i] == _this.media_type ) {
                                        include = true;
-                                       if(!first_tab)
+                                       if ( !first_tab )
                                                first_tab = sInx;
                                }
                        }
-                       if(include){
-                               o+=     '<li>'+
-                                               '<a id="mv_smi_'+sInx+'" href="#sc_' + sInx + '">' + gM('mwe-sc_' + sInx ) + '</a>'+
+                       if ( include ) {
+                               o +=    '<li>' +
+                                               '<a id="mv_smi_' + sInx + '" href="#sc_' + sInx + '">' + gM( 'mwe-sc_' + sInx ) + '</a>' +
                                        '</li>';
                                tabc += '<div id="sc_' + sInx + '" style="overflow:auto;" ></div>';
                        }
-               });
-               o+= '</ul>' + tabc;
-               o+= '</div>';
-               //add sub menu container with menu html:
-               $j('#'+this.control_ct).html( o ) ;
-               //set up bindings:
-               $j('#mv_submenu_clipedit').tabs({
+               } );
+               o += '</ul>' + tabc;
+               o += '</div>';
+               // add sub menu container with menu html:
+               $j( '#' + this.control_ct ).html( o ) ;
+               // set up bindings:
+               $j( '#mv_submenu_clipedit' ).tabs( {
                        selected: 0,
-                       select: function(event, ui) {
-                               _this.doDisplayEdit( $j(ui.tab).attr('id').replace('mv_smi_', '') );
+                       select: function( event, ui ) {
+                               _this.doDisplayEdit( $j( ui.tab ).attr( 'id' ).replace( 'mv_smi_', '' ) );
                        }
-               }).addClass('ui-tabs-vertical ui-helper-clearfix');
-               //close left:
-               $j("#mv_submenu_clipedit li").removeClass('ui-corner-top').addClass('ui-corner-left');
-               //update the default edit display:
+               } ).addClass( 'ui-tabs-vertical ui-helper-clearfix' );
+               // close left:
+               $j( "#mv_submenu_clipedit li" ).removeClass( 'ui-corner-top' ).addClass( 'ui-corner-left' );
+               // update the default edit display:
                _this.doDisplayEdit( first_tab );
        },
-       doDisplayEdit:function( edit_type ){
-               if(!edit_type)
+       doDisplayEdit:function( edit_type ) {
+               if ( !edit_type )
                        return false;
-               js_log('doDisplayEdit: ' + edit_type );
+               js_log( 'doDisplayEdit: ' + edit_type );
 
-               //do edit interface for that edit type:
-               if( this.edit_types[ edit_type ].doEdit )
-                       this.edit_types[ edit_type ].doEdit(this, '#sc_'+edit_type );
+               // do edit interface for that edit type:
+               if ( this.edit_types[ edit_type ].doEdit )
+                       this.edit_types[ edit_type ].doEdit( this, '#sc_' + edit_type );
        },
-       setUpVideoCtrl:function(){
-               js_log('setUpVideoCtrl:f');
+       setUpVideoCtrl:function() {
+               js_log( 'setUpVideoCtrl:f' );
                var _this = this;
-               var eb = $j('#embed_vid').get(0);
-               //turn on preview to avoid onDone actions
+               var eb = $j( '#embed_vid' ).get( 0 );
+               // turn on preview to avoid onDone actions
                eb.preview_mode = true;
-               $j('#'+this.control_ct).html('<h3>' + gM('mwe-edit-video-tools') + '</h3>');
-               if( eb.supportsURLTimeEncoding() ){
-                       if(eb.end_ntp){
-                               $j('#'+this.control_ct).append(
-                                       _this.getSetInOutHtml({
+               $j( '#' + this.control_ct ).html( '<h3>' + gM( 'mwe-edit-video-tools' ) + '</h3>' );
+               if ( eb.supportsURLTimeEncoding() ) {
+                       if ( eb.end_ntp ) {
+                               $j( '#' + this.control_ct ).append(
+                                       _this.getSetInOutHtml( {
                                                'start_ntp'     : eb.start_ntp,
                                                'end_ntp'       : eb.end_ntp
-                                       })
+                                       } )
                                );
                                _this.setInOutBindings();
                        }
                }
-               //if in a sequence we have no need for insertDesc
-               if( !_this.p_seqObj){
-                       $j('#'+this.control_ct).append( _this.getInsertDescHtml() );
+               // if in a sequence we have no need for insertDesc
+               if ( !_this.p_seqObj ) {
+                       $j( '#' + this.control_ct ).append(     _this.getInsertDescHtml() );
                }
-               //update control actions
+               // update control actions
                this.updateInsertControlActions();
        },
-       setInOutBindings:function(){
+       setInOutBindings:function() {
                var _this = this;
-               //setup a top level shortcut: 
-               var $tp = $j('#'+this.control_ct);
+               // setup a top level shortcut: 
+               var $tp = $j( '#' + this.control_ct );
 
-               var start_sec = npt2seconds( $tp.find('.startInOut').val() );
-               var end_sec   = npt2seconds( $tp.find('.endInOut').val() );
+               var start_sec = npt2seconds( $tp.find( '.startInOut' ).val() );
+               var end_sec   = npt2seconds( $tp.find( '.endInOut' ).val() );
 
-               //if we don't have 0 as start then assume we are in a range request and give some buffer area:
-               var min_slider =  (start_sec - 60 < 0 ) ? 0 : start_sec - 60;
-               if(min_slider!=0){
-                       var max_slider =  end_sec+60;
-               }else{
+               // if we don't have 0 as start then assume we are in a range request and give some buffer area:
+               var min_slider =  ( start_sec - 60 < 0 ) ? 0 : start_sec - 60;
+               if ( min_slider != 0 ) {
+                       var max_slider =  end_sec + 60;
+               } else {
                        max_slider = end_sec;
                }
 
-               $tp.find('.inOutSlider').slider({
+               $tp.find( '.inOutSlider' ).slider( {
                        range: true,
                        min: min_slider,
                        max: max_slider,
                        animate: true,
                        values: [start_sec, end_sec],
-                       slide: function(event, ui) {
-                               //js_log(" vals:"+  seconds2npt( ui.values[0] ) + ' : ' + seconds2npt( ui.values[1]) );
-                               $tp.find('.startInOut').val( seconds2npt( ui.values[0] ) );
-                               $tp.find('.endInOut').val( seconds2npt( ui.values[1] ) );
+                       slide: function( event, ui ) {
+                               // js_log(" vals:"+  seconds2npt( ui.values[0] ) + ' : ' + seconds2npt( ui.values[1]) );
+                               $tp.find( '.startInOut' ).val( seconds2npt( ui.values[0] ) );
+                               $tp.find( '.endInOut' ).val( seconds2npt( ui.values[1] ) );
                        },
-                       change:function(event, ui){
-                               do_video_time_update( seconds2npt( ui.values[0]), seconds2npt( ui.values[1] ) );
+                       change:function( event, ui ) {
+                               do_video_time_update( seconds2npt( ui.values[0] ), seconds2npt( ui.values[1] ) );
                        }
-               });             
+               } );
                
-               //bind up and down press when focus on start or end 
-               $tp.find('.startInOut').upDownTimeInputBind( function( inputElm ){              
+               // bind up and down press when focus on start or end 
+               $tp.find( '.startInOut' ).upDownTimeInputBind( function( inputElm ) {
                        var s_sec = npt2seconds( $j( inputElm ).val() );
-                       var e_sec = npt2seconds( $tp.find('.endInOut').val() )                                                          
-                       if( s_sec > e_sec )
-                               $j( inputElm ).val( seconds2npt( e_sec - 1 ) );                         
-                       //update the slider: 
-                       var values = $tp.find('.inOutSlider').slider('option', 'values');
-                       js_log('in slider len: ' + $tp.find('.inOutSlider').length);
-                       //set to 5 
-                       $tp.find('.inOutSlider').slider('value', 10 );
+                       var e_sec = npt2seconds( $tp.find( '.endInOut' ).val() )
+                       if ( s_sec > e_sec )
+                               $j( inputElm ).val( seconds2npt( e_sec - 1 ) );
+                       // update the slider: 
+                       var values = $tp.find( '.inOutSlider' ).slider( 'option', 'values' );
+                       js_log( 'in slider len: ' + $tp.find( '.inOutSlider' ).length );
+                       // set to 5 
+                       $tp.find( '.inOutSlider' ).slider( 'value', 10 );
                        debugger;
-                       $tp.find('.inOutSlider').slider('option', 'values', [s_sec, e_sec] );
-                       var values = $tp.find('.inOutSlider').slider('option', 'values');
-                       js_log('values (after update):' + values );
-               });
-               $tp.find('.endInOut').upDownTimeInputBind( function( inputElm ){                        
-                       var s_sec = npt2seconds( $tp.find('.startInOut').val() );       
-                       var e_sec = npt2seconds( $j( inputElm ).val() );                                        
-                       if( e_sec < s_sec )
-                               $j( inputElm ).val(  seconds2npt( s_sec + 1 ) );                                                
-                       //update the slider: 
-                       $tp.find('.inOutSlider').slider('option', 'values', [ s_sec, e_sec ]);
-               });
+                       $tp.find( '.inOutSlider' ).slider( 'option', 'values', [s_sec, e_sec] );
+                       var values = $tp.find( '.inOutSlider' ).slider( 'option', 'values' );
+                       js_log( 'values (after update):' + values );
+               } );
+               $tp.find( '.endInOut' ).upDownTimeInputBind( function( inputElm ) {
+                       var s_sec = npt2seconds( $tp.find( '.startInOut' ).val() );
+                       var e_sec = npt2seconds( $j( inputElm ).val() );
+                       if ( e_sec < s_sec )
+                               $j( inputElm ).val(  seconds2npt( s_sec + 1 ) );
+                       // update the slider: 
+                       $tp.find( '.inOutSlider' ).slider( 'option', 'values', [ s_sec, e_sec ] );
+               } );
                
-               //preview button:
-               $j('#'+this.control_ct + ' .inOutPreviewClip').btnBind().click(function(){                      
-                       $j('#embed_vid').get(0).stop();
-                       $j('#embed_vid').get(0).play();
-               });             
+               // preview button:
+               $j( '#' + this.control_ct + ' .inOutPreviewClip' ).btnBind().click( function() {
+                       $j( '#embed_vid' ).get( 0 ).stop();
+                       $j( '#embed_vid' ).get( 0 ).play();
+               } );
 
        },
-       getSetInOutHtml:function( setInt ){
-               return '<strong>' + gM('mwe-set_in_out_points') + '</strong>'+
-                       '<table border="0" style="background: transparent; width:94%;height:50px;">'+
+       getSetInOutHtml:function( setInt ) {
+               return '<strong>' + gM( 'mwe-set_in_out_points' ) + '</strong>' +
+                       '<table border="0" style="background: transparent; width:94%;height:50px;">' +
                                '<tr>' +
-                                       '<td style="width:90px">'+
-                                               gM('mwe-start_time') +
-                                               '<input class="ui-widget-content ui-corner-all startInOut" size="9" value="' + setInt.start_ntp +'">'+
+                                       '<td style="width:90px">' +
+                                               gM( 'mwe-start_time' ) +
+                                               '<input class="ui-widget-content ui-corner-all startInOut" size="9" value="' + setInt.start_ntp + '">' +
                                        '</td>' +
                                        '<td>' +
-                                               '<div class="inOutSlider"></div>'+
+                                               '<div class="inOutSlider"></div>' +
                                        '</td>' +
-                                       '<td style="width:90px;text-align:right;">'+
-                                               gM('mwe-end_time') +
-                                               '<input class="ui-widget-content ui-corner-all endInOut" size="9" value="'+ setInt.end_ntp +'">'+
+                                       '<td style="width:90px;text-align:right;">' +
+                                               gM( 'mwe-end_time' ) +
+                                               '<input class="ui-widget-content ui-corner-all endInOut" size="9" value="' + setInt.end_ntp + '">' +
                                        '</td>' +
                                '</tr>' +
-                       '</table>'+
-                       $j.btnHtml( gM('mwe-preview_inout'), 'inOutPreviewClip', 'video');                              
+                       '</table>' +
+                       $j.btnHtml( gM( 'mwe-preview_inout' ), 'inOutPreviewClip', 'video' );
        },
-       getInsertDescHtml:function(){
-               var o= '<h3>' + gM('mwe-inline-description') + '</h3>'+
+       getInsertDescHtml:function() {
+               var o = '<h3>' + gM( 'mwe-inline-description' ) + '</h3>' +
                                        '<textarea style="width:95%" id="mv_inline_img_desc" rows="5" cols="30">';
-               if( this.p_rsdObj ){
-                       //if we have a parent remote search driver let it parse the inline description
-                       o+= this.rObj.pSobj.getInlineDescWiki( this.rObj );
+               if ( this.p_rsdObj ) {
+                       // if we have a parent remote search driver let it parse the inline description
+                       o += this.rObj.pSobj.getInlineDescWiki( this.rObj );
                }
-               o+='</textarea><br>';
-               //js_log('getInsertDescHtml: ' + o );
+               o += '</textarea><br>';
+               // js_log('getInsertDescHtml: ' + o );
                return o;
        },
-       updateInsertControlActions:function(){
+       updateInsertControlActions:function() {
                var _this = this;
                var b_target =   _this.p_rsdObj.target_container + '~ .ui-dialog-buttonpane';
-               //empty the ui-dialog-buttonpane bar:
-               $j(b_target).empty();
-               for( var cbType in _this.controlActionsCb ){
-                       switch(cbType){
+               // empty the ui-dialog-buttonpane bar:
+               $j( b_target ).empty();
+               for ( var cbType in _this.controlActionsCb ) {
+                       switch( cbType ) {
                                case 'insert_seq':
-                                       $j(b_target).append( $j.btnHtml(gM('mwe-insert_into_sequence'), 'mv_insert_sequence', 'check' ) + ' ' )
-                                               .children('.mv_insert_sequence')
+                                       $j( b_target ).append( $j.btnHtml( gM( 'mwe-insert_into_sequence' ), 'mv_insert_sequence', 'check' ) + ' ' )
+                                               .children( '.mv_insert_sequence' )
                                                .btnBind()
-                                               .click(function(){
+                                               .click( function() {
                                                        _this.applyEdit();
                                                        _this.controlActionsCb['insert_seq'](  _this.rObj );
-                                               });
+                                               } );
                                break;
                                case 'insert':
-                                       $j(b_target).append(  $j.btnHtml(gM('mwe-insert_image_page'), 'mv_insert_image_page', 'check' ) + ' ' )
-                                               .children('.mv_insert_image_page')
+                                       $j( b_target ).append(  $j.btnHtml( gM( 'mwe-insert_image_page' ), 'mv_insert_image_page', 'check' ) + ' ' )
+                                               .children( '.mv_insert_image_page' )
                                                .btnBind()
-                                               .click(function(){
+                                               .click( function() {
                                                        _this.applyEdit();
                                                        _this.controlActionsCb['insert'](  _this.rObj );
-                                               }).show('slow');
+                                               } ).show( 'slow' );
                                break;
                                case 'preview':
-                                       $j(b_target).append( $j.btnHtml( gM('mwe-preview_insert'), 'mv_preview_insert', 'refresh') + ' ' )
-                                               .children('.mv_preview_insert')
+                                       $j( b_target ).append( $j.btnHtml( gM( 'mwe-preview_insert' ), 'mv_preview_insert', 'refresh' ) + ' ' )
+                                               .children( '.mv_preview_insert' )
                                                .btnBind()
-                                               .click(function(){
+                                               .click( function() {
                                                        _this.applyEdit();
                                                        _this.controlActionsCb['preview'](  _this.rObj );
-                                               }).show('slow');
+                                               } ).show( 'slow' );
                                break;
                                case 'cancel':
-                                       $j(b_target).append( $j.btnHtml( gM('mwe-cancel_image_insert'), 'mv_cancel_img_edit', 'close') + ' ')
-                                               .children('.mv_cancel_img_edit')
+                                       $j( b_target ).append( $j.btnHtml( gM( 'mwe-cancel_image_insert' ), 'mv_cancel_img_edit', 'close' ) + ' ' )
+                                               .children( '.mv_cancel_img_edit' )
                                                .btnBind()
-                                               .click(function(){
-                                                       //no cancel action;
+                                               .click( function() {
+                                                       // no cancel action;
                                                        _this.controlActionsCb['cancel'](  _this.rObj );
-                                               }).show('slow');
+                                               } ).show( 'slow' );
                                break;
                        }
                }
        },
-       applyEdit:function(){
+       applyEdit:function() {
                var _this = this;
-               js_log('applyEdit::' + this.media_type);
-               if(this.media_type == 'image'){
+               js_log( 'applyEdit::' + this.media_type );
+               if ( this.media_type == 'image' ) {
                        this.applyCrop();
-               }else if(this.media_type == 'video'){
+               } else if ( this.media_type == 'video' ) {
                        this.applyVideoAdj();
                }
-               //copy over the desc text to the resource object
-               _this.rObj['inlineDesc']= $j('#mv_inline_img_desc').val();
+               // copy over the desc text to the resource object
+               _this.rObj['inlineDesc'] = $j( '#mv_inline_img_desc' ).val();
        },
-       appendTool: function( $target, tool_id ){
+       appendTool: function( $target, tool_id ) {
                var _this = this;
-               switch(tool_id){
-                       case 'layout':                  
-                               $target.append( ''+             
+               switch( tool_id ) {
+                       case 'layout':
+                               $target.append( '' +
                                        '<span style="float:left;">Layout:</span>' +
-                                               '<input type="radio" name="mv_layout" id="mv_layout_left" style="float:left"><div id="mv_layout_left_img" title="'+gM('mwe-layout_left')+'"/>'+
-                                               '<input type="radio" name="mv_layout" id="mv_layout_right" style="float:left"><div id="mv_layout_right_img" title="'+gM('mwe-layout_left')+'"/>'+
-                                       '<hr style="clear:both" /><br>' 
+                                               '<input type="radio" name="mv_layout" id="mv_layout_left" style="float:left"><div id="mv_layout_left_img" title="' + gM( 'mwe-layout_left' ) + '"/>' +
+                                               '<input type="radio" name="mv_layout" id="mv_layout_right" style="float:left"><div id="mv_layout_right_img" title="' + gM( 'mwe-layout_left' ) + '"/>' +
+                                       '<hr style="clear:both" /><br>'
                                );
-                               //make sure the default is reflected:
-                               if( ! _this.rObj.layout )
+                               // make sure the default is reflected:
+                               if ( ! _this.rObj.layout )
                                        _this.rObj.layout = 'right';
-                               $j('#mv_layout_' + _this.rObj.layout)[0].checked = true;
+                               $j( '#mv_layout_' + _this.rObj.layout )[0].checked = true;
                
-                               //left radio click
-                               $j('#mv_layout_left,#mv_layout_left_img').click(function(){
-                                       $j('#mv_layout_right')[0].checked = false;
-                                       $j('#mv_layout_left')[0].checked = true;
+                               // left radio click
+                               $j( '#mv_layout_left,#mv_layout_left_img' ).click( function() {
+                                       $j( '#mv_layout_right' )[0].checked = false;
+                                       $j( '#mv_layout_left' )[0].checked = true;
                                        _this.rObj.layout = 'left';
-                               });
-                               //right radio click
-                               $j('#mv_layout_right,#mv_layout_right_img').click(function(){
-                                       $j('#mv_layout_left')[0].checked = false;
-                                       $j('#mv_layout_right')[0].checked = true;
+                               } );
+                               // right radio click
+                               $j( '#mv_layout_right,#mv_layout_right_img' ).click( function() {
+                                       $j( '#mv_layout_left' )[0].checked = false;
+                                       $j( '#mv_layout_right' )[0].checked = true;
                                        _this.rObj.layout = 'right';
-                               });             
+                               } );
                        break;
-                       case 'crop':                    
-                               $target.append( ''+
-                                       '<div class="mv_edit_button mv_crop_button_base" id="mv_crop_button" alt="crop" title="'+gM('mwe-crop')+'"/>'+
-                                               '<a href="#" class="mv_crop_msg">' + gM('mwe-crop') + '</a> '+
-                                               '<span style="display:none" class="mv_crop_msg_load">' + gM('mwe-loading_txt') + '</span> '+
-                                               '<a href="#" style="display:none" class="mv_apply_crop">' + gM('mwe-apply_crop') + '</a> '+
-                                               '<a href="#" style="display:none" class="mv_reset_crop">' + gM('mwe-reset_crop') + '</a> '+
+                       case 'crop':
+                               $target.append( '' +
+                                       '<div class="mv_edit_button mv_crop_button_base" id="mv_crop_button" alt="crop" title="' + gM( 'mwe-crop' ) + '"/>' +
+                                               '<a href="#" class="mv_crop_msg">' + gM( 'mwe-crop' ) + '</a> ' +
+                                               '<span style="display:none" class="mv_crop_msg_load">' + gM( 'mwe-loading_txt' ) + '</span> ' +
+                                               '<a href="#" style="display:none" class="mv_apply_crop">' + gM( 'mwe-apply_crop' ) + '</a> ' +
+                                               '<a href="#" style="display:none" class="mv_reset_crop">' + gM( 'mwe-reset_crop' ) + '</a> ' +
                                        '<hr style="clear:both"/><br>'
                                );
-                               //add binding: 
-                               $j('#mv_crop_button,.mv_crop_msg,.mv_apply_crop').click(function(){
-                                       js_log('click:mv_crop_button: base width: ' + _this.rObj.width + ' bh: ' + _this.rObj.height);
-                                       if($j('#mv_crop_button').hasClass('mv_crop_button_selected')){
+                               // add binding: 
+                               $j( '#mv_crop_button,.mv_crop_msg,.mv_apply_crop' ).click( function() {
+                                       js_log( 'click:mv_crop_button: base width: ' + _this.rObj.width + ' bh: ' + _this.rObj.height );
+                                       if ( $j( '#mv_crop_button' ).hasClass( 'mv_crop_button_selected' ) ) {
                                                _this.applyCrop();
-                                       }else{
-                                               js_log('click:turn on');
+                                       } else {
+                                               js_log( 'click:turn on' );
                                                _this.enableCrop();
                                        }
-                               });
-                               $j('.mv_reset_crop').click(function(){
-                                       $j('.mv_apply_crop,.mv_reset_crop').hide();
-                                       $j('.mv_crop_msg').show();
-                                       $j('#mv_crop_button').removeClass('mv_crop_button_selected').addClass('mv_crop_button_base').attr('title',gM('mwe-crop'));
-                                       _this.rObj.crop=null;
-                                       $j('#' + _this.clip_disp_ct ).empty().html(
+                               } );
+                               $j( '.mv_reset_crop' ).click( function() {
+                                       $j( '.mv_apply_crop,.mv_reset_crop' ).hide();
+                                       $j( '.mv_crop_msg' ).show();
+                                       $j( '#mv_crop_button' ).removeClass( 'mv_crop_button_selected' ).addClass( 'mv_crop_button_base' ).attr( 'title', gM( 'mwe-crop' ) );
+                                       _this.rObj.crop = null;
+                                       $j( '#' + _this.clip_disp_ct ).empty().html(
                                                '<img src="' + _this.rObj.edit_url + '" id="rsd_edit_img">'
                                        );
-                               });                             
+                               } );
                        break;
                        case 'scale':
                                /*scale:
@@ -594,187 +594,187 @@ mvClipEdit.prototype = {
                        break;
                }
        },
-       setUpImageCtrl:function(){
+       setUpImageCtrl:function() {
                var _this = this;
-               var $tool_target = $j('#'+this.control_ct);
-               //by default apply Crop tool
-               if( _this.enabled_tools == 'all' || _this.enabled_tools.length > 0){
-                       $tool_target.append( '<h3>'+ gM('mwe-edit-tools') +'</h3>' );
-                       for( var i in _this.toolset ){
+               var $tool_target = $j( '#' + this.control_ct );
+               // by default apply Crop tool
+               if ( _this.enabled_tools == 'all' || _this.enabled_tools.length > 0 ) {
+                       $tool_target.append( '<h3>' + gM( 'mwe-edit-tools' ) + '</h3>' );
+                       for ( var i in _this.toolset ) {
                                var toolid = _this.toolset[i];
-                               if( $j.inArray( toolid, _this.enabled_tools) != -1 || _this.enabled_tools=='all')
+                               if ( $j.inArray( toolid, _this.enabled_tools ) != - 1 || _this.enabled_tools == 'all' )
                                        _this.appendTool( $tool_target, toolid );
                        }
                }
-               //add the insert description text field: 
+               // add the insert description text field: 
                $tool_target.append( _this.getInsertDescHtml() );
-               //add the actions to the 'button bar'
+               // add the actions to the 'button bar'
                _this.updateInsertControlActions();
        },
-       applyVideoAdj:function(){
-               js_log('applyVideoAdj::');
-               $tp = $j('#'+this.control_ct );
+       applyVideoAdj:function() {
+               js_log( 'applyVideoAdj::' );
+               $tp = $j( '#' + this.control_ct );
 
-               //be sure to "stop the video (some plugins can't have DOM elements on top of them)
-               $j('#embed_vid').get(0).stop();
+               // be sure to "stop the video (some plugins can't have DOM elements on top of them)
+               $j( '#embed_vid' ).get( 0 ).stop();
 
-               //update video related keys
-               this.rObj['start_time'] = $tp.find('.startInOut').val();
-               this.rObj['end_time']   = $tp.find('.endInOut').val() ;
+               // update video related keys
+               this.rObj['start_time'] = $tp.find( '.startInOut' ).val();
+               this.rObj['end_time']   = $tp.find( '.endInOut' ).val() ;
 
-               //do the local video adjust
-               if(typeof this.rObj.pSobj['applyVideoAdj'] != 'undefined'){
+               // do the local video adjust
+               if ( typeof this.rObj.pSobj['applyVideoAdj'] != 'undefined' ) {
                        this.rObj.pSobj.applyVideoAdj( this.rObj );
                }
        },
-       applyCrop:function(){
+       applyCrop:function() {
                var _this = this;
-               $j('.mv_apply_crop').hide();
-               $j('.mv_crop_msg').show();
-               $j('#mv_crop_button').removeClass('mv_crop_button_selected').addClass('mv_crop_button_base').attr('title',gM('mwe-crop'));
+               $j( '.mv_apply_crop' ).hide();
+               $j( '.mv_crop_msg' ).show();
+               $j( '#mv_crop_button' ).removeClass( 'mv_crop_button_selected' ).addClass( 'mv_crop_button_base' ).attr( 'title', gM( 'mwe-crop' ) );
                js_log( 'click:turn off' );
                var cat = _this.rObj;
-               if(_this.rObj.crop){
-                       //empty out and display cropped:
-                       $j('#'+_this.clip_disp_ct ).empty().html(
-                               '<div id="mv_cropcotainer" style="overflow:hidden;position:absolute;'+
-                                       'width:' + _this.rObj.crop.w + 'px;'+
-                                       'height:' + _this.rObj.crop.h + 'px;">'+
-                                       '<div id="mv_crop_img" style="position:absolute;'+
-                                               'top:-' + _this.rObj.crop.y +'px;'+
-                                               'left:-' + _this.rObj.crop.x + 'px;">'+
-                                               '<img src="' + _this.rObj.edit_url  + '">'+
-                                       '</div>'+
+               if ( _this.rObj.crop ) {
+                       // empty out and display cropped:
+                       $j( '#' + _this.clip_disp_ct ).empty().html(
+                               '<div id="mv_cropcotainer" style="overflow:hidden;position:absolute;' +
+                                       'width:' + _this.rObj.crop.w + 'px;' +
+                                       'height:' + _this.rObj.crop.h + 'px;">' +
+                                       '<div id="mv_crop_img" style="position:absolute;' +
+                                               'top:-' + _this.rObj.crop.y + 'px;' +
+                                               'left:-' + _this.rObj.crop.x + 'px;">' +
+                                               '<img src="' + _this.rObj.edit_url  + '">' +
+                                       '</div>' +
                                '</div>'
                        );
                }
                return true;
        },
-       //right now enableCrop loads "just in time"
-       //@@todo we really need an "auto loader" type system.
-       enableCrop:function(){
+       // right now enableCrop loads "just in time"
+       // @@todo we really need an "auto loader" type system.
+       enableCrop:function() {
                var _this = this;
-               $j('.mv_crop_msg').hide();
-               $j('.mv_crop_msg_load').show();
-               var doEnableCrop = function(){
-                       $j('.mv_crop_msg_load').hide();
-                       $j('.mv_reset_crop,.mv_apply_crop').show();
-                       $j('#mv_crop_button').removeClass('mv_crop_button_base').addClass('mv_crop_button_selected').attr('title',gM('mwe-crop_done'));
-                       $j('#' + _this.clip_disp_ct + ' img').Jcrop({
-                                onSelect: function(c){
-                                        js_log('on select:' + c.x +','+ c.y+','+ c.x2+','+ c.y2+','+ c.w+','+ c.h);
+               $j( '.mv_crop_msg' ).hide();
+               $j( '.mv_crop_msg_load' ).show();
+               var doEnableCrop = function() {
+                       $j( '.mv_crop_msg_load' ).hide();
+                       $j( '.mv_reset_crop,.mv_apply_crop' ).show();
+                       $j( '#mv_crop_button' ).removeClass( 'mv_crop_button_base' ).addClass( 'mv_crop_button_selected' ).attr( 'title', gM( 'mwe-crop_done' ) );
+                       $j( '#' + _this.clip_disp_ct + ' img' ).Jcrop( {
+                                onSelect: function( c ) {
+                                        js_log( 'on select:' + c.x + ',' + c.y + ',' + c.x2 + ',' + c.y2 + ',' + c.w + ',' + c.h );
                                         _this.rObj.crop = c;
                                 },
-                                onChange: function(c){
+                                onChange: function( c ) {
                                 }
-                       });
-                       //temporary hack (@@todo need to debug why rsd_res_item gets moved )
-                       $j('#clip_edit_disp .rsd_res_item').css({
+                       } );
+                       // temporary hack (@@todo need to debug why rsd_res_item gets moved )
+                       $j( '#clip_edit_disp .rsd_res_item' ).css( {
                                'top':'0px',
                                'left':'0px'
-                       });
+                       } );
                }
-               //load the jcrop library if needed:
-               mvJsLoader.doLoad([
+               // load the jcrop library if needed:
+               mvJsLoader.doLoad( [
                        '$j.Jcrop'
-               ],function(){
+               ], function() {
                        doEnableCrop();
-               });
+               } );
        }
 }
 
 // mv_lock_vid_updates defined in mv_stream.js (we need to do some more refactoring )
-if(typeof mv_lock_vid_updates == 'undefined')
-       mv_lock_vid_updates= false;
+if ( typeof mv_lock_vid_updates == 'undefined' )
+       mv_lock_vid_updates = false;
 
-function add_adjust_hooks(mvd_id, adj_callback){
+function add_adjust_hooks( mvd_id, adj_callback ) {
 
-       var start_sec = npt2seconds($j('#mv_start_hr_' + mvd_id).val() );
-       var end_sec   = npt2seconds($j('#mv_end_hr_' + mvd_id).val()  );
+       var start_sec = npt2seconds( $j( '#mv_start_hr_' + mvd_id ).val() );
+       var end_sec   = npt2seconds( $j( '#mv_end_hr_' + mvd_id ).val()  );
 
-       //if we don't have 0 as start then assume we are in a range request and give some buffer area:
-       var min_slider =  (start_sec - 60 < 0 ) ? 0 : start_sec - 60;
-       if(min_slider!=0){
-               var max_slider =  end_sec+60;
-       }else{
+       // if we don't have 0 as start then assume we are in a range request and give some buffer area:
+       var min_slider =  ( start_sec - 60 < 0 ) ? 0 : start_sec - 60;
+       if ( min_slider != 0 ) {
+               var max_slider =  end_sec + 60;
+       } else {
                max_slider = end_sec;
        }
-       //pre-destroy just in case:
-       $j('#mvd_form_' + mvd_id + ' .inOutSlider').slider( 'destroy' ).slider({
+       // pre-destroy just in case:
+       $j( '#mvd_form_' + mvd_id + ' .inOutSlider' ).slider( 'destroy' ).slider( {
                range: true,
                min: min_slider,
                max: max_slider,
                values: [start_sec, end_sec],
-               slide: function(event, ui) {
-                       js_log(" vals:"+  seconds2npt( ui.values[0] ) + ' : ' + seconds2npt( ui.values[1]) );
-                       $j('#mv_start_hr_' + mvd_id).val( seconds2npt( ui.values[0] ) );
-                       $j('#mv_end_hr_' + mvd_id).val( seconds2npt( ui.values[1] ) );
+               slide: function( event, ui ) {
+                       js_log( " vals:" +  seconds2npt( ui.values[0] ) + ' : ' + seconds2npt( ui.values[1] ) );
+                       $j( '#mv_start_hr_' + mvd_id ).val( seconds2npt( ui.values[0] ) );
+                       $j( '#mv_end_hr_' + mvd_id ).val( seconds2npt( ui.values[1] ) );
                },
-               change:function(event, ui){
-                       do_video_time_update( seconds2npt( ui.values[0]), seconds2npt( ui.values[1] ) );
+               change:function( event, ui ) {
+                       do_video_time_update( seconds2npt( ui.values[0] ), seconds2npt( ui.values[1] ) );
                }
-       });     
-       $j('.mv_adj_hr').change(function(){
-               //preserve track duration for nav and seq:
-               //ie seems to crash so no interface updates for IE for the time being
-               if(!$j.browser.msie){
-                       if(mvd_id=='nav'||mvd_id=='seq'){
-                               add_adjust_hooks(mvd_id); // (no adj_callback)
-                       }else{
-                               add_adjust_hooks(mvd_id)
+       } );
+       $j( '.mv_adj_hr' ).change( function() {
+               // preserve track duration for nav and seq:
+               // ie seems to crash so no interface updates for IE for the time being
+               if ( !$j.browser.msie ) {
+                       if ( mvd_id == 'nav' || mvd_id == 'seq' ) {
+                               add_adjust_hooks( mvd_id ); // (no adj_callback)
+                       } else {
+                               add_adjust_hooks( mvd_id )
                        }
                }
-               //update the video time for onChange
-               do_video_time_update( $j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() );
-       });
+               // update the video time for onChange
+               do_video_time_update( $j( '#mv_start_hr_' + mvd_id ).val(), $j( '#mv_end_hr_' + mvd_id ).val() );
+       } );
 }
 
-function do_video_time_update(start_time, end_time, mvd_id)    {
-       js_log('do_video_time_update: ' +start_time +' '+ end_time);
-       if( mv_lock_vid_updates == false ){
-               //update the vid title:
-               $j('#mv_videoPlayerTime').html( start_time + ' to ' + end_time );
-               var ebvid = $j('#embed_vid').get(0);
-               if( ebvid ){
-                       if(ebvid.isPaused())
+function do_video_time_update( start_time, end_time, mvd_id )  {
+       js_log( 'do_video_time_update: ' + start_time + ' ' + end_time );
+       if ( mv_lock_vid_updates == false ) {
+               // update the vid title:
+               $j( '#mv_videoPlayerTime' ).html( start_time + ' to ' + end_time );
+               var ebvid = $j( '#embed_vid' ).get( 0 );
+               if ( ebvid ) {
+                       if ( ebvid.isPaused() )
                                ebvid.stop();
-                       ebvid.updateVideoTime(start_time, end_time);
-                       js_log('update thumb: '+ start_time);
+                       ebvid.updateVideoTime( start_time, end_time );
+                       js_log( 'update thumb: ' + start_time );
                        ebvid.updateThumbTimeNTP( start_time );
                }
        }
 }
 
-//some custom jquery bindings: 
-(function( $ ) {
-       $.fn.upDownTimeInputBind = function( inputCB ){                 
-               $( this.selector ).unbind('focus').focus(function(){                    
+// some custom jquery bindings: 
+( function( $ ) {
+       $.fn.upDownTimeInputBind = function( inputCB ) {
+               $( this.selector ).unbind( 'focus' ).focus( function() {
                        var doDelayCall = true;
-                       $(this).addClass('ui-state-focus');     
-                       //bind up down keys
-                       $(this).unbind('keydown').keydown(function (e) {
-                               var sec = npt2seconds( $j(this).val() );
-                               var k = e.which;                                                                                                                                        
-                               if(k == 38 ){//up                                                                                               
-                                       $(this).val( seconds2npt( sec + 1 ) );
-                               }else if( k == 40 ){ //down                     
-                                       var sval = ( (sec - 1) < 0 ) ? 0 : (sec - 1)            
-                                       $(this).val(  seconds2npt( sval ) );                                            
-                               }                               
-                               //set the delay updates:
-                               if(k == 38 || k == 40){ 
+                       $( this ).addClass( 'ui-state-focus' );
+                       // bind up down keys
+                       $( this ).unbind( 'keydown' ).keydown( function ( e ) {
+                               var sec = npt2seconds( $j( this ).val() );
+                               var k = e.which;
+                               if ( k == 38 ) {// up                                                                                           
+                                       $( this ).val( seconds2npt( sec + 1 ) );
+                               } else if ( k == 40 ) { // down                 
+                                       var sval = ( ( sec - 1 ) < 0 ) ? 0 : ( sec - 1 )
+                                       $( this ).val(  seconds2npt( sval ) );
+                               }
+                               // set the delay updates:
+                               if ( k == 38 || k == 40 ) {
                                        var _inputElm = this;
-                                       if(doDelayCall){                                                                
-                                               setTimeout(function(){
+                                       if ( doDelayCall ) {
+                                               setTimeout( function() {
                                                        inputCB( _inputElm );
                                                        doDelayCall = true;
-                                               },500);
+                                               }, 500 );
                                                doDelayCall = false;
-                                       }                                       
-                               }               
-                       });                                             
-               }).unbind('blur').blur(function(){
-                       $(this).removeClass('ui-state-focus');                                                                                  
-               });
+                                       }
+                               }
+                       } );
+               } ).unbind( 'blur' ).blur( function() {
+                       $( this ).removeClass( 'ui-state-focus' );
+               } );
        }
-})(jQuery);
+} )( jQuery );
index f9bc407..b42a542 100644 (file)
@@ -2,7 +2,7 @@
 *      for supported attribute details see README
 */
 
-loadGM({
+loadGM( {
        "mwe-loading_plugin" : "loading plugin ...",
        "mwe-select_playback" : "Set playback preference",
        "mwe-link_back" : "Link back",
@@ -52,7 +52,7 @@ loadGM({
        "mwe-related_videos" : "Related videos",
        "mwe-seeking" : "seeking",
        "mwe-copy-code" : "Copy code"
-});
+} );
 
 var default_video_attributes = {
        "id" : null,
@@ -63,7 +63,7 @@ var default_video_attributes = {
        "width" : "320",
        "height" : "240",
 
-       //video attributes:
+       // video attributes:
        "src" : null,
        "autoplay" : false,
        "start" : 0,
@@ -72,40 +72,40 @@ var default_video_attributes = {
        "muted" : false,
        "wikiTitleKey" : null,
        
-       //roe url (for xml based metadata)
+       // roe url (for xml based metadata)
        "roe" : null,
-       //if roe includes metadata tracks we can expose a link to metadata
+       // if roe includes metadata tracks we can expose a link to metadata
        "show_meta_link" : true,
 
-       //default state attributes per html5 spec:
-       //http://www.whatwg.org/specs/web-apps/current-work/#video)
+       // default state attributes per html5 spec:
+       // http://www.whatwg.org/specs/web-apps/current-work/#video)
        "paused" : true,
-       "readyState" : 0,  //http://www.whatwg.org/specs/web-apps/current-work/#readystate
-       "currentTime"  :0, //current playback position (should be updated by plugin)
-       "duration"  :null,   //media duration (read from file or the temporal url)
+       "readyState" : 0,  // http://www.whatwg.org/specs/web-apps/current-work/#readystate
+       "currentTime"  :0, // current playback position (should be updated by plugin)
+       "duration"  :null,   // media duration (read from file or the temporal url)
        "networkState" : 0,
 
-       "startOffset" : null, //if serving an ogg_chop segment use this to offset the presentation time 
+       "startOffset" : null, // if serving an ogg_chop segment use this to offset the presentation time 
 
-       //custom attributes for mv_embed:
-       "play_button" : true,   
+       // custom attributes for mv_embed:
+       "play_button" : true,
        "thumbnail" : null,
        "linkback" : null,
        "embed_link" : true,
        "download_link" : true,
-       "type" :null,    //the content type of the media 
+       "type" :null,    // the content type of the media 
 };
 /*
  * the base source attribute checks
  */
-var mv_default_source_attr= new Array(
+var mv_default_source_attr = new Array(
        'id',
        'src',
        'apisrc',
        'titleKey',
        'title',
-       'URLTimeEncoding', //boolean if we support temporal url requests on the source media
-       'startOffset',  
+       'URLTimeEncoding', // boolean if we support temporal url requests on the source media
+       'startOffset',
        
        'durationHint',
        'start',
@@ -114,85 +114,85 @@ var mv_default_source_attr= new Array(
        'default',
        'lang'
 );
-//set the dismissNativeWarn flag: 
+// set the dismissNativeWarn flag: 
 _global['dismissNativeWarn'] = false;
 /*
 * Converts all occurrences of <video> tag into video object
 */
-function mv_video_embed(swap_done_callback, force_id){
-       //check call stack
+function mv_video_embed( swap_done_callback, force_id ) {
+       // check call stack
        mvEmbed.init( swap_done_callback, force_id );
 }
-mvEmbed = {    
-       //flist stores the set of functions to run after the video has been swapped in. 
+mvEmbed = {
+       // flist stores the set of functions to run after the video has been swapped in. 
        flist:new Array(),
-       init:function( swap_callback, force_id ){       
-               var _this = this;       
+       init:function( swap_callback, force_id ) {
+               var _this = this;
                
-               if(swap_callback)
-                       mvEmbed.flist.push( swap_callback );                    
+               if ( swap_callback )
+                       mvEmbed.flist.push( swap_callback );
                // Get mv_embed location if it has not been set
-               js_log('mvEmbed:init: ' + mw.version);                                          
+               js_log( 'mvEmbed:init: ' + mw.version );
                
-               var loadPlaylistLib=false;                                              
+               var loadPlaylistLib = false;
                
                // Setup the selector (should be a configuration option) 
-               if( force_id == null && force_id != '' ){
-                       var j_selector = 'video,audio,playlist';                                
-               }else{          
+               if ( force_id == null && force_id != '' ) {
+                       var j_selector = 'video,audio,playlist';
+               } else {
                        var j_selector = '#' + force_id;
-               }               
-               js_log('EmbedVideo:: rewrite j_selector:: ' + j_selector);              
+               }
+               js_log( 'EmbedVideo:: rewrite j_selector:: ' + j_selector );
                // Process selected elements: 
                // ie8 does not play well with the jQuery video,audio,playlist selector use native:                     
-               if($j.browser.msie && $j.browser.version >= 8){
-                       jtags = j_selector.split(',');                          
-                       for( var i=0; i < jtags.length; i++){                   
-                               if(     jtags[i].indexOf('#') === 1){
-                                       _this.doElementSwap( $j( j_selector ).get(0) );
-                               }else{
-                                       $j( document.getElementsByTagName( jtags[i] )).each(function(){
+               if ( $j.browser.msie && $j.browser.version >= 8 ) {
+                       jtags = j_selector.split( ',' );
+                       for ( var i = 0; i < jtags.length; i++ ) {
+                               if (    jtags[i].indexOf( '#' ) === 1 ) {
+                                       _this.doElementSwap( $j( j_selector ).get( 0 ) );
+                               } else {
+                                       $j( document.getElementsByTagName( jtags[i] ) ).each( function() {
                                                _this.doElementSwap( this );
-                                       });
+                                       } );
                                }
-                       }                               
-               }else{                  
-                       $j( j_selector ).each(function(){
+                       }
+               } else {
+                       $j( j_selector ).each( function() {
                                _this.doElementSwap( this );
-                       });     
-               }   
+                       } );
+               }
                // Check clips ready to call swap_callback now in ( mvEmbed.flist )
                this.checkClipsReady();
-       },      
-       doElementSwap: function( element ){
-               if( $j(element).attr("id") == '' ){
-                       $j(element).attr("id", 'v'+ mw.player_list.length);
-               }                       
-               js_log( "mvEmbed::rewrite:: " + $j( element ).attr("id") + ' tag: '+ element.tagName.toLowerCase() );
+       },
+       doElementSwap: function( element ) {
+               if ( $j( element ).attr( "id" ) == '' ) {
+                       $j( element ).attr( "id", 'v' + mw.player_list.length );
+               }
+               js_log( "mvEmbed::rewrite:: " + $j( element ).attr( "id" ) + ' tag: ' + element.tagName.toLowerCase() );
                // Store a global reference to the id   
-               mw.player_list.push( $j( element ).attr("id") );
+               mw.player_list.push( $j( element ).attr( "id" ) );
                        
-               switch( element.tagName.toLowerCase()){
+               switch( element.tagName.toLowerCase() ) {
                        case 'video':
-                       case 'audio':                                                   
-                               var videoInterface = new embedVideo( element );                                         
+                       case 'audio':
+                               var videoInterface = new embedVideo( element );
                                mvEmbed.swapEmbedVideoElement( element, videoInterface );
                        break;
                        case 'playlist':
                                // Make sure we have the necessary play-list libs loaded:
-                               mvJsLoader.doLoad(
+                               mvJsLoader.doLoad( [
                                        'mvPlayList',
-                                       '$j.ui',        //Include dialog for pop-ing up things
-                                       '$j.ui.dialog'  
-                               ], function(){
+                                       '$j.ui',        // Include dialog for pop-ing up things
+                                       '$j.ui.dialog'
+                               ], function() {
                                        var plObj = new mvPlayList( element );
                                        mvEmbed.swapEmbedVideoElement( element, plObj );
                                        var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
                                        // Wrap a blocking display container with height + controls + title height: 
-                                       $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
-                               });
+                                       $j( '#' + plObj.id ).wrap( '<div style="display:block;height:' + ( plObj.height + added_height ) + 'px;"></div>' );
+                               } );
                        break;
-          }            
+          }
        },
        /*
        * swapEmbedVideoElement
@@ -201,82 +201,82 @@ mvEmbed = {
        * @param {Element} video_element
        * @param {Object}  
        */
-       swapEmbedVideoElement:function(video_element, videoInterface){
-               js_log('do swap ' + videoInterface.id + ' for ' + video_element);
-               embed_video = document.createElement('div');
-               //make sure our div has a hight/width set:
-                       
-               $j(embed_video).css({
+       swapEmbedVideoElement:function( video_element, videoInterface ) {
+               js_log( 'do swap ' + videoInterface.id + ' for ' + video_element );
+               embed_video = document.createElement( 'div' );
+               // make sure our div has a hight/width set:
+
+               $j( embed_video ).css( {
                        'width' : videoInterface.width,
                        'height' : videoInterface.height
-               }).html( mv_get_loading_img() );                
-               //inherit the video interface
-               for(var method in videoInterface){ //for in loop oky in Element context 
-                       if(method!='readyState'){ //readyState crashes IE
-                               if(method=='style'){
-                                               embed_video.setAttribute('style', videoInterface[method]);
-                               }else if(method=='class'){
-                                       if( $j.browser.msie )
-                                               embed_video.setAttribute("className", videoInterface['class']);
+               } ).html( mv_get_loading_img() );
+               // inherit the video interface
+               for ( var method in videoInterface ) { // for in loop oky in Element context    
+                       if ( method != 'readyState' ) { // readyState crashes IE
+                               if ( method == 'style' ) {
+                                               embed_video.setAttribute( 'style', videoInterface[method] );
+                               } else if ( method == 'class' ) {
+                                       if ( $j.browser.msie )
+                                               embed_video.setAttribute( "className", videoInterface['class'] );
                                        else
-                                               embed_video.setAttribute("class", videoInterface['class']);
-                               }else{
-                                       //normal inherit:
-                                       embed_video[method]=videoInterface[method];
+                                               embed_video.setAttribute( "class", videoInterface['class'] );
+                               } else {
+                                       // normal inherit:
+                                       embed_video[method] = videoInterface[method];
                                }
                        }
-                       //string -> boolean:
-                       if(embed_video[method]=="false")
-                               embed_video[method]=false;
+                       // string -> boolean:
+                       if ( embed_video[method] == "false" )
+                               embed_video[method] = false;
                                
-                       if(embed_video[method]=="true")
-                               embed_video[method]=true;
-               }       
+                       if ( embed_video[method] == "true" )
+                               embed_video[method] = true;
+               }
                                  
                // Now swap out the video element for the embed_video obj:        
-               $j(video_element).after(embed_video).remove();                                    
-               $j('#'+embed_video.id).get(0).on_dom_swap();    
+               $j( video_element ).after( embed_video ).remove();
+               $j( '#' + embed_video.id ).get( 0 ).on_dom_swap();
                          
                // Now that "embed_video" is stable, do more initialization (if we are ready)
-               if($j('#'+embed_video.id).get(0).loading_external_data == false
-                        && $j('#'+embed_video.id).get(0).init_with_sources_loadedDone == false){
-                       //load and set ready state since source are available: 
-                       $j('#'+embed_video.id).get(0).init_with_sources_loaded();
-               }               
-               js_log('done with child: ' + embed_video.id + ' len:' + mw.player_list.length);
+               if ( $j( '#' + embed_video.id ).get( 0 ).loading_external_data == false
+                        && $j( '#' + embed_video.id ).get( 0 ).init_with_sources_loadedDone == false ) {
+                       // load and set ready state since source are available: 
+                       $j( '#' + embed_video.id ).get( 0 ).init_with_sources_loaded();
+               }
+               js_log( 'done with child: ' + embed_video.id + ' len:' + mw.player_list.length );
                return true;
        },
        /**
        * Check if Clips in the player_list are ready and runs 
        * any associated queued functions 
        */
-       checkClipsReady : function(){
-               //js_log('checkClipsReady');
-               var is_ready=true;        
-               for(var i=0; i < mw.player_list.length; i++){
-                         if( $j('#'+mw.player_list[i]).length !=0){
-                               var cur_vid =  $j('#'+mw.player_list[i]).get(0);                  
+       checkClipsReady : function() {
+               // js_log('checkClipsReady');
+               var is_ready = true;
+               for ( var i = 0; i < mw.player_list.length; i++ ) {
+                         if ( $j( '#' + mw.player_list[i] ).length != 0 ) {
+                               var cur_vid =  $j( '#' + mw.player_list[i] ).get( 0 );
                                
                                is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
                                
-                               if( !is_ready && cur_vid.load_error ){ 
-                                       is_ready=true;
+                               if ( !is_ready && cur_vid.load_error ) {
+                                       is_ready = true;
                                        // Update the video with its load error:
-                                       $j(cur_vid).html( cur_vid.load_error );
+                                       $j( cur_vid ).html( cur_vid.load_error );
                                }
                        }
                }
-               if( is_ready ){
+               if ( is_ready ) {
                        mvEmbed.allClipsReady = true;
                        // run queued functions 
-                       //js_log('run queded functions:' + mvEmbed.flist[0]);
+                       // js_log('run queded functions:' + mvEmbed.flist[0]);
                        mvEmbed.runFlist();
-               }else{                           
+               } else {
                         setTimeout( 'mvEmbed.checkClipsReady()', 25 );
-                }                        
+                }
        },
-       runFlist:function(){
-               while (this.flist.length){                              
+       runFlist:function() {
+               while ( this.flist.length ) {
                        this.flist.shift()();
                }
        }
@@ -287,8 +287,8 @@ mvEmbed = {
   * @param {Element} element: MIME type of the source.
   * @constructor
   */
-function mediaSource(element){
-       this.init(element);
+function mediaSource( element ) {
+       this.init( element );
 }
 
 mediaSource.prototype = {
@@ -315,37 +315,37 @@ mediaSource.prototype = {
        /**
        * MediaSource constructor:
        */
-       init : function(element){
-               //js_log('adding mediaSource: ' + element);                             
-               this.src = $j(element).attr('src');
+       init : function( element ) {
+               // js_log('adding mediaSource: ' + element);                            
+               this.src = $j( element ).attr( 'src' );
                this.marked_default = false;
-               if ( element.tagName.toLowerCase() == 'video')
-                       this.marked_default = true;             
+               if ( element.tagName.toLowerCase() == 'video' )
+                       this.marked_default = true;
                
                // Set default URLTimeEncoding if we have a time  url:
                // not ideal way to discover if content is on an oggz_chop server. 
                // should check some other way. 
                var pUrl = parseUri ( this.src );
-               if(typeof pUrl['queryKey']['t'] != 'undefined'){
-                       this['URLTimeEncoding']=true;                   
-               }                               
-               for(var i=0; i < mv_default_source_attr.length; i++){ //array loop:
-                       var attr = mv_default_source_attr[ i ];                 
-                       if( $j(element).attr( attr ) ) {
-                               this[ attr ] =  $j(element).attr( attr );
+               if ( typeof pUrl['queryKey']['t'] != 'undefined' ) {
+                       this['URLTimeEncoding'] = true;
+               }
+               for ( var i = 0; i < mv_default_source_attr.length; i++ ) { // array loop:
+                       var attr = mv_default_source_attr[ i ];
+                       if ( $j( element ).attr( attr ) ) {
+                               this[ attr ] =  $j( element ).attr( attr );
                        }
-               }       
+               }
                                        
                        
-               if ( $j(element).attr('type'))
-                       this.mime_type = $j(element).attr('type');
-               else if ($j(element).attr('content-type'))
-                       this.mime_type = $j(element).attr('content-type');
-               else                    
-                       this.mime_type = this.detectType(this.src);
+               if ( $j( element ).attr( 'type' ) )
+                       this.mime_type = $j( element ).attr( 'type' );
+               else if ( $j( element ).attr( 'content-type' ) )
+                       this.mime_type = $j( element ).attr( 'content-type' );
+               else
+                       this.mime_type = this.detectType( this.src );
                
                // Set the title if unset:
-               if( !this.title )
+               if ( !this.title )
                        this.title = this.mime_type;
 
                this.parseURLDuration();
@@ -354,67 +354,67 @@ mediaSource.prototype = {
        * Update Source title via Element
        * @param Element:       
        */
-       updateSource:function(element){
-               //for now just update the title: 
-               if ($j(element).attr("title"))
-                       this.title = $j(element).attr("title");         
+       updateSource:function( element ) {
+               // for now just update the title: 
+               if ( $j( element ).attr( "title" ) )
+                       this.title = $j( element ).attr( "title" );
        },
        /** 
         * Updates the src time and start & end
         * @param {String} start_time: in NTP format
         * @param {String} end_time: in NTP format
         */
-       updateSrcTime:function (start_ntp, end_ntp){
-               //js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp + ' from org: ' + this.start_ntp+ '/'+this.end_ntp);
-               //js_log("pre uri:" + this.src);
-               //if we have time we can use:
-               if( this.URLTimeEncoding ){
-                       //make sure its a valid start time / end time (else set default) 
-                       if( !npt2seconds(start_ntp) ) 
+       updateSrcTime:function ( start_ntp, end_ntp ) {
+               // js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp + ' from org: ' + this.start_ntp+ '/'+this.end_ntp);
+               // js_log("pre uri:" + this.src);
+               // if we have time we can use:
+               if ( this.URLTimeEncoding ) {
+                       // make sure its a valid start time / end time (else set default) 
+                       if ( !npt2seconds( start_ntp ) )
                                start_ntp = this.start_ntp;
                                
-                       if( !npt2seconds(end_ntp) )
+                       if ( !npt2seconds( end_ntp ) )
                                end_ntp = this.end_ntp;
                                                                                  
-                       this.src = getURLParamReplace(this.src, { 't': start_ntp +'/'+ end_ntp } );                
+                       this.src = getURLParamReplace( this.src, { 't': start_ntp + '/' + end_ntp } );
                        
-                       //update the duration
+                       // update the duration
                        this.parseURLDuration();
-               }                
+               }
        },
        /**
        * Sets the duration and sets the end time if unset 
        * @param {Float} duration: in seconds
        */
-       setDuration:function (duration){
+       setDuration:function ( duration ) {
                this.duration = duration;
-               if(!this.end_ntp){
-                       this.end_ntp = seconds2npt( this.start_offset + duration);
+               if ( !this.end_ntp ) {
+                       this.end_ntp = seconds2npt( this.start_offset + duration );
                }
        },
        /** 
        * MIME type accessor function.
        * @return {String} the MIME type of the source.
        */
-       getMIMEType : function(){
+       getMIMEType : function() {
                return this.mime_type;
        },
        /** URI function.
        * @param {Number} seek_time_sec  Int: Used to adjust the URI for url based seeks) 
        * @return {String} the URI of the source.
        */
-       getURI : function( seek_time_sec ){                             
-               if( !seek_time_sec || !this.URLTimeEncoding ){                  
-                       return this.src;                                                  
-               }                               
-               if(!this.end_ntp){
+       getURI : function( seek_time_sec ) {
+               if ( !seek_time_sec || !this.URLTimeEncoding ) {
+                       return this.src;
+               }
+               if ( !this.end_ntp ) {
                        var endvar = '';
-               }else{
-                       var endvar = '/'+ this.end_ntp;
-               }               
-               return getURLParamReplace(this.src,  
-                       { 
-                               't': seconds2npt( seek_time_sec ) + endvar 
+               } else {
+                       var endvar = '/' + this.end_ntp;
+               }
+               return getURLParamReplace( this.src,
+                       {
+                               't': seconds2npt( seek_time_sec ) + endvar
                        }
                );
        },
@@ -422,14 +422,14 @@ mediaSource.prototype = {
                @return the title of the source.
                @type String
        */
-       getTitle : function(){
+       getTitle : function() {
                return this.title;
        },
        /** Index accessor function.
                @return the source's index within the enclosing mediaElement container.
                @type Integer
        */
-       getIndex : function(){
+       getIndex : function() {
                return this.index;
        },
        /*
@@ -438,53 +438,53 @@ mediaSource.prototype = {
         * special case derive duration from request url
         * supports media_url?t=ntp_start/ntp_end url request format
         */
-       parseURLDuration : function(){                    
-               //check if we have a URLTimeEncoding: 
-               if( this.URLTimeEncoding ){               
+       parseURLDuration : function() {
+               // check if we have a URLTimeEncoding: 
+               if ( this.URLTimeEncoding ) {
                        var annoURL = parseUri( this.src );
-                       if( annoURL.queryKey['t'] ){
-                               var times = annoURL.queryKey['t'].split('/');
+                       if ( annoURL.queryKey['t'] ) {
+                               var times = annoURL.queryKey['t'].split( '/' );
                                this.start_ntp = times[0];
                                this.end_ntp = times[1];
                                this.start_offset = npt2seconds( this.start_ntp );
                                this.duration = npt2seconds( this.end_ntp ) - this.start_offset;
-                       }else{
-                               //look for this info as attributes
-                               if(this.startOffset){
+                       } else {
+                               // look for this info as attributes
+                               if ( this.startOffset ) {
                                        this.start_offset = this.startOffset;
-                                       this.start_ntp = seconds2npt( this.startOffset);                                        
-                               } 
-                               if(this.duration){
-                                       this.end_ntp = seconds2npt( parseInt(this.duration) + parseInt(this.start_offset) );
-                               }                               
-                       }                                               
-               }       
+                                       this.start_ntp = seconds2npt( this.startOffset );
+                               }
+                               if ( this.duration ) {
+                                       this.end_ntp = seconds2npt( parseInt( this.duration ) + parseInt( this.start_offset ) );
+                               }
+                       }
+               }
        },
        /** Attempts to detect the type of a media file based on the URI.
        *       @param {String} uri URI of the media file.
        *       @returns {String} The guessed MIME type of the file.
        *       @type String
        */
-       detectType:function(uri){
-               //@@todo if media is on the same server as the javascript
+       detectType:function( uri ) {
+               // @@todo if media is on the same server as the javascript
                // we can issue a HEAD request and read the mime type of the media...
                // (this will detect media mime type independently of the url name)
                // http://www.jibbering.com/2002/4/httprequest.html (this should be done by extending jquery's ajax objects)
-               var end_inx =  (uri.indexOf('?')!=-1)? uri.indexOf('?') : uri.length;
-               var no_param_uri = uri.substr(0, end_inx);
-               switch( no_param_uri.substr(no_param_uri.lastIndexOf('.'),4).toLowerCase() ){
-                       case '.mp4': 
-                               return 'video/h264'; 
+               var end_inx =  ( uri.indexOf( '?' ) != - 1 ) ? uri.indexOf( '?' ) : uri.length;
+               var no_param_uri = uri.substr( 0, end_inx );
+               switch( no_param_uri.substr( no_param_uri.lastIndexOf( '.' ), 4 ).toLowerCase() ) {
+                       case '.mp4':
+                               return 'video/h264';
                        break;
-                       case '.flv': 
-                               return 'video/x-flv'; 
+                       case '.flv':
+                               return 'video/x-flv';
                        break;
-                       case '.ogg': 
-                       case '.ogv': 
+                       case '.ogg':
+                       case '.ogv':
                                return 'video/ogg';
                        break;
-                       case '.oga': 
-                               return 'audio/ogg'; 
+                       case '.oga':
+                               return 'audio/ogg';
                        break;
                        case '.anx':
                                return 'video/ogg';
@@ -509,65 +509,65 @@ function mediaElement( element )
 
 mediaElement.prototype = {
        /** The array of mediaSource elements. */
-       sources:null,   
-       addedROEData:false,     
+       sources:null,
+       addedROEData:false,
        /** Selected mediaSource element. */
        selected_source:null,
        thumbnail:null,
-       linkback:null,  
+       linkback:null,
 
        /** @private */
        init:function( video_element )
        {
                var _this = this;
-               js_log('Initializing mediaElement...' );
+               js_log( 'Initializing mediaElement...' );
                this.sources = new Array();
-               this.thumbnail = mv_default_thumb_url;                            
+               this.thumbnail = mv_default_thumb_url;
                
-               if($j(video_element).attr('thumbnail'))
-                       this.thumbnail = $j(video_element).attr('thumbnail');
+               if ( $j( video_element ).attr( 'thumbnail' ) )
+                       this.thumbnail = $j( video_element ).attr( 'thumbnail' );
                        
-               if($j(video_element).attr('poster'))
-                       this.thumbnail = $j(video_element).attr('poster');
+               if ( $j( video_element ).attr( 'poster' ) )
+                       this.thumbnail = $j( video_element ).attr( 'poster' );
                
-               if($j(video_element).attr('wikiTitleKey'))
-                       this.wikiTitleKey = $j(video_element).attr('wikiTitleKey');
+               if ( $j( video_element ).attr( 'wikiTitleKey' ) )
+                       this.wikiTitleKey = $j( video_element ).attr( 'wikiTitleKey' );
        
-               if($j(video_element).attr('durationHint')){
-                       this.durationHint = $j(video_element).attr('durationHint');                     
-                       //convert duration hint if needed:
-                       var sc = this.durationHint.split(':');
-                       if( sc.length >=1 ){
+               if ( $j( video_element ).attr( 'durationHint' ) ) {
+                       this.durationHint = $j( video_element ).attr( 'durationHint' );
+                       // convert duration hint if needed:
+                       var sc = this.durationHint.split( ':' );
+                       if ( sc.length >= 1 ) {
                                this.duration = npt2seconds( this.durationHint );
-                       }else{
+                       } else {
                                this.duration = parseFloat( this.durationHint );
                        }
                }
                
                // Process the video_element as a source element:
-               if($j(video_element).attr("src"))
-                       this.tryAddSource(video_element);       
+               if ( $j( video_element ).attr( "src" ) )
+                       this.tryAddSource( video_element );
                
                // Process all inner <source> elements  
-               $j(video_element).find('source,text,itext').each(function(inx, inner_source){                   
+               $j( video_element ).find( 'source,text,itext' ).each( function( inx, inner_source ) {
                        _this.tryAddSource( inner_source );
-               });                                               
+               } );
        },
        /** 
        * Updates the time request for all sources that have a standard time request argument (ie &t=start_time/end_time)
        */
-       updateSourceTimes:function(start_ntp, end_ntp){
+       updateSourceTimes:function( start_ntp, end_ntp ) {
                var _this = this;
-               $j.each(this.sources, function(inx, mediaSource){
-                       mediaSource.updateSrcTime(start_ntp, end_ntp);
-               });
+               $j.each( this.sources, function( inx, mediaSource ) {
+                       mediaSource.updateSrcTime( start_ntp, end_ntp );
+               } );
        },
        /*timed Text check*/
-       timedTextSources:function(){
-               for(var i=0; i < this.sources.length; i++){                     
-                       if    this.sources[i].mime_type == 'text/cmml' ||
-                               this.sources[i].mime_type == 'text/x-srt')
-                                       return true;                                                            
+       timedTextSources:function() {
+               for ( var i = 0; i < this.sources.length; i++ ) {
+                       if (    this.sources[i].mime_type == 'text/cmml' ||
+                               this.sources[i].mime_type == 'text/x-srt' )
+                                       return true;
                };
                return false;
        },
@@ -576,99 +576,99 @@ mediaElement.prototype = {
        */
        getSources:function( mime_filter )
        {
-               if(!mime_filter)
+               if ( !mime_filter )
                        return this.sources;
-               //apply mime filter: 
+               // apply mime filter: 
                   var source_set = new Array();
-               for(var i=0; i < this.sources.length ; i++){
-                       if( this.sources[i].mime_type.indexOf( mime_filter ) != -1 )
+               for ( var i = 0; i < this.sources.length ; i++ ) {
+                       if ( this.sources[i].mime_type.indexOf( mime_filter ) != - 1 )
                                source_set.push( this.sources[i] );
                }
                return source_set;
        },
-       getSourceById:function( source_id ){            
-               for(var i=0; i < this.sources.length ; i++){
-                       if( this.sources[i].id ==  source_id)
+       getSourceById:function( source_id ) {
+               for ( var i = 0; i < this.sources.length ; i++ ) {
+                       if ( this.sources[i].id ==  source_id )
                                return this.sources[i];
                }
                return null;
        },
        /** Selects a particular source for playback.
        */
-       selectSource:function(index)
+       selectSource:function( index )
        {
-               js_log('f:selectSource:'+index);
+               js_log( 'f:selectSource:' + index );
                var playable_sources = this.getPlayableSources();
-               for(var i=0; i < playable_sources.length; i++){
-                       if( i==index ){
+               for ( var i = 0; i < playable_sources.length; i++ ) {
+                       if ( i == index ) {
                                this.selected_source = playable_sources[i];
                                // Update the user selected format: 
                                embedTypes.players.userSelectFormat( playable_sources[i].mime_type );
                                break;
                        }
-               }               
+               }
        },
        /** 
        * Selects the default source via cookie preference, default marked, or by id order
        */
-       autoSelectSource:function()
-               js_log('f:autoSelectSource:');                                  
+       autoSelectSource:function() {
+               js_log( 'f:autoSelectSource:' );
                // Select the default source
-               var playable_sources = this.getPlayableSources();                                                       
-               var flash_flag=ogg_flag=false;            
-               //debugger;
-               for(var source=0; source < playable_sources.length; source++){
-                       var mime_type =playable_sources[source].mime_type;
-                       if( playable_sources[source].marked_default ){
-                               js_log('set via marked default: ' + playable_sources[source].marked_default);
-                               this.selected_source = playable_sources[source];                                
+               var playable_sources = this.getPlayableSources();
+               var flash_flag = ogg_flag = false;
+               // debugger;
+               for ( var source = 0; source < playable_sources.length; source++ ) {
+                       var mime_type = playable_sources[source].mime_type;
+                       if ( playable_sources[source].marked_default ) {
+                               js_log( 'set via marked default: ' + playable_sources[source].marked_default );
+                               this.selected_source = playable_sources[source];
                                return true;
                        }
                        // Set via user-preference
-                       if(embedTypes.players.preference['format_prefrence'] == mime_type){
-                                js_log('set via preference: '+playable_sources[source].mime_type);
+                       if ( embedTypes.players.preference['format_prefrence'] == mime_type ) {
+                                js_log( 'set via preference: ' + playable_sources[source].mime_type );
                                 this.selected_source = playable_sources[source];
-                                return true; 
-                       }                                                                                                                       
-               }          
+                                return true;
+                       }
+               }
                // Set Ogg via player support           
-               for(var source=0; source < playable_sources.length; source++){
-                       js_log('f:autoSelectSource:' + playable_sources[source].mime_type);
-                       var mime_type =playable_sources[source].mime_type;                                      
-                          //set source via player                               
-                       if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){                             
-                               for(var i=0; i < embedTypes.players.players.length; i++){ //for in loop on object oky
-                                       var player = embedTypes.players.players[i];                                     
-                                       if(player.library=='vlc' || player.library=='native'){
-                                               js_log('set via ogg via order');                                                
-                                               this.selected_source = playable_sources[source];        
+               for ( var source = 0; source < playable_sources.length; source++ ) {
+                       js_log( 'f:autoSelectSource:' + playable_sources[source].mime_type );
+                       var mime_type = playable_sources[source].mime_type;
+                          // set source via player                              
+                       if ( mime_type == 'video/ogg' || mime_type == 'ogg/video' || mime_type == 'video/annodex' || mime_type == 'application/ogg' ) {
+                               for ( var i = 0; i < embedTypes.players.players.length; i++ ) { // for in loop on object oky
+                                       var player = embedTypes.players.players[i];
+                                       if ( player.library == 'vlc' || player.library == 'native' ) {
+                                               js_log( 'set via ogg via order' );
+                                               this.selected_source = playable_sources[source];
                                                return true;
-                                       }                                       
+                                       }
                                }
                        }
                }
                // Set basic flash
-               for(var source=0; source < playable_sources.length; source++){  
-                       var mime_type =playable_sources[source].mime_type;                                                                              
-                       if( mime_type=='video/x-flv' ){
-                               js_log('set via by player preference normal flash')
+               for ( var source = 0; source < playable_sources.length; source++ ) {
+                       var mime_type = playable_sources[source].mime_type;
+                       if ( mime_type == 'video/x-flv' ) {
+                               js_log( 'set via by player preference normal flash' )
                                this.selected_source = playable_sources[source];
                                return true;
-                       }                                               
+                       }
                }
                // Set h264 flash 
-               for(var source=0; source < playable_sources.length; source++){  
-                       var mime_type =playable_sources[source].mime_type;                                                                              
-                       if( mime_type=='video/h264' ){
-                               js_log('set via playable_sources preference h264 flash')
+               for ( var source = 0; source < playable_sources.length; source++ ) {
+                       var mime_type = playable_sources[source].mime_type;
+                       if ( mime_type == 'video/h264' ) {
+                               js_log( 'set via playable_sources preference h264 flash' )
                                this.selected_source = playable_sources[source];
                                return true;
-                       }                          
-               }               
+                       }
+               }
                // Select first source          
-               if (!this.selected_source)
+               if ( !this.selected_source )
                {
-                       js_log('set via first source:' + playable_sources[0]);
+                       js_log( 'set via first source:' + playable_sources[0] );
                        this.selected_source = playable_sources[0];
                        return true;
                }
@@ -688,18 +688,18 @@ mediaElement.prototype = {
        */
        hasStreamOfMIMEType:function( mime_type )
        {
-               for(source in this.sources)
+               for ( source in this.sources )
                {
-                       if(this.sources[source].getMIMEType() == mime_type)
+                       if ( this.sources[source].getMIMEType() == mime_type )
                                return true;
                }
                return false;
        },
-       isPlayableType:function(mime_type)
+       isPlayableType:function( mime_type )
        {
-               if( embedTypes.players.defaultPlayer( mime_type ) ){
+               if ( embedTypes.players.defaultPlayer( mime_type ) ) {
                        return true;
-               }else{
+               } else {
                        return false;
                }
        },
@@ -710,75 +710,75 @@ mediaElement.prototype = {
        */
        tryAddSource:function( element )
        {
-               js_log('f:tryAddSource:'+ $j(element).attr("src"));                             
-               if ( $j(element).attr("src") ){
-                       var new_src = $j(element).attr('src');
-                       //make sure an existing element with the same src does not already exist:                
-                       for( var i=0; i < this.sources.length; i++ ){                           
-                               if(this.sources[i].src == new_src){
-                                       //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);      
-                                       //can't add it all but try to update any additional attr: 
-                                       this.sources[i].updateSource(element);
+               js_log( 'f:tryAddSource:' + $j( element ).attr( "src" ) );
+               if ( $j( element ).attr( "src" ) ) {
+                       var new_src = $j( element ).attr( 'src' );
+                       // make sure an existing element with the same src does not already exist:               
+                       for ( var i = 0; i < this.sources.length; i++ ) {
+                               if ( this.sources[i].src == new_src ) {
+                                       // js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);     
+                                       // can't add it all but try to update any additional attr: 
+                                       this.sources[i].updateSource( element );
                                }
                        }
-               }                                       
+               }
                var source = new mediaSource( element );
                // Inherit some properties from the parent <video> element if unset: 
-               if( !source.duration && this.duration)
+               if ( !source.duration && this.duration )
                        source.duration = this.duration;
                        
-               if( !source.startOffset && this.startOffset)
-                       source.startOffset =this.startOffset;
+               if ( !source.startOffset && this.startOffset )
+                       source.startOffset = this.startOffset;
                
                                
-               this.sources.push(source);              
-               js_log('pushed source to stack'+ source + 'sl:'+this.sources.length);
+               this.sources.push( source );
+               js_log( 'pushed source to stack' + source + 'sl:' + this.sources.length );
        },
-       getPlayableSources: function(){          
-                var playable_sources= new Array();
-                for(var i=0; i < this.sources.length; i++){                                                               
-                        if( this.isPlayableType( this.sources[i].mime_type ) ){                                 
+       getPlayableSources: function() {
+                var playable_sources = new Array();
+                for ( var i = 0; i < this.sources.length; i++ ) {
+                        if ( this.isPlayableType( this.sources[i].mime_type ) ) {
                                 playable_sources.push( this.sources[i] );
-                        }else{
-                                js_log("type "+ this.sources[i].mime_type + 'is not playable');
+                        } else {
+                                js_log( "type " + this.sources[i].mime_type + 'is not playable' );
                         }
-                };              
+                };
                 return playable_sources;
        },
        /* Imports media sources from ROE data.
         *   @param roe_data ROE data.
        */
-       addROE:function(roe_data){              
-               js_log('f:addROE');
-               this.addedROEData=true;
-               var _this = this;               
-               if( typeof roe_data == 'string' )
+       addROE:function( roe_data ) {
+               js_log( 'f:addROE' );
+               this.addedROEData = true;
+               var _this = this;
+               if ( typeof roe_data == 'string' )
                {
-                       var parser=new DOMParser();
-                       js_log('ROE data:' + roe_data);
-                       roe_data=parser.parseFromString(roe_data,"text/xml");
-               }
-               if( roe_data ){
-                       $j.each(roe_data.getElementsByTagName('mediaSource'), function(inx, source){
-                               _this.tryAddSource(source);
-                       });
-                       //set the thumbnail:
-                       $j.each(roe_data.getElementsByTagName('img'), function(inx, n){
-                               if($j(n).attr("id")=="stream_thumb"){
-                                       js_log('roe:set thumb to '+$j(n).attr("src"));
-                                       _this['thumbnail'] =$j(n).attr("src");
+                       var parser = new DOMParser();
+                       js_log( 'ROE data:' + roe_data );
+                       roe_data = parser.parseFromString( roe_data, "text/xml" );
+               }
+               if ( roe_data ) {
+                       $j.each( roe_data.getElementsByTagName( 'mediaSource' ), function( inx, source ) {
+                               _this.tryAddSource( source );
+                       } );
+                       // set the thumbnail:
+                       $j.each( roe_data.getElementsByTagName( 'img' ), function( inx, n ) {
+                               if ( $j( n ).attr( "id" ) == "stream_thumb" ) {
+                                       js_log( 'roe:set thumb to ' + $j( n ).attr( "src" ) );
+                                       _this['thumbnail'] = $j( n ).attr( "src" );
                                }
-                       });
-                       //set the linkback:
-                       $j.each(roe_data.getElementsByTagName('link'), function(inx, n){
-                               if($j(n).attr('id')=='html_linkback'){
-                                       js_log('roe:set linkback to '+$j(n).attr("href"));
-                                       _this['linkback'] = $j(n).attr('href');
+                       } );
+                       // set the linkback:
+                       $j.each( roe_data.getElementsByTagName( 'link' ), function( inx, n ) {
+                               if ( $j( n ).attr( 'id' ) == 'html_linkback' ) {
+                                       js_log( 'roe:set linkback to ' + $j( n ).attr( "href" ) );
+                                       _this['linkback'] = $j( n ).attr( 'href' );
                                }
-                       });
-               }else{
-                       js_log('ROE data empty.');
-               }                               
+                       } );
+               } else {
+                       js_log( 'ROE data empty.' );
+               }
        }
 };
 
@@ -787,292 +787,292 @@ mediaElement.prototype = {
        @param element <video> tag used for initialization.
        @constructor
 */
-var embedVideo = function(element) {
-       return this.init(element);
+var embedVideo = function( element ) {
+       return this.init( element );
 };
 
 embedVideo.prototype = {
        /** The mediaElement object containing all mediaSource objects */
        media_element:null,
-       preview_mode:false,                
-       ready_to_play:false, //should use html5 ready state
-       load_error:false, //used to set error in case of error
+       preview_mode:false,
+       ready_to_play:false, // should use html5 ready state
+       load_error:false, // used to set error in case of error
        loading_external_data:false,
        thumbnail_updating:false,
        thumbnail_disp:true,
        init_with_sources_loadedDone:false,
        inDOM:false,
-       //for onClip done stuff: 
+       // for onClip done stuff: 
        anno_data_cache:null,
        seek_time_sec:0,
        base_seeker_slider_offset:null,
        onClipDone_disp:false,
-       supports:{},    
-       //for seek thumb updates:
+       supports: { },
+       // for seek thumb updates:
        cur_thumb_seek_time:0,
        thumb_seek_interval:null,
-       //set the default tag type to video:    
+       // set the default tag type to video:   
        seeking:false,
-       //set the buffered percent:     
-       bufferedPercent:0,      
-       //utility functions for property values:
+       // set the buffered percent:    
+       bufferedPercent:0,
+       // utility functions for property values:
        hx : function ( s ) {
                if ( typeof s != 'String' ) {
                        s = s.toString();
                }
-               return s.replace( /&/g, '&amp;' )
-                       . replace( /</g, '&lt;' )
-                       . replace( />/g, '&gt;' );
+               return s.replace( / & / g, '&amp;' )
+                       . replace( / < / g, '&lt;' )
+                       . replace( / > / g, '&gt;' );
        },
        hq : function ( s ) {
                return '"' + this.hx( s ) + '"';
        },
        playerPixelWidth : function()
        {
-               var player = $j('#mv_embedded_player_'+this.id).get(0);
-               if(typeof player!='undefined' && player['offsetWidth'])
+               var player = $j( '#mv_embedded_player_' + this.id ).get( 0 );
+               if ( typeof player != 'undefined' && player['offsetWidth'] )
                        return player.offsetWidth;
                else
-                       return parseInt(this.width);
+                       return parseInt( this.width );
        },
        playerPixelHeight : function()
        {
-               var player = $j('#mv_embedded_player_'+this.id).get(0);
-               if(typeof player!='undefined' && player['offsetHeight'])
+               var player = $j( '#mv_embedded_player_' + this.id ).get( 0 );
+               if ( typeof player != 'undefined' && player['offsetHeight'] )
                        return player.offsetHeight;
                else
-                       return parseInt(this.height);
+                       return parseInt( this.height );
        },
-       init: function(element){                                                        
+       init: function( element ) {
                // Inherit all the default video_attributes             
-               for(var attr in default_video_attributes){ //for in loop oky on user object
-                       if(element.getAttribute(attr)){
-                               this[ attr ] = element.getAttribute(attr);
-                       }else{
+               for ( var attr in default_video_attributes ) { // for in loop oky on user object
+                       if ( element.getAttribute( attr ) ) {
+                               this[ attr ] = element.getAttribute( attr );
+                       } else {
                                this[attr] = default_video_attributes[attr];
                        }
                }
                
                // Set the skin name from the class  
-               var     sn = element.getAttribute('class');
-               if( sn && sn != ''){
-                       for(var n=0;n< mw.valid_skins.length;n++){ 
-                               if( sn.indexOf(mw.valid_skins[n]) !== -1){
+               var     sn = element.getAttribute( 'class' );
+               if ( sn && sn != '' ) {
+                       for ( var n = 0; n < mw.valid_skins.length; n++ ) {
+                               if ( sn.indexOf( mw.valid_skins[n] ) !== - 1 ) {
                                        this.skin_name = mw.valid_skins[ n ];
                                }
                        }
                }
                // Set the default if unset: 
-               if(!this.skin_name)
+               if ( !this.skin_name )
                        this.skin_name = mw.conf.skin_name;
                
                // Make sure startOffset is cast as an int                 
-               if( this.startOffset && this.startOffset.split(':').length >= 2)
-                       this.startOffset = npt2seconds(this.startOffset);
+               if ( this.startOffset && this.startOffset.split( ':' ).length >= 2 )
+                       this.startOffset = npt2seconds( this.startOffset );
                // Make sure offset is in float: 
-               this.startOffset = parseFloat(this.startOffset);
+               this.startOffset = parseFloat( this.startOffset );
                 
-               if( this.duration && this.duration.split(':').length >= 2)
-                       this.duration = npt2seconds( this.duration );    
+               if ( this.duration && this.duration.split( ':' ).length >= 2 )
+                       this.duration = npt2seconds( this.duration );
                // Make sure duration is in float:  
-               this.duration = parseFloat(this.duration);  
-               js_log("duration is: " +  this.duration);
+               this.duration = parseFloat( this.duration );
+               js_log( "duration is: " +  this.duration );
                
                // Get defaults         
-               var dwh = mw.conf['video_size'].split('x');
-               this.width = element.style.width ? element.style.width : dwh[0];                
-               if( element.tagName == 'AUDIO' ){
+               var dwh = mw.conf['video_size'].split( 'x' );
+               this.width = element.style.width ? element.style.width : dwh[0];
+               if ( element.tagName == 'AUDIO' ) {
                        this.height = element.style.height ? element.style.height : 0;
-               }else{
+               } else {
                        this.height = element.style.height ? element.style.height : dwh[1];
-               }                               
+               }
                
                // Set the plugin id
                this.pid = 'pid_' + this.id;
 
                // Grab any innerHTML and set it to missing_plugin_html
                // @@todo we should strip source tags instead of checking and skipping
-               if(element.innerHTML!='' && element.getElementsByTagName('source').length==0){
-                       js_log('innerHTML: ' + element.innerHTML);
-                       this.user_missing_plugin_html=element.innerHTML;
-               }                                 
+               if ( element.innerHTML != '' && element.getElementsByTagName( 'source' ).length == 0 ) {
+                       js_log( 'innerHTML: ' + element.innerHTML );
+                       this.user_missing_plugin_html = element.innerHTML;
+               }
                // Load all of the specified sources
-               this.media_element = new mediaElement(element);         
+               this.media_element = new mediaElement( element );
                
                // If we are displaying controls setup the ctrlBuilder  
-               if( this.controls ){
-                       //set-up the local ctrlBuilder instance: 
+               if ( this.controls ) {
+                       // set-up the local ctrlBuilder instance: 
                        this.ctrlBuilder = new ctrlBuilder( this );
-                       //load the css for the current player
-                                       
-               }                       
+                       // load the css for the current player
+
+               }
                // Load skin:
-               loadExternalCss(  mv_embed_path +  'skins/' + this.skin_name + '/playerSkin.css');
+               loadExternalCss(  mv_embed_path +  'skins/' + this.skin_name + '/playerSkin.css' );
        },
-       on_dom_swap: function(){
-               js_log('f:on_dom_swap');                                
+       on_dom_swap: function() {
+               js_log( 'f:on_dom_swap' );
                // Process the provided ROE file... if we don't yet have sources
-               if(this.roe && this.media_element.sources.length==0 ){
-                       js_log('loading external data');
-                       this.loading_external_data=true;
-                       var _this = this;                                       
-                       do_request(this.roe, function(data)
-                       {                                                       
+               if ( this.roe && this.media_element.sources.length == 0 ) {
+                       js_log( 'loading external data' );
+                       this.loading_external_data = true;
+                       var _this = this;
+                       do_request( this.roe, function( data )
+                       {
                                // Continue                                        
-                               _this.media_element.addROE( data );                                                                       
-                               js_log('added_roe::' + _this.media_element.sources.length);                                                        
+                               _this.media_element.addROE( data );
+                               js_log( 'added_roe::' + _this.media_element.sources.length );
                                                                                                           
-                               js_log('set loading_external_data=false');       
-                               _this.loading_external_data=false;                                                         
+                               js_log( 'set loading_external_data=false' );
+                               _this.loading_external_data = false;
                                
-                               _this.init_with_sources_loaded();               
-                       });
+                               _this.init_with_sources_loaded();
+                       } );
                }
        },
        init_with_sources_loaded : function()
-       {       
-               js_log('f:init_with_sources_loaded');
+       {
+               js_log( 'f:init_with_sources_loaded' );
                // Set flag that we have run this function:
-               this.init_with_sources_loadedDone=true;                          
+               this.init_with_sources_loadedDone = true;
                // Autoseletct the source
-               this.media_element.autoSelectSource();          
+               this.media_element.autoSelectSource();
                // Auto select player based on default order
-               if( !this.media_element.selected_source )
+               if ( !this.media_element.selected_source )
                {
                        // check for parent clip: 
-                       if( typeof this.pc != 'undefined' ){                    
-                               js_log('no sources, type:' +this.type + ' check for html');     
-                               //debugger;                     
+                       if ( typeof this.pc != 'undefined' ) {
+                               js_log( 'no sources, type:' + this.type + ' check for html' );
+                               // debugger;                    
                                // do load player if just displaying innerHTML: 
-                               if( this.pc.type == 'text/html' ){
+                               if ( this.pc.type == 'text/html' ) {
                                        this.selected_player = embedTypes.players.defaultPlayer( 'text/html' );
-                                       js_log('set selected player:'+ this.selected_player.mime_type); 
+                                       js_log( 'set selected player:' + this.selected_player.mime_type );
                                }
                        }
-               }else{          
+               } else {
                        this.selected_player = embedTypes.players.defaultPlayer( this.media_element.selected_source.mime_type );
-               }                                                 
-               if( this.selected_player ){                     
-                       js_log("Playback type: "+this.selected_player.library);
-                       this.thumbnail_disp = true;             
-                       this.inheritEmbedObj();            
-               }else{                                                   
+               }
+               if ( this.selected_player ) {
+                       js_log( "Playback type: " + this.selected_player.library );
+                       this.thumbnail_disp = true;
+                       this.inheritEmbedObj();
+               } else {
                        // No source's playable
-                       var missing_type ='';
-                       var or ='';  
-                       for( var i=0; i < this.media_element.sources.length; i++){
-                               missing_type+= or + this.media_element.sources[i].mime_type;
-                               or=' or ';
-                       }       
+                       var missing_type = '';
+                       var or = '';
+                       for ( var i = 0; i < this.media_element.sources.length; i++ ) {
+                               missing_type += or + this.media_element.sources[i].mime_type;
+                               or = ' or ';
+                       }
                        // Get from parent playlist if set:             
-                       if( this.pc )
+                       if ( this.pc )
                                var missing_type = this.pc.type;
                                                                                                                
-                       js_log('No player found for given source type ' + missing_type);
-                       this.load_error= this.getPluginMissingHTML(missing_type);                                                                                  
-               }               
-       },
-       inheritEmbedObj:function(){             
-               js_log("inheritEmbedObj:duration is: " +  this.getDuration() );  
-               //@@note: tricky cuz direct overwrite is not so ideal.. since the extended object is already tied to the dom
-               //clear out any non-base embedObj stuff:
-               if(this.instanceOf){
-                       eval('tmpObj = '+this.instanceOf);
-                       for(var i in tmpObj){ //for in loop oky for object  
-                               if(this['parent_'+i]){
-                                       this[i]=this['parent_'+i];
-                               }else{
-                                       this[i]=null;
+                       js_log( 'No player found for given source type ' + missing_type );
+                       this.load_error = this.getPluginMissingHTML( missing_type );
+               }
+       },
+       inheritEmbedObj:function() {
+               js_log( "inheritEmbedObj:duration is: " +  this.getDuration() );
+               // @@note: tricky cuz direct overwrite is not so ideal.. since the extended object is already tied to the dom
+               // clear out any non-base embedObj stuff:
+               if ( this.instanceOf ) {
+                       eval( 'tmpObj = ' + this.instanceOf );
+                       for ( var i in tmpObj ) { // for in loop oky for object  
+                               if ( this['parent_' + i] ) {
+                                       this[i] = this['parent_' + i];
+                               } else {
+                                       this[i] = null;
                                }
                        }
-               }                                 
-               //set up the new embedObj
-               js_log('f: inheritEmbedObj: embedding with ' + this.selected_player.library);
-               var _this = this;               
-               this.selected_player.load( function(){                    
-                       //js_log('inheriting '+_this.selected_player.library +'Embed to ' + _this.id + ' ' + $j('#'+_this.id).length);
-                       eval('embedObj = ' +_this.selected_player.library +'Embed;');
-                       for(var method in embedObj){ //for in loop oky for object  
-                               //parent method preservation for local overwritten methods
-                               if(_this[method])
+               }
+               // set up the new embedObj
+               js_log( 'f: inheritEmbedObj: embedding with ' + this.selected_player.library );
+               var _this = this;
+               this.selected_player.load( function() {
+                       // js_log('inheriting '+_this.selected_player.library +'Embed to ' + _this.id + ' ' + $j('#'+_this.id).length);
+                       eval( 'embedObj = ' + _this.selected_player.library + 'Embed;' );
+                       for ( var method in embedObj ) { // for in loop oky for object  
+                               // parent method preservation for local overwritten methods
+                               if ( _this[method] )
                                        _this['parent_' + method] = _this[method];
-                               _this[method]=embedObj[method];
-                       }                                               
-                       if(_this.inheritEmbedOverride){
+                               _this[method] = embedObj[method];
+                       }
+                       if ( _this.inheritEmbedOverride ) {
                                _this.inheritEmbedOverride();
                        }
                        // Update controls if possible
-                       if(!_this.loading_external_data)
-                               _this.refreshControlsHTML();                                                                                            
+                       if ( !_this.loading_external_data )
+                               _this.refreshControlsHTML();
                                        
-                       _this.ready_to_play=true;                               
+                       _this.ready_to_play = true;
                        _this.getDuration();
                        _this.getHTML();
-               });
+               } );
        },
-       selectPlayer:function(player)
+       selectPlayer:function( player )
        {
                var _this = this;
-               if(this.selected_player.id != player.id){
+               if ( this.selected_player.id != player.id ) {
                        this.selected_player = player;
                        this.inheritEmbedObj();
-               }                       
+               }
        },
-       doNativeWarningCheck:function(){                        
-               if( $j.cookie('dismissNativeWarn') && $j.cookie('dismissNativeWarn')===true){
+       doNativeWarningCheck:function() {
+               if ( $j.cookie( 'dismissNativeWarn' ) && $j.cookie( 'dismissNativeWarn' ) === true ) {
                        return false;
-               }else{                  
-                       //see if we have native support for ogg: 
-                       var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );          
-                       for(var i=0; i < supporting_players.length; i++){
-                               if(supporting_players[i].id == 'videoElement'){
+               } else {
+                       // see if we have native support for ogg: 
+                       var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );
+                       for ( var i = 0; i < supporting_players.length; i++ ) {
+                               if ( supporting_players[i].id == 'videoElement' ) {
                                        return false;
-                               }                       
-                       }       
-                       //see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P                      
-                       if(this.media_element && this.media_element.sources){
+                               }
+                       }
+                       // see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P                     
+                       if ( this.media_element && this.media_element.sources ) {
                                var foundOgg = false;
                                var playable_sources = this.media_element.getPlayableSources();
-                               for(var sInx=0; sInx < playable_sources.length; sInx++){  
+                               for ( var sInx = 0; sInx < playable_sources.length; sInx++ ) {
                                        var mime_type = playable_sources[sInx].mime_type;
-                                       if( mime_type=='video/ogg' ){                                           
+                                       if ( mime_type == 'video/ogg' ) {
                                                foundOgg = true;
                                        }
                                }
-                               //no ogg src... no point in download firefox link
-                               if(!foundOgg)
+                               // no ogg src... no point in download firefox link
+                               if ( !foundOgg )
                                        return false;
                                                                                
                        }
                }
-               return true;    
+               return true;
        },
-       getTimeReq:function(){
-               var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.getDuration() ) : '';
+       getTimeReq:function() {
+               var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + seconds2npt( this.getDuration() ) : '';
                var default_time_req = '0:00:00' + et;
-               if(!this.media_element)
+               if ( !this.media_element )
+                       return default_time_req;
+               if ( !this.media_element.selected_source )
                        return default_time_req;
-               if(!this.media_element.selected_source)
-                       return default_time_req;                
-               if(!this.media_element.selected_source.end_ntp)
-                       return default_time_req;                
-               var et = (this.ctrlBuilder.long_time_disp) ?'/'+this.media_element.selected_source.end_ntp : '';
+               if ( !this.media_element.selected_source.end_ntp )
+                       return default_time_req;
+               var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + this.media_element.selected_source.end_ntp : '';
                return this.media_element.selected_source.start_ntp + et;
-       },      
-       getDuration:function(){                                                 
-               //update some local pointers for the selected source:   
-               if(this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration){                                                                     
-                       this.duration = this.media_element.selected_source.duration;                                            
+       },
+       getDuration:function() {
+               // update some local pointers for the selected source:  
+               if ( this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration ) {
+                       this.duration = this.media_element.selected_source.duration;
                        this.start_offset = this.media_element.selected_source.start_offset;
                        this.start_ntp = this.media_element.selected_source.start_ntp;
-                       this.end_ntp = this.media_element.selected_source.end_ntp;                                      
+                       this.end_ntp = this.media_element.selected_source.end_ntp;
                }
-               //update start end_ntp if duration !=0 (set from plugin) 
-               if(!this.start_ntp)
+               // update start end_ntp if duration !=0 (set from plugin) 
+               if ( !this.start_ntp )
                        this.start_ntp = '0:0:0';
-               if(!this.end_ntp && this.duration)
-                       this.end_ntp = seconds2npt( this.duration );            
-               //return the duration
+               if ( !this.end_ntp && this.duration )
+                       this.end_ntp = seconds2npt( this.duration );
+               // return the duration
                return this.duration;
        },
        /*
@@ -1081,433 +1081,433 @@ embedVideo.prototype = {
         *  (where embed element is swapped for next clip
         *  (where plugin method does not support playlist) 
         */
-       wrapEmebedContainer:function(embed_code){
+       wrapEmebedContainer:function( embed_code ) {
                // Check if parent clip is set( ie we are in a playlist so name the embed container by playlistID)
-               var id = (this.pc!=null)?this.pc.pp.id:this.id;
-               return '<div id="mv_ebct_'+id+'" style="width:'+this.width+'px;height:'+this.height+'px;">' + 
-                                       embed_code + 
+               var id = ( this.pc != null ) ? this.pc.pp.id:this.id;
+               return '<div id="mv_ebct_' + id + '" style="width:' + this.width + 'px;height:' + this.height + 'px;">' +
+                                       embed_code +
                                '</div>';
-       },      
-       getEmbedHTML : function(){
+       },
+       getEmbedHTML : function() {
                // Return this.wrapEmebedContainer( this.getEmbedObj() );
                return 'Error: function getEmbedHTML should be overwritten by embedLib ';
        },
        // Do seek function (should be overwritten by implementing embedLibs)
        // to check if seek can be done on locally downloaded content. 
-       doSeek : function( perc ){              
-               if( this.supportsURLTimeEncoding() ){                   
-                       //make sure this.seek_time_sec is up-to-date:
+       doSeek : function( perc ) {
+               if ( this.supportsURLTimeEncoding() ) {
+                       // make sure this.seek_time_sec is up-to-date:
                        this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
-                       js_log('updated seek_time_sec: ' + seconds2npt ( this.seek_time_sec) );
-                       this.stop();                                    
-                       this.didSeekJump=true;
-                       //update the slider
-                       this.setSliderValue( perc ); 
-               }               
-               //do play in 100ms (give things time to clear) 
-               setTimeout('$j(\'#' + this.id + '\').get(0).play()',100);
+                       js_log( 'updated seek_time_sec: ' + seconds2npt ( this.seek_time_sec ) );
+                       this.stop();
+                       this.didSeekJump = true;
+                       // update the slider
+                       this.setSliderValue( perc );
+               }
+               // do play in 100ms (give things time to clear) 
+               setTimeout( '$j(\'#' + this.id + '\').get(0).play()', 100 );
        },
        /*
         * seeks to the requested time and issues a callback when ready 
         * (should be overwritten by client that supports frame serving)
-        */     
-       setCurrentTime:function( time, callback){
-               js_log('Error: base embed setCurrentTime can not frame serve (override via plugin)');
-       },
-       addPresTimeOffset:function(){
-          //add in the offset:         
-          if(this.seek_time_sec && this.seek_time_sec!=0){
-                       this.currentTime+=this.seek_time_sec;
-          }else if(this.start_offset && this.start_offset!=0){    
-                  this.currentTime = parseFloat(this.currentTime) + parseFloat(this.start_offset);                      
-          }               
-       },
-       doEmbedHTML:function(){
-               js_log('f:doEmbedHTML');
-               js_log('thum disp:'+this.thumbnail_disp);
+        */
+       setCurrentTime:function( time, callback ) {
+               js_log( 'Error: base embed setCurrentTime can not frame serve (override via plugin)' );
+       },
+       addPresTimeOffset:function() {
+          // add in the offset:                
+          if ( this.seek_time_sec && this.seek_time_sec != 0 ) {
+                       this.currentTime += this.seek_time_sec;
+          } else if ( this.start_offset && this.start_offset != 0 ) {
+                  this.currentTime = parseFloat( this.currentTime ) + parseFloat( this.start_offset );
+          }
+       },
+       doEmbedHTML:function() {
+               js_log( 'f:doEmbedHTML' );
+               js_log( 'thum disp:' + this.thumbnail_disp );
                var _this = this;
                this.closeDisplayedHTML();
                
-               //Set "loading" here
-               $j('#mv_embedded_player_'+_this.id).html(''+
-                       '<div style="color:black;width:'+this.width+'px;height:'+this.height+'px;">' + 
-                               gM('mwe-loading_plugin') + 
-                       '</div>'                                        
+               // Set "loading" here
+               $j( '#mv_embedded_player_' + _this.id ).html( '' +
+                       '<div style="color:black;width:' + this.width + 'px;height:' + this.height + 'px;">' +
+                               gM( 'mwe-loading_plugin' ) +
+                       '</div>'
                );
                // Schedule embedding after player library is loaded:
-               this.selected_player.load(function(){
-                       js_log('performing embed for ' + _this.id);                     
-                       var embed_code = _this.getEmbedHTML();                  
-                       //js_log('shopuld embed:' + embed_code);
-                       $j('#mv_embedded_player_'+_this.id).html(embed_code);   
-               });
-       },
-       relatedTitleKeySearch:function(){
-               var _this = this;                   
-               js_log( 'Switch video Relational' );            
+               this.selected_player.load( function() {
+                       js_log( 'performing embed for ' + _this.id );
+                       var embed_code = _this.getEmbedHTML();
+                       // js_log('shopuld embed:' + embed_code);
+                       $j( '#mv_embedded_player_' + _this.id ).html( embed_code );
+               } );
+       },
+       relatedTitleKeySearch:function() {
+               var _this = this;
+               js_log( 'Switch video Relational' );
                var reqObj = {
-                       'action' : 'query',                      
+                       'action' : 'query',
                        'titles' : this.wikiTitleKey,
                    'generator' : 'categories'
-               };                              
-               var req_categories = new Array();                                               
-           do_api_req({
-                       'data'  : reqObj, 
+               };
+               var req_categories = new Array();
+           do_api_req( {
+                       'data'  : reqObj,
                        'url'   : commons_api_url
-           },  function(data){ 
+           },  function( data ) {
                        req_categories = Array();
-                       if(data.query && data.query.pages){
-                               for(var pageid in  data.query.pages){
-                                       if(data.query.pages[pageid].title)
-                                               req_categories.push(data.query.pages[pageid].title);
+                       if ( data.query && data.query.pages ) {
+                               for ( var pageid in  data.query.pages ) {
+                                       if ( data.query.pages[pageid].title )
+                                               req_categories.push( data.query.pages[pageid].title );
                                }
-                               _this.getRelatedFromCat( req_categories );                                              
-                       }else{
-                               _this.doThumbnailHTML();                        
+                               _this.getRelatedFromCat( req_categories );
+                       } else {
+                               _this.doThumbnailHTML();
                        }
-               });             
+               } );
        },
-       getRelatedFromCat:function(catAry){
-               js_log('getRelatedFromCat');
+       getRelatedFromCat:function( catAry ) {
+               js_log( 'getRelatedFromCat' );
                var _this = this;
-               for ( var i= 0 ; i <= catAry.length ;i++ ){
-                       if(!catAry[i])
-                               continue;                                               
+               for ( var i = 0 ; i <= catAry.length ; i++ ) {
+                       if ( !catAry[i] )
+                               continue;
                        var reqObj = {
-                               'action'        : 'query',                       
+                               'action'        : 'query',
                                'generator'     : 'categorymembers'  ,
                                'gcmtitle'      : catAry[i],
                                'prop'          : 'imageinfo',
                                'iiprop'        : 'url',
-                               'iiurlwidth': '80'      
+                               'iiurlwidth': '80'
                        };
-                       do_api_req({
-                               'data':reqObj, 
+                       do_api_req( {
+                               'data':reqObj,
                                'url': mw.commons_api_url
-                       },  function(data){                         
-                   //empty the videos:                     
-                   $j('#dc_'+ _this.id + ' .related_vids ul').html(' ');
+                       },  function( data ) {
+                   // empty the videos:                            
+                   $j( '#dc_' + _this.id + ' .related_vids ul' ).html( ' ' );
                                                           
-                               for(var j in data.query.pages){         
+                               for ( var j in data.query.pages ) {
                                        // Setup poster default:                                        
-                                       var local_poster ="http://upload.wikimedia.org/wikipedia/commons/7/79/Wiki-commons.png";
+                                       var local_poster = "http://upload.wikimedia.org/wikipedia/commons/7/79/Wiki-commons.png";
                                        // Make sure it exists: 
                                        var page = data.query.pages[j];
-                                       if( j > 0 && page && page['imageinfo'] ){
-                                               if(     page['imageinfo'][0].thumburl ){
+                                       if ( j > 0 && page && page['imageinfo'] ) {
+                                               if (    page['imageinfo'][0].thumburl ) {
                                                        local_poster = page['imageinfo'][0].thumburl;
-                                               }                                                       
-                                               var descriptionurl = page['imageinfo'][0].descriptionurl;                                                               
-                                               var title_str = page.title.replace( /File:|.ogv$|.oga$|.ogg$/gi, "" ); 
-                                               //only link to other videos:                                                            
-                                               if ( descriptionurl.match( /\.ogg$|\.ogv$|\.oga$/gi ) != null) {                
+                                               }
+                                               var descriptionurl = page['imageinfo'][0].descriptionurl;
+                                               var title_str = page.title.replace( / File: | .ogv$ | .oga$ | .ogg$ / gi, "" );
+                                               // only link to other videos:                                                           
+                                               if ( descriptionurl.match( /\.ogg$|\.ogv$|\.oga$/gi ) != null) {
                                                        var liout = '<li>' +
                                                                '<a href="' + descriptionurl + '" >' +
                                                                        '<img src="' + local_poster + '">' +
-                                                               '</a>' +                                                                                
+                                                               '</a>' +
                                                                        ' <a title="' + title_str + '" target="_blank" ' +
-                                                                               'href="'+ descriptionurl +'">' + title_str + '</a>' +                                                   
-                                                       '</li>';                                                
-                                                       $j('#dc_'+ _this.id + ' .related_vids ul').append(liout) ;                                                              
+                                                                               'href="' + descriptionurl + '">' + title_str + '</a>' +
+                                                       '</li>';
+                                                       $j( '#dc_' + _this.id + ' .related_vids ul' ).append( liout ) ;
                                                }
                                         }
-                               };                                      
-                       }); //end do_api_req
+                               };
+                       } ); // end do_api_req
                };
        },
-       onClipDone:function(){
-               js_log('base:onClipDone');
-               //stop the clip (load the thumbnail etc) 
+       onClipDone:function() {
+               js_log( 'base:onClipDone' );
+               // stop the clip (load the thumbnail etc) 
                this.stop();
                this.seek_time_sec = 0;
-               this.setSliderValue(0);
+               this.setSliderValue( 0 );
                var _this = this;
                
-               if(this.width < 300){
+               if ( this.width < 300 ) {
                        return ;
                }
-               this.onClipDone_disp=true;
-               this.thumbnail_disp=true;
+               this.onClipDone_disp = true;
+               this.thumbnail_disp = true;
                
-               //make sure we are not in preview mode( no end clip actions in preview mode) 
-               if( this.preview_mode )
+               // make sure we are not in preview mode( no end clip actions in preview mode) 
+               if ( this.preview_mode )
                        return ;
                        
-               $j('#img_thumb_'+this.id).css('zindex',1);
-               $j('#'+ this.id + ' .play-btn-large').hide();
+               $j( '#img_thumb_' + this.id ).css( 'zindex', 1 );
+               $j( '#' + this.id + ' .play-btn-large' ).hide();
 
-               //add black background
-               $j('#dc_'+this.id).append( '<div id="black_back_' + this.id + '" ' +
+               // add black background
+               $j( '#dc_' + this.id ).append( '<div id="black_back_' + this.id + '" ' +
                                        'style="z-index:-2;position:absolute;background:#000;' +
                                        'top:0px;left:0px;width:' + parseInt( this.width ) + 'px;' +
                                        'height:' + parseInt( this.height ) + 'px;">' +
-                               '</div>');      
+                               '</div>' );
 
-               if( this.wikiTitleKey){
-                       $j('#dc_'+this.id).append(
+               if ( this.wikiTitleKey ) {
+                       $j( '#dc_' + this.id ).append(
                        '<div class="related_vids" >' +
-                          '<h1>' + gM('mwe-related_videos') + '</h1>'+
+                          '<h1>' + gM( 'mwe-related_videos' ) + '</h1>' +
                                '<ul>' +
                                '</ul>' +
-                       '</div>');      
-                       $j('#img_thumb_' + this.id).fadeOut("fast");
-                       $j('#dc_'+ _this.id + ' .related_vids ul').html( gM('mwe-loading_txt') );
+                       '</div>' );
+                       $j( '#img_thumb_' + this.id ).fadeOut( "fast" );
+                       $j( '#dc_' + _this.id + ' .related_vids ul' ).html( gM( 'mwe-loading_txt' ) );
                        this.relatedTitleKeySearch();
-               }else{          
+               } else {
                        this.onClipDoneDisp();
-               }                                       
+               }
        },
-       onClipDoneDisp:function(){
+       onClipDoneDisp:function() {
                var _this = this;
-               //add the liks_info_div black back 
-               $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' +
-                               'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+                
-                               'height:'+ parseInt(parseInt(this.height)) +'px;'+
-                               'position:absolute;top:10px;overflow:auto'+                             
-                               'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
-                               'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+                                    
-                       '</div>'                                                                        
+               // add the liks_info_div black back 
+               $j( '#dc_' + this.id ).append( '<div id="liks_info_' + this.id + '" ' +
+                               'style="width:' + parseInt( parseInt( this.width ) / 2 ) + 'px;' +
+                               'height:' + parseInt( parseInt( this.height ) ) + 'px;' +
+                               'position:absolute;top:10px;overflow:auto' +
+                               'width: ' + parseInt( ( ( parseInt( this.width ) / 2 ) - 15 ) ) + 'px;' +
+                               'left:' + parseInt( ( ( parseInt( this.width ) / 2 ) + 15 ) ) + 'px;">' +
+                       '</div>'
           );
-          //start animation (make thumb small in upper left add in div for "loading"                   
-               $j('#img_thumb_'+this.id).animate({                             
-                               width : parseInt( parseInt(_this.width)/2 ),
-                               height : parseInt( parseInt(_this.height)/2 ),
+          // start animation (make thumb small in upper left add in div for "loading"                  
+               $j( '#img_thumb_' + this.id ).animate( {
+                               width : parseInt( parseInt( _this.width ) / 2 ),
+                               height : parseInt( parseInt( _this.height ) / 2 ),
                                top:20,
                                left:10
                        },
-                       1000, 
-                       function(){
-                               //animation done.. add "loading" to div if empty                
-                               if($j('#liks_info_'+_this.id).html()==''){
-                                       $j('#liks_info_'+_this.id).html(gM('mwe-loading_txt'));
-                               }               
+                       1000,
+                       function() {
+                               // animation done.. add "loading" to div if empty               
+                               if ( $j( '#liks_info_' + _this.id ).html() == '' ) {
+                                       $j( '#liks_info_' + _this.id ).html( gM( 'mwe-loading_txt' ) );
+                               }
                        }
-               )                                  
-               //now load roe if run the showNextPrevLinks
-               if(this.roe && this.media_element.addedROEData==false){
-                       do_request(this.roe, function(data)
-                       {                                                                                                                          
-                               _this.media_element.addROE(data);
+               )
+               // now load roe if run the showNextPrevLinks
+               if ( this.roe && this.media_element.addedROEData == false ) {
+                       do_request( this.roe, function( data )
+                       {
+                               _this.media_element.addROE( data );
                                _this.getNextPrevLinks();
-                       });     
-               }else{
+                       } );
+               } else {
                        this.getNextPrevLinks();
-               }               
+               }
        },
-       //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them. 
-       getNextPrevLinks:function(){
-               js_log('f:getNextPrevLinks');
+       // @@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them. 
+       getNextPrevLinks:function() {
+               js_log( 'f:getNextPrevLinks' );
                var anno_track_url = null;
-               var _this = this; 
-               //check for annoative track
-               $j.each(this.media_element.sources, function(inx, n){                   
-                       if(n.mime_type=='text/cmml'){
-                               if( n.id == 'Anno_en'){
+               var _this = this;
+               // check for annoative track
+               $j.each( this.media_element.sources, function( inx, n ) {
+                       if ( n.mime_type == 'text/cmml' ) {
+                               if ( n.id == 'Anno_en' ) {
                                        anno_track_url = n.src;
                                }
                        }
-               });
+               } );
                
-               if(!anno_track_url){
-                       js_log('no annotative track url found');
-                       //$j('#liks_info_'+this.id).html('no metadata found for related links');
+               if ( !anno_track_url ) {
+                       js_log( 'no annotative track url found' );
+                       // $j('#liks_info_'+this.id).html('no metadata found for related links');
                        _this.doThumbnailHTML();
                        return ;
                }
                
-               js_log('we have annotative track:'+ anno_track_url);
+               js_log( 'we have annotative track:' + anno_track_url );
                // Zero out seconds (should improve cache hit rate and generally expands metadata search)
                // @@todo this could be replaced with a regExp
-               var annoURL = parseUri(anno_track_url);
-               var times = annoURL.queryKey['t'].split('/');                     
-               var stime_parts = times[0].split(':');   
-               var etime_parts = times[1].split(':');                                           
-               //zero out the hour:
-               var new_start = stime_parts[0]+':'+'0:0';
-               //zero out the end sec
-               var new_end   = (etime_parts[0]== stime_parts[0])? (etime_parts[0]+1)+':0:0' :etime_parts[0]+':0:0';
+               var annoURL = parseUri( anno_track_url );
+               var times = annoURL.queryKey['t'].split( '/' );
+               var stime_parts = times[0].split( ':' );
+               var etime_parts = times[1].split( ':' );
+               // zero out the hour:
+               var new_start = stime_parts[0] + ':' + '0:0';
+               // zero out the end sec
+               var new_end   = ( etime_parts[0] == stime_parts[0] ) ? ( etime_parts[0] + 1 ) + ':0:0' :etime_parts[0] + ':0:0';
                                 
-               var etime_parts = times[1].split(':');
+               var etime_parts = times[1].split( ':' );
                
-               var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host + annoURL.path +'?';
-               $j.each(annoURL.queryKey, function(i, val){
-                       new_anno_track_url +=(i=='t')?'t='+new_start+'/'+new_end +'&' :
-                                                                        i+'='+ val+'&';
-               });
-               var request_key = new_start+'/'+new_end;
-               //check the anno_data cache: 
-               //@@todo search cache see if current is in range.  
-               if(this.anno_data_cache){
-                       js_log('anno data found in cache: '+request_key);
+               var new_anno_track_url = annoURL.protocol + '://' + annoURL.host + annoURL.path + '?';
+               $j.each( annoURL.queryKey, function( i, val ) {
+                       new_anno_track_url += ( i == 't' ) ? 't=' + new_start + '/' + new_end + '&' :
+                                                                        i + '=' + val + '&';
+               } );
+               var request_key = new_start + '/' + new_end;
+               // check the anno_data cache: 
+               // @@todo search cache see if current is in range.  
+               if ( this.anno_data_cache ) {
+                       js_log( 'anno data found in cache: ' + request_key );
                        this.showNextPrevLinks();
-               }else{                                                          
-                       do_request(new_anno_track_url, function(cmml_data){
-                               js_log('raw response: '+ cmml_data);
-                               if(typeof cmml_data == 'string'){
-                                       var parser=new DOMParser();
-                                       js_log('Parse CMML data:' + cmml_data);
-                                       cmml_data=parser.parseFromString(cmml_data,"text/xml");
+               } else {
+                       do_request( new_anno_track_url, function( cmml_data ) {
+                               js_log( 'raw response: ' + cmml_data );
+                               if ( typeof cmml_data == 'string' ) {
+                                       var parser = new DOMParser();
+                                       js_log( 'Parse CMML data:' + cmml_data );
+                                       cmml_data = parser.parseFromString( cmml_data, "text/xml" );
                                }
-                               //init anno_data_cache
-                               if(!_this.anno_data_cache)
-                                       _this.anno_data_cache={};                                       
-                               //grab all metadata and put it into the anno_data_cache:                                         
-                               $j.each(cmml_data.getElementsByTagName('clip'), function(inx, clip){
-                                       _this.anno_data_cache[ $j(clip).attr("id") ]={
-                                                       'start_time_sec':npt2seconds($j(clip).attr("start").replace('npt:','')),
-                                                       'end_time_sec':npt2seconds($j(clip).attr("end").replace('npt:','')),
-                                                       'time_req':$j(clip).attr("start").replace('npt:','')+'/'+$j(clip).attr("end").replace('npt:','')
+                               // init anno_data_cache
+                               if ( !_this.anno_data_cache )
+                                       _this.anno_data_cache = { };
+                               // grab all metadata and put it into the anno_data_cache:                                        
+                               $j.each( cmml_data.getElementsByTagName( 'clip' ), function( inx, clip ) {
+                                       _this.anno_data_cache[ $j( clip ).attr( "id" ) ] = {
+                                                       'start_time_sec':npt2seconds( $j( clip ).attr( "start" ).replace( 'npt:', '' ) ),
+                                                       'end_time_sec':npt2seconds( $j( clip ).attr( "end" ).replace( 'npt:', '' ) ),
+                                                       'time_req':$j( clip ).attr( "start" ).replace( 'npt:', '' ) + '/' + $j( clip ).attr( "end" ).replace( 'npt:', '' )
                                                };
-                                       //grab all its meta
-                                       _this.anno_data_cache[ $j(clip).attr("id") ]['meta']={};
-                                       $j.each(clip.getElementsByTagName('meta'),function(imx, meta){                                                  
-                                               //js_log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content"));
-                                               _this.anno_data_cache[$j(clip).attr("id")]['meta'][$j(meta).attr("name")]=$j(meta).attr("content");
-                                       });
-                               });
-                               _this.showNextPrevLinks();                                      
-                       });
-               }
-               //query current request time +|- 60s to get prev next speech links. 
-       },
-       showNextPrevLinks:function(){
-               //js_log('f:showNextPrevLinks');
-               //int requested links: 
+                                       // grab all its meta
+                                       _this.anno_data_cache[ $j( clip ).attr( "id" ) ]['meta'] = { };
+                                       $j.each( clip.getElementsByTagName( 'meta' ), function( imx, meta ) {
+                                               // js_log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content"));
+                                               _this.anno_data_cache[$j( clip ).attr( "id" )]['meta'][$j( meta ).attr( "name" )] = $j( meta ).attr( "content" );
+                                       } );
+                               } );
+                               _this.showNextPrevLinks();
+                       } );
+               }
+               // query current request time +|- 60s to get prev next speech links. 
+       },
+       showNextPrevLinks:function() {
+               // js_log('f:showNextPrevLinks');
+               // int requested links: 
                var link = {
                        'prev':'',
                        'current':'',
                        'next':''
-               }               
-               var curTime = this.getTimeReq().split('/');
+               }
+               var curTime = this.getTimeReq().split( '/' );
                
-               var s_sec = npt2seconds(curTime[0]);
-               var e_sec = npt2seconds(curTime[1]); 
-               js_log('showNextPrevLinks: req time: '+ s_sec + ' to ' + e_sec);
-               //now we have all the data in anno_data_cache
-               var current_done=false;
-               for(var clip_id in this.anno_data_cache){  //for in loop oky for object
+               var s_sec = npt2seconds( curTime[0] );
+               var e_sec = npt2seconds( curTime[1] );
+               js_log( 'showNextPrevLinks: req time: ' + s_sec + ' to ' + e_sec );
+               // now we have all the data in anno_data_cache
+               var current_done = false;
+               for ( var clip_id in this.anno_data_cache ) {  // for in loop oky for object
                         var clip =  this.anno_data_cache[clip_id];
-                        //js_log('on clip:'+ clip_id);
-                        //set prev_link (if cur_link is still empty)
-                       if( s_sec > clip.end_time_sec){
+                        // js_log('on clip:'+ clip_id);
+                        // set prev_link (if cur_link is still empty)
+                       if ( s_sec > clip.end_time_sec ) {
                                link.prev = clip_id;
-                               js_log('showNextPrevLinks: ' + s_sec + ' < ' + clip.end_time_sec + ' set prev');
+                               js_log( 'showNextPrevLinks: ' + s_sec + ' < ' + clip.end_time_sec + ' set prev' );
                        }
                                
-                       if(e_sec==clip.end_time_sec && s_sec== clip.start_time_sec)
+                       if ( e_sec == clip.end_time_sec && s_sec == clip.start_time_sec )
                                current_done = true;
-                       //current clip is not done:
-                       if(  e_sec < clip.end_time_sec  && link.current=='' && !current_done){
+                       // current clip is not done:
+                       if (  e_sec < clip.end_time_sec  && link.current == '' && !current_done ) {
                                link.current = clip_id;
-                               js_log('showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current'); 
+                               js_log( 'showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current' );
                        }
                        
-                       //set end clip (first clip where start time is > end_time of req
-                       if( e_sec <  clip.start_time_sec && link.next==''){
+                       // set end clip (first clip where start time is > end_time of req
+                       if ( e_sec <  clip.start_time_sec && link.next == '' ) {
                                link.next = clip_id;
-                               js_log('showNextPrevLinks: '+  e_sec + ' < '+ clip.start_time_sec + ' && ' + link.next );
+                               js_log( 'showNextPrevLinks: ' +  e_sec + ' < ' + clip.start_time_sec + ' && ' + link.next );
                        }
-               }   
-               var html='';   
-               if(link.prev=='' && link.current=='' && link.next==''){
-                       html='<p><a href="'+this.media_element.linkbackgetMsg+'">clip page</a>';
-               }else{          
-                       for(var link_type in link){
-                               var link_id = link[link_type];                  
-                               if(link_id!=''){
-                                       var clip = this.anno_data_cache[link_id];                               
-                                       var title_msg='';
-                                       for(var j in clip['meta']){
-                                               title_msg+=j.replace(/_/g,' ') +': ' +clip['meta'][j].replace(/_/g,' ') +" <br>";
-                                       }               
+               }
+               var html = '';
+               if ( link.prev == '' && link.current == '' && link.next == '' ) {
+                       html = '<p><a href="' + this.media_element.linkbackgetMsg + '">clip page</a>';
+               } else {
+                       for ( var link_type in link ) {
+                               var link_id = link[link_type];
+                               if ( link_id != '' ) {
+                                       var clip = this.anno_data_cache[link_id];
+                                       var title_msg = '';
+                                       for ( var j in clip['meta'] ) {
+                                               title_msg += j.replace( / _ / g, ' ' ) + ': ' + clip['meta'][j].replace( / _ / g, ' ' ) + " <br>";
+                                       }
                                        var time_req =   clip.time_req;
-                                       if(link_type=='current') //if current start from end of current clip play to end of current meta:                                
-                                               time_req = curTime[1]+ '/' + seconds2npt( clip.end_time_sec );
+                                       if ( link_type == 'current' ) // if current start from end of current clip play to end of current meta:                          
+                                               time_req = curTime[1] + '/' + seconds2npt( clip.end_time_sec );
                                        
-                                       //do special linkbacks for metavid content: 
-                                       var regTimeCheck = new RegExp(/[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/);                            
-                                       html+='<p><a  ';
-                                       if( regTimeCheck.test( this.media_element.linkback ) ){
-                                               html+=' href="'+ this.media_element.linkback.replace(regTimeCheck,time_req) +'" '; 
-                                       }else{
-                                               html+=' href="#" onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+ 
-                                                               time_req + '\'); return false; "';                              
+                                       // do special linkbacks for metavid content: 
+                                       var regTimeCheck = new RegExp( /[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/ );
+                                       html += '<p><a  ';
+                                       if ( regTimeCheck.test( this.media_element.linkback ) ) {
+                                               html += ' href="' + this.media_element.linkback.replace( regTimeCheck, time_req ) + '" ';
+                                       } else {
+                                               html += ' href="#" onClick="$j(\'#' + this.id + '\').get(0).playByTimeReq(\'' +
+                                                               time_req + '\'); return false; "';
                                        }
-                                       html+=' title="' + title_msg + '">' + 
-                                                gM('mwe-' + link_type+'_clip_msg') +                             
-                                       '</a><br><span style="font-size:small">'+ title_msg +'<span></p>';
-                               }                                                       
+                                       html += ' title="' + title_msg + '">' +
+                                                gM( 'mwe-' + link_type + '_clip_msg' ) +
+                                       '</a><br><span style="font-size:small">' + title_msg + '<span></p>';
+                               }
                        }
-               }       
-               //js_og("should set html:"+ html);
-               $j('#liks_info_'+this.id).html( html );
+               }
+               // js_og("should set html:"+ html);
+               $j( '#liks_info_' + this.id ).html( html );
        },
-       playByTimeReq: function(time_req){
-               js_log('f:playByTimeReq: '+time_req );
+       playByTimeReq: function( time_req ) {
+               js_log( 'f:playByTimeReq: ' + time_req );
                this.stop();
-               this.updateVideoTimeReq(time_req);
-               this.play();            
+               this.updateVideoTimeReq( time_req );
+               this.play();
        },
-       doThumbnailHTML:function(){       
+       doThumbnailHTML:function() {
                var _this = this;
-               js_log('f:doThumbnailHTML'+ this.thumbnail_disp);               
-               this.closeDisplayedHTML();         
+               js_log( 'f:doThumbnailHTML' + this.thumbnail_disp );
+               this.closeDisplayedHTML();
                $j( '#mv_embedded_player_' + this.id ).html( this.getThumbnailHTML() );
-               this.paused = true;             
+               this.paused = true;
                this.thumbnail_disp = true;
-               //make sure the ctrlBuilder remain active: 
-               this.ctrlBuilder.addControlHooks();     
+               // make sure the ctrlBuilder remain active: 
+               this.ctrlBuilder.addControlHooks();
        },
-       refreshControlsHTML:function(){
-               if($j('#' + this.id + ' .control-bar').length == 0){
-                       js_log('refreshControlsHTML::control-bar not present, no refresh');
+       refreshControlsHTML:function() {
+               if ( $j( '#' + this.id + ' .control-bar' ).length == 0 ) {
+                       js_log( 'refreshControlsHTML::control-bar not present, no refresh' );
                        return ;
                }
                // Do update controls: 
-               $j('#' + this.id + ' .control-bar').html( this.getControlsHTML() );
-               this.ctrlBuilder.addControlHooks();                                             
+               $j( '#' + this.id + ' .control-bar' ).html( this.getControlsHTML() );
+               this.ctrlBuilder.addControlHooks();
                                
-       },   
-       getControlsHTML:function(){                     
+       },
+       getControlsHTML:function() {
                return this.ctrlBuilder.getControls( this );
-       },      
-       getHTML : function (){          
-               //@@todo check if we have sources available     
-               js_log('embedVideo:getHTML : ' + this.id  + ' resource type: ' + this.type);
+       },
+       getHTML : function () {
+               // @@todo check if we have sources available    
+               js_log( 'embedVideo:getHTML : ' + this.id  + ' resource type: ' + this.type );
                
-               //set-up the local ctrlBuilder instance: 
+               // set-up the local ctrlBuilder instance: 
                this.ctrlBuilder = new ctrlBuilder( this );
                                                
-               var _this = this;                                
-               var html_code = '';             
-               html_code = '<div id="videoPlayer_' + this.id + '" style="width:' + this.width + 'px;position:relative;"'
-                                               'class="' + this.ctrlBuilder.pClass + '">';             
-               html_code += '<div style="width:'+parseInt(this.width)+'px;height:'+parseInt(this.height)+'px;"  id="mv_embedded_player_'+this.id+'">' +
-                                               this.getThumbnailHTML() + 
-                                       '</div>';                                                                       
+               var _this = this;
+               var html_code = '';
+               html_code = '<div id="videoPlayer_' + this.id + '" style="width:' + this.width + 'px;position:relative;"' +
+                                               'class="' + this.ctrlBuilder.pClass + '">';
+               html_code += '<div style="width:' + parseInt( this.width ) + 'px;height:' + parseInt( this.height ) + 'px;"  id="mv_embedded_player_' + this.id + '">' +
+                                               this.getThumbnailHTML() +
+                                       '</div>';
                
-               //js_log("mvEmbed:controls "+ typeof this.controls);                                                                    
-               if( this.controls ){            
-                       js_log("f:getHTML:AddControls");
-                       html_code +='<div class="ui-state-default ui-widget-header ui-helper-clearfix control-bar" >';
-                       html_code += this.getControlsHTML();       
-                       html_code +='</div>';                           
-                       //block out some space by encapulating the top level div 
-                       $j(this).wrap('<div style="width:'+parseInt(this.width)+'px;height:'
-                                       +( parseInt(this.height) + this.ctrlBuilder.height )+'px"></div>');                                                             
+               // js_log("mvEmbed:controls "+ typeof this.controls);                                                                   
+               if ( this.controls ) {
+                       js_log( "f:getHTML:AddControls" );
+                       html_code += '<div class="ui-state-default ui-widget-header ui-helper-clearfix control-bar" >';
+                       html_code += this.getControlsHTML();
+                       html_code += '</div>';
+                       // block out some space by encapulating the top level div 
+                       $j( this ).wrap( '<div style="width:' + parseInt( this.width ) + 'px;height:'
+                                       + ( parseInt( this.height ) + this.ctrlBuilder.height ) + 'px"></div>' );
                }
                
-               html_code += '</div>'; //videoPlayer div close          
-               
-               //js_log('should set: '+this.id);
-               $j(this).html( html_code );                                     
+               html_code += '</div>'; // videoPlayer div close         
+
+               // js_log('should set: '+this.id);
+               $j( this ).html( html_code );
                
                // Add hooks once Controls are in DOM
-               this.ctrlBuilder.addControlHooks();             
+               this.ctrlBuilder.addControlHooks();
                                                  
                
-               if( this.autoplay ){
-                       js_log('getHTML::activating autoplay');
+               if ( this.autoplay ) {
+                       js_log( 'getHTML::activating autoplay' );
                        this.play();
                }
        },
@@ -1515,117 +1515,117 @@ embedVideo.prototype = {
        * get missing plugin html (check for user included code)
        * @param {String} misssing_type missing type mime
        */
-       getPluginMissingHTML : function(missing_type){
-               //keep the box width hight:
-               var out = '<div style="width:'+this.width+'px;height:'+this.height+'px">';
-               if(this.user_missing_plugin_html){
-                 out+= this.user_missing_plugin_html;
-               }else{
-                 if(!missing_type)
-                       missing_type='';
-                 out+= gM('mwe-generic_missing_plugin', missing_type) + '<br><a title="'+gM('mwe-download_clip')+'" href="'+this.src +'">'+gM('mwe-download_clip')+'</a>';
+       getPluginMissingHTML : function( missing_type ) {
+               // keep the box width hight:
+               var out = '<div style="width:' + this.width + 'px;height:' + this.height + 'px">';
+               if ( this.user_missing_plugin_html ) {
+                 out += this.user_missing_plugin_html;
+               } else {
+                 if ( !missing_type )
+                       missing_type = '';
+                 out += gM( 'mwe-generic_missing_plugin', missing_type ) + '<br><a title="' + gM( 'mwe-download_clip' ) + '" href="' + this.src + '">' + gM( 'mwe-download_clip' ) + '</a>';
                }
                return out + '</div>';
        },
-       updateVideoTimeReq:function( time_req ){
-               js_log('f:updateVideoTimeReq');
-               var time_parts =time_req.split('/');
+       updateVideoTimeReq:function( time_req ) {
+               js_log( 'f:updateVideoTimeReq' );
+               var time_parts = time_req.split( '/' );
                this.updateVideoTime( time_parts[0], time_parts[1] );
        },
-       //update video time
-       updateVideoTime:function(start_ntp, end_ntp){                                   
-               //update media
+       // update video time
+       updateVideoTime:function( start_ntp, end_ntp ) {
+               // update media
                this.media_element.updateSourceTimes( start_ntp, end_ntp );
-               //update mv_time
+               // update mv_time
                this.setStatus( start_ntp + '/' + end_ntp );
-               //reset slider
-               this.setSliderValue(0);
-               //reset seek_offset:
-               if( this.media_element.selected_source.URLTimeEncoding )
-                       this.seek_time_sec=0;
+               // reset slider
+               this.setSliderValue( 0 );
+               // reset seek_offset:
+               if ( this.media_element.selected_source.URLTimeEncoding )
+                       this.seek_time_sec = 0;
                else
-                       this.seek_time_sec=npt2seconds(start_ntp);
-       },              
+                       this.seek_time_sec = npt2seconds( start_ntp );
+       },
        // Should overwrite by embed library if we can render frames natively 
-       renderTimelineThumbnail:function( options ){
+       renderTimelineThumbnail:function( options ) {
                var my_thumb_src = this.media_element.getThumbnailURL();
-               //check if our thumbnail has a time attribute: 
-               if( my_thumb_src.indexOf('t=') !== -1){
-                       var time_ntp =  seconds2npt ( options.time + parseInt(this.start_offset) );
+               // check if our thumbnail has a time attribute: 
+               if ( my_thumb_src.indexOf( 't=' ) !== - 1 ) {
+                       var time_ntp =  seconds2npt ( options.time + parseInt( this.start_offset ) );
                        my_thumb_src = getURLParamReplace( my_thumb_src, { 't':time_ntp, 'size': options.size } );
                }
-               var thumb_class = (typeof options['thumb_class'] != 'undefined' ) ? options['thumb_class'] : '';
-               return '<div class="ui-corner-all ' + thumb_class + '" src="' + my_thumb_src + '" '+
+               var thumb_class = ( typeof options['thumb_class'] != 'undefined' ) ? options['thumb_class'] : '';
+               return '<div class="ui-corner-all ' + thumb_class + '" src="' + my_thumb_src + '" ' +
                                'style="height:' + options.height + 'px;' +
-                               'width:' + options.width + 'px" >' + 
-                                        '<img src="' + my_thumb_src +'" '+
+                               'width:' + options.width + 'px" >' +
+                                        '<img src="' + my_thumb_src + '" ' +
                                                'style="height:' + options.height + 'px;' +
                                                'width:' + options.width + 'px">' +
                                '</div>';
        },
-       updateThumbTimeNTP:function( time){
-               this.updateThumbTime( npt2seconds(time) - parseInt(this.start_offset) );
+       updateThumbTimeNTP:function( time ) {
+               this.updateThumbTime( npt2seconds( time ) - parseInt( this.start_offset ) );
        },
-       updateThumbTime:function( float_sec ){
-               //js_log('updateThumbTime:'+float_sec);
-               var _this = this;                                                                                                          
-               if( typeof this.org_thum_src=='undefined' ){            
+       updateThumbTime:function( float_sec ) {
+               // js_log('updateThumbTime:'+float_sec);
+               var _this = this;
+               if ( typeof this.org_thum_src == 'undefined' ) {
                        this.org_thum_src = this.media_element.getThumbnailURL();
-               }                                                       
-               if( this.org_thum_src.indexOf('t=') !== -1){
-                       this.last_thumb_url = getURLParamReplace(this.org_thum_src, 
-                               { 't' : seconds2npt( float_sec + parseInt(this.start_offset)) } );                                                                      
-                       if(!this.thumbnail_updating){                           
-                               this.updateThumbnail(this.last_thumb_url ,false);
-                               this.last_thumb_url =null;
+               }
+               if ( this.org_thum_src.indexOf( 't=' ) !== - 1 ) {
+                       this.last_thumb_url = getURLParamReplace( this.org_thum_src,
+                               { 't' : seconds2npt( float_sec + parseInt( this.start_offset ) ) } );
+                       if ( !this.thumbnail_updating ) {
+                               this.updateThumbnail( this.last_thumb_url , false );
+                               this.last_thumb_url = null;
                        }
                }
        },
-       updateThumbPerc:function( perc ){       
-               return this.updateThumbTime( (this.getDuration() * perc) );
+       updateThumbPerc:function( perc ) {
+               return this.updateThumbTime( ( this.getDuration() * perc ) );
        },
        // Updates the thumbnail if the thumbnail is being displayed
-       updateThumbnail : function(src, quick_switch){                          
-               //make sure we don't go to the same url if we are not already updating: 
-               if( !this.thumbnail_updating && $j('#img_thumb_'+this.id).attr('src')== src )
+       updateThumbnail : function( src, quick_switch ) {
+               // make sure we don't go to the same url if we are not already updating: 
+               if ( !this.thumbnail_updating && $j( '#img_thumb_' + this.id ).attr( 'src' ) == src )
                        return false;
-               //if we are already updating don't issue a new update: 
-               if( this.thumbnail_updating && $j('#new_img_thumb_'+this.id).attr('src')== src )
+               // if we are already updating don't issue a new update: 
+               if ( this.thumbnail_updating && $j( '#new_img_thumb_' + this.id ).attr( 'src' ) == src )
                        return false;
                
-               js_log('update thumb: ' + src);
+               js_log( 'update thumb: ' + src );
                
-               if(quick_switch){
-                       $j('#img_thumb_'+this.id).attr('src', src);
-               }else{
-                       var _this = this;                       
-                       //if still animating remove new_img_thumb_
-                       if(this.thumbnail_updating==true)
-                               $j('#new_img_thumb_'+this.id).stop().remove();          
+               if ( quick_switch ) {
+                       $j( '#img_thumb_' + this.id ).attr( 'src', src );
+               } else {
+                       var _this = this;
+                       // if still animating remove new_img_thumb_
+                       if ( this.thumbnail_updating == true )
+                               $j( '#new_img_thumb_' + this.id ).stop().remove();
                                        
-                       if(this.thumbnail_disp){
-                               js_log('set to thumb:'+ src);
-                               this.thumbnail_updating=true;
-                               $j('#dc_'+this.id).append('<img src="'+src+'" ' +
+                       if ( this.thumbnail_disp ) {
+                               js_log( 'set to thumb:' + src );
+                               this.thumbnail_updating = true;
+                               $j( '#dc_' + this.id ).append( '<img src="' + src + '" ' +
                                        'style="display:none;position:absolute;zindex:2;top:0px;left:0px;" ' +
-                                       'width="'+this.width+'" height="'+this.height+'" '+
-                                       'id = "new_img_thumb_'+this.id+'" />');                                         
-                               //js_log('appended: new_img_thumb_');           
-                               $j('#new_img_thumb_'+this.id).fadeIn("slow", function(){                                                
-                                               //once faded in remove org and rename new:
-                                               $j('#img_thumb_'+_this.id).remove();
-                                               $j('#new_img_thumb_'+_this.id).attr('id', 'img_thumb_'+_this.id);
-                                               $j('#img_thumb_'+_this.id).css('zindex','1');
-                                               _this.thumbnail_updating=false;                                         
-                                               //js_log("done fadding in "+ $j('#img_thumb_'+_this.id).attr("src"));
-                                               
-                                               //if we have a thumb queued update to that
-                                               if(_this.last_thumb_url){
-                                                       var src_url =_this.last_thumb_url;
-                                                       _this.last_thumb_url=null;
-                                                       _this.updateThumbnail(src_url);
+                                       'width="' + this.width + '" height="' + this.height + '" ' +
+                                       'id = "new_img_thumb_' + this.id + '" />' );
+                               // js_log('appended: new_img_thumb_');          
+                               $j( '#new_img_thumb_' + this.id ).fadeIn( "slow", function() {
+                                               // once faded in remove org and rename new:
+                                               $j( '#img_thumb_' + _this.id ).remove();
+                                               $j( '#new_img_thumb_' + _this.id ).attr( 'id', 'img_thumb_' + _this.id );
+                                               $j( '#img_thumb_' + _this.id ).css( 'zindex', '1' );
+                                               _this.thumbnail_updating = false;
+                                               // js_log("done fadding in "+ $j('#img_thumb_'+_this.id).attr("src"));
+
+                                               // if we have a thumb queued update to that
+                                               if ( _this.last_thumb_url ) {
+                                                       var src_url = _this.last_thumb_url;
+                                                       _this.last_thumb_url = null;
+                                                       _this.updateThumbnail( src_url );
                                                }
-                               });
+                               } );
                        }
                }
        },
@@ -1635,160 +1635,160 @@ embedVideo.prototype = {
        * playing, configuring the player, inline cmml display, HTML linkback,
        * download, and embed code.
        */
-       getThumbnailHTML : function (){         
-               js_log('embedVideo:getThumbnailHTML::' + this.id);
+       getThumbnailHTML : function () {
+               js_log( 'embedVideo:getThumbnailHTML::' + this.id );
                var thumb_html = '';
-               var class_atr='';
-               var style_atr='';
-               //if(this.class)class_atr = ' class="'+this.class+'"';
-               //if(this.style)style_atr = ' style="'+this.style+'"';
+               var class_atr = '';
+               var style_atr = '';
+               // if(this.class)class_atr = ' class="'+this.class+'"';
+               // if(this.style)style_atr = ' style="'+this.style+'"';
                //      else style_atr = 'overflow:hidden;height:'+this.height+'px;width:'+this.width+'px;';
                this.thumbnail = this.media_element.getThumbnailURL();
 
-               //put it all in the div container dc_id
-               thumb_html+= '<div id="dc_'+this.id+'" style="position:absolute;'+
-                       ' overflow:hidden; top:0px; left:0px; width:'+this.playerPixelWidth()+'px; height:'+this.playerPixelHeight()+'px; z-index:0;">'+
-                       '<img width="'+this.playerPixelWidth()+'" height="'+this.playerPixelHeight()+'" style="position:relative;width:'+this.playerPixelWidth()+';height:'+this.playerPixelHeight()+'"' +
-                       ' id="img_thumb_'+this.id+'" src="' + this.thumbnail + '">';
+               // put it all in the div container dc_id
+               thumb_html += '<div id="dc_' + this.id + '" style="position:absolute;' +
+                       ' overflow:hidden; top:0px; left:0px; width:' + this.playerPixelWidth() + 'px; height:' + this.playerPixelHeight() + 'px; z-index:0;">' +
+                       '<img width="' + this.playerPixelWidth() + '" height="' + this.playerPixelHeight() + '" style="position:relative;width:' + this.playerPixelWidth() + ';height:' + this.playerPixelHeight() + '"' +
+                       ' id="img_thumb_' + this.id + '" src="' + this.thumbnail + '">';
                
-               if(this.play_button == true && this.controls == true)
-                         thumb_html+= this.ctrlBuilder.getComponent( 'play-btn-large' );
+               if ( this.play_button == true && this.controls == true )
+                         thumb_html += this.ctrlBuilder.getComponent( 'play-btn-large' );
                          
-                  thumb_html+='</div>';
+                  thumb_html += '</div>';
                return thumb_html;
        },
-       getEmbeddingHTML:function(){
+       getEmbeddingHTML:function() {
                var thumbnail = this.media_element.getThumbnailURL();
 
                var embed_thumb_html;
-               if(thumbnail.substring(0,1)=='/'){
-                       eURL = parseUri(mv_embed_path);
+               if ( thumbnail.substring( 0, 1 ) == '/' ) {
+                       eURL = parseUri( mv_embed_path );
                        embed_thumb_url = eURL.protocol + '://' + eURL.host + thumbnail;
-                       //js_log('set from mv_embed_path:'+embed_thumb_html);
-               }else{
-                       embed_thumb_url = (thumbnail.indexOf('http://')!=-1)?thumbnail:mv_embed_path + thumbnail;
+                       // js_log('set from mv_embed_path:'+embed_thumb_html);
+               } else {
+                       embed_thumb_url = ( thumbnail.indexOf( 'http://' ) != - 1 ) ? thumbnail:mv_embed_path + thumbnail;
                }
                var embed_code_html = '&lt;script type=&quot;text/javascript&quot; ' +
                                        'src=&quot;' + mv_embed_path + 'mv_embed.js&quot;&gt;&lt;/script&gt' +
                                        '&lt;video ';
-               if(this.roe){
-                       embed_code_html+='roe=&quot;' + escape( this.roe ) + '&quot; ';
-               }else{
-                       embed_code_html+='src=&quot;'+this.src+'&quot; ' +
-                               'poster=&quot;'+ escape( embed_thumb_url )+'&quot; ';
+               if ( this.roe ) {
+                       embed_code_html += 'roe=&quot;' + escape( this.roe ) + '&quot; ';
+               } else {
+                       embed_code_html += 'src=&quot;' + this.src + '&quot; ' +
+                               'poster=&quot;' + escape( embed_thumb_url ) + '&quot; ';
                }
                
                // Add in the wikiTitle key if provided 
                // (in the future we should just include the titleKey on remote embeds 
                // and query a roe like xml/json representaiton thing from mediawiki)
-               if( this.wikiTitleKey ){
-                       embed_code_html+= 'wikiTitleKey=&quot;' + escape( this.wikiTitleKey ) + '&quot;';               
+               if ( this.wikiTitleKey ) {
+                       embed_code_html += 'wikiTitleKey=&quot;' + escape( this.wikiTitleKey ) + '&quot;';
                }
                
-               //close the video tag
-               embed_code_html+='&gt;&lt;/video&gt;';
+               // close the video tag
+               embed_code_html += '&gt;&lt;/video&gt;';
 
                return embed_code_html;
        },
-       doOptionsHTML:function(){
-               var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               var pos = $j('#'+sel_id + ' .options-btn').offset();
-               pos['top']=pos['top']+24;
-               pos['left']=pos['left']-124;
-               //js_log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
-               $j('#mv_vid_options_'+sel_id).css(pos).toggle();
+       doOptionsHTML:function() {
+               var sel_id = ( this.pc != null ) ? this.pc.pp.id:this.id;
+               var pos = $j( '#' + sel_id + ' .options-btn' ).offset();
+               pos['top'] = pos['top'] + 24;
+               pos['left'] = pos['left'] - 124;
+               // js_log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
+               $j( '#mv_vid_options_' + sel_id ).css( pos ).toggle();
                return;
-       },      
-       doLinkBack:function(){
-               if(this.roe && this.media_element.addedROEData==false){
+       },
+       doLinkBack:function() {
+               if ( this.roe && this.media_element.addedROEData == false ) {
                        var _this = this;
-                       this.displayHTML( gM('mwe-loading_txt') );
-                       do_request(this.roe, function(data){
-                               _this.media_element.addROE(data);                                                        
+                       this.displayHTML( gM( 'mwe-loading_txt' ) );
+                       do_request( this.roe, function( data ) {
+                               _this.media_element.addROE( data );
                                _this.doLinkBack();
-                       });                        
-               }else{
-                       if( this.linkback){
+                       } );
+               } else {
+                       if ( this.linkback ) {
                                window.location = this.linkback;
-                       }else if(this.media_element.linkback){                  
+                       } else if ( this.media_element.linkback ) {
                                window.location = this.media_element.linkback;
-                       }else{
-                               this.displayHTML( gM('mwe-could_not_find_linkback') );
+                       } else {
+                               this.displayHTML( gM( 'mwe-could_not_find_linkback' ) );
                        }
-               }          
+               }
        },
-       showShare:function($target){    
+       showShare:function( $target ) {
                var     embed_code = this.getEmbeddingHTML();
                var o = '';
                var _this = this;
-        //@todo: hook events to two a's for swapping in and out code for link vs. embed;
+        // @todo: hook events to two a's for swapping in and out code for link vs. embed;
         //       hook events for changing active class of li based on a.
-               o+= '<h2>' + gM('mwe-share_this_video') + '</h2>' +
+               o += '<h2>' + gM( 'mwe-share_this_video' ) + '</h2>' +
                        '<ul>' +
-                       '<li><a href="#" class="active">'+gM('mwe-embed_site_or_blog')+'</a></li>';
-               if(this.linkback) {
-                       o+='<li><a href="#" id="k-share-link">' + this.linkback + '</a></li>';
+                       '<li><a href="#" class="active">' + gM( 'mwe-embed_site_or_blog' ) + '</a></li>';
+               if ( this.linkback ) {
+                       o += '<li><a href="#" id="k-share-link">' + this.linkback + '</a></li>';
         }
-               o+=     '</ul>' +
+               o +=    '</ul>' +
                        '<div class="source_wrap"><textarea>' + embed_code + '</textarea></div>' +
-                               '<button class="ui-state-default ui-corner-all copycode">' + gM('mwe-copy-code') + '</button>' +
-                               '<div class="ui-state-highlight ui-corner-all">' + gM('mwe-read_before_embed') + '</div>' +
+                               '<button class="ui-state-default ui-corner-all copycode">' + gM( 'mwe-copy-code' ) + '</button>' +
+                               '<div class="ui-state-highlight ui-corner-all">' + gM( 'mwe-read_before_embed' ) + '</div>' +
                        '</div>';
-               $target.html(o); 
-               $cpBtn = $j( '#' + this.id + ' .copycode');
-               $cpTxt = $j( '#' + this.id + ' .source_wrap textarea');
+               $target.html( o );
+               $cpBtn = $j( '#' + this.id + ' .copycode' );
+               $cpTxt = $j( '#' + this.id + ' .source_wrap textarea' );
                
-               $cpTxt.click(function(){
-                       $j(this).get(0).select();
-               });
+               $cpTxt.click( function() {
+                       $j( this ).get( 0 ).select();
+               } );
                
-               //add copy binding: 
-               $cpBtn.click(function(){                                                
-                       $cpTxt.focus().get(0).select();                 
-                       if(document.selection){   
-                               CopiedTxt = document.selection.createRange();   
-                               CopiedTxt.execCommand("Copy");
+               // add copy binding: 
+               $cpBtn.click( function() {
+                       $cpTxt.focus().get( 0 ).select();
+                       if ( document.selection ) {
+                               CopiedTxt = document.selection.createRange();
+                               CopiedTxt.execCommand( "Copy" );
                        }
-               });
+               } );
        },
-       showTextInterface:function(){   
+       showTextInterface:function() {
                var _this = this;
-               //display the text container with loading text: 
-               //@@todo support position config
-               var loc = $j(this).position();                  
-               if($j('#metaBox_'+this.id).length==0){
-                       var theight =  (parseInt( this.height ) < 200) ? 200 : parseInt( this.height );
-                       $j(this).after('<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;'+
-                               'top:' + (loc.top) + 'px;' +
-                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 ) + 'px;' +
-                               'height:' + theight + 'px;width:400px;' +                                               
+               // display the text container with loading text: 
+               // @@todo support position config
+               var loc = $j( this ).position();
+               if ( $j( '#metaBox_' + this.id ).length == 0 ) {
+                       var theight =  ( parseInt( this.height ) < 200 ) ? 200 : parseInt( this.height );
+                       $j( this ).after( '<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;' +
+                               'top:' + ( loc.top ) + 'px;' +
+                               'left:' + ( parseInt( loc.left ) + parseInt( this.width ) + 10 ) + 'px;' +
+                               'height:' + theight + 'px;width:400px;' +
                                'display:none;" ' +
-                               'id="metaBox_' + this.id + '">'+
+                               'id="metaBox_' + this.id + '">' +
                                        mv_get_loading_img() +
-                               '</div>');                                      
-               }
-               //fade in the text display
-               $j('#metaBox_'+this.id).fadeIn("fast"); 
-               //check if textObj present:
-               if(typeof this.textInterface == 'undefined' ){
-                       //load the default text interface:
-                       mvJsLoader.doLoad([
-                                       'mvTextInterface', 
+                               '</div>' );
+               }
+               // fade in the text display
+               $j( '#metaBox_' + this.id ).fadeIn( "fast" );
+               // check if textObj present:
+               if ( typeof this.textInterface == 'undefined' ) {
+                       // load the default text interface:
+                       mvJsLoader.doLoad( [
+                                       'mvTextInterface',
                                        '$j.fn.hoverIntent'
-                               ], function(){                                  
-                                       _this.textInterface = new mvTextInterface( _this );                                                     
-                                       //show interface
-                                       _this.textInterface.show();                                     
+                               ], function() {
+                                       _this.textInterface = new mvTextInterface( _this );
+                                       // show interface
+                                       _this.textInterface.show();
                                }
                        );
-               }else{
-                       //show interface
+               } else {
+                       // show interface
                        this.textInterface.show();
                }
        },
-       closeTextInterface:function(){
-               js_log('closeTextInterface '+ typeof this.textInterface);
-               if(typeof this.textInterface !== 'undefined' ){
+       closeTextInterface:function() {
+               js_log( 'closeTextInterface ' + typeof this.textInterface );
+               if ( typeof this.textInterface !== 'undefined' ) {
                        this.textInterface.close();
                }
        },
@@ -1800,478 +1800,478 @@ embedVideo.prototype = {
        */
        displayHTML:function( html_code )
        {
-               var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
+               var sel_id = ( this.pc != null ) ? this.pc.pp.id:this.id;
                
-               if(!this.supports['overlays'])
+               if ( !this.supports['overlays'] )
                        this.stop();
                
-               //put select list on-top
-               //make sure the parent is relatively positioned:
-               $j('#'+sel_id).css('position', 'relative');
-               //set height width (check for playlist container)
-               var width = (this.pc)?this.pc.pp.width:this.playerPixelWidth();
-               var height = (this.pc)?this.pc.pp.height:this.playerPixelHeight();
+               // put select list on-top
+               // make sure the parent is relatively positioned:
+               $j( '#' + sel_id ).css( 'position', 'relative' );
+               // set height width (check for playlist container)
+               var width = ( this.pc ) ? this.pc.pp.width:this.playerPixelWidth();
+               var height = ( this.pc ) ? this.pc.pp.height:this.playerPixelHeight();
                
-               if(this.pc)
-                       height+=(this.pc.pp.pl_layout.title_bar_height + this.pc.pp.pl_layout.control_height);
+               if ( this.pc )
+                       height += ( this.pc.pp.pl_layout.title_bar_height + this.pc.pp.pl_layout.control_height );
          
                var fade_in = true;
-               if($j('#blackbg_'+sel_id).length!=0)
+               if ( $j( '#blackbg_' + sel_id ).length != 0 )
                {
                        fade_in = false;
-                       $j('#blackbg_'+sel_id).remove();
-               }
-               //fade in a black bg div ontop of everything
-                var div_code = '<div id="blackbg_'+sel_id+'" class="videoComplete" ' +
-                        'style="height:'+parseInt(height)+'px;width:'+parseInt(width)+'px;">'+
-                         '<div class="videoOptionsComplete">'+
-                       //@@TODO: this style should go to .css
-                       '<span style="float:right;margin-right:10px">' +                        
-                                       '<a href="#" style="color:white;" onClick="$j(\'#'+sel_id+'\').get(0).closeDisplayedHTML();return false;">close</a>' +
-                       '</span>'+
-                       '<div id="mv_disp_inner_'+sel_id+'" style="padding-top:10px;">'+
-                                html_code 
-                          +'</div>'+
+                       $j( '#blackbg_' + sel_id ).remove();
+               }
+               // fade in a black bg div ontop of everything
+                var div_code = '<div id="blackbg_' + sel_id + '" class="videoComplete" ' +
+                        'style="height:' + parseInt( height ) + 'px;width:' + parseInt( width ) + 'px;">' +
+                         '<div class="videoOptionsComplete">' +
+                       // @@TODO: this style should go to .css
+                       '<span style="float:right;margin-right:10px">' +
+                                       '<a href="#" style="color:white;" onClick="$j(\'#' + sel_id + '\').get(0).closeDisplayedHTML();return false;">close</a>' +
+                       '</span>' +
+                       '<div id="mv_disp_inner_' + sel_id + '" style="padding-top:10px;">' +
+                                html_code
+                          + '</div>' +
                           '</div></div>';
-               $j('#'+sel_id).prepend(div_code);
-               if (fade_in)
-                       $j('#blackbg_'+sel_id).fadeIn("slow");
+               $j( '#' + sel_id ).prepend( div_code );
+               if ( fade_in )
+                       $j( '#blackbg_' + sel_id ).fadeIn( "slow" );
                else
-                       $j('#blackbg_'+sel_id).show();
-               return false; //onclick action return false
+                       $j( '#blackbg_' + sel_id ).show();
+               return false; // onclick action return false
        },
        /** 
        * Close the custom HTML displayed using displayHTML and restores the
        * regular mv_embed display.
        */
-       closeDisplayedHTML:function(){
-                 var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
-                $j('#blackbg_'+sel_id).fadeOut("slow", function(){
-                        $j('#blackbg_'+sel_id).remove();
-                });
-                return false; //onclick action return false
-       },
-       showPlayerselect:function( $target ){
+       closeDisplayedHTML:function() {
+                 var sel_id = ( this.pc != null ) ? this.pc.pp.id:this.id;
+                $j( '#blackbg_' + sel_id ).fadeOut( "slow", function() {
+                        $j( '#blackbg_' + sel_id ).remove();
+                } );
+                return false; // onclick action return false
+       },
+       showPlayerselect:function( $target ) {
                // Get id (in case where we have a parent container)
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               var _this=this;
-               var o= '';
-               o+='<h2>' + gM('mwe-chose_player') + '</h2>';
-               var _this=this;         
-               $j.each( this.media_element.getPlayableSources(), function(source_id, source){
+               var this_id = ( this.pc != null ) ? this.pc.pp.id:this.id;
+               var _this = this;
+               var o = '';
+               o += '<h2>' + gM( 'mwe-chose_player' ) + '</h2>';
+               var _this = this;
+               $j.each( this.media_element.getPlayableSources(), function( source_id, source ) {
                        var default_player = embedTypes.players.defaultPlayer( source.getMIMEType() );
 
-                       var is_selected = (source == _this.media_element.selected_source);
+                       var is_selected = ( source == _this.media_element.selected_source );
                        var image_src =  mv_skin_img_path ;
 
-                       if (default_player){
-                               o+='<ul>';
-                               //output the player select code:
+                       if ( default_player ) {
+                               o += '<ul>';
+                               // output the player select code:
                                var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );
 
-                               for(var i=0; i < supporting_players.length ; i++){
-                                       if( _this.selected_player.id == supporting_players[i].id && is_selected ){
-                                               o+='<li>' +
-                                                       '<a href="#" class="active" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
+                               for ( var i = 0; i < supporting_players.length ; i++ ) {
+                                       if ( _this.selected_player.id == supporting_players[i].id && is_selected ) {
+                                               o += '<li>' +
+                                                       '<a href="#" class="active" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id + '">' +
                                                                supporting_players[i].getName() +
                                                        '</li>';
-                                       }else{                                  
-                               o+='<li>' +
-                                                       '<a href="#" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
-                                                               supporting_players[i].getName() + 
+                                       } else {
+                               o += '<li>' +
+                                                       '<a href="#" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id + '">' +
+                                                               supporting_players[i].getName() +
                                                        '</a>' +
                                                '</li>';
                                        }
                                }
-                               o+='</ul>';
-                       }else{
-                               o+= source.getTitle() + ' - no player available';
+                               o += '</ul>';
+                       } else {
+                               o += source.getTitle() + ' - no player available';
                        }
-               });
-               $target.html(o);
+               } );
+               $target.html( o );
 
                // Set up the click bindings:
-               $target.find("[rel='sel_source']").each(function(){
-                       $j(this).click(function(){
-                               var iparts = $j(this).attr( 'id' ).replace(/sc_/,'').split('_');
+               $target.find( "[rel='sel_source']" ).each( function() {
+                       $j( this ).click( function() {
+                               var iparts = $j( this ).attr( 'id' ).replace( / sc_ / , '' ).split( '_' );
                                var source_id = iparts[0];
                                var default_player_id = iparts[1];
-                               js_log('source id: ' +  source_id + ' player id: ' + default_player_id);
+                               js_log( 'source id: ' +  source_id + ' player id: ' + default_player_id );
 
-                               $j('#' + this_id  ).get(0).closeDisplayedHTML();
-                               $j('#' + _this.id ).get(0).media_element.selectSource( source_id );
+                               $j( '#' + this_id  ).get( 0 ).closeDisplayedHTML();
+                               $j( '#' + _this.id ).get( 0 ).media_element.selectSource( source_id );
 
                                embedTypes.players.userSelectPlayer( default_player_id,
                                         _this.media_element.sources[ source_id ].getMIMEType() );
 
                                // Issue a stop
-                               $j('#' + this_id  ).get(0).stop();
+                               $j( '#' + this_id  ).get( 0 ).stop();
 
                                // Don't follow the empty # link:
                                return false;
-                       });
-               });
-       },      
-       showDownload:function( $target ){
+                       } );
+               } );
+       },
+       showDownload:function( $target ) {
                var _this = this;
                // Load the roe if available (to populate out download options:
-               function getShowVideoDownload(){
-                               var out='<div style="color:white">';                                    
-                       var dl_list='';
-                       var dl_txt_list='';             
-                       $j.each(_this.media_element.getSources(), function(index, source){
-                               var dl_line = '<li>' + '<a style="color:white" href="' + source.getURI() +'"> '
-                                       + source.getTitle()+'</a> '+ '</li>'+"\n";                      
-                               if(      source.getURI().indexOf('?t=')!==-1){
-                                       out+=dl_line;
-                               }else if( this.getMIMEType()=="text/cmml" || this.getMIMEType()=="text/x-srt" ){
-                                       dl_txt_list+=dl_line;
-                               }else{
-                                       dl_list+=dl_line;
+               function getShowVideoDownload() {
+                               var out = '<div style="color:white">';
+                       var dl_list = '';
+                       var dl_txt_list = '';
+                       $j.each( _this.media_element.getSources(), function( index, source ) {
+                               var dl_line = '<li>' + '<a style="color:white" href="' + source.getURI() + '"> '
+                                       + source.getTitle() + '</a> ' + '</li>' + "\n";
+                               if (     source.getURI().indexOf( '?t=' ) !== - 1 ) {
+                                       out += dl_line;
+                               } else if ( this.getMIMEType() == "text/cmml" || this.getMIMEType() == "text/x-srt" ) {
+                                       dl_txt_list += dl_line;
+                               } else {
+                                       dl_list += dl_line;
                                }
-                       });             
+                       } );
                        
-                       if( dl_list != '' )
-                               out += gM('mwe-download_full') + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
-                       if( dl_txt_list != '' )
-                               out += gM('mwe-download_text') + '<blockquote style="background:#000">' + dl_txt_list +'</blockquote>';
+                       if ( dl_list != '' )
+                               out += gM( 'mwe-download_full' ) + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
+                       if ( dl_txt_list != '' )
+                               out += gM( 'mwe-download_text' ) + '<blockquote style="background:#000">' + dl_txt_list + '</blockquote>';
                        out += '</div>';
                        return out;
                }
-               //js_log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData);
-               if(this.roe && this.media_element.addedROEData == false){
+               // js_log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData);
+               if ( this.roe && this.media_element.addedROEData == false ) {
                        var _this = this;
-                       $target.html( gM('loading_txt') );
-                       do_request(this.roe, function(data){
-                          _this.media_element.addROE(data);
+                       $target.html( gM( 'loading_txt' ) );
+                       do_request( this.roe, function( data ) {
+                          _this.media_element.addROE( data );
                           $target.html( getShowVideoDownload() );
-                       });
-               }else{
+                       } );
+               } else {
                        $target.html( getShowVideoDownload() );
                }
-       },      
-       showCredits:function( $target ){
-               $target.html('<h2>' + gM('mwe-credits') + '</h2>');
+       },
+       showCredits:function( $target ) {
+               $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' );
        },
        /*
        *  Base embed controls
        *  The Play Action:
        */
-       play : function(){
-               var eid = (this.pc!=null)?this.pc.pp.id:this.id;
+       play : function() {
+               var eid = ( this.pc != null ) ? this.pc.pp.id:this.id;
                                                
-               //check if thumbnail is being displayed and embed html
-               if( this.thumbnail_disp ){                      
-                       if( !this.selected_player ){
-                               js_log('no selected_player');
-                               //this.innerHTML = this.getPluginMissingHTML();                         
-                               $j('#'+this.id).html( this.getPluginMissingHTML() );
-                       }else{
+               // check if thumbnail is being displayed and embed html
+               if ( this.thumbnail_disp ) {
+                       if ( !this.selected_player ) {
+                               js_log( 'no selected_player' );
+                               // this.innerHTML = this.getPluginMissingHTML();                                
+                               $j( '#' + this.id ).html( this.getPluginMissingHTML() );
+                       } else {
                                this.doEmbedHTML();
-                               this.onClipDone_disp=false;                        
-                               this.paused=false;         
-                               this.thumbnail_disp=false;               
+                               this.onClipDone_disp = false;
+                               this.paused = false;
+                               this.thumbnail_disp = false;
                        }
-               }else{
-                       //the plugin is already being displayed                 
-                       this.paused=false; //make sure we are not "paused"
-                       this.seeking=false;
-               }                               
+               } else {
+                       // the plugin is already being displayed                        
+                       this.paused = false; // make sure we are not "paused"
+                       this.seeking = false;
+               }
                
-                $j('#' + eid + ' .play-btn span').removeClass('ui-icon-play').addClass('ui-icon-pause');                          
-                $j('#' + eid + ' .play-btn').unbind().btnBind().click(function(){                                      
-                       $j('#' + eid ).get(0).pause();
-                }).attr('title', gM('mwe-pause_clip'));
+                $j( '#' + eid + ' .play-btn span' ).removeClass( 'ui-icon-play' ).addClass( 'ui-icon-pause' );
+                $j( '#' + eid + ' .play-btn' ).unbind().btnBind().click( function() {
+                       $j( '#' + eid ).get( 0 ).pause();
+                } ).attr( 'title', gM( 'mwe-pause_clip' ) );
                   
        },
-       load:function(){
-               //should be done by child (no base way to pre-buffer video)
-               js_log('baseEmbed:load call');
+       load:function() {
+               // should be done by child (no base way to pre-buffer video)
+               js_log( 'baseEmbed:load call' );
        },
-       getSrc:function(){
+       getSrc:function() {
           return this.media_element.selected_source.getURI( this.seek_time_sec );
-       }, 
+       },
        /*
         * Base embed pause
         *      there is no general way to pause the video
         *  must be overwritten by embed object to support this functionality.
         */
-       pause: function(){
-               var eid = (this.pc!=null)?this.pc.pp.id:this.id;                                                          
-               //js_log('mv_embed:do pause');          
-               //(playing) do pause            
-               this.paused = true; 
-               //update the ctrl "paused state"                                
-               $j('#' + eid + ' .play-btn span').removeClass('ui-icon-pause').addClass('ui-icon-play');
-                $j('#' + eid + ' .play-btn').unbind().btnBind().click(function(){                                                       
-                               $j('#'+eid).get(0).play();
-               }).attr('title', gM('mwe-play_clip'));
-       },      
+       pause: function() {
+               var eid = ( this.pc != null ) ? this.pc.pp.id:this.id;
+               // js_log('mv_embed:do pause');         
+               // (playing) do pause           
+               this.paused = true;
+               // update the ctrl "paused state"                               
+               $j( '#' + eid + ' .play-btn span' ).removeClass( 'ui-icon-pause' ).addClass( 'ui-icon-play' );
+                $j( '#' + eid + ' .play-btn' ).unbind().btnBind().click( function() {
+                               $j( '#' + eid ).get( 0 ).play();
+               } ).attr( 'title', gM( 'mwe-play_clip' ) );
+       },
        /**
         * Base embed stop (can be overwritten by the plugin)
         */
-       stop: function(){
+       stop: function() {
                var _this = this;
-               js_log('mvEmbed:stop:'+this.id);
+               js_log( 'mvEmbed:stop:' + this.id );
                
-               //no longer seeking:
-               this.didSeekJump=false;
+               // no longer seeking:
+               this.didSeekJump = false;
                
-               //first issue pause to update interface (only call the parent) 
-               if(this['parent_pause']){
+               // first issue pause to update interface        (only call the parent) 
+               if ( this['parent_pause'] ) {
                        this.parent_pause();
-               }else{
+               } else {
                        this.pause();
-               }       
+               }
                
-               //reset the currentTime: 
-               this.currentTime=0;
-               //check if thumbnail is being displayed in which case do nothing
-               if( this.thumbnail_disp ){
-                       //already in stooped state
-                       js_log('already in stopped state');
-               }else{
-                       //rewrite the html to thumbnail disp
+               // reset the currentTime: 
+               this.currentTime = 0;
+               // check if thumbnail is being displayed in which case do nothing
+               if ( this.thumbnail_disp ) {
+                       // already in stooped state
+                       js_log( 'already in stopped state' );
+               } else {
+                       // rewrite the html to thumbnail disp
                        this.doThumbnailHTML();
-                       this.bufferedPercent=0; //reset buffer state
-                       this.setSliderValue(0);
+                       this.bufferedPercent = 0; // reset buffer state
+                       this.setSliderValue( 0 );
                        this.setStatus( this.getTimeReq() );
                }
                
-               //make sure the big playbutton is has click action: 
-               $j('#' + _this.id + ' .play-btn-large').unbind('click').click(function(){
-                       $j('#' +_this.id).get(0).play();
-               });
+               // make sure the big playbutton is has click action: 
+               $j( '#' + _this.id + ' .play-btn-large' ).unbind( 'click' ).click( function() {
+                       $j( '#' + _this.id ).get( 0 ).play();
+               } );
                
-               if(this.update_interval)
+               if ( this.update_interval )
                {
-                       clearInterval(this.update_interval);
+                       clearInterval( this.update_interval );
                        this.update_interval = null;
                }
        },
-       toggleMute:function(){  
-               var eid = (this.pc!=null)?this.pc.pp.id:this.id;        
-               if( this.muted ){
-                       this.muted=false;                       
-                       $j('#' + eid + ' .volume-slider').slider('value', 100);
-                       this.updateVolumen(1);
-               }else{
-                       this.muted=true;                        
-                       $j('#' + eid + ' .volume-slider').slider('value', 0);
-                       this.updateVolumen(0); 
+       toggleMute:function() {
+               var eid = ( this.pc != null ) ? this.pc.pp.id:this.id;
+               if ( this.muted ) {
+                       this.muted = false;
+                       $j( '#' + eid + ' .volume-slider' ).slider( 'value', 100 );
+                       this.updateVolumen( 1 );
+               } else {
+                       this.muted = true;
+                       $j( '#' + eid + ' .volume-slider' ).slider( 'value', 0 );
+                       this.updateVolumen( 0 );
                }
-               js_log('f:toggleMute::' + this.muted);          
+               js_log( 'f:toggleMute::' + this.muted );
        },
-       updateVolumen:function(perc){
-               js_log('update volume not supported with current playback type');
+       updateVolumen:function( perc ) {
+               js_log( 'update volume not supported with current playback type' );
        },
-       fullscreen:function(){
-               js_log('fullscreen not supported with current playback type');
+       fullscreen:function() {
+               js_log( 'fullscreen not supported with current playback type' );
        },
        /**
        *  returns bool true if playing or paused, false if stooped
        */
-       isPlaying : function(){
-               if(this.thumbnail_disp){
-                       //in stoped state
+       isPlaying : function() {
+               if ( this.thumbnail_disp ) {
+                       // in stoped state
                        return false;
-               }else if( this.paused ){
-                       //paused state
+               } else if ( this.paused ) {
+                       // paused state
                        return false;
-               }else{
+               } else {
                        return true;
                }
        },
-       isPaused : function(){
+       isPaused : function() {
                return this.isPlaying() && this.paused;
        },
-       isStoped : function(){
+       isStoped : function() {
                return this.thumbnail_disp;
        },
-       playlistSupport:function(){
-               //by default not supported (implemented in js)
+       playlistSupport:function() {
+               // by default not supported (implemented in js)
                return false;
        },
-       postEmbedJS:function(){
+       postEmbedJS:function() {
                return '';
        },
        /*
        * Monitor playback and update interface components.
        * underling plugin objects are responsible for updating currentTime
        */
-       monitor:function(){              
-               //js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 )  + ' is seek: ' + this.seeking );
-               if( this.currentTime && this.currentTime > 0 && this.duration){
-                       if( !this.userSlide && !this.seeking ){
-                               if( this.start_offset  ){ 
-                                       //if start offset include that calculation 
+       monitor:function() {
+               // js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 )  + ' is seek: ' + this.seeking );
+               if ( this.currentTime && this.currentTime > 0 && this.duration ) {
+                       if ( !this.userSlide && !this.seeking ) {
+                               if ( this.start_offset  ) {
+                                       // if start offset include that calculation 
                                        this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );
-                                       var et = (this.ctrlBuilder.long_time_disp)? '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ) : '';                    
-                                       this.setStatus( seconds2npt(this.currentTime) + et);
-                               }else{
+                                       var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + seconds2npt( parseFloat( this.start_offset ) + parseFloat( this.duration ) ) : '';
+                                       this.setStatus( seconds2npt( this.currentTime ) + et );
+                               } else {
                                        this.setSliderValue( this.currentTime / this.duration );
-                                       var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.duration ):'';
-                                       this.setStatus( seconds2npt( this.currentTime ) + et);                                  
-                               }                               
+                                       var et = ( this.ctrlBuilder.long_time_disp ) ? '/' + seconds2npt( this.duration ):'';
+                                       this.setStatus( seconds2npt( this.currentTime ) + et );
+                               }
                        }
                        // Check if we are "done"
-                       if( this.currentTime > ( parseInt(this.duration) + 1 ) ){
-                               js_log("should run clip done ct:: " + this.currentTime + ' > ' +  parseInt( this.duration + 1 ) );
+                       if ( this.currentTime > ( parseInt( this.duration ) + 1 ) ) {
+                               js_log( "should run clip done ct:: " + this.currentTime + ' > ' +  parseInt( this.duration + 1 ) );
                                this.onClipDone();
-                       }                               
-               }else{
+                       }
+               } else {
                        // Media lacks duration just show end time
-                       //js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
-                       if( this.isStoped() ){
+                       // js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
+                       if ( this.isStoped() ) {
                                this.setStatus( this.getTimeReq() );
-                       }else if( this.isPaused() ){
-                               this.setStatus( gM('mwe-paused') );                     
-                       }else if( this.isPlaying() ){
-                               if( this.currentTime && ! this.duration ) 
+                       } else if ( this.isPaused() ) {
+                               this.setStatus( gM( 'mwe-paused' ) );
+                       } else if ( this.isPlaying() ) {
+                               if ( this.currentTime && ! this.duration )
                                        this.setStatus( seconds2npt( this.currentTime ) + ' /' );
-                               else   
-                                       this.setStatus(" - - - ");
-                       }else{
+                               else
+                                       this.setStatus( " - - - " );
+                       } else {
                                this.setStatus( this.getTimeReq() );
-                       }                       
+                       }
                }
                // Could check if time > duration here and stop playback
-               
+
                // Update buffer information 
                this.updateBufferStatus();
                var _this = this;
                // Update monitorTimerId to call child monitor
-               if( ! this.monitorTimerId ){
+               if ( ! this.monitorTimerId ) {
                        // Make sure an instance of this.id exists: 
-                       if( document.getElementById(this.id) ){
-                               this.monitorTimerId = setInterval(function(){
-                                       if(_this.id && $j( '#'+_this.id ).length != 0){
-                                               $j( '#'+_this.id ).get(0).monitor();
+                       if ( document.getElementById( this.id ) ) {
+                               this.monitorTimerId = setInterval( function() {
+                                       if ( _this.id && $j( '#' + _this.id ).length != 0 ) {
+                                               $j( '#' + _this.id ).get( 0 ).monitor();
                                        }
-                               }, 250);
+                               }, 250 );
                        }
                }
-       },              
-       stopMonitor:function(){
-               if( this.monitorTimerId != 0 )
+       },
+       stopMonitor:function() {
+               if ( this.monitorTimerId != 0 )
                {
                        clearInterval( this.monitorTimerId );
                        this.monitorTimerId = 0;
                }
        },
-       updateBufferStatus: function(){
+       updateBufferStatus: function() {
                        
                // Build the buffer target based for playlist vs clip 
-               var buffer_select = (this.pc) ? 
-                       '#cl_status_' + this.id + ' .mv_buffer': 
+               var buffer_select = ( this.pc ) ?
+                       '#cl_status_' + this.id + ' .mv_buffer':
                        '#' + this.id + ' .play_head .mv_buffer';
                        
                // Update the buffer progress bar (if available )
-               if( this.bufferedPercent != 0 ){
-                       //js_log('bufferedPercent: ' + this.bufferedPercent);                   
-                       if(this.bufferedPercent > 1)
-                               this.bufferedPercent=1;                                                 
+               if ( this.bufferedPercent != 0 ) {
+                       // js_log('bufferedPercent: ' + this.bufferedPercent);                  
+                       if ( this.bufferedPercent > 1 )
+                               this.bufferedPercent = 1;
                        
-                       $j(buffer_select).css("width", (this.bufferedPercent*100) +'%' );
-               }else{
-                       $j(buffer_select).css("width", '0px' );
+                       $j( buffer_select ).css( "width", ( this.bufferedPercent * 100 ) + '%' );
+               } else {
+                       $j( buffer_select ).css( "width", '0px' );
                }
        },
-       relativeCurrentTime: function(){
-               if(!this.start_offset)
-                       this.start_offset =0;
+       relativeCurrentTime: function() {
+               if ( !this.start_offset )
+                       this.start_offset = 0;
                var rt = this.currentTime - this.start_offset;
-               if( rt < 0 ) //should not happen but does. 
+               if ( rt < 0 ) // should not happen but does. 
                        return 0;
                return rt;
        },
-       getPluginEmbed : function(){
-               if (window.document[this.pid]){
+       getPluginEmbed : function() {
+               if ( window.document[this.pid] ) {
                        return window.document[this.pid];
                }
-               if ($j.browser.msie){
-                       return document.getElementById(this.pid );
-               }else{
-                        if (document.embeds && document.embeds[this.pid])
+               if ( $j.browser.msie ) {
+                       return document.getElementById( this.pid );
+               } else {
+                        if ( document.embeds && document.embeds[this.pid] )
                                return  document.embeds[this.pid];
                }
                return null;
        },
-       setSliderValue: function(perc, hide_progress){  
-               var eid = (this.pc)?this.pc.pp.id:this.id;
-               if(this.controls && $j('#' + eid + ' .play_head').length != 0){                                 
-                       var val = parseInt( perc*1000 ); 
-                       $j('#' + eid + ' .play_head').slider('value', val);                             
+       setSliderValue: function( perc, hide_progress ) {
+               var eid = ( this.pc ) ? this.pc.pp.id:this.id;
+               if ( this.controls && $j( '#' + eid + ' .play_head' ).length != 0 ) {
+                       var val = parseInt( perc * 1000 );
+                       $j( '#' + eid + ' .play_head' ).slider( 'value', val );
                }
-               //js_log('set#mv_seeker_slider_'+eid + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+eid).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
-               //js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')');
+               // js_log('set#mv_seeker_slider_'+eid + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+eid).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
+               // js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')');
        },
-       highlightPlaySection:function(options){
-               js_log('highlightPlaySection');
-               var eid = (this.pc)?this.pc.pp.id:this.id;
+       highlightPlaySection:function( options ) {
+               js_log( 'highlightPlaySection' );
+               var eid = ( this.pc ) ? this.pc.pp.id:this.id;
                var dur = this.getDuration();
-               var hide_progress = true;               
-               //set the left percet and update the slider: 
-               rel_start_sec = npt2seconds( options['start']);
-               //remove the start_offset if relevent: 
-               if(this.start_offset)
+               var hide_progress = true;
+               // set the left percet and update the slider: 
+               rel_start_sec = npt2seconds( options['start'] );
+               // remove the start_offset if relevent: 
+               if ( this.start_offset )
                        rel_start_sec = rel_start_sec - this.start_offset
                
-               var slider_perc=0;
-               if( rel_start_sec <= 0 ){
-                       left_perc =0;                    
+               var slider_perc = 0;
+               if ( rel_start_sec <= 0 ) {
+                       left_perc = 0;
                        options['start'] = seconds2npt( this.start_offset );
-                       rel_start_sec=0;                        
-                       this.setSliderValue( 0 , hide_progress);
-               }else{
-                       left_perc = parseInt( (rel_start_sec / dur)*100 ) ;             
-                       slider_perc = (left_perc / 100);
-               }               
+                       rel_start_sec = 0;
+                       this.setSliderValue( 0 , hide_progress );
+               } else {
+                       left_perc = parseInt( ( rel_start_sec / dur ) * 100 ) ;
+                       slider_perc = ( left_perc / 100 );
+               }
                
-               js_log("slider perc:" + slider_perc);   
-               if( ! this.isPlaying() ){
-                       this.setSliderValue( slider_perc , hide_progress);              
+               js_log( "slider perc:" + slider_perc );
+               if ( ! this.isPlaying() ) {
+                       this.setSliderValue( slider_perc , hide_progress );
                }
                
-               width_perc = parseInt( (( npt2seconds( options['end'] ) - npt2seconds( options['start'] ) ) / dur)*100 ) ;                                                       
-               if( (width_perc + left_perc) > 100 ){
-                       width_perc = 100 - left_perc; 
-               }               
-               //js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:'  + left_perc + ' width: ' + width_perc);  
-               $j('#mv_seeker_' + eid + ' .mv_highlight').css({
-                       'left' : left_perc+'%',
-                       'width' : width_perc+'%'                        
-               }).show();
+               width_perc = parseInt( ( ( npt2seconds( options['end'] ) - npt2seconds( options['start'] ) ) / dur ) * 100 ) ;
+               if ( ( width_perc + left_perc ) > 100 ) {
+                       width_perc = 100 - left_perc;
+               }
+               // js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:'  + left_perc + ' width: ' + width_perc); 
+               $j( '#mv_seeker_' + eid + ' .mv_highlight' ).css( {
+                       'left' : left_perc + '%',
+                       'width' : width_perc + '%'
+               } ).show();
                
                this.jump_time =  options['start'];
-               this.seek_time_sec = npt2seconds( options['start']);
-               //trim output to 
-               this.setStatus( gM('mwe-seek_to', seconds2npt( this.seek_time_sec ) ) );
-               js_log('DO update: ' +  this.jump_time);
-               this.updateThumbTime( rel_start_sec );  
-       },
-       hideHighlight:function(){
-               var eid = (this.pc)?this.pc.pp.id:this.id;
-               $j('#mv_seeker_' + eid + ' .mv_highlight').hide();
+               this.seek_time_sec = npt2seconds( options['start'] );
+               // trim output to 
+               this.setStatus( gM( 'mwe-seek_to', seconds2npt( this.seek_time_sec ) ) );
+               js_log( 'DO update: ' +  this.jump_time );
+               this.updateThumbTime( rel_start_sec );
+       },
+       hideHighlight:function() {
+               var eid = ( this.pc ) ? this.pc.pp.id:this.id;
+               $j( '#mv_seeker_' + eid + ' .mv_highlight' ).hide();
                this.setStatus( this.getTimeReq() );
                this.setSliderValue( 0 );
        },
-       setStatus:function(value){
-               var eid = (this.pc)?this.pc.pp.id:this.id;
-               //update status:
-               $j('#' + eid + ' .time-disp').html(value);
-       },      
+       setStatus:function( value ) {
+               var eid = ( this.pc ) ? this.pc.pp.id:this.id;
+               // update status:
+               $j( '#' + eid + ' .time-disp' ).html( value );
+       },
        /**
        * Helper Functions for selected source 
-       */      
+       */
        /*
        * returns the selected source url for players to play
        */
-       getURI : function( seek_time_sec ){
+       getURI : function( seek_time_sec ) {
                return this.media_element.selected_source.getURI( this.seek_time_sec );
        },
-       supportsURLTimeEncoding: function(){
-               //do head request if on the same domain
+       supportsURLTimeEncoding: function() {
+               // do head request if on the same domain
                return this.media_element.selected_source.URLTimeEncoding;
        }
 }
@@ -2285,9 +2285,9 @@ embedVideo.prototype = {
   * @param {String} library external script containing the plugin interface code. (mv_<library>Embed.js)
   * @constructor
   */
-function mediaPlayer(id, supported_types, library)
+function mediaPlayer( id, supported_types, library )
 {
-       this.id=id;
+       this.id = id;
        this.supported_types = supported_types;
        this.library = library;
        this.loaded = false;
@@ -2300,48 +2300,48 @@ mediaPlayer.prototype =
        supported_types:null,
        library:null,
        loaded:false,
-       loading_callbacks:null, 
-       supportsMIMEType : function(type)
-       {               
-               for (var i=0; i < this.supported_types.length; i++)
-                       if(this.supported_types[i] == type)
+       loading_callbacks:null,
+       supportsMIMEType : function( type )
+       {
+               for ( var i = 0; i < this.supported_types.length; i++ )
+                       if ( this.supported_types[i] == type )
                                return true;
                return false;
        },
        getName : function()
        {
-               return gM('mwe-ogg-player-' + this.id);
-       },
-       load : function(callback){              
-               mvJsLoader.doLoad(
-                       this.library + 'Embed'  
-               ],function(){
-                       callback();                                                     
-               });
-       }       
+               return gM( 'mwe-ogg-player-' + this.id );
+       },
+       load : function( callback ) {
+               mvJsLoader.doLoad( [
+                       this.library + 'Embed'
+               ], function() {
+                       callback();
+               } );
+       }
 }
 /* players and supported mime types 
 @@note ideally we query the plugin to get what mime types it supports in practice not always reliable/avaliable
 */
-var flowPlayer = new mediaPlayer('flowplayer', ['video/x-flv', 'video/h264'], 'flowplayer');
-//var kplayer = new mediaPlayer('kplayer', ['video/x-flv', 'video/h264'], 'kplayer');
+var flowPlayer = new mediaPlayer( 'flowplayer', ['video/x-flv', 'video/h264'], 'flowplayer' );
+// var kplayer = new mediaPlayer('kplayer', ['video/x-flv', 'video/h264'], 'kplayer');
 
-var omtkPlayer = new mediaPlayer('omtkplayer',['audio/ogg'], 'omtk' );
+var omtkPlayer = new mediaPlayer( 'omtkplayer', ['audio/ogg'], 'omtk' );
 
-var cortadoPlayer = new mediaPlayer('cortado',['video/ogg', 'audio/ogg'],'java');
-var videoElementPlayer = new mediaPlayer('videoElement',['video/ogg', 'audio/ogg'],'native');
+var cortadoPlayer = new mediaPlayer( 'cortado', ['video/ogg', 'audio/ogg'], 'java' );
+var videoElementPlayer = new mediaPlayer( 'videoElement', ['video/ogg', 'audio/ogg'], 'native' );
 
 var vlcMineList = ['video/ogg', 'audio/ogg', 'video/x-flv', 'video/mp4',  'video/h264'];
-var vlcPlayer = new mediaPlayer('vlc-player', vlcMineList, 'vlc');
+var vlcPlayer = new mediaPlayer( 'vlc-player', vlcMineList, 'vlc' );
 
-//add generic
-var oggPluginPlayer = new mediaPlayer('oggPlugin',['video/ogg'],'generic');
+// add generic
+var oggPluginPlayer = new mediaPlayer( 'oggPlugin', ['video/ogg'], 'generic' );
 
-//depricate quicktime in favor of safari native 
-//var quicktimeMozillaPlayer = new mediaPlayer('quicktime-mozilla',['video/ogg'],'quicktime');
-//var quicktimeActiveXPlayer = new mediaPlayer('quicktime-activex',['video/ogg'],'quicktime');
+// depricate quicktime in favor of safari native 
+// var quicktimeMozillaPlayer = new mediaPlayer('quicktime-mozilla',['video/ogg'],'quicktime');
+// var quicktimeActiveXPlayer = new mediaPlayer('quicktime-activex',['video/ogg'],'quicktime');
 
-var htmlPlayer = new mediaPlayer('html',['text/html', 'image/jpeg', 'image/png', 'image/svg'], 'html');
+var htmlPlayer = new mediaPlayer( 'html', ['text/html', 'image/jpeg', 'image/png', 'image/svg'], 'html' );
 
 /**
   * mediaPlayers is a collection of mediaPlayer objects supported by the client.
@@ -2357,18 +2357,18 @@ mediaPlayers.prototype =
 {
        players : null,
        preference : null,
-       default_players : {},
-       init : function(){
+       default_players : { },
+       init : function() {
                this.players = new Array();
                this.loadPreferences();
                
-               //set up default players order for each library type            
+               // set up default players order for each library type           
                this.default_players['video/x-flv'] = ['flowplayer', 'vlc'];
                this.default_players['video/h264'] = ['flowplayer', 'vlc'];
                
-               this.default_players['video/ogg'] = ['native','vlc','java', 'generic'];         
-               this.default_players['application/ogg'] = ['native','vlc','java', 'generic'];           
-               this.default_players['audio/ogg'] = ['native','vlc', 'java', 'omtk' ];          
+               this.default_players['video/ogg'] = ['native', 'vlc', 'java', 'generic'];
+               this.default_players['application/ogg'] = ['native', 'vlc', 'java', 'generic'];
+               this.default_players['audio/ogg'] = ['native', 'vlc', 'java', 'omtk' ];
                this.default_players['video/mp4'] = ['vlc'];
                
                this.default_players['text/html'] = ['html'];
@@ -2377,56 +2377,56 @@ mediaPlayers.prototype =
                this.default_players['image/svg'] = ['html'];
                
        },
-       addPlayer : function(player, mime_type){                
-               for (var i =0; i < this.players.length; i++){
-                       if (this.players[i].id == player.id){
-                               if(mime_type!=null){
-                                       //make sure the mime_type is not already there:
-                                       var add_mime = true; 
-                                       for(var j=0; j < this.players[i].supported_types.length; j++ ){
-                                               if( this.players[i].supported_types[j]== mime_type)
-                                                       add_mime=false;
-                                       }                                       
-                                       if(add_mime)
+       addPlayer : function( player, mime_type ) {
+               for ( var i = 0; i < this.players.length; i++ ) {
+                       if ( this.players[i].id == player.id ) {
+                               if ( mime_type != null ) {
+                                       // make sure the mime_type is not already there:
+                                       var add_mime = true;
+                                       for ( var j = 0; j < this.players[i].supported_types.length; j++ ) {
+                                               if ( this.players[i].supported_types[j] == mime_type )
+                                                       add_mime = false;
+                                       }
+                                       if ( add_mime )
                                                this.players[i].supported_types.push( mime_type );
                                }
                                return ;
                        }
                }
                // Player not found: 
-               if( mime_type != null )
-                       player.supported_types.push(mime_type);
+               if ( mime_type != null )
+                       player.supported_types.push( mime_type );
                                  
-               js_log('Adding ' + player.id + ' with mime_type ' + mime_type);  
+               js_log( 'Adding ' + player.id + ' with mime_type ' + mime_type );
                this.players.push( player );
        },
-       getMIMETypePlayers : function(mime_type){                               
+       getMIMETypePlayers : function( mime_type ) {
                var mime_players = new Array();
                var _this = this;
                var inx = 0;
-               if( this.default_players[mime_type] ){                                          
-                       $j.each( this.default_players[mime_type], function(d, lib){                             
-                               var library = _this.default_players[mime_type][d];                              
-                               for ( var i=0; i < _this.players.length; i++ ){                                 
-                                       if ( _this.players[i].library == library && _this.players[i].supportsMIMEType(mime_type) ){
-                                               mime_players[ inx ] = _this.players[i];                                         
+               if ( this.default_players[mime_type] ) {
+                       $j.each( this.default_players[mime_type], function( d, lib ) {
+                               var library = _this.default_players[mime_type][d];
+                               for ( var i = 0; i < _this.players.length; i++ ) {
+                                       if ( _this.players[i].library == library && _this.players[i].supportsMIMEType( mime_type ) ) {
+                                               mime_players[ inx ] = _this.players[i];
                                                inx++;
                                        }
                                }
-                       });
-               }               
+                       } );
+               }
                return mime_players;
        },
-       defaultPlayer : function(mime_type){                            
-               js_log("get defaultPlayer for " + mime_type);           
-               var mime_players = this.getMIMETypePlayers(mime_type);                          
-               if( mime_players.length > 0)
+       defaultPlayer : function( mime_type ) {
+               js_log( "get defaultPlayer for " + mime_type );
+               var mime_players = this.getMIMETypePlayers( mime_type );
+               if ( mime_players.length > 0 )
                {
                        // Check for prior preference for this mime type
-                       for( var i=0; i < mime_players.length; i++ ){
-                               if( mime_players[i].id==this.preference[mime_type] )
+                       for ( var i = 0; i < mime_players.length; i++ ) {
+                               if ( mime_players[i].id == this.preference[mime_type] )
                                        return mime_players[i];
-                       }                                       
+                       }
                        // Otherwise just return the first compatible player
                        // (it will be chosen according to the default_players list
                        return mime_players[0];
@@ -2434,54 +2434,54 @@ mediaPlayers.prototype =
                js_log( 'No default player found for ' + mime_type );
                return null;
        },
-       userSelectFormat : function (mime_format){
+       userSelectFormat : function ( mime_format ) {
                 this.preference['format_prefrence'] = mime_format;
                 this.savePreferences();
        },
-       userSelectPlayer : function(player_id, mime_type){
-               var selected_player=null;
-               for(var i=0; i < this.players.length; i++){
-                       if(this.players[i].id == player_id){
+       userSelectPlayer : function( player_id, mime_type ) {
+               var selected_player = null;
+               for ( var i = 0; i < this.players.length; i++ ) {
+                       if ( this.players[i].id == player_id ) {
                                selected_player = this.players[i];
-                               js_log('choosing ' + player_id + ' for ' + mime_type);
-                               this.preference[mime_type]=player_id;
+                               js_log( 'choosing ' + player_id + ' for ' + mime_type );
+                               this.preference[mime_type] = player_id;
                                this.savePreferences();
                                break;
                        }
                }
-               if( selected_player ){
-                       for(var i=0; i < mw.player_list.length; i++){
-                               var embed = $j('#'+mw.player_list[i]).get(0);
-                               if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type))
+               if ( selected_player ) {
+                       for ( var i = 0; i < mw.player_list.length; i++ ) {
+                               var embed = $j( '#' + mw.player_list[i] ).get( 0 );
+                               if ( embed.media_element.selected_source && ( embed.media_element.selected_source.mime_type == mime_type ) )
                                {
-                                       embed.selectPlayer(selected_player);
-                                       js_log('using ' + embed.selected_player.getName() + ' for ' + embed.media_element.selected_source.getTitle());
+                                       embed.selectPlayer( selected_player );
+                                       js_log( 'using ' + embed.selected_player.getName() + ' for ' + embed.media_element.selected_source.getTitle() );
                                }
                        }
                }
        },
        loadPreferences : function()
        {
-               this.preference = new Object();                         
+               this.preference = new Object();
                // see if we have a cookie set to a clientSupported type:
                var cookieVal = $j.cookie( 'ogg_player_exp' );
-               if (cookieVal){
-                       var pairs = cookieVal.split('&');
-                       for(var i=0; i < pairs.length; i++)
+               if ( cookieVal ) {
+                       var pairs = cookieVal.split( '&' );
+                       for ( var i = 0; i < pairs.length; i++ )
                        {
-                               var name_value = pairs[i].split('=');
-                               this.preference[name_value[0]]=name_value[1];
-                               //js_log('load preference for ' + name_value[0] + ' is ' + name_value[1]);
+                               var name_value = pairs[i].split( '=' );
+                               this.preference[name_value[0]] = name_value[1];
+                               // js_log('load preference for ' + name_value[0] + ' is ' + name_value[1]);
                        }
                }
        },
-       savePreferences : function(){
-               var cookieVal = '';             
-               for(var i in this.preference)
-                       cookieVal+= i + '='+ this.preference[i] + '&';
+       savePreferences : function() {
+               var cookieVal = '';
+               for ( var i in this.preference )
+                       cookieVal += i + '=' + this.preference[i] + '&';
                        
-               cookieVal=cookieVal.substr(0, cookieVal.length-1);              
-               var week = 7*86400*1000;
+               cookieVal = cookieVal.substr( 0, cookieVal.length - 1 );
+               var week = 7 * 86400 * 1000;
                $j.cookie( 'ogg_player_exp', cookieVal, { 'expires':week } );
        }
 };
@@ -2494,137 +2494,137 @@ mediaPlayers.prototype =
 var embedTypes = {
         // List of players
         players: null,
-        detect_done:false,      
-        init: function(){
-               //detect supported types
+        detect_done:false,
+        init: function() {
+               // detect supported types
                this.detect();
-               this.detect_done=true;
+               this.detect_done = true;
        },
        clientSupports: { 'thumbnail' : true },
-       supportedMimeType: function(mimetype) {
-               for (var i = navigator.plugins.length; i-- > 0; ) {
+       supportedMimeType: function( mimetype ) {
+               for ( var i = navigator.plugins.length; i-- > 0; ) {
                        var plugin = navigator.plugins[i];
-                       if (typeof plugin[mimetype] != "undefined")
+                       if ( typeof plugin[mimetype] != "undefined" )
                          return true;
                }
                return false;
        },
 
         detect: function() {
-                js_log("running detect");
+                js_log( "running detect" );
                this.players = new mediaPlayers();
-               //every browser supports html rendering:
-               this.players.addPlayer( htmlPlayer );                   
+               // every browser supports html rendering:
+               this.players.addPlayer( htmlPlayer );
                 // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to
                 // search navigator.mimeTypes to see if it's installed
-                var javaEnabled = navigator.javaEnabled();                              
+                var javaEnabled = navigator.javaEnabled();
                 // Some browsers filter out duplicate mime types, hiding some plugins
-                var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;            
+                var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;
                 // Opera will switch off javaEnabled in preferences if java can't be found.
                 // And it doesn't register an application/x-java-applet mime type like Mozilla does.
                 if ( javaEnabled )
-                        this.players.addPlayer( cortadoPlayer );                               
+                        this.players.addPlayer( cortadoPlayer );
                
                 // ActiveX plugins
-                if($j.browser.msie){
+                if ( $j.browser.msie ) {
                        // check for flash               
-                       if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){                                  
-                               //try to get the flash version for omtk include: 
+                       if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash' ) ) {
+                               // try to get the flash version for omtk include: 
                                try {
-                                       a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
-                                       d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
-                                       if (d) {
-                                               d = d.split(" ")[1].split(",");                                         
-                                               //we need flash version 10 or greater:
-                                               if(parseInt( d[0]) >=10){
+                                       a = new ActiveXObject( SHOCKWAVE_FLASH_AX + ".7" );
+                                       d = a.GetVariable( "$version" );        // Will crash fp6.0.21/23/29
+                                       if ( d ) {
+                                               d = d.split( " " )[1].split( "," );
+                                               // we need flash version 10 or greater:
+                                               if ( parseInt( d[0] ) >= 10 ) {
                                                        this.players.addPlayer( omtkPlayer );
-                                               }                                       
-                                       }                                       
-                               }catch(e) {
-                                       //failed to check for flash
-                               }                               
-                               //flowplayer has pretty good compatiablity 
+                                               }
+                                       }
+                               } catch ( e ) {
+                                       // failed to check for flash
+                               }
+                               // flowplayer has pretty good compatiablity 
                                // (but if we wanted to be fancy we would check for version of flash and update the mp4/h.264 support
-                               
-                               //this.players.addPlayer( kplayer );
-                               this.players.addPlayer( flowPlayer );                              
+
+                               // this.players.addPlayer( kplayer );
+                               this.players.addPlayer( flowPlayer );
                        }
                         // VLC
                         if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) )
-                                this.players.addPlayer(vlcActiveXPlayer);
+                                this.players.addPlayer( vlcActiveXPlayer );
                                 
                         // Java ActiveX
                         if ( this.testActiveX( 'JavaWebStart.isInstalled' ) )
                                 this.players.addPlayer( cortadoPlayer );
                         // quicktime (currently off) 
-                        //if ( this.testActiveX( 'QuickTimeCheckObject.QuickTimeCheck.1' ) )
+                        // if ( this.testActiveX( 'QuickTimeCheckObject.QuickTimeCheck.1' ) )
                         //     this.players.addPlayer(quicktimeActiveXPlayer);                  
-                }                               
+                }
                // <video> element
                if ( typeof HTMLVideoElement == 'object' // Firefox, Safari
                                || typeof HTMLVideoElement == 'function' ) // Opera
                {
-                       //do another test for safari: 
-                       if( $j.browser.safari ){                                
-                               try{
-                                       var dummyvid = document.createElement("video");
-                                       if (dummyvid.canPlayType && dummyvid.canPlayType("video/ogg;codecs=\"theora,vorbis\"") == "probably")
+                       // do another test for safari: 
+                       if ( $j.browser.safari ) {
+                               try {
+                                       var dummyvid = document.createElement( "video" );
+                                       if ( dummyvid.canPlayType && dummyvid.canPlayType( "video/ogg;codecs=\"theora,vorbis\"" ) == "probably" )
                                        {
                                                this.players.addPlayer( videoElementPlayer );
-                                       } else if(this.supportedMimeType( 'video/ogg' )) {
+                                       } else if ( this.supportedMimeType( 'video/ogg' ) ) {
                                                /* older versions of safari do not support canPlayType,
                                                   but xiph qt registers mimetype via quicktime plugin */
                                                this.players.addPlayer( videoElementPlayer );
                                        } else {
-                                               //@@todo add some user nagging to install the xiph qt 
+                                               // @@todo add some user nagging to install the xiph qt 
                                        }
-                               }catch(e){
-                                       js_log('could not run canPlayType in safari');
+                               } catch ( e ) {
+                                       js_log( 'could not run canPlayType in safari' );
                                }
-                       }else{
+                       } else {
                                this.players.addPlayer( videoElementPlayer );
                        }
-               }                
+               }
                
                 // "navigator" plugins
-               if( navigator.mimeTypes && navigator.mimeTypes.length > 0) {
+               if ( navigator.mimeTypes && navigator.mimeTypes.length > 0 ) {
                        for ( var i = 0; i < navigator.mimeTypes.length; i++ ) {
                                var type = navigator.mimeTypes[i].type;
                                var semicolonPos = type.indexOf( ';' );
-                               if ( semicolonPos > -1 ) {
+                               if ( semicolonPos > - 1 ) {
                                        type = type.substr( 0, semicolonPos );
                                }
-                               //js_log('on type: '+type);
+                               // js_log('on type: '+type);
                                var pluginName = navigator.mimeTypes[i].enabledPlugin ? navigator.mimeTypes[i].enabledPlugin.name : '';
                                if ( !pluginName ) {
                                        // In case it is null or undefined
                                        pluginName = '';
-                               }                               
+                               }
                                if ( pluginName.toLowerCase() == 'vlc multimedia plugin' || pluginName.toLowerCase() == 'vlc multimedia plug-in' ) {
-                                       this.players.addPlayer( vlcPlayer, type);
+                                       this.players.addPlayer( vlcPlayer, type );
                                        continue;
                                }
                
                                if ( type == 'application/x-java-applet' ) {
                                        this.players.addPlayer( cortadoPlayer );
                                        continue;
-                               }                               
+                               }
                
                                if ( type == 'application/ogg' ) {
-                                       if ( pluginName.toLowerCase() == 'vlc multimedia plugin' ){
-                                               this.players.addPlayer(vlcMozillaPlayer, type);
-                                       //else if ( pluginName.indexOf( 'QuickTime' ) > -1 )
+                                       if ( pluginName.toLowerCase() == 'vlc multimedia plugin' ) {
+                                               this.players.addPlayer( vlcMozillaPlayer, type );
+                                       // else if ( pluginName.indexOf( 'QuickTime' ) > -1 )
                                        //      this.players.addPlayer(quicktimeMozillaPlayer);
-                                       }else{
-                                               this.players.addPlayer(oggPluginPlayer);
+                                       } else {
+                                               this.players.addPlayer( oggPluginPlayer );
                                        }
                                        continue;
                                } else if ( uniqueMimesOnly ) {
                                        if ( type == 'application/x-vlc-player' ) {
-                                               this.players.addPlayer(vlcMozillaPlayer, type);
+                                               this.players.addPlayer( vlcMozillaPlayer, type );
                                                continue;
                                        } else if ( type == 'video/quicktime' ) {
-                                               //this.players.addPlayer(quicktimeMozillaPlayer);
+                                               // this.players.addPlayer(quicktimeMozillaPlayer);
                                                continue;
                                        }
                                }
@@ -2633,28 +2633,28 @@ var embedTypes = {
                                        this.players.addPlayer(vlcMozillaPlayer, type);
                                        continue;
                                }*/
-                               if( type == 'application/x-shockwave-flash' ){
+                               if ( type == 'application/x-shockwave-flash' ) {
                                
-                                       //this.players.addPlayer( kplayer );
-                                       this.players.addPlayer( flowPlayer );   
+                                       // this.players.addPlayer( kplayer );
+                                       this.players.addPlayer( flowPlayer );
                                        
-                                       //check version to add omtk:
+                                       // check version to add omtk:
                                        var flashDescription = navigator.plugins["Shockwave Flash"].description;
-                                       var descArray = flashDescription.split(" ");
-                                       var tempArrayMajor = descArray[2].split(".");
+                                       var descArray = flashDescription.split( " " );
+                                       var tempArrayMajor = descArray[2].split( "." );
                                        var versionMajor = tempArrayMajor[0];
-                                       //js_log("version of flash: " + versionMajor);
-                                       if(versionMajor >= 10){
+                                       // js_log("version of flash: " + versionMajor);
+                                       if ( versionMajor >= 10 ) {
                                                this.players.addPlayer( omtkPlayer );
-                                       }                                       
+                                       }
                                        continue;
                                }
                        }
                }
-               //@@The xiph quicktime component does not work well with annodex streams (temporarly disable)
-               //this.clientSupports['quicktime-mozilla'] = false;
-               //this.clientSupports['quicktime-activex'] = false;
-               //js_log(this.clientSupports);
+               // @@The xiph quicktime component does not work well with annodex streams (temporarly disable)
+               // this.clientSupports['quicktime-mozilla'] = false;
+               // this.clientSupports['quicktime-activex'] = false;
+               // js_log(this.clientSupports);
        },
        testActiveX : function ( name ) {
                 var hasObj = true;
@@ -2665,5 +2665,5 @@ var embedTypes = {
                         hasObj = false;
                 }
                 return hasObj;
-       }        
+       }
 };
index 9540bbe..f41109a 100644 (file)
@@ -16,7 +16,7 @@
  * 
  * Version: 3.0.0-rc5 - Thu Nov 20 2008 22:09:49 GMT-0000 (GMT+00:00)
  */
-(function() {
+( function() {
  
 /* 
        FEATURES 
        - player loading / unloading
        - $f() function
        - jQuery support
-*/ 
+*/
  
 
 /*jslint glovar: true, browser: true */
 /*global flowplayer, $f */
 
 // {{{ private utility methods
-       
-       function log(args) {
+
+       function log( args ) {
                
                // write into opera console
-               if (typeof opera == 'object') {
-                       opera.postError("$f.fireEvent: " + args.join(" | "));   
+               if ( typeof opera == 'object' ) {
+                       opera.postError( "$f.fireEvent: " + args.join( " | " ) );
 
                        
-               } else if (typeof console == 'object') {
-                       console.log("$f.fireEvent", [].slice.call(args));       
+               } else if ( typeof console == 'object' ) {
+                       console.log( "$f.fireEvent", [].slice.call( args ) );
                }
        }
 
                
        // thanks: http://keithdevens.com/weblog/archive/2007/Jun/07/javascript.clone
-       function clone(obj) {   
-               if (!obj || typeof obj != 'object') { return obj; }             
-               var temp = new obj.constructor();       
-               for (var key in obj) {  
-                       if (obj.hasOwnProperty(key)) {
-                               temp[key] = clone(obj[key]);
+       function clone ( obj ) {
+               if ( !obj || typeof obj != 'object' ) { return obj; }
+               var temp = new obj.constructor();
+               for ( var key in obj ) {
+                       if ( obj.hasOwnProperty( key ) ) {
+                               temp[key] = clone ( obj[key] );
                        }
-               }               
+               }
                return temp;
        }
 
        // stripped from jQuery, thanks John Resig 
-       function each(obj, fn) {
-               if (!obj) { return; }
+       function each( obj, fn ) {
+               if ( !obj ) { return; }
                
                var name, i = 0, length = obj.length;
        
                // object
-               if (length === undefined) {
-                       for (name in obj) {
-                               if (fn.call(obj[name], name, obj[name]) === false) { break; }
+               if ( length === undefined ) {
+                       for ( name in obj ) {
+                               if ( fn.call( obj[name], name, obj[name] ) === false ) { break; }
                        }
                        
                // array
                } else {
-                       for (var value = obj[0];
-                               i < length && fn.call( value, i, value ) !== false; value = obj[++i]) {                         
+                       for ( var value = obj[0];
+                               i < length && fn.call( value, i, value ) !== false; value = obj[++i] ) {
                        }
                }
        
 
        
        // convenience
-       function el(id) {
-               return document.getElementById(id);      
-       }       
+       function el( id ) {
+               return document.getElementById( id );
+       }
 
        
        // used extensively. a very simple implementation. 
-       function extend(to, from, skipFuncs) {
-               if (to && from) {                       
-                       each(from, function(name, value) {
-                               if (!skipFuncs || typeof value != 'function') {
-                                       to[name] = value;               
+       function extend( to, from, skipFuncs ) {
+               if ( to && from ) {
+                       each( from, function( name, value ) {
+                               if ( !skipFuncs || typeof value != 'function' ) {
+                                       to[name] = value;
                                }
-                       });
+                       } );
                }
        }
        
        // var arr = select("elem.className"); 
-       function select(query) {
-               var index = query.indexOf("."); 
-               if (index != -1) {
-                       var tag = query.substring(0, index) || "*";
-                       var klass = query.substring(index + 1, query.length);
+       function select( query ) {
+               var index = query.indexOf( "." );
+               if ( index != - 1 ) {
+                       var tag = query.substring( 0, index ) || "*";
+                       var klass = query.substring( index + 1, query.length );
                        var els = [];
-                       each(document.getElementsByTagName(tag), function() {
-                               if (this.className && this.className.indexOf(klass) != -1) {
-                                       els.push(this);         
+                       each( document.getElementsByTagName( tag ), function() {
+                               if ( this.className && this.className.indexOf( klass ) != - 1 ) {
+                                       els.push( this );
                                }
-                       });
+                       } );
                        return els;
                }
        }
        
        // fix event inconsistencies across browsers
-       function stopEvent(e) {
+       function stopEvent( e ) {
                e = e || window.event;
                
-               if (e.preventDefault) {
+               if ( e.preventDefault ) {
                        e.stopPropagation();
                        e.preventDefault();
                        
                } else {
-                       e.returnValue = false;  
+                       e.returnValue = false;
                        e.cancelBubble = true;
-               } 
+               }
                return false;
        }
 
        // push an event listener into existing array of listeners
-       function bind(to, evt, fn) {
+       function bind( to, evt, fn ) {
                to[evt] = to[evt] || [];
-               to[evt].push(fn);               
+               to[evt].push( fn );
        }
        
        
        // generates an unique id
    function makeId() {
-         return "_" + ("" + Math.random()).substring(2, 10);   
+         return "_" + ( "" + Math.random() ).substring( 2, 10 );
    }
        
-//}}}  
-       
+// }}} 
+
 
 // {{{ Clip
 
-       var Clip = function(json, index, player) {
+       var Clip = function( json, index, player ) {
                
                // private variables
                var self = this;
-               var cuepoints = {};
-               var listeners = {}; 
+               var cuepoints = { };
+               var listeners = { };
                this.index = index;
                
                // instance variables
-               if (typeof json == 'string') {
-                       json = {url:json};      
+               if ( typeof json == 'string' ) {
+                       json = { url:json };
                }
        
-               extend(this, json, true);       
+               extend( this, json, true );
                
                // event handling 
-               each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),
+               each( ( "Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop" ).split( "," ),
                        function() {
                        
                        var evt = "on" + this;
                                
                        // before event
-                       if (evt.indexOf("*") != -1) {
-                               evt = evt.substring(0, evt.length -1); 
-                               var before = "onBefore" + evt.substring(2); 
+                       if ( evt.indexOf( "*" ) != - 1 ) {
+                               evt = evt.substring( 0, evt.length - 1 );
+                               var before = "onBefore" + evt.substring( 2 );
                                
-                               self[before] = function(fn) {
-                                       bind(listeners, before, fn);
+                               self[before] = function( fn ) {
+                                       bind( listeners, before, fn );
                                        return self;
-                               };                              
-                       }  
+                               };
+                       }
                        
-                       self[evt] = function(fn) {
-                               bind(listeners, evt, fn);
+                       self[evt] = function( fn ) {
+                               bind( listeners, evt, fn );
                                return self;
                        };
                        
                        
                        // set common clip event listeners to player level
-                       if (index == -1) {
-                               if (self[before]) {
-                                       player[before] = self[before];          
-                               }                               
-                               if (self[evt])  {
-                                       player[evt] = self[evt];                
+                       if ( index == - 1 ) {
+                               if ( self[before] ) {
+                                       player[before] = self[before];
+                               }
+                               if ( self[evt] )  {
+                                       player[evt] = self[evt];
                                }
                        }
                        
-               });                       
+               } );
                
-               extend(this, {
+               extend( this, {
                        
                         
-                       onCuepoint: function(points, fn) {
+                       onCuepoint: function( points, fn ) {
                                
                                // embedded cuepoints
-                               if (arguments.length == 1) {
+                               if ( arguments.length == 1 ) {
                                        cuepoints.embedded = [null, points];
                                        return self;
                                }
                                
-                               if (typeof points == 'number') {
-                                       points = [points];      
+                               if ( typeof points == 'number' ) {
+                                       points = [points];
                                }
                                
-                               var fnId = makeId();  
-                               cuepoints[fnId] = [points, fn]; 
+                               var fnId = makeId();
+                               cuepoints[fnId] = [points, fn];
                                
-                               if (player.isLoaded()) {
-                                       player._api().fp_addCuepoints(points, index, fnId);     
-                               }  
+                               if ( player.isLoaded() ) {
+                                       player._api().fp_addCuepoints( points, index, fnId );
+                               }
                                
                                return self;
                        },
                        
-                       update: function(json) {
-                               extend(self, json);
+                       update: function( json ) {
+                               extend( self, json );
 
-                               if (player.isLoaded()) {
-                                       player._api().fp_updateClip(json, index);       
+                               if ( player.isLoaded() ) {
+                                       player._api().fp_updateClip( json, index );
                                }
-                               var conf = player.getConfig(); 
-                               var clip = (index == -1) ? conf.clip : conf.playlist[index];
-                               extend(clip, json, true);
+                               var conf = player.getConfig();
+                               var clip = ( index == - 1 ) ? conf.clip : conf.playlist[index];
+                               extend( clip, json, true );
                        },
                        
                        
                        // internal event for performing clip tasks. should be made private someday
-                       _fireEvent: function(evt, arg1, arg2, target) {                          
+                       _fireEvent: function( evt, arg1, arg2, target ) {
                                
-                               if (evt == 'onLoad') { 
-                                       each(cuepoints, function(key, val) {
-                                               player._api().fp_addCuepoints(val[0], index, key);               
-                                       }); 
+                               if ( evt == 'onLoad' ) {
+                                       each( cuepoints, function( key, val ) {
+                                               player._api().fp_addCuepoints( val[0], index, key );
+                                       } );
                                        return false;
-                               }                                       
+                               }
                                
                                // target clip we are working against
-                               if (index != -1) {
-                                       target = self;  
+                               if ( index != - 1 ) {
+                                       target = self;
                                }
                                
-                               if (evt == 'onCuepoint') {
+                               if ( evt == 'onCuepoint' ) {
                                        var fn = cuepoints[arg1];
-                                       if (fn) {
-                                               return fn[1].call(player, target, arg2);
+                                       if ( fn ) {
+                                               return fn[1].call( player, target, arg2 );
                                        }
-                               }  
+                               }
        
-                               if (evt == 'onStart' || evt == 'onUpdate') {
+                               if ( evt == 'onStart' || evt == 'onUpdate' ) {
                                        
-                                       extend(target, arg1);                                   
+                                       extend( target, arg1 );
                                        
-                                       if (!target.duration) {
-                                               target.duration = arg1.metaData.duration;        
+                                       if ( !target.duration ) {
+                                               target.duration = arg1.metaData.duration;
                                        } else {
-                                               target.fullDuration = arg1.metaData.duration;   
-                                       }                                         
-                               }  
+                                               target.fullDuration = arg1.metaData.duration;
+                                       }
+                               }
                                
                                var ret = true;
-                               each(listeners[evt], function() {
-                                       ret = this.call(player, target, arg1);          
-                               }); 
-                               return ret;                             
-                       }                       
+                               each( listeners[evt], function() {
+                                       ret = this.call( player, target, arg1 );
+                               } );
+                               return ret;
+                       }
                        
-               });
+               } );
                
                
                // get cuepoints from config
-               if (json.onCuepoint) {
-                       self.onCuepoint.apply(self, json.onCuepoint);
+               if ( json.onCuepoint ) {
+                       self.onCuepoint.apply( self, json.onCuepoint );
                        delete json.onCuepoint;
-               } 
+               }
                
                // get other events
-               each(json, function(key, val) {
-                       if (typeof val == 'function') {
-                               bind(listeners, key, val);
-                               delete json[key];       
+               each( json, function( key, val ) {
+                       if ( typeof val == 'function' ) {
+                               bind( listeners, key, val );
+                               delete json[key];
                        }
-               });
+               } );
 
                
                // setup common clip event callbacks for Player object too (shortcuts)
-               if (index == -1) {
-                       player.onCuepoint = this.onCuepoint;    
+               if ( index == - 1 ) {
+                       player.onCuepoint = this.onCuepoint;
                }
        
        };
 
-//}}}
+// }}}
 
 
 // {{{ Plugin
-               
-       var Plugin = function(name, json, player, fn) {
+
+       var Plugin = function( name, json, player, fn ) {
        
-               var listeners = {};
-               var self = this;   
+               var listeners = { };
+               var self = this;
                var hasMethods = false;
        
-               if (fn) {
-                       extend(listeners, fn);  
-               }   
+               if ( fn ) {
+                       extend( listeners, fn );
+               }
                
                // custom callback functions in configuration
-               each(json, function(key, val) {
-                       if (typeof val == 'function') {
+               each( json, function( key, val ) {
+                       if ( typeof val == 'function' ) {
                                listeners[key] = val;
-                               delete json[key];       
+                               delete json[key];
                        }
-               });  
+               } );
                
                // core plugin methods          
-               extend(this, {
+               extend( this, {
   
-                       animate: function(props, speed, fn) { 
-                               if (!props) {
-                                       return self;    
+                       animate: function( props, speed, fn ) {
+                               if ( !props ) {
+                                       return self;
                                }
                                
-                               if (typeof speed == 'function') { 
-                                       fn = speed; 
+                               if ( typeof speed == 'function' ) {
+                                       fn = speed;
                                        speed = 500;
                                }
                                
-                               if (typeof props == 'string') {
+                               if ( typeof props == 'string' ) {
                                        var key = props;
-                                       props = {};
+                                       props = { };
                                        props[key] = speed;
-                                       speed = 500; 
+                                       speed = 500;
                                }
                                
-                               if (fn) {
+                               if ( fn ) {
                                        var fnId = makeId();
                                        listeners[fnId] = fn;
                                }
                
-                               if (speed === undefined) { speed = 500; }
-                               json = player._api().fp_animate(name, props, speed, fnId);      
+                               if ( speed === undefined ) { speed = 500; }
+                               json = player._api().fp_animate( name, props, speed, fnId );
                                return self;
                        },
                        
-                       css: function(props, val) {
-                               if (val !== undefined) {
-                                       var css = {};
+                       css: function( props, val ) {
+                               if ( val !== undefined ) {
+                                       var css = { };
                                        css[props] = val;
-                                       props = css;                                    
+                                       props = css;
                                }
-                               try{
-                                       json = player._api().fp_css(name, props);
-                                       extend(self, json);
+                               try {
+                                       json = player._api().fp_css( name, props );
+                                       extend( self, json );
                                        return self;
-                               }catch(e){
-                                       js_log('flow player could not set css: ' + json);
+                               } catch ( e ) {
+                                       js_log( 'flow player could not set css: ' + json );
                                }
                        },
                        
                        show: function() {
                                this.display = 'block';
-                               player._api().fp_showPlugin(name);
+                               player._api().fp_showPlugin( name );
                                return self;
                        },
                        
                        hide: function() {
                                this.display = 'none';
-                               player._api().fp_hidePlugin(name);
+                               player._api().fp_hidePlugin( name );
                                return self;
                        },
                        
                        toggle: function() {
-                               this.display = player._api().fp_togglePlugin(name);
+                               this.display = player._api().fp_togglePlugin( name );
                                return self;
-                       },                      
+                       },
                        
-                       fadeTo: function(o, speed, fn) {
+                       fadeTo: function( o, speed, fn ) {
                                
-                               if (typeof speed == 'function') { 
-                                       fn = speed; 
+                               if ( typeof speed == 'function' ) {
+                                       fn = speed;
                                        speed = 500;
                                }
                                
-                               if (fn) {
+                               if ( fn ) {
                                        var fnId = makeId();
                                        listeners[fnId] = fn;
-                               }                               
-                               this.display = player._api().fp_fadeTo(name, o, speed, fnId);
+                               }
+                               this.display = player._api().fp_fadeTo( name, o, speed, fnId );
                                this.opacity = o;
                                return self;
                        },
                        
-                       fadeIn: function(speed, fn) { 
-                               return self.fadeTo(1, speed, fn);                               
+                       fadeIn: function( speed, fn ) {
+                               return self.fadeTo( 1, speed, fn );
                        },
        
-                       fadeOut: function(speed, fn) {
-                               return self.fadeTo(0, speed, fn);       
+                       fadeOut: function( speed, fn ) {
+                               return self.fadeTo( 0, speed, fn );
                        },
                        
                        getName: function() {
-                               return name;    
+                               return name;
                        },
                        
                        
                        // internal method not meant to be used by clients
-                _fireEvent: function(evt, arg) {
+                _fireEvent: function( evt, arg ) {
 
                                
                        // update plugins properties & methods
-                       if (evt == 'onUpdate') {
-                          var json = arg || player._api().fp_getPlugin(name); 
-                                       if (!json) { return;    }                                       
+                       if ( evt == 'onUpdate' ) {
+                          var json = arg || player._api().fp_getPlugin( name );
+                                       if ( !json ) { return;  }
                                        
-                          extend(self, json);
+                          extend( self, json );
                           delete self.methods;
                                        
-                          if (!hasMethods) {
-                                 each(json.methods, function() {
-                                        var method = "" + this;           
+                          if ( !hasMethods ) {
+                                 each( json.methods, function() {
+                                        var method = "" + this;
                                                        
                                         self[method] = function() {
-                                               var a = [].slice.call(arguments);
-                                               var ret = player._api().fp_invoke(name, method, a); 
+                                               var a = [].slice.call( arguments );
+                                               var ret = player._api().fp_invoke( name, method, a );
                                                return ret == 'undefined' ? self : ret;
                                         };
-                                 });
-                                 hasMethods = true;             
+                                 } );
+                                 hasMethods = true;
                           }
                        }
                        
                        // plugin callbacks
                        var fn = listeners[evt];
 
-                               if (fn) {
+                               if ( fn ) {
                                        
-                                       fn.call(self, arg);
+                                       fn.call( self, arg );
                                        
                                        // "one-shot" callback
-                                       if (evt.substring(0, 1) == "_") {
-                                               delete listeners[evt];  
-                                       } 
-                       }                
-                }                                       
+                                       if ( evt.substring( 0, 1 ) == "_" ) {
+                                               delete listeners[evt];
+                                       }
+                       }
+                }
                        
-               });
+               } );
 
        };
 
 
-//}}}
+// }}}
 
 
-function Player(wrapper, params, conf) {   
+function Player( wrapper, params, conf ) {
                
        // private variables (+ arguments)
-       var 
-               self = this, 
-               api = null, 
-               html, 
-               commonClip, 
-               playlist = [], 
-               plugins = {},
-               listeners = {},
+       var
+               self = this,
+               api = null,
+               html,
+               commonClip,
+               playlist = [],
+               plugins = { },
+               listeners = { },
                playerId,
                apiId,
                activeIndex,
                swfHeight,
-               wrapperHeight;  
+               wrapperHeight;
 
   
 // {{{ public methods 
-       
-       extend(self, {
+
+       extend( self, {
                        
                id: function() {
-                       return playerId;        
-               }, 
+                       return playerId;
+               },
                
                isLoaded: function() {
-                       return (api !== null);  
+                       return ( api !== null );
                },
                
                getParent: function() {
-                       return wrapper; 
+                       return wrapper;
                },
                
-               hide: function(all) {
-                       if (all) { wrapper.style.height = "0px"; }
-                       if (api) { api.style.height = "0px"; } 
+               hide: function( all ) {
+                       if ( all ) { wrapper.style.height = "0px"; }
+                       if ( api ) { api.style.height = "0px"; }
                        return self;
                },
 
                show: function() {
                        wrapper.style.height = wrapperHeight + "px";
-                       if (api) { api.style.height = swfHeight + "px"; }
+                       if ( api ) { api.style.height = swfHeight + "px"; }
                        return self;
-               }, 
+               },
                                        
                isHidden: function() {
-                       return api && parseInt(api.style.height, 10) === 0;
+                       return api && parseInt( api.style.height, 10 ) === 0;
                },
                
                
-               load: function(fn) { 
+               load: function( fn ) {
                        
-                       if (!api && self._fireEvent("onBeforeLoad") !== false) {
+                       if ( !api && self._fireEvent( "onBeforeLoad" ) !== false ) {
                                
                                // unload all instances
-                               each(players, function()  {
-                                       this.unload();          
-                               });
+                               each( players, function()  {
+                                       this.unload();
+                               } );
                                
-                               html = wrapper.innerHTML; 
-                               flashembed(wrapper, params, {config: conf});
+                               html = wrapper.innerHTML;
+                               flashembed( wrapper, params, { config: conf } );
                                
                                // function argument
-                               if (fn) {
+                               if ( fn ) {
                                        fn.cached = true;
-                                       bind(listeners, "onLoad", fn);  
+                                       bind( listeners, "onLoad", fn );
                                }
                        }
                        
-                       return self;    
+                       return self;
                },
                
-               unload: function() {  
+               unload: function() {
                        
-                if (api && html.replace(/\s/g, '') !== '' && !api.fp_isFullscreen() && 
-                       self._fireEvent("onBeforeUnload") !== false) { 
+                if ( api && html.replace( /\s/g, '' ) !== '' && !api.fp_isFullscreen() &&
+                       self._fireEvent( "onBeforeUnload" ) !== false ) {
                                api.fp_close();
-                               wrapper.innerHTML = html; 
-                               self._fireEvent("onUnload");
+                               wrapper.innerHTML = html;
+                               self._fireEvent( "onUnload" );
                                api = null;
                        }
                        
                        return self;
                },
 
-               getClip: function(index) {
-                       if (index === undefined) {
-                               index = activeIndex;    
+               getClip: function( index ) {
+                       if ( index === undefined ) {
+                               index = activeIndex;
                        }
                        return playlist[index];
                },
                
                
                getCommonClip: function() {
-                       return commonClip;      
-               },              
+                       return commonClip;
+               },
                
                getPlaylist: function() {
-                       return playlist; 
+                       return playlist;
                },
                
-         getPlugin: function(name) {  
+         getPlugin: function( name ) {
                 var plugin = plugins[name];
                 
                        // create plugin if nessessary
-                if (!plugin && self.isLoaded()) {
-                               var json = self._api().fp_getPlugin(name);
-                               if (json) {
-                                       plugin = new Plugin(name, json, self);
-                                       plugins[name] = plugin;                                           
-                               } 
-                }              
-                return plugin; 
+                if ( !plugin && self.isLoaded() ) {
+                               var json = self._api().fp_getPlugin( name );
+                               if ( json ) {
+                                       plugin = new Plugin( name, json, self );
+                                       plugins[name] = plugin;
+                               }
+                }
+                return plugin;
          },
                
-               getScreen: function() { 
-                       return self.getPlugin("screen");
-               }, 
+               getScreen: function() {
+                       return self.getPlugin( "screen" );
+               },
                
-               getControls: function() { 
-                       return self.getPlugin("controls");
-               }, 
+               getControls: function() {
+                       return self.getPlugin( "controls" );
+               },
 
-               getConfig: function() { 
-                       return clone(conf);
+               getConfig: function() {
+                       return clone ( conf );
                },
                
-               getFlashParams: function() { 
+               getFlashParams: function() {
                        return params;
-               },              
+               },
                
-               loadPlugin: function(name, url, props, fn) { 
+               loadPlugin: function( name, url, props, fn ) {
 
                        // properties not supplied                      
-                       if (typeof props == 'function') { 
-                               fn = props; 
-                               props = {};
-                       } 
+                       if ( typeof props == 'function' ) {
+                               fn = props;
+                               props = { };
+                       }
                        
                        // if fn not given, make a fake id so that plugin's onUpdate get's fired
-                       var fnId = fn ? makeId() : "_"; 
-                       self._api().fp_loadPlugin(name, url, props, fnId); 
+                       var fnId = fn ? makeId() : "_";
+                       self._api().fp_loadPlugin( name, url, props, fnId );
                        
                        // create new plugin
-                       var arg = {};
+                       var arg = { };
                        arg[fnId] = fn;
-                       var p = new Plugin(name, null, self, arg);
+                       var p = new Plugin( name, null, self, arg );
                        plugins[name] = p;
-                       return p;                       
+                       return p;
                },
                
                
                getState: function() {
-                       return api ? api.fp_getState() : -1;
+                       return api ? api.fp_getState() : - 1;
                },
                
                // "lazy" play
-               play: function(clip) {
+               play: function( clip ) {
                        
                        function play() {
-                               if (clip !== undefined) {
-                                       self._api().fp_play(clip);
+                               if ( clip !== undefined ) {
+                                       self._api().fp_play( clip );
                                } else {
-                                       if(typeof self._api().fp_play == 'function')
-                                               self._api().fp_play();  
+                                       if ( typeof self._api().fp_play == 'function' )
+                                               self._api().fp_play();
                                }
                        }
                        
-                       if (api) {
+                       if ( api ) {
                                play();
                                
                        } else {
-                               self.load(function() { 
+                               self.load( function() {
                                        play();
-                               });
+                               } );
                        }
                        
                        return self;
@@ -645,294 +645,294 @@ function Player(wrapper, params, conf) {
                
                getVersion: function() {
                        var js = "flowplayer.js 3.0.0-rc5";
-                       if (api) {
+                       if ( api ) {
                                var ver = api.fp_getVersion();
-                               ver.push(js);
+                               ver.push( js );
                                return ver;
                        }
-                       return js; 
+                       return js;
                },
                
                _api: function() {
-                       if (!api) {
-                               throw "Flowplayer " +self.id()+ " not loaded. Try moving your call to player's onLoad event";
+                       if ( !api ) {
+                               throw "Flowplayer " + self.id() + " not loaded. Try moving your call to player's onLoad event";
                        }
-                       return api;                             
+                       return api;
                },
                
                _dump: function() {
-                       console.log(listeners);
+                       console.log( listeners );
                }
                
-       }); 
+       } );
        
        
        // event handlers
-       each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,Fullscreen*,FullscreenExit,Error").split(","),
-               function() {             
+       each( ( "Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,Fullscreen*,FullscreenExit,Error" ).split( "," ),
+               function() {
                        var name = "on" + this;
                        
                        // before event
-                       if (name.indexOf("*") != -1) {
-                               name = name.substring(0, name.length -1); 
-                               var name2 = "onBefore" + name.substring(2);
-                               self[name2] = function(fn) {
-                                       bind(listeners, name2, fn);     
+                       if ( name.indexOf( "*" ) != - 1 ) {
+                               name = name.substring( 0, name.length - 1 );
+                               var name2 = "onBefore" + name.substring( 2 );
+                               self[name2] = function( fn ) {
+                                       bind( listeners, name2, fn );
                                        return self;
-                               };                                              
+                               };
                        }
                        
                        // normal event
-                       self[name] = function(fn) {
-                               bind(listeners, name, fn);      
+                       self[name] = function( fn ) {
+                               bind( listeners, name, fn );
                                return self;
-                       };                       
+                       };
                }
-       ); 
+       );
        
        
        // core API methods
-       each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,reset").split(","),         
-               function() {             
+       each( ( "pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,reset" ).split( "," ),
+               function() {
                        var name = this;
                        
-                       self[name] = function(arg) {
-                               if (!api) { return self; }
-                               try{
-                                       var ret = (arg === undefined) ? api["fp_" + name]() : api["fp_" + name](arg);
+                       self[name] = function( arg ) {
+                               if ( !api ) { return self; }
+                               try {
+                                       var ret = ( arg === undefined ) ? api["fp_" + name]() : api["fp_" + name]( arg );
                                        return ret == 'undefined' ? self : ret;
-                               }catch (e){
-                                       js_log('flowplayer could not access fp_ '+ name);
+                               } catch ( e ) {
+                                       js_log( 'flowplayer could not access fp_ ' + name );
                                }
-                       };                       
+                       };
                }
-       );               
+       );
        
-//}}}
+// }}}
 
 
 // {{{ public method: _fireEvent
-               
-       self._fireEvent = function(evt, arg0, arg1, arg2) {             
+
+       self._fireEvent = function( evt, arg0, arg1, arg2 ) {
                                
-               if (conf.debug) {
-                       log(arguments);         
-               }                               
+               if ( conf.debug ) {
+                       log( arguments );
+               }
                
                // internal onLoad
-               if (evt == 'onLoad' && !api) {  
+               if ( evt == 'onLoad' && !api ) {
                        
-                       api = api || el(apiId); 
+                       api = api || el( apiId );
                        swfHeight = api.clientHeight;
                        
-                       each(playlist, function() {
-                               this._fireEvent("onLoad");              
-                       });
+                       each( playlist, function() {
+                               this._fireEvent( "onLoad" );
+                       } );
                        
-                       each(plugins, function(name, p) {
-                               p._fireEvent("onUpdate");               
-                       });
+                       each( plugins, function( name, p ) {
+                               p._fireEvent( "onUpdate" );
+                       } );
                        
                        
-                       commonClip._fireEvent("onLoad");  
+                       commonClip._fireEvent( "onLoad" );
                }
                
-         if (evt == 'onContextMenu') {
-                each(conf.contextMenu[arg0], function(key, fn)  {
-                       fn.call(self);
-                });
+         if ( evt == 'onContextMenu' ) {
+                each( conf.contextMenu[arg0], function( key, fn )  {
+                       fn.call( self );
+                } );
                 return;
          }
 
-               if (evt == 'onPluginEvent') {
+               if ( evt == 'onPluginEvent' ) {
                        var name = arg0.name || arg0;
                        var p = plugins[name];
-                       if (p) {
-                               if (arg0.name) {
-                                       p._fireEvent("onUpdate", arg0);         
+                       if ( p ) {
+                               if ( arg0.name ) {
+                                       p._fireEvent( "onUpdate", arg0 );
                                }
-                               p._fireEvent(arg1);             
+                               p._fireEvent( arg1 );
                        }
                        return;
-               }               
+               }
 
                // onPlaylistReplace
-               if (evt == 'onPlaylistReplace') {
+               if ( evt == 'onPlaylistReplace' ) {
                        playlist = [];
                        var index = 0;
-                       each(arg0, function() {
-                               playlist.push(new Clip(this, index++));
-                       });             
+                       each( arg0, function() {
+                               playlist.push( new Clip( this, index++ ) );
+                       } );
                }
                
                var ret = true;
                
                // clip event
-               if (arg0 === 0 || (arg0 && arg0 >= 0)) {
+               if ( arg0 === 0 || ( arg0 && arg0 >= 0 ) ) {
                        
                        activeIndex = arg0;
-                       var clip = playlist[arg0];                      
+                       var clip = playlist[arg0];
                        
-                       if (clip) {
-                               ret = clip._fireEvent(evt, arg1, arg2); 
-                       } 
+                       if ( clip ) {
+                               ret = clip._fireEvent( evt, arg1, arg2 );
+                       }
                        
-                       if (!clip || ret !== false) {
+                       if ( !clip || ret !== false ) {
                                
                                // clip argument is given for common clip, because it behaves as the target
-                               ret = commonClip._fireEvent(evt, arg1, arg2, clip);     
-                       }  
-               } 
+                               ret = commonClip._fireEvent( evt, arg1, arg2, clip );
+                       }
+               }
                
                // player event 
                var i = 0;
-               each(listeners[evt], function() {
-                       ret = this.call(self, arg0);            
+               each( listeners[evt], function() {
+                       ret = this.call( self, arg0 );
                        
                        // remove cached entry
-                       if (this.cached) {
-                               listeners[evt].splice(i, 1);    
+                       if ( this.cached ) {
+                               listeners[evt].splice( i, 1 );
                        }
                        
                        // break loop
-                       if (ret === false) { return false;       }
+                       if ( ret === false ) { return false;     }
                        i++;
                        
-               }); 
+               } );
 
                return ret;
        };
 
-//}}}
+// }}}
+
 
 // {{{ init
-       
+
    function init() {
                
-               if ($f(wrapper)) {
-                       return null;    
-               }               
+               if ( $f( wrapper ) ) {
+                       return null;
+               }
                
-               wrapperHeight = parseInt(wrapper.style.height) || wrapper.clientHeight;
+               wrapperHeight = parseInt( wrapper.style.height ) || wrapper.clientHeight;
                
                // register this player into global array of instances
-               players.push(self);  
+               players.push( self );
                
                
                // flashembed parameters
-               if (typeof params == 'string') {
-                       params = {src: params}; 
-               }       
+               if ( typeof params == 'string' ) {
+                       params = { src: params };
+               }
                
                // playerId     
                playerId = wrapper.id || "fp" + makeId();
-               apiId = params.id || playerId + "_api";          
+               apiId = params.id || playerId + "_api";
                params.id = apiId;
                conf.playerId = playerId;
                
                
                // plain url is given as config
-               if (typeof conf == 'string') {
-                       conf = {clip:{url:conf}};       
-               } 
+               if ( typeof conf == 'string' ) {
+                       conf = { clip: { url:conf } };
+               }
                
                // common clip is always there
-               conf.clip = conf.clip || {};
-               commonClip = new Clip(conf.clip, -1, self);  
+               conf.clip = conf.clip || { };
+               commonClip = new Clip( conf.clip, - 1, self );
                
                
                // wrapper href as playlist
-               if (wrapper.getAttribute("href")) { 
-                       conf.playlist = [{url:wrapper.getAttribute("href", 2)}];                        
-               } 
+               if ( wrapper.getAttribute( "href" ) ) {
+                       conf.playlist = [ { url:wrapper.getAttribute( "href", 2 ) }];
+               }
                
                // playlist
-               conf.playlist = conf.playlist || [conf.clip]; 
+               conf.playlist = conf.playlist || [conf.clip];
                
                var index = 0;
-               each(conf.playlist, function() {
+               each( conf.playlist, function() {
 
                        var clip = this;
                        
                        // clip is an array, we don't allow that
-                       if (typeof clip == 'object' && clip.length)  {
-                               clip = "" + clip;       
+                       if ( typeof clip == 'object' && clip.length )  {
+                               clip = "" + clip;
                        }
                        
-                       if (!clip.url && typeof clip == 'string') {                             
-                               clip = {url: clip};                             
-                       } 
+                       if ( !clip.url && typeof clip == 'string' ) {
+                               clip = { url: clip };
+                       }
                        
                        // populate common clip properties to each clip
-                       extend(clip, conf.clip, true);          
+                       extend( clip, conf.clip, true );
                        
                        // modify configuration playlist
-                       conf.playlist[index] = clip;                    
+                       conf.playlist[index] = clip;
                        
                        // populate playlist array
-                       clip = new Clip(clip, index, self);
-                       playlist.push(clip);                                            
-                       index++;                        
-               });
+                       clip = new Clip( clip, index, self );
+                       playlist.push( clip );
+                       index++;
+               } );
                        
                
                // event listeners
-               each(conf, function(key, val) {
-                       if (typeof val == 'function') {
-                               bind(listeners, key, val);
-                               delete conf[key];       
+               each( conf, function( key, val ) {
+                       if ( typeof val == 'function' ) {
+                               bind( listeners, key, val );
+                               delete conf[key];
                        }
-               });              
+               } );
                
                
                // plugins
-               each(conf.plugins, function(name, val) {
-                       if (val) {
-                               plugins[name] = new Plugin(name, val, self);
+               each( conf.plugins, function( name, val ) {
+                       if ( val ) {
+                               plugins[name] = new Plugin( name, val, self );
                        }
-               });
+               } );
                
                
                // setup controlbar plugin if not explicitly defined
-               if (!conf.plugins || conf.plugins.controls === undefined) {
-                       plugins.controls = new Plugin("controls", null, self);  
-               } 
+               if ( !conf.plugins || conf.plugins.controls === undefined ) {
+                       plugins.controls = new Plugin( "controls", null, self );
+               }
                
                // Flowplayer uses black background by default
                params.bgcolor = params.bgcolor || "#000000";
                
                
                // setup default settings for express install
-               params.version = params.version || [9,0];               
+               params.version = params.version || [9, 0];
                params.expressInstall = 'http://www.flowplayer.org/swf/expressinstall.swf';
                
                
                // click function
-               function doClick(e) {
-                       if (self._fireEvent("onBeforeClick") !== false) {
-                               self.load();            
-                       } 
-                       return stopEvent(e);                                    
+               function doClick( e ) {
+                       if ( self._fireEvent( "onBeforeClick" ) !== false ) {
+                               self.load();
+                       }
+                       return stopEvent( e );
                }
                
                // defer loading upon click
                html = wrapper.innerHTML;
-               if (html.replace(/\s/g, '') !== '') {    
+               if ( html.replace( /\s/g, '' ) !== '' ) {
                        
-                       if (wrapper.addEventListener) {
-                               wrapper.addEventListener("click", doClick, false);      
+                       if ( wrapper.addEventListener ) {
+                               wrapper.addEventListener( "click", doClick, false );
                                
-                       } else if (wrapper.attachEvent) {
-                               wrapper.attachEvent("onclick", doClick);        
+                       } else if ( wrapper.attachEvent ) {
+                               wrapper.attachEvent( "onclick", doClick );
                        }
                        
                // player is loaded upon page load 
                } else {
                        
                        // prevent default action from wrapper (safari problem) loaded
-                       if (wrapper.addEventListener) {
-                               wrapper.addEventListener("click", stopEvent, false);    
+                       if ( wrapper.addEventListener ) {
+                               wrapper.addEventListener( "click", stopEvent, false );
                        }
                        
                        // load player
@@ -942,25 +942,25 @@ function Player(wrapper, params, conf) {
        }
 
        // possibly defer initialization until DOM get's loaded
-       if (typeof wrapper == 'string') { 
-               flashembed.domReady(function() {
-                       var node = el(wrapper); 
+       if ( typeof wrapper == 'string' ) {
+               flashembed.domReady( function() {
+                       var node = el( wrapper );
                        
-                       if (!node) {
-                               throw "Flowplayer cannot access element: " + wrapper;   
+                       if ( !node ) {
+                               throw "Flowplayer cannot access element: " + wrapper;
                        } else {
-                               wrapper = node; 
-                               init();                                 
-                       } 
-               });
+                               wrapper = node;
+                               init();
+                       }
+               } );
                
        // we have a DOM element so page is already loaded
-       } else {                
+       } else {
                init();
        }
        
        
-//}}}
+// }}}
 
 
 }
@@ -973,111 +973,111 @@ var players = [];
 
 
 // this object is returned when multiple player's are requested 
-function Iterator(arr) {
+function Iterator( arr ) {
        
        this.length = arr.length;
        
-       this.each = function(fn)  {
-               each(arr, fn);  
+       this.each = function( fn )  {
+               each( arr, fn );
        };
        
        this.size = function() {
-               return arr.length;      
-       };      
+               return arr.length;
+       };
 }
 
 // these two variables are the only global variables
 window.flowplayer = window.$f = function() {
        
        var instance = null;
-       var arg = arguments[0]; 
+       var arg = arguments[0];
        
        
        // $f()
-       if (!arguments.length) {
-               each(players, function() {
-                       if (this.isLoaded())  {
-                               instance = this;        
+       if ( !arguments.length ) {
+               each( players, function() {
+                       if ( this.isLoaded() )  {
+                               instance = this;
                                return false;
                        }
-               });
+               } );
                
                return instance || players[0];
-       } 
+       }
        
-       if (arguments.length == 1) {
+       if ( arguments.length == 1 ) {
                
                // $f(index);
-               if (typeof arg == 'number') { 
-                       return players[arg];    
+               if ( typeof arg == 'number' ) {
+                       return players[arg];
        
                        
                // $f(wrapper || 'containerId' || '*');
                } else {
                        
                        // $f("*");
-                       if (arg == '*') {
-                               return new Iterator(players);   
+                       if ( arg == '*' ) {
+                               return new Iterator( players );
                        }
                        
                        // $f(wrapper || 'containerId');
-                       each(players, function() {
-                               if (this.id() == arg.id || this.id() == arg || this.getParent() == arg)  {
-                                       instance = this;        
+                       each( players, function() {
+                               if ( this.id() == arg.id || this.id() == arg || this.getParent() == arg )  {
+                                       instance = this;
                                        return false;
                                }
-                       });
+                       } );
                        
-                       return instance;                                        
+                       return instance;
                }
-       }                        
+       }
 
        // instance builder 
-       if (arguments.length > 1) {             
+       if ( arguments.length > 1 ) {
 
                var swf = arguments[1];
-               var conf = (arguments.length == 3) ? arguments[2] : {};
+               var conf = ( arguments.length == 3 ) ? arguments[2] : { };
                                                
-               if (typeof arg == 'string') {
+               if ( typeof arg == 'string' ) {
                        
                        // select arg by classname
-                       if (arg.indexOf(".") != -1) {
+                       if ( arg.indexOf( "." ) != - 1 ) {
                                var instances = [];
                                
-                               each(select(arg), function() { 
-                                       instances.push(new Player(this, clone(swf), clone(conf)));               
-                               });     
+                               each( select( arg ), function() {
+                                       instances.push( new Player( this, clone ( swf ), clone ( conf ) ) );
+                               } );
                                
-                               return new Iterator(instances);
+                               return new Iterator( instances );
                                
                        // select node by id
-                       } else {                
-                               var node = el(arg);
-                               return new Player(node !== null ? node : arg, swf, conf);         
-                       } 
+                       } else {
+                               var node = el( arg );
+                               return new Player( node !== null ? node : arg, swf, conf );
+                       }
                        
                        
                // arg is a DOM element
-               } else if (arg) {
-                       return new Player(arg, swf, conf);                                              
+               } else if ( arg ) {
+                       return new Player( arg, swf, conf );
                }
                
-       } 
+       }
        
-       return null; 
+       return null;
 };
        
-extend(window.$f, {
+extend( window.$f, {
 
        // called by Flash External Interface            
-       fireEvent: function(id, evt, a0, a1, a2) {              
-               var p = $f(id);         
-               return p ? p._fireEvent(evt, a0, a1, a2) : null;
+       fireEvent: function( id, evt, a0, a1, a2 ) {
+               var p = $f( id );
+               return p ? p._fireEvent( evt, a0, a1, a2 ) : null;
        },
        
        
        // create plugins by modifying Player's prototype
-       addPlugin: function(name, fn) {
+       addPlugin: function( name, fn ) {
                Player.prototype[name] = fn;
                return $f;
        },
@@ -1087,42 +1087,42 @@ extend(window.$f, {
        
        extend: extend
        
-});
+} );
        
-//}}}
+// }}}
 
 
-//{{{ jQuery support
+// {{{ jQuery support
 
-if (typeof jQuery == 'function') {
+if ( typeof jQuery == 'function' ) {
        
-       jQuery.prototype.flowplayer = function(params, conf) {  
+       jQuery.prototype.flowplayer = function( params, conf ) {
                
                // select instances
-               if (!arguments.length || typeof arguments[0] == 'number') {
+               if ( !arguments.length || typeof arguments[0] == 'number' ) {
                        var arr = [];
-                       this.each(function()  {
-                               var p = $f(this);
-                               if (p) {
-                                       arr.push(p);    
+                       this.each( function()  {
+                               var p = $f( this );
+                               if ( p ) {
+                                       arr.push( p );
                                }
-                       });
-                       return arguments.length ? arr[arguments[0]] : new Iterator(arr);
+                       } );
+                       return arguments.length ? arr[arguments[0]] : new Iterator( arr );
                }
                
                // create flowplayer instances
-               return this.each(function() { 
-                       $f(this, clone(params), conf ? clone(conf) : {});       
-               }); 
+               return this.each( function() {
+                       $f( this, clone ( params ), conf ? clone ( conf ) : { } );
+               } );
                
        };
        
 }
 
-//}}}
+// }}}
 
 
-})();
+} )();
 /** 
  * flashembed 0.34. Adobe Flash embedding script
  * 
@@ -1138,107 +1138,107 @@ if (typeof jQuery == 'function') {
  * first version 0.01 - 03/11/2008 
  * version 0.34 - Tue Nov 11 2008 09:09:52 GMT-0000 (GMT+00:00)
  */
-(function() { 
+( function() {
  
-//{{{ utility functions 
-               
+// {{{ utility functions 
+
 var jQ = typeof jQuery == 'function';
 
 
 // from "Pro JavaScript techniques" by John Resig
 function isDomReady() {
        
-       if (domReady.done)  { return false; }
+       if ( domReady.done )  { return false; }
        
        var d = document;
-       if (d && d.getElementsByTagName && d.getElementById && d.body) {
-               clearInterval(domReady.timer);
+       if ( d && d.getElementsByTagName && d.getElementById && d.body ) {
+               clearInterval( domReady.timer );
                domReady.timer = null;
                
-               for (var i = 0; i < domReady.ready.length; i++) {
-                       domReady.ready[i].call();       
+               for ( var i = 0; i < domReady.ready.length; i++ ) {
+                       domReady.ready[i].call();
                }
                
                domReady.ready = null;
                domReady.done = true;
-       } 
+       }
 }
 
 // if jQuery is present, use it's more effective domReady method
-var domReady = jQ ? jQuery : function(f) {
+var domReady = jQ ? jQuery : function( f ) {
        
-       if (domReady.done) {
-               return f();     
+       if ( domReady.done ) {
+               return f();
        }
        
-       if (domReady.timer) {
-               domReady.ready.push(f); 
+       if ( domReady.timer ) {
+               domReady.ready.push( f );
                
        } else {
                domReady.ready = [f];
-               domReady.timer = setInterval(isDomReady, 13);
-       } 
-};     
+               domReady.timer = setInterval( isDomReady, 13 );
+       }
+};
 
 
 // override extend params function 
-function extend(to, from) {
-       if (from) {
-               for (key in from) {
-                       if (from.hasOwnProperty(key)) {
+function extend( to, from ) {
+       if ( from ) {
+               for ( key in from ) {
+                       if ( from.hasOwnProperty( key ) ) {
                                to[key] = from[key];
                        }
                }
        }
        
        return to;
-}      
+}
 
 
-function concatVars(vars) {            
+function concatVars( vars ) {
        var out = "";
        
-       for (var key in vars) { 
-               if (vars[key]) {
-                       out += [key] + '=' + asString(vars[key]) + '&';
+       for ( var key in vars ) {
+               if ( vars[key] ) {
+                       out += [key] + '=' + asString( vars[key] ) + '&';
                }
-       }                       
-       return out.substring(0, out.length -1);                         
-}  
+       }
+       return out.substring( 0, out.length - 1 );
+}
 
 
 
 // JSON.asString() function
-function asString(obj) {
+function asString( obj ) {
 
-       switch (typeOf(obj)){
+       switch ( typeOf( obj ) ) {
                case 'string':
-                       obj = obj.replace(new RegExp('(["\\\\])', 'g'), '\\$1');
+                       obj = obj.replace( new RegExp( '(["\\\\])', 'g' ), '\\$1' );
                        
                        // flash does not handle %- characters well. transforms "50%" to "50pct" (a dirty hack, I admit)
-                       obj = obj.replace(/^\s?(\d+)%/, "$1pct");
-                       return '"' +obj+ '"';
+                       obj = obj.replace( /^\s?(\d+)%/, "$1pct" );
+                       return '"' + obj + '"';
                        
                case 'array':
-                       return '['+ map(obj, function(el) {
-                               return asString(el);
-                       }).join(',') +']'; 
+                       return '[' + map( obj, function( el ) {
+                               return asString( el );
+                       } ).join( ',' ) + ']';
                        
                case 'function':
                        return '"function()"';
                        
                case 'object':
                        var str = [];
-                       for (var prop in obj) {
-                               if (obj.hasOwnProperty(prop)) {
-                                       str.push('"'+prop+'":'+ asString(obj[prop]));
+                       for ( var prop in obj ) {
+                               if ( obj.hasOwnProperty( prop ) ) {
+                                       str.push( '"' + prop + '":' + asString( obj[prop] ) );
                                }
                        }
-                       return '{'+str.join(',')+'}';
+                       return '{' + str.join( ',' ) + '}';
        }
        
        // replace ' --> "  and remove spaces
-       return String(obj).replace(/\s/g, " ").replace(/\'/g, "\"");
+       return String( obj ).replace( /\s/g, " ").replace( /\'/g, "\"" );
 }
 
 
@@ -1269,18 +1269,18 @@ function map(arr, func) {
 }
        
 function getEmbedCode(p, c) {
-       var html = '<embed type="application/x-shockwave-flash" ';
+       var html = ' < embed type = "application/x-shockwave-flash" ';
 
        if (p.id) { extend(p, {name:p.id}); }
        
        for (var key in p) { 
                if (p[key] !== null) { 
-                       html += key + '="' +p[key]+ '"\n\t';
+                       html += key + '="' + p[key] + '"\n\t';
                }
        }
 
        if (c) {
-                html += 'flashvars=\'' + concatVars(c) + '\'';
+                html += 'flashvars=\'' + concatVars( c ) + '\'';
        }
        
        // thanks Tom Price (07/17/2008)
@@ -1289,44 +1289,44 @@ function getEmbedCode(p, c) {
        return html;
 }
 
-function getObjectCode(p, c, embeddable) {
+function getObjectCode( p, c, embeddable ) {
        
        var html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
-       html += 'width="' + p.width + '" height="' + p.height + '"'; 
+       html += 'width="' + p.width + '" height="' + p.height + '"';
        
        // force id for IE. otherwise embedded Flash object cannot be returned
-       if (!p.id && document.all) {
-               p.id = "_" + ("" + Math.random()).substring(5);
-       } 
+       if ( !p.id && document.all ) {
+               p.id = "_" + ( "" + Math.random() ).substring( 5 );
+       }
        
-       if (p.id) {
+       if ( p.id ) {
                html += ' id="' + p.id + '"';
        }
        
-       html += '>';  
+       html += '>';
        
        // sometimes ie fails to load flash if it's on cache
-       if (document.all) {
-               p.src += ((p.src.indexOf("?") != -1 ? "&" : "?") + Math.random());              
-       } 
+       if ( document.all ) {
+               p.src += ( ( p.src.indexOf( "?" ) != - 1 ? "&" : "?" ) + Math.random() );
+       }
        
-       html += '\n\t<param name="movie" value="'+ p.src +'" />';
+       html += '\n\t<param name="movie" value="' + p.src + '" />';
 
-       var e = extend({}, p);
+       var e = extend( { }, p );
        e.id = e.width = e.height = e.src = null;
        
-       for (var k in e) {
-               if (e[k] !== null) {
-                       html += '\n\t<param name="'+ k +'" value="'+ e[k] +'" />';
+       for ( var k in e ) {
+               if ( e[k] !== null ) {
+                       html += '\n\t<param name="' + k + '" value="' + e[k] + '" />';
                }
        }
        
-       if (c) {
-               html += '\n\t<param name="flashvars" value=\'' + concatVars(c) + '\' />';
+       if ( c ) {
+               html += '\n\t<param name="flashvars" value=\'' + concatVars( c ) + '\' />';
        }
        
-       if (embeddable) {
-               html += getEmbedCode(p, c);     
+       if ( embeddable ) {
+               html += getEmbedCode( p, c );
        }
         
        html += "</object>";
@@ -1334,35 +1334,35 @@ function getObjectCode(p, c, embeddable) {
        return html;
 }
 
-function getFullHTML(p, c) {
-       return getObjectCode(p, c, true);       
+function getFullHTML( p, c ) {
+       return getObjectCode( p, c, true );
 }
 
-function getHTML(p, c) { 
-       var isNav = navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length; 
-       return (isNav) ? getEmbedCode(p, c) : getObjectCode(p, c);
+function getHTML( p, c ) {
+       var isNav = navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length;
+       return ( isNav ) ? getEmbedCode( p, c ) : getObjectCode( p, c );
 }
 
-//}}}
+// }}}
 
        
-window.flashembed = function(root, userParams, flashvars) {    
+window.flashembed = function( root, userParams, flashvars ) {
        
        
-//{{{ construction
-               
+// {{{ construction
+
        // setup params
        var params = {
                
                // very common params
                src: '#',
                width: '100%',
-               height: '100%',         
+               height: '100%',
                
                // flashembed specific options
                version:null,
                onFail:null,
-               expressInstall:null,  
+               expressInstall:null,
                debug: false,
                
                // flashembed defaults
@@ -1375,35 +1375,35 @@ window.flashembed = function(root, userParams, flashvars) {
        };
        
        
-       if (typeof userParams == 'string') {
-               userParams = {src: userParams}; 
+       if ( typeof userParams == 'string' ) {
+               userParams = { src: userParams };
        }
        
-       extend(params, userParams);                      
+       extend( params, userParams );
                
-       var version = flashembed.getVersion(); 
-       var required = params.version; 
-       var express = params.expressInstall;             
+       var version = flashembed.getVersion();
+       var required = params.version;
+       var express = params.expressInstall;
        var debug = params.debug;
 
        
-       if (typeof root == 'string') {
-               var el = document.getElementById(root);
-               if (el) {
-                       root = el;      
+       if ( typeof root == 'string' ) {
+               var el = document.getElementById( root );
+               if ( el ) {
+                       root = el;
                } else {
-                       domReady(function() {
-                               flashembed(root, userParams, flashvars);
-                       });
-                       return;          
-               } 
+                       domReady( function() {
+                               flashembed( root, userParams, flashvars );
+                       } );
+                       return;
+               }
        }
        
-       if (!root) { return; }
+       if ( !root ) { return; }
 
        
        // is supported 
-       if (!required || flashembed.isSupported(required)) {
+       if ( !required || flashembed.isSupported( required ) ) {
                params.onFail = params.version = params.expressInstall = params.debug = null;
                
                // root.innerHTML may cause broplems: http://domscripting.com/blog/display/99
@@ -1411,22 +1411,22 @@ window.flashembed = function(root, userParams, flashvars) {
                // var tmp = document.createElement("extradiv");
                // tmp.innerHTML = getHTML();
                // root.appendChild(tmp);
-               
-               root.innerHTML = getHTML(params, flashvars);
+
+               root.innerHTML = getHTML( params, flashvars );
                
                // return our API                       
                return root.firstChild;
                
        // custom fail event
-       } else if (params.onFail) {
-               var ret = params.onFail.call(params, flashembed.getVersion(), flashvars);
-               if (ret === true) { root.innerHTML = ret; }             
+       } else if ( params.onFail ) {
+               var ret = params.onFail.call( params, flashembed.getVersion(), flashvars );
+               if ( ret === true ) { root.innerHTML = ret; }
                
 
        // express install
-       } else if (required && express && flashembed.isSupported([6,65])) {
+       } else if ( required && express && flashembed.isSupported( [6, 65] ) ) {
                
-               extend(params, {src: express});
+               extend( params, { src: express } );
                
                flashvars = {
                        MMredirectURL: location.href,
@@ -1434,89 +1434,89 @@ window.flashembed = function(root, userParams, flashvars) {
                        MMdoctitle: document.title
                };
                
-               root.innerHTML = getHTML(params, flashvars);    
+               root.innerHTML = getHTML( params, flashvars );
                
        // not supported
        } else {
 
                // minor bug fixed here 08.04.2008 (thanks JRodman)
-               
-               if (root.innerHTML.replace(/\s/g, '') !== '') {
+
+               if ( root.innerHTML.replace( /\s/g, '') !== '' ) {
                        // custom content was supplied
-               
+
                } else {
-                       root.innerHTML = 
-                               "<h2>Flash version " + required + " or greater is required</h2>" + 
-                               "<h3>" + 
-                                       (version[0] > 0 ? "Your version is " + version : "You have no flash plugin installed") +
-                               "</h3>" + 
+                       root.innerHTML =
+                               "<h2>Flash version " + required + " or greater is required</h2>" +
+                               "<h3>" +
+                                       ( version[0] > 0 ? "Your version is " + version : "You have no flash plugin installed" ) +
+                               "</h3>" +
                                "<p>Download latest version from <a href='" + params.pluginspage + "'>here</a></p>";
                }
        }
 
        return root;
        
-//}}}
-       
+// }}}
+
        
 };
 
 
-//{{{ static methods
+// {{{ static methods
 
-extend(window.flashembed, {
+extend( window.flashembed, {
 
        // returns arr[major, fix]
        getVersion: function() {
        
                var version = [0, 0];
                
-               if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
+               if ( navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object" ) {
                        var _d = navigator.plugins["Shockwave Flash"].description;
-                       if (typeof _d != "undefined") {
-                               _d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
-                               var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
-                               var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
+                       if ( typeof _d != "undefined" ) {
+                               _d = _d.replace( /^.*\s+(\S+\s+\S+$ )/, "$1" );
+                               var _m = parseInt( _d.replace( /^(.*)\..*$/, "$1" ), 10 );
+                               var _r = / r / .test( _d ) ? parseInt( _d.replace( / ^ . * r( . * )$ / , "$1" ), 10 ) : 0;
                                version = [_m, _r];
                        }
                        
-               } else if (window.ActiveXObject) {
+               } else if ( window.ActiveXObject ) {
                        
                        try { // avoid fp 6 crashes
-                               var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
+                               var _a = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.7" );
                                
-                       } catch(e) {
-                               try { 
-                                       _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
+                       } catch ( e ) {
+                               try {
+                                       _a = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash.6" );
                                        version = [6, 0];
                                        _a.AllowScriptAccess = "always"; // throws if fp < 6.47 
-                                       
-                               } catch(ee) {
-                                       if (version[0] == 6) { return; }
+
+                               } catch ( ee ) {
+                                       if ( version[0] == 6 ) { return; }
                                }
                                try {
-                                       _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
-                               } catch(eee) {
+                                       _a = new ActiveXObject( "ShockwaveFlash.ShockwaveFlash" );
+                               } catch ( eee ) {
                                
                                }
                                
                        }
                        
-                       if (typeof _a == "object") {
-                               _d = _a.GetVariable("$version"); // bugs in fp 6.21 / 6.23
-                               if (typeof _d != "undefined") {
-                                       _d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
-                                       version = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
+                       if ( typeof _a == "object" ) {
+                               _d = _a.GetVariable( "$version" ); // bugs in fp 6.21 / 6.23
+                               if ( typeof _d != "undefined" ) {
+                                       _d = _d.replace( /^\S+\s+(.*)$/, "$1" ).split( "," );
+                                       version = [parseInt( _d[0], 10 ), parseInt( _d[2], 10 )];
                                }
                        }
-               } 
+               }
                
                return version;
        },
        
-       isSupported: function(version) {
+       isSupported: function( version ) {
                var now = flashembed.getVersion();
-               var ret = (now[0] > version[0]) || (now[0] == version[0] && now[1] >= version[1]);                      
+               var ret = ( now[0] > version[0] ) || ( now[0] == version[0] && now[1] >= version[1] );
                return ret;
        },
        
@@ -1529,307 +1529,307 @@ extend(window.flashembed, {
        
        getFullHTML: getFullHTML
        
-});
+} );
 
-//}}}
+// }}}
 
 
 // setup jquery support
-if (jQ) {
+if ( jQ ) {
        
-       jQuery.prototype.flashembed = function(params, flashvars) { 
-               return this.each(function() { 
-                       flashembed(this, params, flashvars);
-               });
+       jQuery.prototype.flashembed = function( params, flashvars ) {
+               return this.each( function() {
+                       flashembed( this, params, flashvars );
+               } );
        };
 
 }
 
-})();
+} )();
 
 /************************************************
 ********* mv_embed extension to flowplayer.js ***
-************************************************/       
+************************************************/
 var flowplayerEmbed = {
        instanceOf:'flowplayerEmbed',
        monitorTimerId : 0,
        old_pid:0,
        didSeekJump:false,
-       startedTimedPlayback:false,             
+       startedTimedPlayback:false,
        didDateStartTimeRestore:false,
        supports: {
-               'play_head' : true, 
+               'play_head' : true,
                'pause' : true,
-               'stop' : true, 
-               'time_display' : true, 
+               'stop' : true,
+               'time_display' : true,
                'volume_control' : true
        },
-       getEmbedHTML: function (){
-               setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
+       getEmbedHTML: function () {
+               setTimeout( 'document.getElementById(\'' + this.id + '\').postEmbedJS()', 150 );
                return this.wrapEmebedContainer( this.getEmbedObj() );
        },
-       getEmbedObj:function()
-               //give the embed element a unique pid (work around for flowplayer persistence)
-               if( this.old_pid!=0 ){
-                       this.pid = this.pid +'_'+ this.old_pid;
-               }                               
-               return '<a  '+
-                                       'href="'+ this.getSrc() + '" '+  
-                                       'style="display:block;width:' + parseInt(this.width) + 'px;height:' + parseInt(this.height) + 'px" '+  
-                                       'id="'+this.pid+'">'+ 
+       getEmbedObj:function() {
+               // give the embed element a unique pid (work around for flowplayer persistence)
+               if ( this.old_pid != 0 ) {
+                       this.pid = this.pid + '_' + this.old_pid;
+               }
+               return '<a  ' +
+                                       'href="' + this.getSrc() + '" ' +
+                                       'style="display:block;width:' + parseInt( this.width ) + 'px;height:' + parseInt( this.height ) + 'px" ' +
+                                       'id="' + this.pid + '">' +
                                '</a>';
        },
        postEmbedJS: function()
-       {   
+       {
                var _this = this;
-               js_log('embedFlow: uri:'+ this.getSrc() + "\n"+ mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
-               var flowConfig = { 
-                       clip: { 
-                               url: this.getSrc(),                               
+               js_log( 'embedFlow: uri:' + this.getSrc() + "\n" + mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
+               var flowConfig = {
+                       clip: {
+                               url: this.getSrc(),
                                // when this is false playback does not start until play button is pressed 
                                autoPlay: true
                        },
-                       plugins: { 
-                               controls: { 
-                                  all: false, 
+                       plugins: {
+                               controls: {
+                                  all: false,
                                   fullscreen: true,
                                   backgroundColor: 'transparent',
                                   backgroundGradient: 'none',
                                   autoHide:'always',
                                   top:'95%',
                                   right:'0px'
-                               }                                
+                               }
                        },
                        screen: {
                                opacity : '1.0'
-                       }                       
+                       }
                };
                
-               //if in preview mode set grey and lower volume until "ready"
-               if( this.preview_mode ){
-                       flowConfig.screen.opacity = 0.2;                                 
-               }                                       
-               
-               $f(this.pid,  mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf', flowConfig);                                  
-               //get the this.fla value:                
-               this.getFLA();          
-               //set up bindings (for when interacting with the swf causes action:  
-               this.fla.onPause(function(){                                                                                                                            
-                       _this.parent_pause();   //update the interface                   
-               })
-               this.fla.onResume( function(){
-                       _this.parent_play();    //update the interface  
-               });                             
+               // if in preview mode set grey and lower volume until "ready"
+               if ( this.preview_mode ) {
+                       flowConfig.screen.opacity = 0.2;
+               }
+               
+               $f( this.pid,  mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf', flowConfig );
+               // get the this.fla value:               
+               this.getFLA();
+               // set up bindings (for when interacting with the swf causes action:  
+               this.fla.onPause( function() {
+                       _this.parent_pause();   // update the interface                  
+               } )
+               this.fla.onResume( function() {
+                       _this.parent_play();    // update the interface 
+               } );
                   
-               //start monitor: 
-               this.monitor();  
+               // start monitor: 
+               this.monitor();
                this.old_pid++;
-       },   
+       },
        /* js hooks/controls */
-       play: function(){                               
-               this.getFLA();          
-               //update play/pause button etc
-               this.parent_play();                             
-               if( this.fla ){                 
-                       this.fla.play();                        
-                       
-                       //on a resume make sure volume and opacity are correct 
-                       this.restorePlayer();                                            
-                       setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250);
+       play: function() {
+               this.getFLA();
+               // update play/pause button etc
+               this.parent_play();
+               if ( this.fla ) {
+                       this.fla.play();
+                       
+                       // on a resume make sure volume and opacity are correct 
+                       this.restorePlayer();
+                       setTimeout( '$j(\'#' + this.id + '\').get(0).monitor()', 250 );
                }
        },
-       //@@todo support mute
-       toggleMute: function(){
+       // @@todo support mute
+       toggleMute: function() {
                this.parent_toggleMute();
                this.getFLA();
-               if(this.fla){
-                       if(this.muted){
+               if ( this.fla ) {
+                       if ( this.muted ) {
                                
-                       }else{
+                       } else {
                                
                        }
                }
        },
-       //@@ Suport UpDateVolumen 
-       updateVolumen:function(perc){
-               this.getFLA();          
-               if(this.fla)this.fla.setVolume(perc*100);
+       // @@ Suport UpDateVolumen 
+       updateVolumen:function( perc ) {
+               this.getFLA();
+               if ( this.fla )this.fla.setVolume( perc * 100 );
                            
-    }, 
-    //@@ Get Volumen
-       getVolumen:function(){
-               this.getFLA();          
-               if(this.fla)
-                       return this.fla.getVolume() / 100;                         
-    }, 
-       fullscreen:function(){
-               if(this.fla){
+    },
+    // @@ Get Volumen
+       getVolumen:function() {
+               this.getFLA();
+               if ( this.fla )
+                       return this.fla.getVolume() / 100;
+    },
+       fullscreen:function() {
+               if ( this.fla ) {
                        this.fla.fullscreen();
-               }else{
-                       js_log('must be playing before you can go fullscreen');
+               } else {
+                       js_log( 'must be playing before you can go fullscreen' );
                }
        },
        pause : function()
        {
                this.getFLA();
-               if(!this.thumbnail_disp){
+               if ( !this.thumbnail_disp ) {
                        this.parent_pause();
-                       if(this.fla){           
-                               js_log("Flash:Pause: " + this.fla.isPaused() );
-                               if( this.fla['pause'] ){
-                                       if( ! this.fla.isPaused() ){
-                                               js_log('calling plugin pause');                         
-                                               this.fla.pause();  
+                       if ( this.fla ) {
+                               js_log( "Flash:Pause: " + this.fla.isPaused() );
+                               if ( this.fla['pause'] ) {
+                                       if ( ! this.fla.isPaused() ) {
+                                               js_log( 'calling plugin pause' );
+                                               this.fla.pause();
                                                
-                                               //restore volume and opacity 
-                                               this.restorePlayer();              
+                                               // restore volume and opacity 
+                                               this.restorePlayer();
                                        }
                                }
                        }
                }
        },
        monitor : function()
-       {                       
+       {
                var _this = this;
-               //date time
-               if( !this.dateStartTime ){
+               // date time
+               if ( !this.dateStartTime ) {
                        var d = new Date();
                        this.dateStartTime = d.getTime();
                        
-               }else{
-                       var d = new Date();                                              
-                       if( !this.didDateStartTimeRestore  && this.preview_mode)
-                               this.fla.setVolume(0);
+               } else {
+                       var d = new Date();
+                       if ( !this.didDateStartTimeRestore  && this.preview_mode )
+                               this.fla.setVolume( 0 );
                                
-                       if( (d.getTime() - this.dateStartTime) > 6000  && !this.didDateStartTimeRestore){                                                        
-                               this.restorePlayer(); 
+                       if ( ( d.getTime() - this.dateStartTime ) > 6000  && !this.didDateStartTimeRestore ) {
+                               this.restorePlayer();
                        }
-               }                                         
+               }
                                          
                var flash_state = this.fla.getStatus();
-               //update the duration from the clip if its zero or not set: 
-               if( !this.duration || this.duration==0 ){
-                       if( this.fla.getClip() ){
-                               this.duration = this.fla.getClip().fullDuration;                                
-                               js_log('set duration via clip value: ' + this.getDuration() );
+               // update the duration from the clip if its zero or not set: 
+               if ( !this.duration || this.duration == 0 ) {
+                       if ( this.fla.getClip() ) {
+                               this.duration = this.fla.getClip().fullDuration;
+                               js_log( 'set duration via clip value: ' + this.getDuration() );
                        }
                }
-               //update the duration ntp values: 
-               this.getDuration();             
+               // update the duration ntp values: 
+               this.getDuration();
 
-               if( typeof flash_state == 'undefined' ){
+               if ( typeof flash_state == 'undefined' ) {
                         var flash_state = {
                                 "time" : this.fla.getTime()
-                        };                              
-                       //we are not getting buffered data restore volume and opacity
-                       this.restorePlayer();                                              
-               }else{
-                       //simplification of buffer state ... should move to support returning time rages like:
-                       //http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object                       
-                       this.bufferedPercent = flash_state.bufferEnd / this.getDuration();                                                                      
-               }                          
-               //set the current Time (based on timeFormat)            
-               if( this.supportsURLTimeEncoding() ){
-                       this.currentTime = flash_state.time;                      
-                       //js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration()); 
-               }else{
-                       this.currentTime = flash_state.time + this.start_offset;                                                
-                       //stop buffering if greater than the duration: 
-                       if( flash_state.bufferEnd > this.getDuration() + 5 ){
-                               //js_log('should stop buffering (does not seem to work)' + flash_state.bufferEnd + ' > dur: ' + this.getDuration() );
+                        };
+                       // we are not getting buffered data restore volume and opacity
+                       this.restorePlayer();
+               } else {
+                       // simplification of buffer state ... should move to support returning time rages like:
+                       // http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object                      
+                       this.bufferedPercent = flash_state.bufferEnd / this.getDuration();
+               }
+               // set the current Time (based on timeFormat)           
+               if ( this.supportsURLTimeEncoding() ) {
+                       this.currentTime = flash_state.time;
+                       // js_log('set buffer: ' + flash_state.bufferEnd + ' at time: ' + flash_state.time +' of total dur: ' + this.getDuration()); 
+               } else {
+                       this.currentTime = flash_state.time + this.start_offset;
+                       // stop buffering if greater than the duration: 
+                       if ( flash_state.bufferEnd > this.getDuration() + 5 ) {
+                               // js_log('should stop buffering (does not seem to work)' + flash_state.bufferEnd + ' > dur: ' + this.getDuration() );
                                this.fla.stopBuffering();
-                       } 
-               }                                 
+                       }
+               }
                
-               if(this.currentTime > npt2seconds(this.start_ntp) && !this.startedTimedPlayback){
+               if ( this.currentTime > npt2seconds( this.start_ntp ) && !this.startedTimedPlayback ) {
                        var fail = false;
                        try
                        {
-                               this.restorePlayer();                           
+                               this.restorePlayer();
                        }
-                       catch(err)
+                       catch ( err )
                        {
-                               js_log('failed to set values');
+                               js_log( 'failed to set values' );
                                fail = true;
                        }
-                       if(!fail)
-                               this.startedTimedPlayback=true;                                                                          
+                       if ( !fail )
+                               this.startedTimedPlayback = true;
                }
                
                /* to support local seeks */
-               if(this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() )
+               if ( this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() )
                {
-                       js_log('flashEmbed: _local_ Seeking to ' + this.seek_time_sec);
+                       js_log( 'flashEmbed: _local_ Seeking to ' + this.seek_time_sec );
                        this.fla.seek( this.seek_time_sec );
                        this.seek_time_sec = 0;
-               }                                               
-               
-               //checks to see if we reached the end of playback:                              
-               if(this.duration && this.startedTimedPlayback && 
-                       (        this.currentTime > (npt2seconds(this.end_ntp)+2) 
-                               || 
-                               ( this.currentTime > (npt2seconds(this.end_ntp)-1) 
-                                       && this.prevTime == this.currentTime) )
-                       ){                                                      
-                       js_log('prbally reached end of stream: '+ seconds2npt( this.currentTime) );
-                       this.onClipDone();                                
-               }               
-               
-               //update the status and check timmer via universal parent monitor
+               }
+               
+               // checks to see if we reached the end of playback:                             
+               if ( this.duration && this.startedTimedPlayback &&
+                       (        this.currentTime > ( npt2seconds( this.end_ntp ) + 2 )
+                               ||
+                               ( this.currentTime > ( npt2seconds( this.end_ntp ) - 1 )
+                                       && this.prevTime == this.currentTime ) )
+                       ) {
+                       js_log( 'prbally reached end of stream: ' + seconds2npt( this.currentTime ) );
+                       this.onClipDone();
+               }
+               
+               // update the status and check timmer via universal parent monitor
                this.parent_monitor();
                
                
-               this.prevTime = this.currentTime;       
-               //js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - npt2seconds(this.start_ntp)) +' / ' +(npt2seconds(this.end_ntp)-npt2seconds(this.start_ntp)));
+               this.prevTime = this.currentTime;
+               // js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - npt2seconds(this.start_ntp)) +' / ' +(npt2seconds(this.end_ntp)-npt2seconds(this.start_ntp)));
        },
-       restorePlayer:function(){               
-               if(!this.fla)
+       restorePlayer:function() {
+               if ( !this.fla )
                        this.getFLA();
-               if(this.fla){
-                       js_log('f:do restorePlayer');
-                       this.fla.setVolume(90); 
-                       $f().getPlugin('screen').css({'opacity':'1.0'} );
-                       //set the fallback date restore flag to true:
-                       this.didDateStartTimeRestore=true;                                
-               }               
+               if ( this.fla ) {
+                       js_log( 'f:do restorePlayer' );
+                       this.fla.setVolume( 90 );
+                       $f().getPlugin( 'screen' ).css( { 'opacity':'1.0' } );
+                       // set the fallback date restore flag to true:
+                       this.didDateStartTimeRestore = true;
+               }
        },
        // get the embed fla object 
-       getFLA : function (){
-               this.fla = $f(this.pid);                   
+       getFLA : function () {
+               this.fla = $f( this.pid );
        },
-       stop : function(){      
-               js_log('f:flashEmbed:stop');            
-               this.startedTimedPlayback=false;        
-               if (this.monitorTimerId != 0 )
+       stop : function() {
+               js_log( 'f:flashEmbed:stop' );
+               this.startedTimedPlayback = false;
+               if ( this.monitorTimerId != 0 )
                {
-                       clearInterval(this.monitorTimerId);
+                       clearInterval( this.monitorTimerId );
                        this.monitorTimerId = 0;
                }
-               if(this.fla)
+               if ( this.fla )
                        this.fla.unload();
                this.parent_stop();
        },
-       onStop: function(){
-               js_log('f:onStop');
-               //stop updates: 
-               if( this.monitorTimerId != 0 )
+       onStop: function() {
+               js_log( 'f:onStop' );
+               // stop updates: 
+               if ( this.monitorTimerId != 0 )
                {
-                       clearInterval(this.monitorTimerId);
+                       clearInterval( this.monitorTimerId );
                        this.monitorTimerId = 0;
                }
        },
-       onClipDone: function(){                 
-               js_log('f:flash:onClipDone');           
-               if( ! this.startedTimedPlayback){
-                       js_log('clip done before timed playback started .. not good. (ignoring) ');                     
-                       //keep monitoring: 
+       onClipDone: function() {
+               js_log( 'f:flash:onClipDone' );
+               if ( ! this.startedTimedPlayback ) {
+                       js_log( 'clip done before timed playback started .. not good. (ignoring) ' );
+                       // keep monitoring: 
                        this.monitor();
-               }else{
-                       js_log('clip done and '+ this.startedTimedPlayback);
-                       //stop the clip if its not stopped already:
+               } else {
+                       js_log( 'clip done and ' + this.startedTimedPlayback );
+                       // stop the clip if its not stopped already:
                        this.stop();
-                       this.setStatus("Clip Done...");
-                       //run the onClip done action: 
+                       this.setStatus( "Clip Done..." );
+                       // run the onClip done action: 
                        this.parent_onClipDone();
                }
        }
index 5f65868..39f7f5c 100644 (file)
@@ -1,17 +1,17 @@
 /* the most simple implementation used for unknown application/ogg plugin */
-var genericEmbed={
+var genericEmbed = {
         supports: {
-               'play_head':false, 
-               'pause':false, 
-               'stop':true, 
-               'fullscreen':false, 
-               'time_display':false, 
+               'play_head':false,
+               'pause':false,
+               'stop':true,
+               'fullscreen':false,
+               'time_display':false,
                'volume_control':false
        },
        instanceOf:'genericEmbed',
-       getEmbedHTML:function(){
-               return '<object type="application/ogg" '+
-                                 'width="'+this.width+'" height="'+this.height+'" ' +
+       getEmbedHTML:function() {
+               return '<object type="application/ogg" ' +
+                                 'width="' + this.width + '" height="' + this.height + '" ' +
                                  'data="' + this.getURI( this.seek_time_sec ) + '"></object>';
        }
 };
\ No newline at end of file
index a5927bd..484c1a0 100644 (file)
  * for use with mv_playlist SMIL additions 
  * (we make assumptions about this.pc (parent clip) being available)
  */
-var pcHtmlEmbedDefaults={
-       'dur':4 //default duration of 4 seconds
+var pcHtmlEmbedDefaults = {
+       'dur':4 // default duration of 4 seconds
 }
-var htmlEmbed ={
+var htmlEmbed = {
         supports: {
-               'play_head':true, 
-               'pause':true,            
-               'fullscreen':false, 
-               'time_display':true, 
+               'play_head':true,
+               'pause':true,
+               'fullscreen':false,
+               'time_display':true,
                'volume_control':true,
                
                'overlays':true,
-               'playlist_swap_loader':true //if the object supports playlist functions         
+               'playlist_swap_loader':true // if the object supports playlist functions                
           },
           ready_to_play:true,
           pauseTime:0,
           currentTime:0,
           start_offset:0,
           monitorTimerId:false,
-       play:function(){
-               //call the parent
+       play:function() {
+               // call the parent
                this.parent_play();
                
-               js_log('f:play: htmlEmbedWrapper');
-               var ct = new Date();    
+               js_log( 'f:play: htmlEmbedWrapper' );
+               var ct = new Date();
                this.clockStartTime = ct.getTime();
                        
-               //start up monitor: 
-               this.monitor();                         
+               // start up monitor: 
+               this.monitor();
        },
-       stop:function(){
+       stop:function() {
                this.currentTime = 0;
                this.pause();
-               //window.clearInterval( this.monitorTimerId );
+               // window.clearInterval( this.monitorTimerId );
        },
-       pause:function(){
-               js_log('f:pause: htmlEmbedWrapper');
+       pause:function() {
+               js_log( 'f:pause: htmlEmbedWrapper' );
                var ct = new Date();
                this.pauseTime = this.currentTime;
-               js_log('pause time: '+ this.pauseTime);                         
+               js_log( 'pause time: ' + this.pauseTime );
                
                window.clearInterval( this.monitorTimerId );
        },
-       //monitor just needs to keep track of time (do it at frame rate time) . 
-       monitor:function(){     
-               //js_log('html:monitor: '+ this.currentTime);
-               var ct = new Date();    
-               this.currentTime =( ( ct.getTime() - this.clockStartTime )/1000 ) +this.pauseTime;
-               var ct = new Date();    
-               //js_log('mvPlayList:monitor trueTime: '+ this.currentTime);                                                                            
-               
-               if( ! this.monitorTimerId ){
-                       if(document.getElementById(this.id)){
-                               if( !MV_ANIMATION_CB_RATE )
-                                       var MV_ANIMATION_CB_RATE= 33;                                   
-                               this.monitorTimerId = window.setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
+       // monitor just needs to keep track of time (do it at frame rate time) . 
+       monitor:function() {
+               // js_log('html:monitor: '+ this.currentTime);
+               var ct = new Date();
+               this.currentTime = ( ( ct.getTime() - this.clockStartTime ) / 1000 ) + this.pauseTime;
+               var ct = new Date();
+               // js_log('mvPlayList:monitor trueTime: '+ this.currentTime);                                                                           
+
+               if ( ! this.monitorTimerId ) {
+                       if ( document.getElementById( this.id ) ) {
+                               if ( !MV_ANIMATION_CB_RATE )
+                                       var MV_ANIMATION_CB_RATE = 33;
+                               this.monitorTimerId = window.setInterval( '$j(\'#' + this.id + '\').get(0).monitor()', 250 );
                        }
                }
        },
-       //set up minimal media_element emulation:        
-       media_element:{
-               autoSelectSource:function(){
+       // set up minimal media_element emulation:       
+       media_element: {
+               autoSelectSource:function() {
                        return true;
-               },              
-               selectedPlayer:{
+               },
+               selectedPlayer: {
                        library:"html"
                },
-               selected_source:{
-                       URLTimeEncoding:false                   
+               selected_source: {
+                       URLTimeEncoding:false
                },
-               timedTextSources:function(){
+               timedTextSources:function() {
                        return false;
                }
        },
-       inheritEmbedObj:function(){
+       inheritEmbedObj:function() {
                return true;
        },
-       renderTimelineThumbnail:function( options ){
-               js_log("HTMLembed req w, height: " + options.width + ' ' + options.height);
-               //generate a scaled down version _that_ we can clone if nessisary  
-               //add a not vissiable container to the body:            
-               var do_refresh = (typeof options['refresh'] != 'undefined')?true:false;
+       renderTimelineThumbnail:function( options ) {
+               js_log( "HTMLembed req w, height: " + options.width + ' ' + options.height );
+               // generate a scaled down version _that_ we can clone if nessisary  
+               // add a not vissiable container to the body:           
+               var do_refresh = ( typeof options['refresh'] != 'undefined' ) ? true:false;
                
-               var thumb_render_id =   this.id +'_thumb_render_'+ options.height;
-               if( $j('#' + thumb_render_id ).length == 0  ||  do_refresh ){
-                       //set the font scale down percentage: (kind of arbitrary) 
+               var thumb_render_id =   this.id + '_thumb_render_' + options.height;
+               if ( $j( '#' + thumb_render_id ).length == 0  ||  do_refresh ) {
+                       // set the font scale down percentage: (kind of arbitrary) 
                        var scale_perc = options.width / this.pc.pp.width;
-                       js_log('scale_perc:'+options.width + ' / '+ $j(this).width()+ ' = '+scale_perc );                       
-                       //min scale font percent of 70 (overflow is hidden) 
-                       var font_perc  = ( Math.round( scale_perc*100 ) < 80 ) ? 80 : Math.round( scale_perc*100 );              
-                       var thumb_class = (typeof options['thumb_class'] !='undefined')? options['thumb_class'] : '';                   
-                       $j('body').append( '<div id="' + thumb_render_id + '" style="display:none">'+
-                                                                       '<div class="' + thumb_class + '" '
-                                                                       'style="width:'+options.width+'px;height:'+options.height+'px;" >'+                                                                             
-                                                                                       this.getThumbnailHTML({
+                       js_log( 'scale_perc:' + options.width + ' / ' + $j( this ).width() + ' = ' + scale_perc );
+                       // min scale font percent of 70 (overflow is hidden) 
+                       var font_perc  = ( Math.round( scale_perc * 100 ) < 80 ) ? 80 : Math.round( scale_perc * 100 );
+                       var thumb_class = ( typeof options['thumb_class'] != 'undefined' ) ? options['thumb_class'] : '';
+                       $j( 'body' ).append( '<div id="' + thumb_render_id + '" style="display:none">' +
+                                                                       '<div class="' + thumb_class + '" ' +
+                                                                       'style="width:' + options.width + 'px;height:' + options.height + 'px;" >' +
+                                                                                       this.getThumbnailHTML( {
                                                                                                'width':  options.width,
                                                                                                'height': options.height
-                                                                                       }) + 
+                                                                                       } ) +
                                                                        '</div>' +
-                                                               '</div>' 
+                                                               '</div>'
                                                          );
-                       //scale down the fonts:         
-                       $j('#' + thumb_render_id + ' *').filter('span,div,p,h,h1,h2,h3,h4,h5,h6').css('font-size',font_perc+'%')
+                       // scale down the fonts:                
+                       $j( '#' + thumb_render_id + ' *' ).filter( 'span,div,p,h,h1,h2,h3,h4,h5,h6' ).css( 'font-size', font_perc + '%' )
                        
-                       //replace out links:
-                       $j('#' + thumb_render_id +' a').each(function(){
-                               $j(this).replaceWith("<span>" + $j(this).html() + "</span>");
-                       });     
+                       // replace out links:
+                       $j( '#' + thumb_render_id + ' a' ).each( function() {
+                               $j( this ).replaceWith( "<span>" + $j( this ).html() + "</span>" );
+                       } );
                        
-                       //scale images that have width or height:
-                       $j('#' + thumb_render_id + ' img').filter('[width]').each(function(){                                                           
-                               $j(this).attr({ 
-                                               'width': Math.round( $j(this).attr('width') * scale_perc ),
-                                               'height': Math.round( $j(this).attr('height') * scale_perc )
-                                        } 
-                               );                              
-                       });
-               }                        
-               return $j('#' + thumb_render_id ).html();                          
+                       // scale images that have width or height:
+                       $j( '#' + thumb_render_id + ' img' ).filter( '[width]' ).each( function() {
+                               $j( this ).attr( {
+                                               'width': Math.round( $j( this ).attr( 'width' ) * scale_perc ),
+                                               'height': Math.round( $j( this ).attr( 'height' ) * scale_perc )
+                                        }
+                               );
+                       } );
+               }
+               return $j( '#' + thumb_render_id ).html();
        },
-       //nothing to update in static html display: (return a static representation) 
-       //@@todo render out a mini text "preview"
-       updateThumbTime:function( float_time ){
+       // nothing to update in static html display: (return a static representation) 
+       // @@todo render out a mini text "preview"
+       updateThumbTime:function( float_time ) {
                return ;
-       },      
-       getEmbedHTML:function(){
-               js_log('f:html:getEmbedHTML: ' + this.id);
-               //set up the css for our parent div:             
-               $j(this).css({
-                       'width':this.pc.pp.width, 
-                       'height':this.pc.pp.height, 
+       },
+       getEmbedHTML:function() {
+               js_log( 'f:html:getEmbedHTML: ' + this.id );
+               // set up the css for our parent div:            
+               $j( this ).css( {
+                       'width':this.pc.pp.width,
+                       'height':this.pc.pp.height,
                        'overflow':"hidden"
-               });
-               //@@todo support more smil animation layout stuff: 
-               
-               //wrap output in videoPlayer_ div:
-               $j(this).html('<div id="videoPlayer_'+ this.id+'">'+this.getThumbnailHTML()+'</div>');
-       },      
-       getThumbnailHTML:function( opt ){                               
-               var out='';
-               if(!opt)
-                       opt = {};                       
-               var height = (opt.height)?opt.height:this.pc.pp.height;
-               var width = (opt.width)?opt.width: this.pc.pp.width;    
-               js_log('1req '+ opt.height + ' but got: ' + height);    
-               if( this.pc.type =='image/jpeg' ||  this.pc.type == 'image/png' ){
-                       js_log('should put src: '+this.pc.src);
-                       out = '<img style="width:'+width+'px;height:'+height+'px" src="'+this.pc.src+'">';
-               }else{
+               } );
+               // @@todo support more smil animation layout stuff: 
+
+               // wrap output in videoPlayer_ div:
+               $j( this ).html( '<div id="videoPlayer_' + this.id + '">' + this.getThumbnailHTML() + '</div>' );
+       },
+       getThumbnailHTML:function( opt ) {
+               var out = '';
+               if ( !opt )
+                       opt = { };
+               var height = ( opt.height ) ? opt.height:this.pc.pp.height;
+               var width = ( opt.width ) ? opt.width: this.pc.pp.width;
+               js_log( '1req ' + opt.height + ' but got: ' + height );
+               if ( this.pc.type == 'image/jpeg' ||  this.pc.type == 'image/png' ) {
+                       js_log( 'should put src: ' + this.pc.src );
+                       out = '<img style="width:' + width + 'px;height:' + height + 'px" src="' + this.pc.src + '">';
+               } else {
                        out = this.pc.wholeText;
                }
-               //js_log('f:getThumbnailHTML: got thumb: '+out);
+               // js_log('f:getThumbnailHTML: got thumb: '+out);
                return out;
        },
-       doThumbnailHTML:function(){
-               js_log('htmlEmbed:doThumbnailHTML()');
+       doThumbnailHTML:function() {
+               js_log( 'htmlEmbed:doThumbnailHTML()' );
                this.getEmbedHTML();
        },
        /* since its just html display get the "embed" right away */
-       getHTML:function(){
-               js_log('htmlEmbed::getHTML() ' + this.id);
+       getHTML:function() {
+               js_log( 'htmlEmbed::getHTML() ' + this.id );
                this.getEmbedHTML();
        },
-       getDuration:function(){
-               if(this.pc.dur)
+       getDuration:function() {
+               if ( this.pc.dur )
                        return this.pc.dur;
-               //return default value:  
-               return pcHtmlEmbedDefaults.dur;         
+               // return default value:  
+               return pcHtmlEmbedDefaults.dur;
        },
-       updateVideoTime:function(start_ntp, end_ntp){
-               //since we don't really have timeline for html elements just take the delta and set it as the duration
-               this.pc.dur = npt2seconds(end_ntp) - npt2seconds(start_ntp);                    
-       },      
-       //gives a chance to make any nesseary external requests
-       //@@todo we can "start loading images" if we want
-       on_dom_swap:function(){
-               this.loading_external_data=false
-               this.ready_to_play=true;                                
-               return ;                
-       }       
+       updateVideoTime:function( start_ntp, end_ntp ) {
+               // since we don't really have timeline for html elements just take the delta and set it as the duration
+               this.pc.dur = npt2seconds( end_ntp ) - npt2seconds( start_ntp );
+       },
+       // gives a chance to make any nesseary external requests
+       // @@todo we can "start loading images" if we want
+       on_dom_swap:function() {
+               this.loading_external_data = false
+               this.ready_to_play = true;
+               return ;
+       }
 };
\ No newline at end of file
index 9732069..bd96038 100644 (file)
@@ -2,60 +2,60 @@ window.cortadoDomainLocations = {
        'upload.wikimedia.org'  : 'http://upload.wikimedia.org/jars/cortado.jar',
        'tinyvid.tv'                    : 'http://tinyvid.tv/static/cortado.jar',
        'media.tinyvid.tv'              : 'http://media.tinyvid.tv/cortado.jar'
-} 
+}
 
 var javaEmbed = {
        instanceOf:'javaEmbed',
        iframe_src:'',
        logged_domain_error:false,
        supports: {
-               'play_head':true, 
-               'pause':true, 
-               'stop':true, 
-               'fullscreen':false, 
-               'time_display':true, 
-               'volume_control':false                                                                                                                                                                                                                          
+               'play_head':true,
+               'pause':true,
+               'stop':true,
+               'fullscreen':false,
+               'time_display':true,
+               'volume_control':false
        },
-       getEmbedHTML : function (){
-               //big delay on embed html cuz its just for status updates and ie6 is crazy. 
-               if(this.controls)
-                       setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 500);
-               //set a default duration of 30 seconds: cortao should detect duration.
+       getEmbedHTML : function () {
+               // big delay on embed html cuz its just for status updates and ie6 is crazy. 
+               if ( this.controls )
+                       setTimeout( 'document.getElementById(\'' + this.id + '\').postEmbedJS()', 500 );
+               // set a default duration of 30 seconds: cortao should detect duration.
                return this.wrapEmebedContainer( this.getEmbedObj() );
        },
-       getEmbedObj:function()
-               js_log("java play url:" + this.getURI( this.seek_time_sec ));
-               //get the duration
+       getEmbedObj:function() {
+               js_log( "java play url:" + this.getURI( this.seek_time_sec ) );
+               // get the duration
                this.getDuration();
-               //if still unset set to an arbitrary time 60 seconds: 
-               if(!this.duration)this.duration=60;
-               //@@todo we should have src property in our base embed object
+               // if still unset set to an arbitrary time 60 seconds: 
+               if ( !this.duration )this.duration = 60;
+               // @@todo we should have src property in our base embed object
                var mediaSrc = this.getSrc();
                
-               if(mediaSrc.indexOf('://')!=-1 & parseUri(document.URL).host !=  parseUri(mediaSrc).host){
-                       if(window.cortadoDomainLocations[parseUri(mediaSrc).host]){
-                               applet_loc =  window.cortadoDomainLocations[parseUri(mediaSrc).host];
-                       }else{
+               if ( mediaSrc.indexOf( '://' ) != - 1 & parseUri( document.URL ).host !=  parseUri( mediaSrc ).host ) {
+                       if ( window.cortadoDomainLocations[parseUri( mediaSrc ).host] ) {
+                               applet_loc =  window.cortadoDomainLocations[parseUri( mediaSrc ).host];
+                       } else {
                                applet_loc  = 'http://theora.org/cortado.jar';
                        }
-               }else{
-                       //should be identical to cortado.jar
-                       applet_loc = mv_embed_path+'binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar';
+               } else {
+                       // should be identical to cortado.jar
+                       applet_loc = mv_embed_path + 'binPlayers/cortado/cortado-ovt-stripped-0.5.0.jar';
                }
-                       //load directly in the page..
+                       // load directly in the page..
                        // (media must be on the same server or applet must be signed)
-                       var appplet_code = ''+
-                       '<applet id="' + this.pid + '" code="com.fluendo.player.Cortado.class" archive="' + applet_loc + '" width="' + this.width + '" height="' + this.height + '">    '+ "\n"+
-                               '<param name="url" value="' + mediaSrc + '" /> ' + "\n"+
-                               '<param name="local" value="false"/>'+ "\n"+
-                               '<param name="keepaspect" value="true" />'+ "\n"+
-                               '<param name="video" value="true" />'+"\n"+
-                               '<param name="showStatus" value="hide" />' + "\n"+
-                               '<param name="audio" value="true" />'+"\n"+
-                               '<param name="seekable" value="true" />'+"\n"+
-                               '<param name="duration" value="' + this.duration + '" />'+"\n"+
-                               '<param name="bufferSize" value="4096" />'+"\n"+
-                       '</applet>';                                                            
+                       var appplet_code = '' +
+                       '<applet id="' + this.pid + '" code="com.fluendo.player.Cortado.class" archive="' + applet_loc + '" width="' + this.width + '" height="' + this.height + '">    ' + "\n" +
+                               '<param name="url" value="' + mediaSrc + '" /> ' + "\n" +
+                               '<param name="local" value="false"/>' + "\n" +
+                               '<param name="keepaspect" value="true" />' + "\n" +
+                               '<param name="video" value="true" />' + "\n" +
+                               '<param name="showStatus" value="hide" />' + "\n" +
+                               '<param name="audio" value="true" />' + "\n" +
+                               '<param name="seekable" value="true" />' + "\n" +
+                               '<param name="duration" value="' + this.duration + '" />' + "\n" +
+                               '<param name="bufferSize" value="4096" />' + "\n" +
+                       '</applet>';
                                                                        
                        // Wrap it in an iframe to avoid hanging the event thread in FF 2/3 and similar
                        // Doesn't work in MSIE or Safari/Mac or Opera 9.5
@@ -67,7 +67,7 @@ var javaEmbed = {
                                iframe.setAttribute( 'frameborder', 0 );
                                iframe.setAttribute( 'marginWidth', 0 );
                                iframe.setAttribute( 'marginHeight', 0 );
-                               iframe.setAttribute( 'id', 'cframe_' + this.id)
+                               iframe.setAttribute( 'id', 'cframe_' + this.id )
                                elt.appendChild( iframe );
                                var newDoc = iframe.contentDocument;
                                newDoc.open();
@@ -76,102 +76,102 @@ var javaEmbed = {
                        } else {
                                return appplet_code;
                        }
-       }, 
-       postEmbedJS:function(){
-               //reset logged domain error flag:
+       },
+       postEmbedJS:function() {
+               // reset logged domain error flag:
                this.logged_domain_error = false;
-               //start monitor: 
+               // start monitor: 
                this.monitor();
        },
-       monitor:function(){
-               this.getJCE();   
-               if( this.isPlaying() ){
-                       if( this.jce && this.jce.getPlayPosition ){               
-                               try{                                     
-                                  //java reads ogg media time.. so no need to add the start or seek offset:
-                                  //js_log(' ct: ' + this.jce.getPlayPosition() + ' ' +  this.supportsURLTimeEncoding());                                                                                                 
-                                  this.currentTime = this.jce.getPlayPosition();       
-                                  if( this.jce.getPlayPosition() < 0){
-                                               js_log('pp:'+this.jce.getPlayPosition());                                
-                                               //probably reached clip end                                     
-                                               this.onClipDone();                                      
-                                  }                                              
-                               }catch (e){
-                                  js_log('could not get time from jPlayer: ' + e);
-                               }                                                       
-                       }  
+       monitor:function() {
+               this.getJCE();
+               if ( this.isPlaying() ) {
+                       if ( this.jce && this.jce.getPlayPosition ) {
+                               try {
+                                  // java reads ogg media time.. so no need to add the start or seek offset:
+                                  // js_log(' ct: ' + this.jce.getPlayPosition() + ' ' +  this.supportsURLTimeEncoding());                                                                                                
+                                  this.currentTime = this.jce.getPlayPosition();
+                                  if ( this.jce.getPlayPosition() < 0 ) {
+                                               js_log( 'pp:' + this.jce.getPlayPosition() );
+                                               // probably reached clip end                                    
+                                               this.onClipDone();
+                                  }
+                               } catch ( e ) {
+                                  js_log( 'could not get time from jPlayer: ' + e );
+                               }
+                       }
                }
-               //once currentTime is updated call parent_monitor 
+               // once currentTime is updated call parent_monitor 
                this.parent_monitor();
-       },   
+       },
    /* 
        * (local cortado seek does not seem to work very well)  
        */
-       doSeek:function(perc){           
-               js_log('java:seek:p: ' + perc+ ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );                
+       doSeek:function( perc ) {
+               js_log( 'java:seek:p: ' + perc + ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
                this.getJCE();
                
-               if( this.supportsURLTimeEncoding() ){            
-                       this.parent_doSeek(perc);   
-                       //this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );                                         
+               if ( this.supportsURLTimeEncoding() ) {
+                       this.parent_doSeek( perc );
+                       // this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );                                                
                   // this.jce.setParam('url', this.getURI( this.seek_time_sec ))
-                       //this.jce.restart();
-               }else if(this.jce){                                      
-                  //do a (genneraly broken) local seek:   
-                  js_log("cortado javascript seems to always fail ... but here we go... doSeek(" + (perc * parseFloat(this.getDuration()) ) );  
-                  this.jce.doSeek( perc * parseFloat(this.getDuration())  );                           
-               }else{
-                       this.doPlayThenSeek(perc);
-               }               
+                       // this.jce.restart();
+               } else if ( this.jce ) {
+                  // do a (genneraly broken) local seek:   
+                  js_log( "cortado javascript seems to always fail ... but here we go... doSeek(" + ( perc * parseFloat( this.getDuration() ) ) );
+                  this.jce.doSeek( perc * parseFloat( this.getDuration() )  );
+               } else {
+                       this.doPlayThenSeek( perc );
+               }
        },
-       doPlayThenSeek:function(perc){
-               js_log('doPlayThenSeek Hack');
+       doPlayThenSeek:function( perc ) {
+               js_log( 'doPlayThenSeek Hack' );
                var _this = this;
                this.play();
                var rfsCount = 0;
-               var readyForSeek = function(){
-                       _this.getJCE(); 
-                       //if we have .jre ~in theory~ we can seek (but probably not) 
-                       if(_this.jce){
-                               _this.doSeek(perc);
-                       }else{                  
-                               //try to get player for 10 seconds: 
-                               if( rfsCount < 200 ){
-                                       setTimeout(readyForSeek, 50);
+               var readyForSeek = function() {
+                       _this.getJCE();
+                       // if we have .jre ~in theory~ we can seek (but probably not) 
+                       if ( _this.jce ) {
+                               _this.doSeek( perc );
+                       } else {
+                               // try to get player for 10 seconds: 
+                               if ( rfsCount < 200 ) {
+                                       setTimeout( readyForSeek, 50 );
                                        rfsCount++;
-                               }else{
-                                       js_log('error:doPlayThenSeek failed');
+                               } else {
+                                       js_log( 'error:doPlayThenSeek failed' );
                                }
                        }
                }
                readyForSeek();
        },
-       //get java cortado embed object
-       getJCE:function(){              
+       // get java cortado embed object
+       getJCE:function() {
                if ( embedTypes.mozilla ) {
                        this.jce = window.frames['cframe_' + this.id ].document.getElementById( this.pid );
-               }else{
-                       this.jce = $j('#'+this.pid).get( 0 );
-               }                
+               } else {
+                       this.jce = $j( '#' + this.pid ).get( 0 );
+               }
        },
-       doThumbnailHTML:function(){             
-               //empty out player html (jquery with java applets does mix) :                   
-               var pelm = document.getElementById('dc_' + this.id );
-               if( pelm ){
+       doThumbnailHTML:function() {
+               // empty out player html (jquery with java applets does mix) :                  
+               var pelm = document.getElementById( 'dc_' + this.id );
+               if ( pelm ) {
                        pelm.innerHTML = '';
-               }               
+               }
                this.parent_doThumbnailHTML();
        },
-       play:function(){
+       play:function() {
                this.getJCE();
                this.parent_play();
-               if( this.jce )
+               if ( this.jce )
                        this.jce.doPlay();
        },
-       pause:function(){
+       pause:function() {
                this.getJCE();
                this.parent_pause();
-               if( this.jce )
-                       this.jce.doPause();              
+               if ( this.jce )
+                       this.jce.doPause();
        }
 };
index 6a8dfda..ad36a8b 100644 (file)
@@ -1,39 +1,39 @@
-var kplayerEmbed={
+var kplayerEmbed = {
        instanceOf:'kflashEmbed',
        supports: {
-               'play_head':true, 
+               'play_head':true,
                'pause':true,
-               'stop':true, 
-               'time_display':true, 
+               'stop':true,
+               'time_display':true,
                'volume_control':true,
                'overlay':false,
                'fullscreen':false
        },
-       getEmbedHTML : function (){             
-               var embed_code =  this.getEmbedObj();           
-               //setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 2000);
-               js_log("return embed html");
-               return this.wrapEmebedContainer( embed_code);                   
-       },      
-       getEmbedObj:function(){
-               var player_path = mv_embed_path + 'binPlayers/kaltura-player/player.swf';       
-               return '<object id="'+this.pid+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+ 
-                               'width="' +this.width+'" height="' + this.height + '">'+
-                                       '<param name="movie" value="'+ player_path +'" />' +
+       getEmbedHTML : function () {
+               var embed_code =  this.getEmbedObj();
+               // setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 2000);
+               js_log( "return embed html" );
+               return this.wrapEmebedContainer( embed_code );
+       },
+       getEmbedObj:function() {
+               var player_path = mv_embed_path + 'binPlayers/kaltura-player/player.swf';
+               return '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
+                               'width="' + this.width + '" height="' + this.height + '">' +
+                                       '<param name="movie" value="' + player_path + '" />' +
                                        '<param name="allowfullscreen" value="true" />' +
                                        '<param name="allowscriptaccess" value="always" />' +
                                        '<param name="flashvars" value="file=video.flv&image=preview.jpg" />' +
-                               '<embed '+
-                                       'type="application/x-shockwave-flash" '+
-                                       'id="'+this.pid+'" '+                                   
-                                       'src="' + player_path +'" '+ 
-                                       'width="' + this.width + '" '
-                                       'height="' + this.height + '" '+
-                                       'allowscriptaccess="always" '
-                                       'allowfullscreen="true" '+
-                                       'flashvars="autostart=true&file=' + escape(  this.getSrc() ) + '" '
-                               '/>'+
-                       '</object>';            
+                               '<embed ' +
+                                       'type="application/x-shockwave-flash" ' +
+                                       'id="' + this.pid + '" ' +
+                                       'src="' + player_path + '" ' +
+                                       'width="' + this.width + '" ' +
+                                       'height="' + this.height + '" ' +
+                                       'allowscriptaccess="always" ' +
+                                       'allowfullscreen="true" ' +
+                                       'flashvars="autostart=true&file=' + escape(  this.getSrc() ) + '" ' +
+                               '/>' +
+                       '</object>';
                /*return  '<object id="'+this.pid+'" type="application/x-shockwave-flash"'+ 
                                'allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" '+
                                'height="'+  parseInt(this.height) + '" ' +
@@ -48,21 +48,21 @@ var kplayerEmbed={
                                                //set the url: 
                                                'entryId=' + escape(  this.getSrc() ) + '"/>'+
                                        '<param name="wmode" value="opaque"/>'+
-                               '</object>';    */              
+                               '</object>';    */
        },
-       postEmbedJS:function(){         
+       postEmbedJS:function() {
                this.monitor();
        },
-       pause:function(){
+       pause:function() {
                this.stop();
        },
-       monitor:function(){             
-               //this.parent_monitor();        
+       monitor:function() {
+               // this.parent_monitor();       
        }
 }
 
-function onKdpReady(playerId) {
-        js_log("IN THEORY PLAYER IS READY");
+function onKdpReady( playerId ) {
+        js_log( "IN THEORY PLAYER IS READY" );
         /*
         window.myKdp=get(playerId);
         get("Player_State").innerHTML="<br>&nbsp; READY (Id=" + playerId + ")";
index 70baf9c..c4b48af 100644 (file)
-//native embed library:
+// native embed library:
 var nativeEmbed = {
        instanceOf:'nativeEmbed',
        canPlayThrough:false,
        grab_try_count:0,
-       onlyLoadFlag:false,     
+       onlyLoadFlag:false,
        urlAppend:'',
-       prevCurrentTime:-1,
+       prevCurrentTime: - 1,
        supports: {
-               'play_head':true, 
-               'pause':true,            
-               'fullscreen':false, 
-               'time_display':true, 
+               'play_head':true,
+               'pause':true,
+               'fullscreen':false,
+               'time_display':true,
                'volume_control':true,
                
                'overlays':true,
-               'playlist_swap_loader':true //if the object supports playlist functions         
+               'playlist_swap_loader':true // if the object supports playlist functions                
    },
-       getEmbedHTML : function (){                                     
+       getEmbedHTML : function () {
                var embed_code =  this.getEmbedObj();
-               js_log("embed code: " + embed_code)                             
-               setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 150);
-               return this.wrapEmebedContainer( embed_code);           
+               js_log( "embed code: " + embed_code )
+               setTimeout( '$j(\'#' + this.id + '\').get(0).postEmbedJS()', 150 );
+               return this.wrapEmebedContainer( embed_code );
        },
-       getEmbedObj:function(){
-               //we want to let mv_embed handle the controls so notice the absence of control attribute
+       getEmbedObj:function() {
+               // we want to let mv_embed handle the controls so notice the absence of control attribute
                // controls=false results in controls being displayed: 
-               //http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html           
-               js_log("native play url:" + this.getSrc() + ' start_offset: '+ this.start_ntp + ' end: ' + this.end_ntp);
+               // http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html          
+               js_log( "native play url:" + this.getSrc() + ' start_offset: ' + this.start_ntp + ' end: ' + this.end_ntp );
                var eb = '<video ' +
                                        'id="' + this.pid + '" ' +
-                                       'style="width:' + this.width+'px;height:' + this.height + 'px;" ' +
-                                       'width="' + this.width + '" height="'+this.height+'" '+
+                                       'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' +
+                                       'width="' + this.width + '" height="' + this.height + '" ' +
                                           'src="' + this.getSrc() + '" ';
                                           
                /*if(!this.onlyLoadFlag)
                        eb+='autoplay="true" ';*/
                        
-               //continue with the other attr:                                         
-               eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' +
-                         'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + 
-                         'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' +
-                         'onprogress="$j(\'#'+this.id+'\').get(0).onprogress( event );return false;" '+
-                         'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" '+
-                         'onseeking="$j(\'#'+this.id+'\').get(0).onseeking();" ' +
-                         'onseeked="$j(\'#'+this.id+'\').get(0).onseeked();" >' +                         
+               // continue with the other attr:                                                
+               eb += 'oncanplaythrough="$j(\'#' + this.id + '\').get(0).oncanplaythrough();return false;" ' +
+                         'onloadedmetadata="$j(\'#' + this.id + '\').get(0).onloadedmetadata();return false;" ' +
+                         'loadedmetadata="$j(\'#' + this.id + '\').get(0).onloadedmetadata();return false;" ' +
+                         'onprogress="$j(\'#' + this.id + '\').get(0).onprogress( event );return false;" ' +
+                         'onended="$j(\'#' + this.id + '\').get(0).onended();return false;" ' +
+                         'onseeking="$j(\'#' + this.id + '\').get(0).onseeking();" ' +
+                         'onseeked="$j(\'#' + this.id + '\').get(0).onseeked();" >' +
                        '</video>';
                return eb;
        },
-       //@@todo : loading progress     
-       postEmbedJS:function(){
-               var _this = this;               
-               js_log("f:native:postEmbedJS:");                
+       // @@todo : loading progress    
+       postEmbedJS:function() {
+               var _this = this;
+               js_log( "f:native:postEmbedJS:" );
                this.getVID();
-               if(typeof this.vid != 'undefined'){                     
-                       //always load the media:
-                       if( this.onlyLoadFlag ){ 
+               if ( typeof this.vid != 'undefined' ) {
+                       // always load the media:
+                       if ( this.onlyLoadFlag ) {
                                this.vid.load();
-                       }else{  
-                               //issue play request                            
+                       } else {
+                               // issue play request                           
                                this.vid.play();
-                       }                                                       
-                       setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100);                
-               }else{
-                       js_log('could not grab vid obj trying again:' + typeof this.vid);
+                       }
+                       setTimeout( '$j(\'#' + this.id + '\').get(0).monitor()', 100 );
+               } else {
+                       js_log( 'could not grab vid obj trying again:' + typeof this.vid );
                        this.grab_try_count++;
-                       if(     this.grab_count == 20 ){
-                               js_log(' could not get vid object after 10 tries re-run: getEmbedObj()' ) ;                                             
-                       }else{
-                               setTimeout('$j(\'#'+this.id+'\').get(0).postEmbedJS()', 200);
-                       }                       
+                       if (    this.grab_count == 20 ) {
+                               js_log( ' could not get vid object after 10 tries re-run: getEmbedObj()' ) ;
+                       } else {
+                               setTimeout( '$j(\'#' + this.id + '\').get(0).postEmbedJS()', 200 );
+                       }
                }
-       },      
-       onseeking:function(){
-               js_log("onseeking");
+       },
+       onseeking:function() {
+               js_log( "onseeking" );
                this.seeking = true;
-               this.setStatus( gM('mwe-seeking') );
+               this.setStatus( gM( 'mwe-seeking' ) );
        },
-       onseeked: function(){           
+       onseeked: function() {
                this.seeking = false;
        },
-       doSeek:function(perc){                                  
-               js_log('native:seek:p: ' + perc+ ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );              
-               //@@todo check if the clip is loaded here (if so we can do a local seek)
-               if( this.supportsURLTimeEncoding() ){                   
+       doSeek:function( perc ) {
+               js_log( 'native:seek:p: ' + perc + ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
+               // @@todo check if the clip is loaded here (if so we can do a local seek)
+               if ( this.supportsURLTimeEncoding() ) {
                        // Make sure we could not do a local seek instead:
-                       if( perc < this.bufferedPercent && this.vid.duration && !this.didSeekJump ){
-                               js_log("do local seek " + perc + ' is already buffered < ' + this.bufferedPercent);
-                               this.doNativeSeek(perc);
-                       }else{                  
+                       if ( perc < this.bufferedPercent && this.vid.duration && !this.didSeekJump ) {
+                               js_log( "do local seek " + perc + ' is already buffered < ' + this.bufferedPercent );
+                               this.doNativeSeek( perc );
+                       } else {
                                // We support URLTimeEncoding call parent seek: 
-                               this.parent_doSeek(perc);
-                       }                       
-               }else if(this.vid && this.vid.duration ){          
-                       //(could also check bufferedPercent > perc seek (and issue oggz_chop request or not) 
-                       this.doNativeSeek( perc );      
-               }else{
-                       //try to do a play then seek: 
+                               this.parent_doSeek( perc );
+                       }
+               } else if ( this.vid && this.vid.duration ) {
+                       // (could also check bufferedPercent > perc seek (and issue oggz_chop request or not) 
+                       this.doNativeSeek( perc );
+               } else {
+                       // try to do a play then seek: 
                        this.doPlayThenSeek( perc )
-               }                                 
-       },      
-       doNativeSeek:function(perc){    
-               js_log('native::doNativeSeek::' + perc);
-               this.seek_time_sec=0;                    
-               this.vid.currentTime = perc * this.duration;            
-               this.monitor(); 
+               }
+       },
+       doNativeSeek:function( perc ) {
+               js_log( 'native::doNativeSeek::' + perc );
+               this.seek_time_sec = 0;
+               this.vid.currentTime = perc * this.duration;
+               this.monitor();
        },
-       doPlayThenSeek:function(perc){
-               js_log('native::doPlayThenSeek::');
+       doPlayThenSeek:function( perc ) {
+               js_log( 'native::doPlayThenSeek::' );
                var _this = this;
                this.play();
                var rfsCount = 0;
-               var readyForSeek = function(){          
+               var readyForSeek = function() {
                        _this.getVID();
-                       if(_this.vid)           
-                               js_log('readyForSeek looking::' + _this.vid.duration);
-                       //if we have duration then we are ready to do the seek
-                       if( _this.vid && _this.vid.duration ){
+                       if ( _this.vid )
+                               js_log( 'readyForSeek looking::' + _this.vid.duration );
+                       // if we have duration then we are ready to do the seek
+                       if ( _this.vid && _this.vid.duration ) {
                                _this.doNativeSeek( perc );
-                       }else{                  
-                               //Try to get player for 40 seconds: 
-                               //(it would be nice if the onmetadata type callbacks where fired consistently)
-                               if( rfsCount < 800 ){
-                                       setTimeout(readyForSeek, 50);
+                       } else {
+                               // Try to get player for 40 seconds: 
+                               // (it would be nice if the onmetadata type callbacks where fired consistently)
+                               if ( rfsCount < 800 ) {
+                                       setTimeout( readyForSeek, 50 );
                                        rfsCount++;
-                               }else{
-                                       js_log('error:doPlayThenSeek failed');
+                               } else {
+                                       js_log( 'error:doPlayThenSeek failed' );
                                }
                        }
                }
                readyForSeek();
        },
-       setCurrentTime: function(pos, callback){
+       setCurrentTime: function( pos, callback ) {
                var _this = this;
                this.getVID();
-               if(!this.vid) {                 
+               if ( !this.vid ) {
                        this.load();
-                       var loaded = function(event) {
-                               js_log('native:setCurrentTime (after load): ' + pos + ' :  dur: ' + this.getDuration());
+                       var loaded = function( event ) {
+                               js_log( 'native:setCurrentTime (after load): ' + pos + ' :  dur: ' + this.getDuration() );
                                _this.vid.currentTime = pos;
-                               var once = function(event) { 
+                               var once = function( event ) {
                                        callback();
-                                       _this.vid.removeEventListener('seeked', once, false) 
+                                       _this.vid.removeEventListener( 'seeked', once, false )
                                };
-                               _this.vid.addEventListener('seeked', once, false);
-                               _this.removeEventListener('loadedmetadata', loaded, false);
+                               _this.vid.addEventListener( 'seeked', once, false );
+                               _this.removeEventListener( 'loadedmetadata', loaded, false );
                        };
-                       _this.addEventListener('loadedmetadata', loaded, false);
+                       _this.addEventListener( 'loadedmetadata', loaded, false );
                } else {
-                       //js_log('native:setCurrentTime: ' + pos + ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
+                       // js_log('native:setCurrentTime: ' + pos + ' : '  + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
                        _this.vid.currentTime = pos;
-                       var once = function(event) { 
-                               callback(); 
-                               _this.vid.removeEventListener('seeked', once, false) 
+                       var once = function( event ) {
+                               callback();
+                               _this.vid.removeEventListener( 'seeked', once, false )
                        };
-                       _this.vid.addEventListener('seeked', once, false);
+                       _this.vid.addEventListener( 'seeked', once, false );
                }
        },
-       monitor : function(){           
-               this.getVID(); //make sure we have .vid obj
-               if(!this.vid){
-                       js_log('could not find video embed: '+this.id + ' stop monitor');
-                       this.stopMonitor();                     
+       monitor : function() {
+               this.getVID(); // make sure we have .vid obj
+               if ( !this.vid ) {
+                       js_log( 'could not find video embed: ' + this.id + ' stop monitor' );
+                       this.stopMonitor();
                        return false;
-               }               
-               //don't update status if we are not the current clip 
-               //(playlist leakage?) .. should move to playlist overwrite of monitor? 
-               if(this.pc){
-                       if(this.pc.pp.cur_clip.id != this.pc.id)
+               }
+               // don't update status if we are not the current clip 
+               // (playlist leakage?) .. should move to playlist overwrite of monitor? 
+               if ( this.pc ) {
+                       if ( this.pc.pp.cur_clip.id != this.pc.id )
                                return true;
-               }       
+               }
                
-               //do a seek check (on seeked does not seem fire consistantly)   
-               if( this.prevCurrentTime != -1 && this.prevCurrentTime != 0
-                       && this.prevCurrentTime < this.currentTime && this.seeking)
-                       this.seeking = false;           
+               // do a seek check (on seeked does not seem fire consistantly)  
+               if ( this.prevCurrentTime != - 1 && this.prevCurrentTime != 0
+                       && this.prevCurrentTime < this.currentTime && this.seeking )
+                       this.seeking = false;
                                                                
                this.prevCurrentTime =  this.currentTime;
                
-               //update currentTime                            
-               this.currentTime = this.vid.currentTime;                
+               // update currentTime                           
+               this.currentTime = this.vid.currentTime;
                this.addPresTimeOffset();
                                
-               //js_log('currentTime:' + this.currentTime);
-               //js_log('this.currentTime: ' + this.currentTime );
-               //once currentTime is updated call parent_monitor
+               // js_log('currentTime:' + this.currentTime);
+               // js_log('this.currentTime: ' + this.currentTime );
+               // once currentTime is updated call parent_monitor
                this.parent_monitor();
-       },      
-       getSrc:function(){
+       },
+       getSrc:function() {
                var src = this.parent_getSrc();
-               if(  this.urlAppend != '')
-                       return src + ( (src.indexOf('?')==-1)?'?':'&') + this.urlAppend;
+               if (  this.urlAppend != '' )
+                       return src + ( ( src.indexOf( '?' ) == - 1 ) ? '?':'&' ) + this.urlAppend;
                return src;
        },
        /*
         * native callbacks for the video tag: 
         */
-       oncanplaythrough : function(){          
-               //js_log('f:oncanplaythrough');
+       oncanplaythrough : function() {
+               // js_log('f:oncanplaythrough');
                this.getVID();
-               if( ! this.paused )
+               if ( ! this.paused )
                        this.vid.play();
        },
-       onloadedmetadata: function(){
+       onloadedmetadata: function() {
                this.getVID();
-               js_log('f:onloadedmetadata metadata ready (update duration)');  
-               //update duration if not set (for now trust the getDuration more than this.vid.duration         
-               if( this.getDuration() == 0  &&  ! isNaN( this.vid.duration ) ){
-                       js_log('updaed duration via native video duration: '+ this.vid.duration)
+               js_log( 'f:onloadedmetadata metadata ready (update duration)' );
+               // update duration if not set (for now trust the getDuration more than this.vid.duration                
+               if ( this.getDuration() == 0  &&  ! isNaN( this.vid.duration ) ) {
+                       js_log( 'updaed duration via native video duration: ' + this.vid.duration )
                        this.duration = this.vid.duration;
                }
        },
-       onprogress: function(e){                
+       onprogress: function( e ) {
                this.bufferedPercent =   e.loaded / e.total;
-               //js_log("onprogress:" +e.loaded + ' / ' +  (e.total) + ' = ' + this.bufferedPercent);
+               // js_log("onprogress:" +e.loaded + ' / ' +  (e.total) + ' = ' + this.bufferedPercent);
        },
-       onended:function(){       
-               var _this = this         
-               this.getVID();   
-               js_log('native:onended:' + this.vid.currentTime + ' real dur:' +  this.getDuration() );
-               //if we just started (under 1 second played) & duration is much longer.. don't run onClipDone just yet . (bug in firefox native sending onended event early) 
-               if(this.vid.currentTime  < 1 && this.getDuration() > 1 && this.grab_try_count < 5){                     
-                       js_log('native on ended called with time:' + this.vid.currentTime + ' of total real dur: ' +  this.getDuration() + ' attempting to reload src...');
-                       var doRetry = function(){
-                               _this.urlAppend = 'retry_src=' + _this.grab_try_count; 
+       onended:function() {
+               var _this = this
+               this.getVID();
+               js_log( 'native:onended:' + this.vid.currentTime + ' real dur:' +  this.getDuration() );
+               // if we just started (under 1 second played) & duration is much longer.. don't run onClipDone just yet . (bug in firefox native sending onended event early) 
+               if ( this.vid.currentTime  < 1 && this.getDuration() > 1 && this.grab_try_count < 5 ) {
+                       js_log( 'native on ended called with time:' + this.vid.currentTime + ' of total real dur: ' +  this.getDuration() + ' attempting to reload src...' );
+                       var doRetry = function() {
+                               _this.urlAppend = 'retry_src=' + _this.grab_try_count;
                                _this.doEmbedHTML();
                                _this.grab_try_count++;
                        }
-                       setTimeout(doRetry, 100);                       
-               }else{
-                       js_log('native onClipDone done call');
+                       setTimeout( doRetry, 100 );
+               } else {
+                       js_log( 'native onClipDone done call' );
                        this.onClipDone();
                }
-       },      
-       pause : function(){             
+       },
+       pause : function() {
                this.getVID();
-               this.parent_pause(); //update interface         
-               if(this.vid){                   
+               this.parent_pause(); // update interface                
+               if ( this.vid ) {
                        this.vid.pause();
                }
-               //stop updates: 
+               // stop updates: 
                this.stopMonitor();
        },
-       play:function(){
+       play:function() {
                this.getVID();
-               this.parent_play(); //update interface
-               if( this.vid ){
+               this.parent_play(); // update interface
+               if ( this.vid ) {
                        this.vid.play();
-                       //re-start the monitor: 
+                       // re-start the monitor: 
                        this.monitor();
                }
        },
-       toggleMute:function(){
+       toggleMute:function() {
                this.parent_toggleMute();
                this.getVID();
-               if(this.vid)
+               if ( this.vid )
                        this.vid.muted = this.muted;
-       },      
-       updateVolumen:function(perc){
-               this.getVID();          
-               if(this.vid)
-                       this.vid.volume = perc;                     
-       },              
-    getVolumen:function(){
-               this.getVID();          
-               if(this.vid)
-                       return this.vid.volume;                    
-       },      
-       getNativeDuration:function(){
-               if(this.vid)
+       },
+       updateVolumen:function( perc ) {
+               this.getVID();
+               if ( this.vid )
+                       this.vid.volume = perc;
+       },
+    getVolumen:function() {
+               this.getVID();
+               if ( this.vid )
+                       return this.vid.volume;
+       },
+       getNativeDuration:function() {
+               if ( this.vid )
                        return this.vid.duration;
        },
-       load:function(){
+       load:function() {
                this.getVID();
-               if( !this.vid ){
-                       //no vid loaded
-                       js_log('native::load() ... doEmbed');
+               if ( !this.vid ) {
+                       // no vid loaded
+                       js_log( 'native::load() ... doEmbed' );
                        this.onlyLoadFlag = true;
                        this.doEmbedHTML();
-               }else{
-                       //won't happen offten
+               } else {
+                       // won't happen offten
                        this.vid.load();
                }
        },
        // get the embed vlc object 
-       getVID : function (){
-               this.vid = $j('#'+this.pid).get(0);               
-       },  
+       getVID : function () {
+               this.vid = $j( '#' + this.pid ).get( 0 );
+       },
        /* 
         * playlist driver        
         * mannages native playlist calls                 
-        */     
+        */
 };
index 6e2b13d..9974c10 100644 (file)
@@ -1,65 +1,65 @@
-var omtkEmbed={
+var omtkEmbed = {
        instanceOf:'omtkEmbed',
        supports: {
-               'pause':true,   
+               'pause':true,
                        'time_display':true
        },
-       getEmbedHTML : function (){             
+       getEmbedHTML : function () {
                var embed_code =  this.getEmbedObj();
-               //need omtk to fire an onReady event.
-               setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 2000);
-               return this.wrapEmebedContainer( embed_code);                   
+               // need omtk to fire an onReady event.
+               setTimeout( '$j(\'#' + this.id + '\').get(0).postEmbedJS()', 2000 );
+               return this.wrapEmebedContainer( embed_code );
        },
-       getEmbedObj:function(){
-               var player_path = mv_embed_path + 'binPlayers/omtk-fx/omtkp.swf';       
-               //player_path = 'omtkp.swf';
-               js_log("player path: " + player_path);
-               return  '<object id="'+this.pid+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' +                                
-                                       '<param name="movie" value="' + player_path +'" />'+"\n"+                                       
-                                       '<!--[if !IE]>-->'+"\n"+
-                                               '<object id="'+this.pid+'_ie" type="application/x-shockwave-flash" data="'+player_path+'" width="1" height="1">'+"\n"+
-                                       '<!--<![endif]-->'+"\n"+
-                                                 '<p>Error with Display of Flash Plugin</p>'+"\n"+
-                                       '<!--[if !IE]>-->'+"\n"+
-                                               '</object>'+"\n"+
-                                       '<!--<![endif]-->'+"\n"+
-                                 '</object>';                  
+       getEmbedObj:function() {
+               var player_path = mv_embed_path + 'binPlayers/omtk-fx/omtkp.swf';
+               // player_path = 'omtkp.swf';
+               js_log( "player path: " + player_path );
+               return  '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1">' +
+                                       '<param name="movie" value="' + player_path + '" />' + "\n" +
+                                       '<!--[if !IE]>-->' + "\n" +
+                                               '<object id="' + this.pid + '_ie" type="application/x-shockwave-flash" data="' + player_path + '" width="1" height="1">' + "\n" +
+                                       '<!--<![endif]-->' + "\n" +
+                                                 '<p>Error with Display of Flash Plugin</p>' + "\n" +
+                                       '<!--[if !IE]>-->' + "\n" +
+                                               '</object>' + "\n" +
+                                       '<!--<![endif]-->' + "\n" +
+                                 '</object>';
        },
-       postEmbedJS:function(){
+       postEmbedJS:function() {
                this.getOMTK();
-               //play the url: 
-               js_log("play: pid:"+ this.pid + ' src:' + this.src);
+               // play the url: 
+               js_log( "play: pid:" + this.pid + ' src:' + this.src );
                                
                this.omtk.play( this.src );
                
                this.monitor();
-               //$j('#omtk_player').get(0).play(this.src);
-               //$j('#'+this.pid).get(0).play( this.src );
+               // $j('#omtk_player').get(0).play(this.src);
+               // $j('#'+this.pid).get(0).play( this.src );
        },
-       pause:function(){
+       pause:function() {
                this.stop();
        },
-       monitor:function(){
-               if(this.omtk.getPosition)               
+       monitor:function() {
+               if ( this.omtk.getPosition )
                        this.currentTime = this.omtk.getPosition() / 1000;
                
-               this.parent_monitor();  
+               this.parent_monitor();
        },
-       getOMTK : function (){
-               this.omtk = $j('#'+this.pid).get(0);            
-               if(!this.omtk.play)
-                       this.omtk = $j('#'+this.pid+'_ie').get(0); 
+       getOMTK : function () {
+               this.omtk = $j( '#' + this.pid ).get( 0 );
+               if ( !this.omtk.play )
+                       this.omtk = $j( '#' + this.pid + '_ie' ).get( 0 );
                
-               if(this.omtk.play){
-                       //js_log('omtk obj is missing .play (probably not omtk obj)');
+               if ( this.omtk.play ) {
+                       // js_log('omtk obj is missing .play (probably not omtk obj)');
                }
-       },  
+       },
 }
 
-function OMTK_P_complete(){
-       js_log('OMTK_P_complete');                      
+function OMTK_P_complete() {
+       js_log( 'OMTK_P_complete' );
 }
 
-function OMTK_P_metadataUpdate(){
-       js_log('OMTK_P_metadataUpdate');
+function OMTK_P_metadataUpdate() {
+       js_log( 'OMTK_P_metadataUpdate' );
 }
index db607a5..8ebda9d 100644 (file)
 * javascript api: http://www.videolan.org/doc/play-howto/en/ch04.html
 *  assume version > 0.8.5.1
 */
-var vlcEmbed = { 
+var vlcEmbed = {
        instanceOf:'vlcEmbed',
-       supports: {'play_head':true, 
-               'pause':true, 
-               'stop':true, 
-               'fullscreen':true, 
-               'time_display':true, 
+       supports: { 'play_head':true,
+               'pause':true,
+               'stop':true,
+               'fullscreen':true,
+               'time_display':true,
                'volume_control':true,
                
-               'playlist_driver':true, //if the object supports playlist functions
+               'playlist_driver':true, // if the object supports playlist functions
                'overlay':false
        },
-       //init vars: 
+       // init vars: 
        monitorTimerId : 0,
-       prevState : 0,                    
-       pejs_count:0, //post embed js count
-        
-       getEmbedHTML: function(){               
-               //give VLC 150ms to initialize before we start playback 
-               //@@todo should be able to do this as an ready event
-               this.pejs_count=0;
-               setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
+       prevState : 0,
+       pejs_count:0, // post embed js count
+
+       getEmbedHTML: function() {
+               // give VLC 150ms to initialize before we start playback 
+               // @@todo should be able to do this as an ready event
+               this.pejs_count = 0;
+               setTimeout( 'document.getElementById(\'' + this.id + '\').postEmbedJS()', 150 );
                   return this.getEmbedObj();
        },
-       getEmbedObj:function(){
-               var embed_code = '<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" '+
-                       'codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" '+
-                       'id="' + this.pid + '" events="True" height="'+this.height+'" width="'+this.width+'"' +
-                       '>'+
-                               '<param name="MRL" value="">'+
-                               '<param name="ShowDisplay" value="True">'+
-                               '<param name="AutoLoop" value="False">'+
-                               '<param name="AutoPlay" value="False">'+
-                               '<param name="Volume" value="50">'+
-                               '<param name="StartTime" value="0">'+
-                               '<embed pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" '+
-                                       'progid="VideoLAN.VLCPlugin.2" name="' + this.pid + '" '+
-                                       'height="'+this.height+'" width="'+this.width+'" ' +
-                                       //set the style too 'just to be sure'
-                                       'style="width:'+this.width+'px;height:'+this.height+'px;" '+ 
-                               '>'+
+       getEmbedObj:function() {
+               var embed_code = '<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" ' +
+                       'codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,6,0" ' +
+                       'id="' + this.pid + '" events="True" height="' + this.height + '" width="' + this.width + '"' +
+                       '>' +
+                               '<param name="MRL" value="">' +
+                               '<param name="ShowDisplay" value="True">' +
+                               '<param name="AutoLoop" value="False">' +
+                               '<param name="AutoPlay" value="False">' +
+                               '<param name="Volume" value="50">' +
+                               '<param name="StartTime" value="0">' +
+                               '<embed pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" ' +
+                                       'progid="VideoLAN.VLCPlugin.2" name="' + this.pid + '" ' +
+                                       'height="' + this.height + '" width="' + this.width + '" ' +
+                                       // set the style too 'just to be sure'
+                                       'style="width:' + this.width + 'px;height:' + this.height + 'px;" ' +
+                               '>' +
                        '</object>';
-               js_log('embed with: ' + embed_code);
-               return embed_code;              
+               js_log( 'embed with: ' + embed_code );
+               return embed_code;
        },
        
        /*
        * some java script to start vlc playback after the embed:
        */
-       postEmbedJS: function(){   
-               //load a pointer to the vlc into the object (this.vlc)
+       postEmbedJS: function() {
+               // load a pointer to the vlc into the object (this.vlc)
                this.getVLC();
-               if( this.vlc.log ){
-                       //manipulate the dom object to make sure vlc has the correct size: 
-                       this.vlc.style.width=this.width;
-                       this.vlc.style.height=this.height;         
+               if ( this.vlc.log ) {
+                       // manipulate the dom object to make sure vlc has the correct size: 
+                       this.vlc.style.width = this.width;
+                       this.vlc.style.height = this.height;
                        this.vlc.playlist.items.clear();
-                       //@@todo if client supports seeking no need to send seek_offset to URI
-                       js_log('vlc play::' + this.getSrc() );                    
+                       // @@todo if client supports seeking no need to send seek_offset to URI
+                       js_log( 'vlc play::' + this.getSrc() );
                        var itemId = this.vlc.playlist.add( this.getSrc() );
-                       if( itemId != -1 ){
-                               //play
-                               this.vlc.playlist.playItem(itemId);
-                       }else{
-                               js_log("error:cannot play at the moment !");
+                       if ( itemId != - 1 ) {
+                               // play
+                               this.vlc.playlist.playItem( itemId );
+                       } else {
+                               js_log( "error:cannot play at the moment !" );
+                       }
+                       // if controls enabled start up javascript interface and monitor:
+                       if ( this.controls ) {
+                               // activate the slider: scriptaculus based)
+                               // this.activateSlider();  
+                               // start doing status updates every 1/10th of a second                                                     
                        }
-                       //if controls enabled start up javascript interface and monitor:
-                       if(this.controls){                              
-                               //activate the slider: scriptaculus based)
-                               //this.activateSlider();  
-                               //start doing status updates every 1/10th of a second                                                      
-                       }               
-                       setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100);                                                
-               }else{
-                       js_log('postEmbedJS:vlc not ready');
+                       setTimeout( '$j(\'#' + this.id + '\').get(0).monitor()', 100 );
+               } else {
+                       js_log( 'postEmbedJS:vlc not ready' );
                        this.pejs_count++;
-                       if( this.pejs_count < 10 ){
-                               setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()',100);
-                       }else{
-                               js_log('vlc never ready');
-                       }       
+                       if ( this.pejs_count < 10 ) {
+                               setTimeout( 'document.getElementById(\'' + this.id + '\').postEmbedJS()', 100 );
+                       } else {
+                               js_log( 'vlc never ready' );
+                       }
                }
-       },   
-       //disable local seeking (while we don't know what we have avaliable)
-       doSeek : function(perc){
-               if( this.supportsURLTimeEncoding() ){
-                       this.parent_doSeek(perc);
-               }else if( this.vlc ) {
-                       this.seeking=true;
-                       js_log("do vlc http seek to: " + perc)
-                       if( (this.vlc.input.state == 3) && (this.vlc.input.position != perc) )
+       },
+       // disable local seeking (while we don't know what we have avaliable)
+       doSeek : function( perc ) {
+               if ( this.supportsURLTimeEncoding() ) {
+                       this.parent_doSeek( perc );
+               } else if ( this.vlc ) {
+                       this.seeking = true;
+                       js_log( "do vlc http seek to: " + perc )
+                       if ( ( this.vlc.input.state == 3 ) && ( this.vlc.input.position != perc ) )
                        {
                                this.vlc.input.position = perc;
-                               this.setStatus( 'seeking...' );            
-                       }                               
-               }else{
-                       this.doPlayThenSeek(perc);
+                               this.setStatus( 'seeking...' );
+                       }
+               } else {
+                       this.doPlayThenSeek( perc );
                }
                this.parent_monitor();
        },
-       doPlayThenSeek:function(perc){
-               js_log('doPlayThenSeekHack');
+       doPlayThenSeek:function( perc ) {
+               js_log( 'doPlayThenSeekHack' );
                var _this = this;
                this.play();
                var rfsCount = 0;
-               var readyForSeek = function(){
+               var readyForSeek = function() {
                        _this.getVLC();
                        var newState = _this.vlc.input.state;
-                       //if playing we are ready to do the 
-                       if(newState==3){
-                               _this.doSeek(perc);
-                       }else{                  
-                               //try to get player for 10 seconds: 
-                               if( rfsCount < 200 ){
-                                       setTimeout(readyForSeek, 50);
+                       // if playing we are ready to do the 
+                       if ( newState == 3 ) {
+                               _this.doSeek( perc );
+                       } else {
+                               // try to get player for 10 seconds: 
+                               if ( rfsCount < 200 ) {
+                                       setTimeout( readyForSeek, 50 );
                                        rfsCount++;
-                               }else{
-                                       js_log('error:doPlayThenSeek failed');
+                               } else {
+                                       js_log( 'error:doPlayThenSeek failed' );
                                }
                        }
                }
                readyForSeek();
        },
-       playMovieAt: function (order){
-               //@@todo add clips to playlist after (order) and then play
+       playMovieAt: function ( order ) {
+               // @@todo add clips to playlist after (order) and then play
                this.play();
        },
        /* 
        * updates the status time
        */
-       monitor: function(){
+       monitor: function() {
                this.getVLC();
-               if(!this.vlc)
+               if ( !this.vlc )
                        return ;
-               if( this.vlc.log ){
-                       //js_log( 'state:' + this.vlc.input.state);
-                       //js_log('time: ' + this.vlc.input.time);
-                       //js_log('pos: ' + this.vlc.input.position);
-                       if( this.vlc.log.messages.count > 0 ){
+               if ( this.vlc.log ) {
+                       // js_log( 'state:' + this.vlc.input.state);
+                       // js_log('time: ' + this.vlc.input.time);
+                       // js_log('pos: ' + this.vlc.input.position);
+                       if ( this.vlc.log.messages.count > 0 ) {
                                // there is one or more messages in the log
                                var iter = this.vlc.log.messages.iterator();
-                               while( iter.hasNext ){
+                               while ( iter.hasNext ) {
                                        var msg = iter.next();
                                   var msgtype = msg.type.toString();
-                                  if( (msg.severity == 1) && (msgtype == "input") )
+                                  if ( ( msg.severity == 1 ) && ( msgtype == "input" ) )
                                   {
                                                   js_log( msg.message );
                                   }
@@ -156,134 +156,134 @@ var vlcEmbed = {
                                this.vlc.log.messages.clear();
                        }
                        var newState = this.vlc.input.state;
-                       if( this.prevState != newState ){
-                                  if( newState == 0 )
+                       if ( this.prevState != newState ) {
+                                  if ( newState == 0 )
                                {
                                        // current media has stopped 
                                        this.onStop();
                                }
-                               else if( newState == 1 )
+                               else if ( newState == 1 )
                                {
                                        // current media is opening/connecting
                                        this.onOpen();
                                }
-                               else if( newState == 2 )
+                               else if ( newState == 2 )
                                {
                                        // current media is buffering data
                                        this.onBuffer();
                                }
-                               else if( newState == 3 )
+                               else if ( newState == 3 )
                                {
                                   // current media is now playing
                                   this.onPlay();
                                }
-                                  else if( this.vlc.input.state == 4 )
+                                  else if ( this.vlc.input.state == 4 )
                                {
                                        // current media is now paused
                                        this.onPause();
                                }
                                this.prevState = newState;
-                       }else if( newState == 3 ){
+                       } else if ( newState == 3 ) {
                                // current media is playing
                                this.onPlaying();
                        }
                }
-               //update the status and check timmer via universal parent monitor
+               // update the status and check timmer via universal parent monitor
                this.parent_monitor();
        },
 /* events */
-       onOpen: function(){
-               this.setStatus("Opening...");
+       onOpen: function() {
+               this.setStatus( "Opening..." );
        },
-       onBuffer: function(){
-               this.setStatus("Buffering...");
+       onBuffer: function() {
+               this.setStatus( "Buffering..." );
        },
-       onPlay: function(){
-               this.onPlaying();               
+       onPlay: function() {
+               this.onPlaying();
        },
        liveFeedRoll: 0,
-       onPlaying: function(){          
-               this.seeking=false;
-               //for now trust the duration from url over vlc input.length
-               if( !this.getDuration() && this.vlc.input.length > 0 )
+       onPlaying: function() {
+               this.seeking = false;
+               // for now trust the duration from url over vlc input.length
+               if ( !this.getDuration() && this.vlc.input.length > 0 )
                {
-                       //js_log('setting duration to ' + this.vlc.input.length /1000);                 
-                       this.duration = this.vlc.input.length /1000;
+                       // js_log('setting duration to ' + this.vlc.input.length /1000);                        
+                       this.duration = this.vlc.input.length / 1000;
                }
-               this.currentTime = this.vlc.input.time/1000;            
+               this.currentTime = this.vlc.input.time / 1000;
    },
-   onPause: function(){                   
-               this.parent_pause(); //update the inteface if paused via native control
+   onPause: function() {
+               this.parent_pause(); // update the inteface if paused via native control
    },
-   onStop: function()
-          js_log('vlc:onStop:');
-          if(!this.seeking)
+   onStop: function() {
+          js_log( 'vlc:onStop:' );
+          if ( !this.seeking )
                  this.onClipDone();
        },
    /* js hooks/controls */
-       play : function(){
-               js_log('f:vlcPlay');
+       play : function() {
+               js_log( 'f:vlcPlay' );
                        this.getVLC();
-                       //call the parent
+                       // call the parent
                this.parent_play();
-               if( this.vlc ){
-                       //plugin is already being present send play call: 
+               if ( this.vlc ) {
+                       // plugin is already being present send play call: 
                        // clear the message log and enable error logging
-                       if( this.vlc.log ){
+                       if ( this.vlc.log ) {
                                this.vlc.log.messages.clear();
                        }
-                       if(this.vlc.playlist)
+                       if ( this.vlc.playlist )
                                this.vlc.playlist.play();
                                
                        this.monitor();
-                       this.paused=false;
-               }               
+                       this.paused = false;
+               }
        },
-       stop : function(){
-               if(this.vlc){
-                       if(typeof this.vlc != 'undefined' ){
-                               if(typeof this.vlc.playlist != 'undefined'){
-                                       //dont' stop (issues all the plugin-stop actions) 
-                                       //this.vlc.playlist.stop();
-                                       if( this.monitorTimerId != 0 )
+       stop : function() {
+               if ( this.vlc ) {
+                       if ( typeof this.vlc != 'undefined' ) {
+                               if ( typeof this.vlc.playlist != 'undefined' ) {
+                                       // dont' stop (issues all the plugin-stop actions) 
+                                       // this.vlc.playlist.stop();
+                                       if ( this.monitorTimerId != 0 )
                                        {
-                                               clearInterval(this.monitorTimerId);
+                                               clearInterval( this.monitorTimerId );
                                                this.monitorTimerId = 0;
                                        }
                                }
                        }
                }
-               //this.onStop();
-               //do parent stop
+               // this.onStop();
+               // do parent stop
                this.parent_stop();
        },
-       pause : function(){
-               this.parent_pause(); //update the inteface if paused via native control
-               if( this.vlc ){
+       pause : function() {
+               this.parent_pause(); // update the inteface if paused via native control
+               if ( this.vlc ) {
                        this.vlc.playlist.togglePause();
                }
        },
-       toggleMute:function(){
+       toggleMute:function() {
                this.parent_toggleMute();
                this.getVLC();
-               if(this.vlc)
+               if ( this.vlc )
                        this.vlc.audio.toggleMute();
-    }, 
-    //@@ Suport UpDateVolumen 
-    updateVolumen:function(perc){
+    },
+    // @@ Suport UpDateVolumen 
+    updateVolumen:function( perc ) {
        this.getVLC();
-               if(this.vlc)
-                       this.vlc.audio.volume = perc*100;                           
-    }, 
-    //@@ Get Volumen
-    getVolumen:function(){
+               if ( this.vlc )
+                       this.vlc.audio.volume = perc * 100;
+    },
+    // @@ Get Volumen
+    getVolumen:function() {
        this.getVLC();
-       if(this.vlc) 
+       if ( this.vlc )
                return this.vlc.audio.volume / 100;
-    }, 
-       fullscreen : function(){
-               if(this.vlc){
-                       if(this.vlc.video)
+    },
+       fullscreen : function() {
+               if ( this.vlc ) {
+                       if ( this.vlc.video )
                                this.vlc.video.toggleFullscreen();
                }
        },
@@ -300,8 +300,8 @@ var vlcEmbed = {
        },
        */
        // get the embed vlc object 
-       getVLC : function(){
-               this.vlc = this.getPluginEmbed();                  
+       getVLC : function() {
+               this.vlc = this.getPluginEmbed();
        }
 };
 
index 82581f5..81b80b7 100644 (file)
 *
 */
 
-loadGM({
+loadGM( {
        "mwe-setting-up-proxy" : "Setting up proxy...",
        "mwe-re-try" : "Retry API request",
        "mwe-re-trying" : "Retrying API request...",
        "mwe-proxy-not-ready" : "Proxy is not configured",
        "mwe-please-login" : "You are not <a target=\"_new\" href=\"$1\">logged in<\/a> on $2 or mwEmbed has not been enabled. Resolve the issue, and then retry the request.",
        "mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address."
-});
+} );
 
-(function( $ ) {
+( function( $ ) {
        /**
         * Base API Proxy object
         *       
         */
-       $.proxy = {};
+       $.proxy = { };
        
        /**
         * The client setup function: 
         */
-       $.proxy.client = function( pConf, conf ){
+       $.proxy.client = function( pConf, conf ) {
                var _this = this;
-               //do setup: 
-               if( pConf.server_frame )                
+               // do setup: 
+               if ( pConf.server_frame )
                        $.proxy.server_frame = pConf.server_frame;
                
-               if( pConf.client_frame_path ){
+               if ( pConf.client_frame_path ) {
                        $.proxy.client_frame_path = pConf.client_frame_path;
-               }else{
-                       //guess the client frame path:
-                       $.proxy.client_frame_path =  wgScriptPath +'/js2/mwEmbed/libMwApi/NestedCallbackIframe.html';
+               } else {
+                       // guess the client frame path:
+                       $.proxy.client_frame_path =  wgScriptPath + '/js2/mwEmbed/libMwApi/NestedCallbackIframe.html';
                }
                                
-               if( parseUri( $.proxy.server_frame).host ==  parseUri( document.URL ).host ){
-                       js_log("Error: why are you trying to proxy yourself? " );       
-                       return false;                                   
-               }               
+               if ( parseUri( $.proxy.server_frame ).host ==  parseUri( document.URL ).host ) {
+                       js_log( "Error: why are you trying to proxy yourself? " );
+                       return false;
+               }
                return true;
        }
-       //set the frameProxy Flag: 
+       // set the frameProxy Flag: 
        var frameProxyOk = false;
        /* setup a iframe request hash */
-       $.proxy.doFrameProxy = function( reqObj ){              
+       $.proxy.doFrameProxy = function( reqObj ) {
                var hashPack = {
                        'cd': parseUri( document.URL ).host,
                        'cfp': $.proxy.client_frame_path,
-                       'req': reqObj                   
+                       'req': reqObj
                }
-               js_log( "Do frame proxy request on src: \n" + $.proxy.server_frame + "\n" + 
+               js_log( "Do frame proxy request on src: \n" + $.proxy.server_frame + "\n" +
                                        JSON.stringify(  reqObj ) );
-               //we can't update src's so we have to remove and add all the time :(
-               //@@todo we should support frame msg system 
-               $j('#frame_proxy').remove();
-               $j('body').append('<iframe style="display:none" id="frame_proxy" name="frame_proxy" ' +
+               // we can't update src's so we have to remove and add all the time :(
+               // @@todo we should support frame msg system 
+               $j( '#frame_proxy' ).remove();
+               $j( 'body' ).append( '<iframe style="display:none" id="frame_proxy" name="frame_proxy" ' +
                                'src="' + $.proxy.server_frame +
-                                '#' + escape( JSON.stringify( hashPack ) ) + 
+                                '#' + escape( JSON.stringify( hashPack ) ) +
                                 '"></iframe>' );
                                 
-               //add an onLoad hook: 
-               $j('#frame_proxy').get(0).onload = function(){
-                       //add a 5 second timeout for setting up the nested child callback (after page load) 
-                       setTimeout(function(){
-                               if( !frameProxyOk ){
-                                       //we timmed out no api proxy (should make sure the user is "logged in")
-                                       js_log("Error:: api proxy timeout are we logged in? mwEmbed is on?");   
+               // add an onLoad hook: 
+               $j( '#frame_proxy' ).get( 0 ).onload = function() {
+                       // add a 5 second timeout for setting up the nested child callback (after page load) 
+                       setTimeout( function() {
+                               if ( !frameProxyOk ) {
+                                       // we timmed out no api proxy (should make sure the user is "logged in")
+                                       js_log( "Error:: api proxy timeout are we logged in? mwEmbed is on?" );
                                        $.proxy.proxyNotReadyDialog();
-                               }                               
-                       }, 5000);
+                               }
+                       }, 5000 );
                }
        }
-       var lastApiReq = {};
-       $.proxy.proxyNotReadyDialog = function(){
-               var btn = {};
-               btn[ gM('mwe-re-try') ] = function(){
-                       $j.addLoaderDialog( gM('mwe-re-trying') );
+       var lastApiReq = { };
+       $.proxy.proxyNotReadyDialog = function() {
+               var btn = { };
+               btn[ gM( 'mwe-re-try' ) ] = function() {
+                       $j.addLoaderDialog( gM( 'mwe-re-trying' ) );
                        $.proxy.doFrameProxy( lastApiReq );
                }
-               btn[ gM('mwe-cancel') ] = function(){
+               btn[ gM( 'mwe-cancel' ) ] = function() {
                        $j.closeLoaderDialog();
                }
-               var pUri =  parseUri( $.proxy.server_frame);
-               //this is sort of a temporary hack if we change the MediaWiki:ApiProxy key
-               //we will have to deal with that here as well: 
-               var login_url = pUri.protocol +'://'+ pUri.host + 
-                               pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin');
-               $j.addDialog( gM('mwe-proxy-not-ready'), gM('mwe-please-login', [ login_url, pUri.host] ) + 
-                                               '<p style="font-size:small">' + gM('mwe-remember-loging') + '</p>', 
+               var pUri =  parseUri( $.proxy.server_frame );
+               // this is sort of a temporary hack if we change the MediaWiki:ApiProxy key
+               // we will have to deal with that here as well: 
+               var login_url = pUri.protocol + '://' + pUri.host +
+                               pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin' );
+               $j.addDialog( gM( 'mwe-proxy-not-ready' ), gM( 'mwe-please-login', [ login_url, pUri.host] ) +
+                                               '<p style="font-size:small">' + gM( 'mwe-remember-loging' ) + '</p>',
                        btn
-               )       
-       }       
+               )
+       }
        /* the do_api_request with callback: */
-       $.proxy.doRequest = function( reqObj, callback){
-               js_log("doRequest:: " + JSON.stringify( reqObj ) );             
+       $.proxy.doRequest = function( reqObj, callback ) {
+               js_log( "doRequest:: " + JSON.stringify( reqObj ) );
                lastApiReq = reqObj;
-               //setup the callback:
+               // setup the callback:
                $.proxy.callback = callback;
-               //do the proxy req:
+               // do the proxy req:
                $.proxy.doFrameProxy( reqObj );
        }
        /**
         * The nested iframe action that passes its msg back up to the top instance      
         */
-       $.proxy.nested = function( hashResult ){
-               //close the loader if present: 
+       $.proxy.nested = function( hashResult ) {
+               // close the loader if present: 
                $j.closeLoaderDialog();
                js_log( '$.proxy.nested callback :: ' + unescape( hashResult ) );
                frameProxyOk = true;
-               //try to parse the hash result: 
-               try{
+               // try to parse the hash result: 
+               try {
                        var rObj = JSON.parse( unescape( hashResult ) );
-               }catch (e) {
-                       js_log("Error could not parse hashResult");
-               }               
-               //special callback to frameProxyOk flag (not an api result, don't call callback)   
-               if( rObj.state == 'ok')                 
-                       return ;                        
+               } catch ( e ) {
+                       js_log( "Error could not parse hashResult" );
+               }
+               // special callback to frameProxyOk flag (not an api result, don't call callback)   
+               if ( rObj.state == 'ok' )
+                       return ;
                
-               //if all good pass it to the callback:
-               $.proxy.callback( rObj ); 
+               // if all good pass it to the callback:
+               $.proxy.callback( rObj );
        }
        /**
         * The serverApiProxy handles the actual proxy 
         * and child frames pointing to the parent "blank" frames
         * 
         * This is (Domain B) in the above described setup
-        */      
-       $.proxy.server = function( pConf, callback){                                                            
-               /* clear the body of any html */                                                
-               $j('body').html( 'proxy setup' );                                       
+        */
+       $.proxy.server = function( pConf, callback ) {
+               /* clear the body of any html */
+               $j( 'body' ).html( 'proxy setup' );
                
-               //read the anchor action from the requesting url
+               // read the anchor action from the requesting url
                var jmsg = unescape( parseUri( document.URL ).anchor );
-               try{
+               try {
                        var aObj = JSON.parse( jmsg );
-               }catch ( e ){
-                       js_log("ProxyServer:: could not parse anchor");
+               } catch ( e ) {
+                       js_log( "ProxyServer:: could not parse anchor" );
                }
-               if( !aObj.cd ){
-                       js_log("Error: no client domain provided ");
+               if ( !aObj.cd ) {
+                       js_log( "Error: no client domain provided " );
                        return false;
-               }       
+               }
                
-               js_log("Setup server on: "  + parseUri( document.URL ).host +
-                       ' client from: ' + aObj.cd + 
+               js_log( "Setup server on: "  + parseUri( document.URL ).host +
+                       ' client from: ' + aObj.cd +
                        ' to nested target: ' + aObj.cfp );
                
                // make sure we are logged in 
                // (its a normal mediaWiki page so all site vars should be defined)             
-               if( !wgUserName ){
-                       js_log('error Not logged in');
+               if ( !wgUserName ) {
+                       js_log( 'error Not logged in' );
                        return false;
                }
                        
                var domain =  aObj.cd;
                var nested_frame_src = 'http://' + aObj.cd + aObj.cfp;
-               //check the master whitelist
-               for(var i in pConf.master_whitelist){
-                       if( domain ==  pConf.master_whitelist[ i ] ){
-                               //do the request:                       
+               // check the master whitelist
+               for ( var i in pConf.master_whitelist ) {
+                       if ( domain ==  pConf.master_whitelist[ i ] ) {
+                               // do the request:                      
                                return doNestedProxy( aObj.req );
                        }
-               }               
-               //check master blacklist
-               for(var i in pConf.master_blacklist ){
-                       if( domain == pConf.master_blacklist ){
-                               js_log('domain: ' + domain + ' is blacklisted');
+               }
+               // check master blacklist
+               for ( var i in pConf.master_blacklist ) {
+                       if ( domain == pConf.master_blacklist ) {
+                               js_log( 'domain: ' + domain + ' is blacklisted' );
                                return false;
                        }
                }
-               //@@todo grab the users whitelist for our current domain                                
+               // @@todo grab the users whitelist for our current domain                               
                /*var local_api = wgScriptPath + '/index' + wgScriptExtension + '?title=' +
                                'User:' + wgUserName + '/apiProxyDomainList.js' +
                                '&action=raw&smaxage=0&gen=js';
@@ -211,39 +211,39 @@ loadGM({
                        debugger;
                });*/
                
-               //if still not found: 
-               js_log("domain " + domain + " not approved");
-               
-               //offer the user the ability to "approve" requested domain save to their user page              
+               // if still not found: 
+               js_log( "domain " + domain + " not approved" );
                
-               function doNestedProxy( reqObj ){               
-                       js_log("doNestedProxy to: " + nested_frame_src);
-                       //output iframe prior to running api request 
-                       //(so we can fail faster / cache the nested page / simotaniusly load things) 
-                       doNestedFrame ( 'nested_ok' , {'state':'ok'});
+               // offer the user the ability to "approve" requested domain save to their user page             
+
+               function doNestedProxy( reqObj ) {
+                       js_log( "doNestedProxy to: " + nested_frame_src );
+                       // output iframe prior to running api request 
+                       // (so we can fail faster / cache the nested page / simotaniusly load things) 
+                       doNestedFrame ( 'nested_ok' , { 'state':'ok' } );
                        
-                       var outputhash = escape( JSON.stringify( reqObj ) );    
-                       //add some api stuff: 
-                       reqObj['format'] = 'json';                                                                                              
-                       //process the api request
-                       $j.post(wgScriptPath + '/api' + wgScriptExtension,
+                       var outputhash = escape( JSON.stringify( reqObj ) );
+                       // add some api stuff: 
+                       reqObj['format'] = 'json';
+                       // process the api request
+                       $j.post( wgScriptPath + '/api' + wgScriptExtension,
                                reqObj,
-                               function( data ){                                       
-                                       //js_log("Proxy GOT Res: " +  data );
-                                       //put it into the nested frame hash string: 
+                               function( data ) {
+                                       // js_log("Proxy GOT Res: " +  data );
+                                       // put it into the nested frame hash string: 
                                        doNestedFrame( 'nested_push', JSON.parse( data ) );
                                }
-                       );                                              
+                       );
                }
-               //add the doNestedFrame iframe: 
-               function doNestedFrame( nestname, resultObj ){                  
-                       $j('#nested_push').remove();
-                       //setup the nested proxy that points back to top domain:                        
-                       $j('body').append( '<iframe id="nested_push" name="nested_push" ' +
-                               'src="'+ nested_frame_src +
-                               '#' + escape( JSON.stringify( resultObj ) ) +                                   
+               // add the doNestedFrame iframe: 
+               function doNestedFrame( nestname, resultObj ) {
+                       $j( '#nested_push' ).remove();
+                       // setup the nested proxy that points back to top domain:                       
+                       $j( 'body' ).append( '<iframe id="nested_push" name="nested_push" ' +
+                               'src="' + nested_frame_src +
+                               '#' + escape( JSON.stringify( resultObj ) ) +
                                '"></iframe>' );
-               }       
+               }
        }
        
-})(window.mw);
+} )( window.mw );
index c117c57..d4da1d5 100644 (file)
 /*
  * handles driving the firefogg render system 
 */
-var mvFirefoggRender = function( iObj ) {              
+var mvFirefoggRender = function( iObj ) {
        return this.init( iObj );
 };
 var default_render_options = {
-       "videoQuality" : 10, 
-       "framerate"     : 30, 
-       "width"         : 400, 
+       "videoQuality" : 10,
+       "framerate"     : 30,
+       "width"         : 400,
        "height"        : 300
 }
 var default_FirefoggRender_options = {
        start_time:0,
-       //if we should save to disk (if false setup upload stuff below) 
+       // if we should save to disk (if false setup upload stuff below) 
        save_to_disk:true
 }
-//set up the mvPlaylist object
+// set up the mvPlaylist object
 mvFirefoggRender.prototype = {
-       //default empty render options: 
-       renderOptions: {},              
+       // default empty render options: 
+       renderOptions: { },
        continue_rendering:false,
-       init:function( iObj ){
-               var _this = this;                               
+       init:function( iObj ) {
+               var _this = this;
                
-               //grab the mvFirefogg object to do basic tests
-               this.myFogg = new mvFirefogg({
+               // grab the mvFirefogg object to do basic tests
+               this.myFogg = new mvFirefogg( {
                        'only_fogg':true
-               });
+               } );
                
-               //check for firefogg:
-               if( this.myFogg.firefoggCheck() ){
+               // check for firefogg:
+               if ( this.myFogg.firefoggCheck() ) {
                        this.enabled = true;
-               }else{
+               } else {
                        this.enabled = false;
                        return this;
                }
                
-               //set up local fogg pointer: 
+               // set up local fogg pointer: 
                this.fogg = this.myFogg.fogg;
                
-               //setup player instance
-               this.player = $j(iObj.player_target).get(0);            
+               // setup player instance
+               this.player = $j( iObj.player_target ).get( 0 );
                this.player_target = iObj.player_target;
                
-               //setup the render options (with defaults) 
-               for(var i in default_render_options){
-                       if( iObj['render_options'][i] ){
+               // setup the render options (with defaults) 
+               for ( var i in default_render_options ) {
+                       if ( iObj['render_options'][i] ) {
                                this.renderOptions[ i ] = iObj['render_options'][i];
-                       }else{
+                       } else {
                                this.renderOptions[ i ] = default_render_options[i];
                        }
                }
-               //Setup the application options (with defaults) 
-               for(var i in default_FirefoggRender_options ){
-                       if( iObj[ i ] ){
+               // Setup the application options (with defaults) 
+               for ( var i in default_FirefoggRender_options ) {
+                       if ( iObj[ i ] ) {
                                this[ i ] = iObj[ i ];
-                       }else{
+                       } else {
                                this[ i ] = default_FirefoggRender_options[i];
                        }
                }
-               //Set up targets and local vars         
-               if( iObj.target_startRender ){
-                       $j(iObj.target_startRender).click(function(){
-                               js_log("Start render");
+               // Set up targets and local vars                
+               if ( iObj.target_startRender ) {
+                       $j( iObj.target_startRender ).click( function() {
+                               js_log( "Start render" );
                                _this.startRender();
-                       })
+                       } )
                        this.target_startRender = iObj.target_startRender;
                }
-               if( iObj.target_stopRender ){
-                       $j(iObj.target_stopRender).click(function(){
+               if ( iObj.target_stopRender ) {
+                       $j( iObj.target_stopRender ).click( function() {
                                _this.stopRender();
-                       })
+                       } )
                        this.target_stopRender = iObj.target_stopRender;
                }
-               if( iObj.target_timeStatus ){
+               if ( iObj.target_timeStatus ) {
                        this.target_timeStatus = iObj.target_timeStatus;
                }
        },
-       startRender:function(){
-               var _this = this;       
+       startRender:function() {
+               var _this = this;
                var t = this.start_time;
-               //get the interval from renderOptions framerate
+               // get the interval from renderOptions framerate
                var interval =  1 / this.renderOptions.framerate
                
-               //issue a load request on the player:
+               // issue a load request on the player:
                this.player.load();
                
-               //init the Render
+               // init the Render
                this.fogg.initRender(  JSON.stringify( _this.renderOptions ), 'foggRender' );
                
-               //add audio if we had any:
-               
-               //request a target (should support rendering to temp location too) 
+               // add audio if we had any:
+
+               // request a target (should support rendering to temp location too) 
                this.fogg.saveVideoAs();
                
-               //set the continue rendering flag to true:
+               // set the continue rendering flag to true:
                this.continue_rendering = true;
                
-               //internal function to hanndle updates:                         
-               var doNextFrame = function(){                   
-                       $j(_this.target_timeStatus).val( " on " + (Math.round(t*10)/10) + " of "+
-                               (Math.round( _this.player.getDuration() * 10) / 10 ) );
-                       _this.player.setCurrentTime(t, function(){
-                               _this.fogg.addFrame( $j(_this.player_target).attr('id') );
+               // internal function to hanndle updates:                                
+               var doNextFrame = function() {
+                       $j( _this.target_timeStatus ).val( " on " + ( Math.round( t * 10 ) / 10 ) + " of " +
+                               ( Math.round( _this.player.getDuration() * 10 ) / 10 ) );
+                       _this.player.setCurrentTime( t, function() {
+                               _this.fogg.addFrame( $j( _this.player_target ).attr( 'id' ) );
                                t += interval;
-                               if(t >= _this.player.getDuration() ){
-                                       _this.doFinalRender();                                                          
-                               }else{                          
-                                       if(_this.continue_rendering){
+                               if ( t >= _this.player.getDuration() ) {
+                                       _this.doFinalRender();
+                               } else {
+                                       if ( _this.continue_rendering ) {
                                                doNextFrame();
-                                       }else{
-                                               //else quit:
+                                       } else {
+                                               // else quit:
                                                _this.doFinalRender();
                                        }
                                }
-                       });
+                       } );
                }
                doNextFrame();
        },
-       stopRender:function(){
-               this.continue_rendering=false;
-       },      
-       doFinalRender:function(){               
-               $j(this.target_timeStatus).val("doing final render");
-               this.fogg.render();     
+       stopRender:function() {
+               this.continue_rendering = false;
+       },
+       doFinalRender:function() {
+               $j( this.target_timeStatus ).val( "doing final render" );
+               this.fogg.render();
                this.updateStatus();
        },
-       updateStatus:function(){
-               var _this = this;               
-               var doUpdateStatus = function(){
+       updateStatus:function() {
+               var _this = this;
+               var doUpdateStatus = function() {
                        var rstatus = _this.fogg.renderstatus()
-                   $j(_this.target_timeStatus).val(rstatus);
-                   if(rstatus != 'done' && rstatus != 'rendering failed') {
-                       setTimeout(doUpdateStatus, 100);
+                   $j( _this.target_timeStatus ).val( rstatus );
+                   if ( rstatus != 'done' && rstatus != 'rendering failed' ) {
+                       setTimeout( doUpdateStatus, 100 );
                    } else {
-                       $j(_this.target_startRender).attr("disabled", false); 
+                       $j( _this.target_startRender ).attr( "disabled", false );
                    }
                }
                doUpdateStatus();
index d3b8c44..3e568f8 100644 (file)
  * @author: Michael Dale  mdale@wikimedia.org
  * @license GPL2
  */
-var mv_default_playlist_attributes = { 
-       //playlist attributes :
+var mv_default_playlist_attributes = {
+       // playlist attributes :
        "id":null,
        "title":null,
        "width":400,
        "height":300,
        "desc":'',
        "controls":true,
-       //playlist user controlled features
-       "linkback":null, 
+       // playlist user controlled features
+       "linkback":null,
        "src":null,
        "embed_link":true,
        
-       //enable sequencer? (only display top frame no navigation or accompanying text
+       // enable sequencer? (only display top frame no navigation or accompanying text
        "sequencer":false
 }
-//the call back rate for animations and internal timers in ms: 33 is about 30 frames a second: 
+// the call back rate for animations and internal timers in ms: 33 is about 30 frames a second: 
 var MV_ANIMATION_CB_RATE = 33;
 
-//globals:
-//10 possible colors for clips: (can be in hexadecimal)
-var mv_clip_colors = new Array('aqua', 'blue', 'fuchsia', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red');
+// globals:
+// 10 possible colors for clips: (can be in hexadecimal)
+var mv_clip_colors = new Array( 'aqua', 'blue', 'fuchsia', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red' );
 
-//the base url for requesting stream metadata 
-if(typeof wgServer=='undefined'){
+// the base url for requesting stream metadata 
+if ( typeof wgServer == 'undefined' ) {
        var defaultMetaDataProvider = 'http://metavid.org/overlay/archive_browser/export_cmml?stream_name=';
-}else{
+} else {
        var defaultMetaDataProvider = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name=';
 }
 /*
  * The playlist Object implements ~most~ of embedVideo but we don't inherit (other than to use the control builder)  
  * because pretty much every function has to be changed for the playlist context
  */
-var mvPlayList = function(element) {           
-       return this.init(element);
+var mvPlayList = function( element ) {
+       return this.init( element );
 };
-//set up the mvPlaylist object
+// set up the mvPlaylist object
 mvPlayList.prototype = {
        instanceOf:'mvPlayList',
        pl_duration:null,
        update_tl_hook:null,
        clip_ready_count:0,
-       cur_clip:null,  
-       start_clip:null, 
+       cur_clip:null,
+       start_clip:null,
        start_clip_src:null,
        disp_play_head:null,
        userSlide:false,
-       loading:true,   
-       loading_external_data:true, //if we are loading external data (set to loading by default)
-       
+       loading:true,
+       loading_external_data:true, // if we are loading external data (set to loading by default)
+
        activeClipList:null,
        playlist_buffer_time: 20, // how many seconds of future clips we should buffer
-       
-       interface_url:null, //the interface url 
-       tracks:{},
+
+       interface_url:null, // the interface url 
+       tracks: { },
        default_track:null, // the default track to add clips to.
-       //the layout for the playlist object
+       // the layout for the playlist object
        pl_layout : {
                seq_title:.1,
-               clip_desc:.63, //displays the clip description
+               clip_desc:.63, // displays the clip description
                clip_aspect:1.33,  // 4/3 video aspect ratio
-               seq:.25,                                 //display clip thumbnails 
-               seq_thumb:.25,   //size for thumbnails (same as seq by default) 
-               seq_nav:0,      //for a nav bar at the base (currently disabled)
-               //some pl_layout info:
+               seq:.25,                                 // display clip thumbnails 
+               seq_thumb:.25,   // size for thumbnails (same as seq by default) 
+               seq_nav:0,      // for a nav bar at the base (currently disabled)
+               // some pl_layout info:
                title_bar_height:17,
                control_height:29
        },
-       //embed object type support system; 
+       // embed object type support system; 
        supports: {
-               'play_head':true, 
-               'pause':true,            
-               'fullscreen':false, 
-               'time_display':true, 
+               'play_head':true,
+               'pause':true,
+               'fullscreen':false,
+               'time_display':true,
                'volume_control':true,
                
                'overlays':true,
-               'playlist_swap_loader':true //if the object supports playlist functions         
+               'playlist_swap_loader':true // if the object supports playlist functions                
        },
-       init : function(element){
-               js_log('mvPlayList:init:');             
-               this.tracks={};         
-               this.default_track=null;                                                
+       init : function( element ) {
+               js_log( 'mvPlayList:init:' );
+               this.tracks = { };
+               this.default_track = null;
                
                this.activeClipList = new activeClipList();
-               //add default track & default track pointer: 
-               this.tracks[0]= new trackObj({'inx':0});
-               this.default_track = this.tracks[0];                            
+               // add default track & default track pointer: 
+               this.tracks[0] = new trackObj( { 'inx':0 } );
+               this.default_track = this.tracks[0];
                
-               //get all the attributes:
-                for(var attr in mv_default_playlist_attributes){          
-                       if( element.getAttribute(attr) ){
-                               this[attr]=element.getAttribute(attr);
-                               //js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+'elm_val:' + element.getAttribute(attr) + "\n (set by elm)");  
-                       }else{          
-                               this[attr]=mv_default_playlist_attributes[attr];
-                               //js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");  
+               // get all the attributes:
+                for ( var attr in mv_default_playlist_attributes ) {
+                       if ( element.getAttribute( attr ) ) {
+                               this[attr] = element.getAttribute( attr );
+                               // js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+'elm_val:' + element.getAttribute(attr) + "\n (set by elm)");  
+                       } else {
+                               this[attr] = mv_default_playlist_attributes[attr];
+                               // js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");  
                        }
                }
-               //make sure height and width are int:
-               this.width =parseInt(this.width);
-               this.height=parseInt(this.height);
+               // make sure height and width are int:
+               this.width = parseInt( this.width );
+               this.height = parseInt( this.height );
                
-               //if style is set override width and height
-               if(element.style.width)this.width = parseInt(element.style.width.replace('px',''));
-               if(element.style.height)this.height = parseInt(element.style.height.replace('px',''));                  
+               // if style is set override width and height
+               if ( element.style.width )this.width = parseInt( element.style.width.replace( 'px', '' ) );
+               if ( element.style.height )this.height = parseInt( element.style.height.replace( 'px', '' ) );
                                
-               //if controls=false hide the title and the controls:
-               if(this.controls===false){                       
-                       this.pl_layout.control_height=0;        
-                       this.pl_layout.title_bar_height=0;                      
-               }else{
-                       //setup the controlBuilder object:
-                       this.ctrlBuilder = new ctrlBuilder( this ); 
-               }                                                
-       },                      
-       //the element has now been swapped into the dom: 
-       on_dom_swap:function(){
-               js_log('pl: dom swap');
-               //get and load the html:
+               // if controls=false hide the title and the controls:
+               if ( this.controls === false ) {
+                       this.pl_layout.control_height = 0;
+                       this.pl_layout.title_bar_height = 0;
+               } else {
+                       // setup the controlBuilder object:
+                       this.ctrlBuilder = new ctrlBuilder( this );
+               }
+       },
+       // the element has now been swapped into the dom: 
+       on_dom_swap:function() {
+               js_log( 'pl: dom swap' );
+               // get and load the html:
                this.getHTML();
        },
-       //run inheritEmbedObj on every clip (we have changed the playback method) 
-       inheritEmbedObj:function(){             
-               $j.each(this.tracks, function(i,track){ 
-                       track.inheritEmbedObj();                        
-               });
-       },      
-       doOptionsHTML:function(){
-               //grab "options" use current clip:
+       // run inheritEmbedObj on every clip (we have changed the playback method) 
+       inheritEmbedObj:function() {
+               $j.each( this.tracks, function( i, track ) {
+                       track.inheritEmbedObj();
+               } );
+       },
+       doOptionsHTML:function() {
+               // grab "options" use current clip:
                this.cur_clip.embed.doOptionsHTML();
        },
-       //pulls up the video editor inline
-       doEditor:function(){
-               //black out the page: 
-               //$j('body').append('<div id="ui-widget-overlay"/> <div id="modalbox" class="ui-widget ui-widget-content ui-corner-all modal_editor">' );
-               $j('body').append('<div class="ui-widget-overlay" style="width: 100%; height: 100%px; z-index: 10;"></div>');
-               $j('body').append('<div id="sequencer_target" style="z-index:11;position:fixed;top:10px;left:10px;right:10px;bottom:10px;" ' +
-                               'class="ui-widget ui-widget-content ui-corner-all"></div>');                    
+       // pulls up the video editor inline
+       doEditor:function() {
+               // black out the page: 
+               // $j('body').append('<div id="ui-widget-overlay"/> <div id="modalbox" class="ui-widget ui-widget-content ui-corner-all modal_editor">' );
+               $j( 'body' ).append( '<div class="ui-widget-overlay" style="width: 100%; height: 100%px; z-index: 10;"></div>' );
+               $j( 'body' ).append( '<div id="sequencer_target" style="z-index:11;position:fixed;top:10px;left:10px;right:10px;bottom:10px;" ' +
+                               'class="ui-widget ui-widget-content ui-corner-all"></div>' );
                                        
-               //@@todo clone the playlist (for faster startup)
+               // @@todo clone the playlist (for faster startup)
                /*
                 * var this_plObj_Clone = $j('#'+this.id).get(0).cloneNode(true);
                 *      this_plObj_Clone.sequencer=true;
                 *      this_plObj_Clone.id= 'seq_plobj';
                 *      debugger;
-                */             
+                */
                 
-               //load sequencer: 
-               $j("#sequencer_target").sequencer({                             
-                       "mv_pl_src" : this.src                                          
-               });
+               // load sequencer: 
+               $j( "#sequencer_target" ).sequencer( {
+                       "mv_pl_src" : this.src
+               } );
                                        
        },
-       showPlayerselect:function(){
+       showPlayerselect:function() {
                this.cur_clip.embed.showPlayerselect();
        },
-       closeDisplayedHTML:function(){
+       closeDisplayedHTML:function() {
                this.cur_clip.embed.closeDisplayedHTML();
        },
-       showDownload:function(){
+       showDownload:function() {
                this.cur_clip.embed.showDownload();
        },
-       showShare:function(){
-               var embed_code = '&lt;script type=&quot;text/javascript&quot; '+
-                                               'src=&quot;'+mv_embed_path+'mv_embed.js&quot;&gt;&lt;/script&gt '+"\n" + 
-                                               '&lt;playlist id=&quot;'+this.id+'&quot; ';
-                                               if(this.src){
-                                                       embed_code+='src=&quot;'+this.src+'&quot; /&gt;';
-                                               }else{
-                                                       embed_code+='&gt;'+"\n";
-                                                       embed_code+= this.data.htmlEntities();
-                                                       embed_code+='&lt;playlist/&gt;';
+       showShare:function() {
+               var embed_code = '&lt;script type=&quot;text/javascript&quot; ' +
+                                               'src=&quot;' + mv_embed_path + 'mv_embed.js&quot;&gt;&lt;/script&gt ' + "\n" +
+                                               '&lt;playlist id=&quot;' + this.id + '&quot; ';
+                                               if ( this.src ) {
+                                                       embed_code += 'src=&quot;' + this.src + '&quot; /&gt;';
+                                               } else {
+                                                       embed_code += '&gt;' + "\n";
+                                                       embed_code += this.data.htmlEntities();
+                                                       embed_code += '&lt;playlist/&gt;';
                                                }
                this.cur_clip.embed.showShare( embed_code );
        },
-       timedTextSources:function(){
+       timedTextSources:function() {
                return false;
        },
-       getPlaylist:function(){         
-               js_log("f:getPlaylist: " + this.srcType );
-               //@@todo lazy load plLib
-               eval('var plObj = '+this.srcType+'Playlist;');  
-               //import methods from the plObj to this
-               for(var method in plObj){
-                       //js parent preservation for local overwritten methods
-                       if(this[method])this['parent_' + method] = this[method];
-                       this[method]=plObj[method];
-                       js_log('inherit:'+ method);
-               } 
+       getPlaylist:function() {
+               js_log( "f:getPlaylist: " + this.srcType );
+               // @@todo lazy load plLib
+               eval( 'var plObj = ' + this.srcType + 'Playlist;' );
+               // import methods from the plObj to this
+               for ( var method in plObj ) {
+                       // js parent preservation for local overwritten methods
+                       if ( this[method] )this['parent_' + method] = this[method];
+                       this[method] = plObj[method];
+                       js_log( 'inherit:' + method );
+               }
                        
-               if(typeof this.doParse != 'function'){
-                       js_log('error: method doParse not found in plObj'+ this.srcType);
-                       return false;                                   
-               }   
+               if ( typeof this.doParse != 'function' ) {
+                       js_log( 'error: method doParse not found in plObj' + this.srcType );
+                       return false;
+               }
                                                 
-               if(typeof this.doParse == 'function'){
-                                if( this.doParse() ){
-                                        this.doWhenParseDone();        
-                                }else{
-                                        js_log("error: failed to parse playlist");
+               if ( typeof this.doParse == 'function' ) {
+                                if ( this.doParse() ) {
+                                        this.doWhenParseDone();
+                                } else {
+                                        js_log( "error: failed to parse playlist" );
                                         return false;
-                                        //error or parse needs to do ajax requests     
+                                        // error or parse needs to do ajax requests    
                                 }
-               }                          
+               }
        },
-       doNativeWarningCheck:function(){                
+       doNativeWarningCheck:function() {
                var clip =       this.default_track.clips[0];
-               if(clip){
+               if ( clip ) {
                        return clip.embed.doNativeWarningCheck();
                }
        },
-       doWhenParseDone:function(){                             
-               js_log('f:doWhenParseDone');
-               //do additional init for clips: 
+       doWhenParseDone:function() {
+               js_log( 'f:doWhenParseDone' );
+               // do additional init for clips: 
                var _this = this;
-               var error=false;
-               _this.clip_ready_count=0;               
-               for( var i in this.default_track.clips ){
+               var error = false;
+               _this.clip_ready_count = 0;
+               for ( var i in this.default_track.clips ) {
                        var clip =       this.default_track.clips[i];
-                       if(clip.embed.load_error){
-                               var error = clip.embed.load_error;                              
-                               //break on any clip we can't playback:
+                       if ( clip.embed.load_error ) {
+                               var error = clip.embed.load_error;
+                               // break on any clip we can't playback:
                                break;
                        }
-                       if( clip.embed.ready_to_play ){
+                       if ( clip.embed.ready_to_play ) {
                                _this.clip_ready_count++;
                                continue;
                        }
-                       //js_log('clip sources count: '+ clip.embed.media_element.sources.length);              
+                       // js_log('clip sources count: '+ clip.embed.media_element.sources.length);             
                        clip.embed.on_dom_swap();
-                       if( clip.embed.loading_external_data==false && 
-                                  clip.embed.init_with_sources_loadedDone==false){
+                       if ( clip.embed.loading_external_data == false &&
+                                  clip.embed.init_with_sources_loadedDone == false ) {
                                        clip.embed.init_with_sources_loaded();
-                       }                                       
+                       }
                }
                
-               //@@todo for some plugins we have to conform types of clips
+               // @@todo for some plugins we have to conform types of clips
                // ie vlc can play flash _followed_by_ ogg _followed_by_ whatever 
                //               but
                // native ff 3.1a2 can only play ogg 
-               if( error){
-                       this.load_error=error;
-                       this.is_ready=false;
-               }else if( _this.clip_ready_count == _this.getClipCount() ){
-                       js_log("done init all clips: " +  _this.clip_ready_count + ' = ' + _this.getClipCount());                       
+               if ( error ) {
+                       this.load_error = error;
+                       this.is_ready = false;
+               } else if ( _this.clip_ready_count == _this.getClipCount() ) {
+                       js_log( "done init all clips: " +  _this.clip_ready_count + ' = ' + _this.getClipCount() );
                        this.doWhenClipLoadDone();
-               }else{
-                       js_log("only "+ _this.clip_ready_count +" clips done, scheduling callback:");
-                       var doParseDoneCheck = function(){                              
+               } else {
+                       js_log( "only " + _this.clip_ready_count + " clips done, scheduling callback:" );
+                       var doParseDoneCheck = function() {
                                _this.doWhenParseDone();
                        }
-                       if( !mvJsLoader.load_error )    //re-issue request if no load error:
-                               setTimeout(doParseDoneCheck, 100);
-               }                                                               
+                       if ( !mvJsLoader.load_error )   // re-issue request if no load error:
+                               setTimeout( doParseDoneCheck, 100 );
+               }
        },
-       doWhenClipLoadDone:function(){          
-               js_log('mvPlaylist:doWhenClipLoadDone');
+       doWhenClipLoadDone:function() {
+               js_log( 'mvPlaylist:doWhenClipLoadDone' );
                this.ready_to_play = true;
                this.loading = false;
-               this.getHTML();         
-       },      
-       getDuration:function( regen ){                  
-               //js_log("GET PL DURRATION for : "+ this.tracks[this.default_track_id].clips.length + 'clips');
-               if(!regen && this.pl_duration)
+               this.getHTML();
+       },
+       getDuration:function( regen ) {
+               // js_log("GET PL DURRATION for : "+ this.tracks[this.default_track_id].clips.length + 'clips');
+               if ( !regen && this.pl_duration )
                        return this.pl_duration;
                                                
-               var durSum=0;           
-               $j.each( this.default_track.clips, function( i, clip )
-                       if( clip.embed ){
+               var durSum = 0;
+               $j.each( this.default_track.clips, function( i, clip ) {
+                       if ( clip.embed ) {
                                clip.dur_offset = durSum;
-                               //only calculate the solo Duration if a smil clip that could contain a transition: 
-                               if( clip.instanceOf == 'mvSMILClip' ){
-                                       //don't include transition time (for playlist_swap_loader compatible clips)                             
-                                       durSum += clip.getSoloDuration(); 
-                               }else{
-                                       durSum += clip.getDuration();   
-                               }                                                               
-                       }else{
-                               js_log("ERROR: clip " +clip.id + " not ready");
+                               // only calculate the solo Duration if a smil clip that could contain a transition: 
+                               if ( clip.instanceOf == 'mvSMILClip' ) {
+                                       // don't include transition time (for playlist_swap_loader compatible clips)                            
+                                       durSum += clip.getSoloDuration();
+                               } else {
+                                       durSum += clip.getDuration();
+                               }
+                       } else {
+                               js_log( "ERROR: clip " + clip.id + " not ready" );
                        }
-               });
-               this.pl_duration=durSum;                
-               //js_log("return dur: " + this.pl_duration);
+               } );
+               this.pl_duration = durSum;
+               // js_log("return dur: " + this.pl_duration);
                return this.pl_duration;
        },
-       getTimeReq:function(){
-               //playlist does not really support time request atm ( in theory in the future we could embed playlists with temporal urls)
-               return '0:0:0/' +  seconds2npt( this.getDuration() ); 
+       getTimeReq:function() {
+               // playlist does not really support time request atm ( in theory in the future we could embed playlists with temporal urls)
+               return '0:0:0/' +  seconds2npt( this.getDuration() );
        },
-       getDataSource:function(){       
-               js_log("f:getDataSource "+ this.src);
-               //determine the type / first is it m3u or xml?   
+       getDataSource:function() {
+               js_log( "f:getDataSource " + this.src );
+               // determine the type / first is it m3u or xml?  
                var pl_parent = this;
                this.makeURLAbsolute();
-               if(this.src!=null){                     
-                       do_request(this.src, function(data){
-                               pl_parent.data=data;
+               if ( this.src != null ) {
+                       do_request( this.src, function( data ) {
+                               pl_parent.data = data;
                                pl_parent.getSourceType();
-                       });     
-               }
-       },
-       getSourceType:function(){
-               js_log('data type of: '+ this.src + ' = ' + typeof (this.data) + "\n"+ this.data);
-               this.srcType =null;
-               //if not external use different detection matrix
-               if(this.loading_external_data){                         
-                       if( typeof this.data == 'object' ){
-                               js_log('object');               
-                               //object assume xml (either xspf or rss) 
-                               plElm = this.data.getElementsByTagName('playlist')[0];
-                               if( plElm ){
-                                       if(plElm.getAttribute('xmlns')=='http://xspf.org/ns/0/'){
-                                               this.srcType ='xspf';
+                       } );
+               }
+       },
+       getSourceType:function() {
+               js_log( 'data type of: ' + this.src + ' = ' + typeof ( this.data ) + "\n" + this.data );
+               this.srcType = null;
+               // if not external use different detection matrix
+               if ( this.loading_external_data ) {
+                       if ( typeof this.data == 'object' ) {
+                               js_log( 'object' );
+                               // object assume xml (either xspf or rss) 
+                               plElm = this.data.getElementsByTagName( 'playlist' )[0];
+                               if ( plElm ) {
+                                       if ( plElm.getAttribute( 'xmlns' ) == 'http://xspf.org/ns/0/' ) {
+                                               this.srcType = 'xspf';
+                                       }
+                               }
+                               // check itunes style rss "items" 
+                               rssElm = this.data.getElementsByTagName( 'rss' )[0];
+                               if ( rssElm ) {
+                                       if ( rssElm.getAttribute( 'xmlns:itunes' ) == 'http://www.itunes.com/dtds/podcast-1.0.dtd' ) {
+                                               this.srcType = 'itunes';
                                        }
                                }
-                               //check itunes style rss "items" 
-                               rssElm = this.data.getElementsByTagName('rss')[0];
-                               if(rssElm){
-                                       if(rssElm.getAttribute('xmlns:itunes')=='http://www.itunes.com/dtds/podcast-1.0.dtd'){
-                                               this.srcType='itunes';                                          
-                                       }                                       
-                               }                               
-                               //check for smil tag: 
-                               smilElm = this.data.getElementsByTagName('smil')[0];
-                               if(smilElm){
-                                       //don't check dtd yet.. (have not defined the smil subset) 
-                                       this.srcType='smil';
+                               // check for smil tag: 
+                               smilElm = this.data.getElementsByTagName( 'smil' )[0];
+                               if ( smilElm ) {
+                                       // don't check dtd yet.. (have not defined the smil subset) 
+                                       this.srcType = 'smil';
                                }
-                       }else if(typeof this.data == 'string'){         
-                               js_log('String');
-                               //look at the first line: 
-                               var first_line = this.data.substring(0, this.data.indexOf("\n"));
-                               js_log('first line: '+ first_line);     
-                               //string
-                               if(first_line.indexOf('#EXTM3U')!=-1){
+                       } else if ( typeof this.data == 'string' ) {
+                               js_log( 'String' );
+                               // look at the first line: 
+                               var first_line = this.data.substring( 0, this.data.indexOf( "\n" ) );
+                               js_log( 'first line: ' + first_line );
+                               // string
+                               if ( first_line.indexOf( '#EXTM3U' ) != - 1 ) {
                                        this.srcType = 'm3u';
-                               }else if(first_line.indexOf('<smil')!=-1){
-                                       //@@todo parse string
+                               } else if ( first_line.indexOf( '<smil' ) != - 1 ) {
+                                       // @@todo parse string
                                        this.srcType = 'smil';
                                }
                        }
-               }               
-               if(this.srcType){
-                       js_log('is of type:'+ this.srcType);
+               }
+               if ( this.srcType ) {
+                       js_log( 'is of type:' + this.srcType );
                        this.getPlaylist();
-               }else{
-                       //unknown playlist type
-                       js_log('unknown playlist type?');
-                       if(this.src){
-                               this.innerHTML= 'error: unknown playlist type at url:<br> ' + this.src;
-                       }else{
-                               this.innerHTML='error: unset src or unknown inline playlist data<br>';
+               } else {
+                       // unknown playlist type
+                       js_log( 'unknown playlist type?' );
+                       if ( this.src ) {
+                               this.innerHTML = 'error: unknown playlist type at url:<br> ' + this.src;
+                       } else {
+                               this.innerHTML = 'error: unset src or unknown inline playlist data<br>';
                        }
-               }                       
-       },      
-       //simple function to make a path into an absolute url if its not already
-       makeURLAbsolute:function(){             
-               if(this.src){
-                       if(this.src.indexOf('://')==-1){
-                               var purl = parseUri(document.URL);                      
-                               if(this.src.charAt(0)=='/'){                                            
-                                       this.src = purl.protocol +'://'+ purl.host + this.src;
-                               }else{
-                                       this.src= purl.protocol +'://'+ purl.host + purl.directory + this.src;                          
+               }
+       },
+       // simple function to make a path into an absolute url if its not already
+       makeURLAbsolute:function() {
+               if ( this.src ) {
+                       if ( this.src.indexOf( '://' ) == - 1 ) {
+                               var purl = parseUri( document.URL );
+                               if ( this.src.charAt( 0 ) == '/' ) {
+                                       this.src = purl.protocol + '://' + purl.host + this.src;
+                               } else {
+                                       this.src = purl.protocol + '://' + purl.host + purl.directory + this.src;
                                }
                        }
                }
-       },      
-       //set up minimal media_element emulation:        
-       media_element:
-               selected_source:{
+       },
+       // set up minimal media_element emulation:       
+       media_element: {
+               selected_source: {
                        supports_url_time_encoding:true
                }
        },
-       //@@todo needs to update for multi-track clip counts
-       getClipCount:function(){
-               return this.default_track.clips.length; 
-       },      
-       //},
-       //takes in the playlist 
+       // @@todo needs to update for multi-track clip counts
+       getClipCount:function() {
+               return this.default_track.clips.length;
+       },
+       // },
+       // takes in the playlist 
        // inherits all the properties 
        // swaps in the playlist object html/interface div      
-       getHTML:function(){     
-               js_log('mvPlaylist:getHTML:  loading:' + this.loading);                                         
-               if(this.loading){               
-                       $j('#'+this.id).html('loading playlist...'); 
-                       if( this.loading_external_data ){
-                               //load the data source chain of functions (to update the innerHTML)                        
-                               this.getDataSource();  
-                       }else{
-                               //detect datatype and parse directly: 
+       getHTML:function() {
+               js_log( 'mvPlaylist:getHTML:  loading:' + this.loading );
+               if ( this.loading ) {
+                       $j( '#' + this.id ).html( 'loading playlist...' );
+                       if ( this.loading_external_data ) {
+                               // load the data source chain of functions (to update the innerHTML)                       
+                               this.getDataSource();
+                       } else {
+                               // detect datatype and parse directly: 
                                this.getSourceType();
                        }
-               }else{
-                       //check for empty playlist otherwise renderDisplay:             
-                       if(this.default_track.getClipCount()==0){
-                               $j(this).html('empty playlist');
+               } else {
+                       // check for empty playlist otherwise renderDisplay:            
+                       if ( this.default_track.getClipCount() == 0 ) {
+                               $j( this ).html( 'empty playlist' );
                                return ;
-                       }else{
+                       } else {
                                this.renderDisplay();
-                       }                                                               
+                       }
                }
        },
-       renderDisplay:function(){               
-               js_log('mvPlaylist:renderDisplay:: track length: ' +this.default_track.getClipCount() );        
-               var _this=this;                                                                                 
+       renderDisplay:function() {
+               js_log( 'mvPlaylist:renderDisplay:: track length: ' + this.default_track.getClipCount() );
+               var _this = this;
                                                        
-               //append container and videoPlayer; 
-               $j(this).html('<div id="dc_'+this.id+'" style="width:'+this.width+'px;' +
-                               'height:'+ ( this.height + this.pl_layout.title_bar_height +
-                               this.pl_layout.control_height ) + 'px;position:relative;">' +                           
-                       '</div>');              
-               if(this.controls == true){
+               // append container and videoPlayer; 
+               $j( this ).html( '<div id="dc_' + this.id + '" style="width:' + this.width + 'px;' +
+                               'height:' + ( this.height + this.pl_layout.title_bar_height +
+                               this.pl_layout.control_height ) + 'px;position:relative;">' +
+                       '</div>' );
+               if ( this.controls == true ) {
                        var cpos = _this.height + _this.pl_layout.title_bar_height;
-                       //give more space if not in sequence:
-                       cpos+= (this.sequencer)?2:5;                            
-                       //append title:
-                       $j('#dc_'+_this.id).append(
-                               '<div style="font-size:13px;border:solid thin;width:'+this.width+'px;" id="ptitle_'+this.id+'"></div>' +
-                               '<div class="' + this.ctrlBuilder.pClass + '" style="position:absolute;top:'+cpos+'px">' +
-                               '<div class="ui-widget-header ui-helper-clearfix control-bar" '+
-                                       'style="width:' + _this.width + 'px" >' + 
+                       // give more space if not in sequence:
+                       cpos += ( this.sequencer ) ? 2:5;
+                       // append title:
+                       $j( '#dc_' + _this.id ).append(
+                               '<div style="font-size:13px;border:solid thin;width:' + this.width + 'px;" id="ptitle_' + this.id + '"></div>' +
+                               '<div class="' + this.ctrlBuilder.pClass + '" style="position:absolute;top:' + cpos + 'px">' +
+                               '<div class="ui-widget-header ui-helper-clearfix control-bar" ' +
+                                       'style="width:' + _this.width + 'px" >' +
                                                 _this.getControlsHTML() +
-                                       '</div>'+
+                                       '</div>' +
                                '</div>'
-                       );                                                                                              
+                       );
                                                                
-               //once the controls are in the DOM add hooks:           
+               // once the controls are in the DOM add hooks:          
                        this.ctrlBuilder.addControlHooks( );
-               }else{
-                       //just append the video: 
-                       $j('#dc_'+_this.id).append(
-                               '<div class="' + this.ctrlBuilder.pClass + '" style="position:absolute;top:'+(_this.height+_this.pl_layout.title_bar_height+4)+'px"></div>'
+               } else {
+                       // just append the video: 
+                       $j( '#dc_' + _this.id ).append(
+                               '<div class="' + this.ctrlBuilder.pClass + '" style="position:absolute;top:' + ( _this.height + _this.pl_layout.title_bar_height + 4 ) + 'px"></div>'
                        );
-               }                       
-               this.setupClipDisplay();                                                                                 
+               }
+               this.setupClipDisplay();
                                                
-               //update the title and status bar
-               this.updateBaseStatus();        
-       },
-       setupClipDisplay:function(){
-               js_log('mvPlaylist:setupClipDisplay:: clip len:'+ this.default_track.clips.length);
-               var _this = this;       
-               $j.each(this.default_track.clips, function(i, clip){                                    
-                       var cout = '<div class="clip_container cc_" id="clipDesc_'+clip.id+'" '+
-                               'style="display:none;position:absolute;text-align: center;width:'+_this.width + 'px;'+
-                               'height:'+(_this.height )+'px;'+
-                               'top:' + this.title_bar_height + 'px;left:0px;';        
-                       if(_this.controls){                             
-                               cout+='border:solid thin black;';
-                       }                       
-                       cout+='"></div>';
-                       $j('#dc_'+_this.id).append( cout );     
-                       //update the embed html:                                         
+               // update the title and status bar
+               this.updateBaseStatus();
+       },
+       setupClipDisplay:function() {
+               js_log( 'mvPlaylist:setupClipDisplay:: clip len:' + this.default_track.clips.length );
+               var _this = this;
+               $j.each( this.default_track.clips, function( i, clip ) {
+                       var cout = '<div class="clip_container cc_" id="clipDesc_' + clip.id + '" ' +
+                               'style="display:none;position:absolute;text-align: center;width:' + _this.width + 'px;' +
+                               'height:' + ( _this.height ) + 'px;' +
+                               'top:' + this.title_bar_height + 'px;left:0px;';
+                       if ( _this.controls ) {
+                               cout += 'border:solid thin black;';
+                       }
+                       cout += '"></div>';
+                       $j( '#dc_' + _this.id ).append( cout );
+                       // update the embed html:                                        
                        clip.embed.height = _this.height;
-                       clip.embed.width = _this.width;                         
+                       clip.embed.width = _this.width;
                        clip.embed.play_button = false;
                        clip.embed.controls = false;
                        
-                       clip.embed.getHTML();//get the thubnails for everything                 
-                       
-                       $j(clip.embed).css({ 
+                       clip.embed.getHTML();// get the thubnails for everything                        
+
+                       $j( clip.embed ).css( {
                                'position':"absolute",
-                               'top':"0px", 
+                               'top':"0px",
                                'left':"0px"
-                       });
-                       if($j('#clipDesc_'+clip.id).length != 0){
-                               js_log("should set: #clipDesc_"+clip.id + ' to: ' + $j(clip.embed).html() )
-                               $j('#clipDesc_'+clip.id).append( clip.embed );                          
-                       }else{
-                               js_log('cound not find: clipDesc_'+clip.id);                                    
-                       }                                                                                                                               
-               });                                     
-               if(this.cur_clip)
-                       $j('#clipDesc_'+this.cur_clip.id).css( { display:'inline' } );
-       },      
-       updateThumbPerc:function( perc ){
-               //get float seconds:
+                       } );
+                       if ( $j( '#clipDesc_' + clip.id ).length != 0 ) {
+                               js_log( "should set: #clipDesc_" + clip.id + ' to: ' + $j( clip.embed ).html() )
+                               $j( '#clipDesc_' + clip.id ).append( clip.embed );
+                       } else {
+                               js_log( 'cound not find: clipDesc_' + clip.id );
+                       }
+               } );
+               if ( this.cur_clip )
+                       $j( '#clipDesc_' + this.cur_clip.id ).css( { display:'inline' } );
+       },
+       updateThumbPerc:function( perc ) {
+               // get float seconds:
                var float_sec =  ( this.getDuration() * perc );
-               this.updateThumbTime( float_sec );                      
-       },
-       updateThumbTime:function( float_sec ){                  
-               //update display & cur_clip:
-               var pl_sum_time =0; 
-               var clip_float_sec=0;           
-               //js_log('seeking clip: ');
-               for(var i in this.default_track.clips){
+               this.updateThumbTime( float_sec );
+       },
+       updateThumbTime:function( float_sec ) {
+               // update display & cur_clip:
+               var pl_sum_time = 0;
+               var clip_float_sec = 0;
+               // js_log('seeking clip: ');
+               for ( var i in this.default_track.clips ) {
                        var clip = this.default_track.clips[i];
-                       if( (clip.getDuration() + pl_sum_time) >= float_sec ){
-                               if(this.cur_clip.id != clip.id){                                        
-                                       $j('#clipDesc_'+this.cur_clip.id).hide();
+                       if ( ( clip.getDuration() + pl_sum_time ) >= float_sec ) {
+                               if ( this.cur_clip.id != clip.id ) {
+                                       $j( '#clipDesc_' + this.cur_clip.id ).hide();
                                        this.cur_clip = clip;
-                                       $j('#clipDesc_'+this.cur_clip.id).show();
-                               }                                                               
+                                       $j( '#clipDesc_' + this.cur_clip.id ).show();
+                               }
                                break;
                        }
-                       pl_sum_time+=clip.getDuration();
-               }                               
+                       pl_sum_time += clip.getDuration();
+               }
                
-               //issue thumbnail update request: (if plugin supports it will render out frame 
+               // issue thumbnail update request: (if plugin supports it will render out frame 
                // if not then we do a call to the server to get a new jpeg thumbnail  
                this.cur_clip.embed.updateThumbTime( float_sec - pl_sum_time );
                
-               this.cur_clip.embed.currentTime = (float_sec -pl_sum_time) + this.cur_clip.embed.start_offset ;
-               this.cur_clip.embed.seek_time_sec = (float_sec -pl_sum_time );
+               this.cur_clip.embed.currentTime = ( float_sec - pl_sum_time ) + this.cur_clip.embed.start_offset ;
+               this.cur_clip.embed.seek_time_sec = ( float_sec - pl_sum_time );
                
-               //render effects ontop: (handled by doSmilActions)              
-               this.doSmilActions( single_line = true );       
+               // render effects ontop: (handled by doSmilActions)             
+               this.doSmilActions( single_line = true );
        },
-       updateBaseStatus:function(){
+       updateBaseStatus:function() {
                var _this = this;
-               js_log('Playlist:updateBaseStatus');
+               js_log( 'Playlist:updateBaseStatus' );
                
-               $j('#ptitle_'+this.id).html(''+
-                       '<b>' + this.title + '</b> '+                           
-                       this.getClipCount()+' clips, <i>'+
-                       seconds2npt( this.getDuration() ) + '</i>');                    
+               $j( '#ptitle_' + this.id ).html( '' +
+                       '<b>' + this.title + '</b> ' +
+                       this.getClipCount() + ' clips, <i>' +
+                       seconds2npt( this.getDuration() ) + '</i>' );
                
-               //should probably be based on if we have a provider api url
-               if( typeof wgEnableWriteAPI != 'undefined' && !this.sequencer ){
-                       $j( $j.btnHtml('edit', 'editBtn_'+this.id, 'pencil', 
-                               {'style':'position:absolute;right:0;;font-size:x-small;height:10px;margin-bottom:0;padding-bottom:7px;padding-top:0;'} )
-                       ).click(function(){     
+               // should probably be based on if we have a provider api url
+               if ( typeof wgEnableWriteAPI != 'undefined' && !this.sequencer ) {
+                       $j( $j.btnHtml( 'edit', 'editBtn_' + this.id, 'pencil',
+                               { 'style':'position:absolute;right:0;;font-size:x-small;height:10px;margin-bottom:0;padding-bottom:7px;padding-top:0;' } )
+                       ).click( function() {
                                _this.stop();
                                        _this.doEditor();
                                        return false;
-                       }).appendTo('#ptitle_'+this.id);        
-               $j('.editBtn_'+this.id).btnBind();              
-               }
-               //render out the dividers on the timeline: 
-               this.colorPlayHead();           
-               //update status:
-               this.setStatus( '0:0:00/' + seconds2npt( this.getDuration() ) );                                
-       },      
+                       } ).appendTo( '#ptitle_' + this.id );
+               $j( '.editBtn_' + this.id ).btnBind();
+               }
+               // render out the dividers on the timeline: 
+               this.colorPlayHead();
+               // update status:
+               this.setStatus( '0:0:00/' + seconds2npt( this.getDuration() ) );
+       },
        /*setStatus override (could call the jquery directly) */
-       setStatus:function(value){
-               $j('#'+this.id + ' .time-disp' ).text( value );
+       setStatus:function( value ) {
+               $j( '#' + this.id + ' .time-disp' ).text( value );
        },
-       setSliderValue:function(value){                         
-               //slider is on 1000 scale: 
-               var val = parseInt( value *1000 ); 
-               js_log('update slider: #' + this.id + ' .play_head to ' + val );        
-               $j('#' + this.id + ' .play_head').slider('value', val);         
+       setSliderValue:function( value ) {
+               // slider is on 1000 scale: 
+               var val = parseInt( value * 1000 );
+               js_log( 'update slider: #' + this.id + ' .play_head to ' + val );
+               $j( '#' + this.id + ' .play_head' ).slider( 'value', val );
        },
-       getPlayHeadPos: function(prec_done){
+       getPlayHeadPos: function( prec_done ) {
                var     _this = this;
-               if($j('#mv_seeker_'+this.id).length==0){
-                       js_log('no playhead so we can\'t get playhead pos' );
+               if ( $j( '#mv_seeker_' + this.id ).length == 0 ) {
+                       js_log( 'no playhead so we can\'t get playhead pos' );
                        return 0;
                }
-               var track_len = $j('#mv_seeker_'+this.id).css('width').replace(/px/, '');
-               //assume the duration is static and present at .duration during playback
+               var track_len = $j( '#mv_seeker_' + this.id ).css( 'width' ).replace( / px / , '' );
+               // assume the duration is static and present at .duration during playback
                var clip_perc = this.cur_clip.embed.duration / this.getDuration();
-               var perc_offset =time_offset = 0;
-               for(var i in this.default_track.clips){
+               var perc_offset = time_offset = 0;
+               for ( var i in this.default_track.clips ) {
                        var clip = this.default_track.clips[i];
-                       if(this.cur_clip.id ==clip.id)break;
-                       perc_offset+=(clip.embed.duration /  _this.getDuration());
-                       time_offset+=clip.embed.duration;
-               }                
-               //run any update time line hooks:               
-               if(this.update_tl_hook){        
-                       var cur_time_ms = time_offset + Math.round(this.cur_clip.embed.duration*prec_done);
-                       if(typeof update_tl_hook =='function'){
-                               this.update_tl_hook(cur_time_ms);
-                       }else{
-                               //string type passed use eval: 
-                               eval(this.update_tl_hook+'('+cur_time_ms+');');
+                       if ( this.cur_clip.id == clip.id )break;
+                       perc_offset += ( clip.embed.duration /  _this.getDuration() );
+                       time_offset += clip.embed.duration;
+               }
+               // run any update time line hooks:              
+               if ( this.update_tl_hook ) {
+                       var cur_time_ms = time_offset + Math.round( this.cur_clip.embed.duration * prec_done );
+                       if ( typeof update_tl_hook == 'function' ) {
+                               this.update_tl_hook( cur_time_ms );
+                       } else {
+                               // string type passed use eval: 
+                               eval( this.update_tl_hook + '(' + cur_time_ms + ');' );
                        }
                }
                
-               //handle offset hack @@todo fix so this is not needed:
-               if(perc_offset > .66)
-                       perc_offset+=( 8/track_len );
-               //js_log('perc:'+ perc_offset +' c:'+ clip_perc + '*' + prec_done + ' v:'+(clip_perc*prec_done));
+               // handle offset hack @@todo fix so this is not needed:
+               if ( perc_offset > .66 )
+                       perc_offset += ( 8 / track_len );
+               // js_log('perc:'+ perc_offset +' c:'+ clip_perc + '*' + prec_done + ' v:'+(clip_perc*prec_done));
                return perc_offset + ( clip_perc * prec_done );
        },
-       //attempts to load the embed object with the playlist
-       loadEmbedPlaylist: function(){
-               //js_log('load playlist');
+       // attempts to load the embed object with the playlist
+       loadEmbedPlaylist: function() {
+               // js_log('load playlist');
        },
        /** mannages the loading of future clips
         * called regurally while we are playing clips
@@ -599,7 +599,7 @@ mvPlayList.prototype = {
         * 
         * this won't work so well with time range loading for smil (need to work on that)   
         */
-       loadFutureClips:function(){             
+       loadFutureClips:function() {
                /*if( this.cur_clip.embed.bufferedPercent == 1){
                        //set the buffer to the currentTime - duration 
                        var curBuffredTime = this.cur_clip.getDuration() - this.cur_clip.embed.currentTime;             
@@ -630,170 +630,170 @@ mvPlayList.prototype = {
                        }       
                }*/
        },
-       //called to play the next clip if done call onClipDone 
-       playNext: function(){
-               //advance the playhead to the next clip                 
+       // called to play the next clip if done call onClipDone 
+       playNext: function() {
+               // advance the playhead to the next clip                        
                var next_clip = this.getNextClip();
                
-               if( !next_clip ){
-                       js_log('play next with no next clip... must be done:');
+               if ( !next_clip ) {
+                       js_log( 'play next with no next clip... must be done:' );
                        this.onClipDone();
                        return ;
-               }                                                                       
-               //@@todo where the plugin supports pre_loading future clips and manage that in javascript
-               //stop current clip
+               }
+               // @@todo where the plugin supports pre_loading future clips and manage that in javascript
+               // stop current clip
                this.cur_clip.embed.stop();
                
-               this.updateCurrentClip(next_clip);
+               this.updateCurrentClip( next_clip );
                                
-               this.cur_clip.embed.play();                                     
+               this.cur_clip.embed.play();
        },
-       onClipDone:function(){
-               js_log("pl onClipDone");                
+       onClipDone:function() {
+               js_log( "pl onClipDone" );
                this.cur_clip.embed.stop();
        },
-       updateCurrentClip:function( new_clip ){                         
-               js_log('f:updateCurrentClip:'+new_clip.id);                             
-               //make sure we are not switching to the current
-               if( this.cur_clip.id == new_clip.id ){
-                       js_log('trying to updateCurrentClip to same clip');
+       updateCurrentClip:function( new_clip ) {
+               js_log( 'f:updateCurrentClip:' + new_clip.id );
+               // make sure we are not switching to the current
+               if ( this.cur_clip.id == new_clip.id ) {
+                       js_log( 'trying to updateCurrentClip to same clip' );
                        return false;
                }
                        
-               //keep the active play clip in sync (stop the other clip) 
-               if( this.cur_clip ){
-                       if( !this.cur_clip.embed.isStoped() )
+               // keep the active play clip in sync (stop the other clip) 
+               if ( this.cur_clip ) {
+                       if ( !this.cur_clip.embed.isStoped() )
                                 this.cur_clip.embed.stop();
-                       this.activeClipList.remove(this.cur_clip )
+                       this.activeClipList.remove( this.cur_clip )
                }
                                                
-               this.activeClipList.add( new_clip );    
+               this.activeClipList.add( new_clip );
                                
-               //do swap:              
-               $j('#clipDesc_'+this.cur_clip.id).hide();                       
-               this.cur_clip=new_clip;                                 
-               $j('#clipDesc_'+this.cur_clip.id).show();
-               //update the playhead: 
-               this.setSliderValue( this.cur_clip.dur_offset / this.getDuration() );                    
-       },
-       playPrev: function(){
-               //advance the playhead to the previous clip                     
+               // do swap:             
+               $j( '#clipDesc_' + this.cur_clip.id ).hide();
+               this.cur_clip = new_clip;
+               $j( '#clipDesc_' + this.cur_clip.id ).show();
+               // update the playhead: 
+               this.setSliderValue( this.cur_clip.dur_offset / this.getDuration() );
+       },
+       playPrev: function() {
+               // advance the playhead to the previous clip                    
                var prev_clip = this.getPrevClip();
-               if(!prev_clip){
-                       js_log("tried to play PrevClip with no prev Clip.. setting prev_clip to start clip");
-                       prev_clip = this.start_clip; 
+               if ( !prev_clip ) {
+                       js_log( "tried to play PrevClip with no prev Clip.. setting prev_clip to start clip" );
+                       prev_clip = this.start_clip;
                }
-               //@@todo we could do something fancy like use playlist for sets of clips where supported. 
+               // @@todo we could do something fancy like use playlist for sets of clips where supported. 
                // or in cases where the player nativly supports the playlist format we can just pass it in (ie m3u or xspf)
-               if(this.cur_clip.embed.supports['playlist_swap_loader']){
-                       //where the plugin supports pre_loading future clips and manage that in javascript
-                       //pause current clip
+               if ( this.cur_clip.embed.supports['playlist_swap_loader'] ) {
+                       // where the plugin supports pre_loading future clips and manage that in javascript
+                       // pause current clip
                        this.cur_clip.embed.pause();
-                       //do swap:
-                       this.updateCurrentClip(prev_clip);                      
-                       this.cur_clip.embed.play();                     
-               }else{                  
-                       js_log('do prev hard embed swap');                                                                              
-                       this.switchPlayingClip(prev_clip);
-               }               
-       },
-       switchPlayingClip:function(new_clip){
-               //swap out the existing embed code for next clip embed code
-               $j('#mv_ebct_'+this.id).empty();
-               new_clip.embed.width=this.width;
-               new_clip.embed.height=this.height;
-               //js_log('set embed to: '+ new_clip.embed.getEmbedObj());
-               $j('#mv_ebct_'+this.id).html( new_clip.embed.getEmbedObj() );
-               this.cur_clip=new_clip;
-               //run js code: 
+                       // do swap:
+                       this.updateCurrentClip( prev_clip );
+                       this.cur_clip.embed.play();
+               } else {
+                       js_log( 'do prev hard embed swap' );
+                       this.switchPlayingClip( prev_clip );
+               }
+       },
+       switchPlayingClip:function( new_clip ) {
+               // swap out the existing embed code for next clip embed code
+               $j( '#mv_ebct_' + this.id ).empty();
+               new_clip.embed.width = this.width;
+               new_clip.embed.height = this.height;
+               // js_log('set embed to: '+ new_clip.embed.getEmbedObj());
+               $j( '#mv_ebct_' + this.id ).html( new_clip.embed.getEmbedObj() );
+               this.cur_clip = new_clip;
+               // run js code: 
                this.cur_clip.embed.pe_postEmbedJS();
        },
-       //playlist play
-       play: function(){
-               var _this=this;
-               js_log('pl play');
-               //hide the playlist play button: 
-               $j(this.id + ' .play-btn-large').hide();                                
+       // playlist play
+       play: function() {
+               var _this = this;
+               js_log( 'pl play' );
+               // hide the playlist play button: 
+               $j( this.id + ' .play-btn-large' ).hide();
                
-               //un-pause if paused:
-               if(this.paused)
-                       this.paused=false;              
+               // un-pause if paused:
+               if ( this.paused )
+                       this.paused = false;
                
-               //update the control:            
-               this.start_clip = this.cur_clip;                
-               this.start_clip_src= this.cur_clip.src;
+               // update the control:           
+               this.start_clip = this.cur_clip;
+               this.start_clip_src = this.cur_clip.src;
                 
-               if(this.cur_clip.embed.supports['playlist_swap_loader'] ){
-                       //set the cur_clip to active
-                       this.activeClipList.add(this.cur_clip);
+               if ( this.cur_clip.embed.supports['playlist_swap_loader'] ) {
+                       // set the cur_clip to active
+                       this.activeClipList.add( this.cur_clip );
                        
-                       //navtive support:
+                       // navtive support:
                        // * pre-loads clips
                        // * mv_playlist smil extension, manages transitions animations overlays etc.                    
-                       //js_log('clip obj supports playlist swap_loader (ie playlist controlled playback)');                                                   
-                       //@@todo pre-load each clip:
-                       //play all active clips (playlist_swap_loader can have more than one clip active)                
-                       $j.each(this.activeClipList.getClipList(), function(inx, clip){ 
+                       // js_log('clip obj supports playlist swap_loader (ie playlist controlled playback)');                                                  
+                       // @@todo pre-load each clip:
+                       // play all active clips (playlist_swap_loader can have more than one clip active)               
+                       $j.each( this.activeClipList.getClipList(), function( inx, clip ) {
                                clip.embed.play();
-                       }); 
-               }else if(this.cur_clip.embed.supports['playlist_driver']){                              
-                       //js_log('playlist_driver');
-                       //embedObject is feed the playlist info directly and manages next/prev
+                       } );
+               } else if ( this.cur_clip.embed.supports['playlist_driver'] ) {
+                       // js_log('playlist_driver');
+                       // embedObject is feed the playlist info directly and manages next/prev
                        this.cur_clip.embed.playMovieAt( this.cur_clip.order );
-               }else{
-                       //not much playlist support just play the first clip:
-                       //js_log('basic play');
-                       //play cur_clip                 
-                       this.cur_clip.embed.play();             
-               }               
-               //start up the playlist monitor                 
-               this.monitor();         
+               } else {
+                       // not much playlist support just play the first clip:
+                       // js_log('basic play');
+                       // play cur_clip                        
+                       this.cur_clip.embed.play();
+               }
+               // start up the playlist monitor                        
+               this.monitor();
        },
        /*
         * the load function loads all the clips in order 
-        */     
-       load:function(){
-               //do nothing right now)
+        */
+       load:function() {
+               // do nothing right now)
        },
-       toggleMute:function(){
+       toggleMute:function() {
                this.cur_clip.embed.toggleMute();
-       },      
-       pause:function(){               
-               //js_log('f:pause: playlist');
+       },
+       pause:function() {
+               // js_log('f:pause: playlist');
                var ct = new Date();
                this.pauseTime = this.currentTime;
-               this.paused=true;
-               //js_log('pause time: '+ this.pauseTime + ' call embed pause:');
-               
-               //pause all the active clips:
-               $j.each(this.activeClipList.getClipList(), function(inx, clip){ 
-                       clip.embed.pause();             
-               });
-       },
-       //@@todo mute across all child clips: 
-       toggleMute:function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;    
-               if(this.muted){
-                       this.muted=false;
-                       $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
-                       $j('#volume_bar_'+this_id).slider('value', 100); 
-                       this.updateVolumen(1);
-               }else{
-                       this.muted=true;
-                       $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
-                       $j('#volume_bar_'+this_id).slider('value', 0);
-                       this.updateVolumen(0); 
-               }
-               js_log('f:toggleMute::' + this.muted);          
-       },
-       updateVolumen:function(perc){
-               js_log('update volume not supported with current playback type');
-       },
-       fullscreen:function(){
+               this.paused = true;
+               // js_log('pause time: '+ this.pauseTime + ' call embed pause:');
+
+               // pause all the active clips:
+               $j.each( this.activeClipList.getClipList(), function( inx, clip ) {
+                       clip.embed.pause();
+               } );
+       },
+       // @@todo mute across all child clips: 
+       toggleMute:function() {
+               var this_id = ( this.pc != null ) ? this.pc.pp.id:this.id;
+               if ( this.muted ) {
+                       this.muted = false;
+                       $j( '#volume_control_' + this_id + ' span' ).removeClass( 'ui-icon-volume-off' ).addClass( 'ui-icon-volume-on' );
+                       $j( '#volume_bar_' + this_id ).slider( 'value', 100 );
+                       this.updateVolumen( 1 );
+               } else {
+                       this.muted = true;
+                       $j( '#volume_control_' + this_id + ' span' ).removeClass( 'ui-icon-volume-on' ).addClass( 'ui-icon-volume-off' );
+                       $j( '#volume_bar_' + this_id ).slider( 'value', 0 );
+                       this.updateVolumen( 0 );
+               }
+               js_log( 'f:toggleMute::' + this.muted );
+       },
+       updateVolumen:function( perc ) {
+               js_log( 'update volume not supported with current playback type' );
+       },
+       fullscreen:function() {
                this.cur_clip.embed.fullscreen();
        },
-       //playlist stops playback for the current clip (and resets state for start clips)
-       stop:function(){
+       // playlist stops playback for the current clip (and resets state for start clips)
+       stop:function() {
                var _this = this;
                /*js_log("pl stop:"+ this.start_clip.id + ' c:'+this.cur_clip.id);
                //if start clip 
@@ -808,9 +808,9 @@ mvPlayList.prototype = {
                        this.start_clip.embed.thumbnail_disp=true;
                }
                //empty the play-back container
-               $j('#mv_ebct_'+this.id).empty();*/                      
+               $j('#mv_ebct_'+this.id).empty();*/
                
-               //stop all the clips: monitor: 
+               // stop all the clips: monitor: 
                window.clearInterval( this.smil_monitorTimerId );
                /*for (var i=0;i<this.clips.length;i++){
                        var clip = this.clips[i];
@@ -819,255 +819,255 @@ mvPlayList.prototype = {
                                $j('#clipDesc_'+clip.id).hide();
                        }
                }*/
-               //stop, hide and remove all active clips:
-               $j.each(this.activeClipList.getClipList(), function(inx, clip){
-                       if(clip){
+               // stop, hide and remove all active clips:
+               $j.each( this.activeClipList.getClipList(), function( inx, clip ) {
+                       if ( clip ) {
                                clip.embed.stop();
-                               $j('#clipDesc_'+clip.id).hide();
-                               _this.activeClipList.remove(clip);
+                               $j( '#clipDesc_' + clip.id ).hide();
+                               _this.activeClipList.remove( clip );
                        }
-               });             
-               //set the current clip to the first clip: 
-               if(this.start_clip){
-                       this.cur_clip = this.start_clip;                
-                       //display the first clip thumb: 
+               } );
+               // set the current clip to the first clip: 
+               if ( this.start_clip ) {
+                       this.cur_clip = this.start_clip;
+                       // display the first clip thumb: 
                        this.cur_clip.embed.stop();
-                       //hide other clips:
-                       $j('#'+this.id+' .clip_container').hide();
-                       //show the first/current clip:
-                       $j('#clipDesc_'+this.cur_clip.id).show();
+                       // hide other clips:
+                       $j( '#' + this.id + ' .clip_container' ).hide();
+                       // show the first/current clip:
+                       $j( '#clipDesc_' + this.cur_clip.id ).show();
                }
-               //reset the currentTime: 
+               // reset the currentTime: 
                this.currentTime = 0;
-               //rest the sldier
+               // rest the sldier
                this.setSliderValue( 0 );
-               //FIXME still some issues with "stoping" and reseting the playlist      
-       },      
-       doSeek:function(v){
-               js_log('pl:doSeek:' + v + ' sts:' + this.seek_time_sec );
+               // FIXME still some issues with "stoping" and reseting the playlist     
+       },
+       doSeek:function( v ) {
+               js_log( 'pl:doSeek:' + v + ' sts:' + this.seek_time_sec );
                var _this = this;
-               var prevClip=null;                                              
+               var prevClip = null;
                
-               //jump to the clip in the current percent. 
-               var perc_offset=0;
-               var next_perc_offset=0;
-               for(var i in _this.default_track.clips){
-                       var clip = _this.default_track.clips[i];                
-                       next_perc_offset+=( clip.getDuration() /  _this.getDuration()) ;
-                       //js_log('on ' + clip.getDuration() +' next_perc_offset:'+ next_perc_offset);
-                       if( next_perc_offset > v ){     
-                               //pass along the relative percentage to embed object:                            
-                               //js_log('seek:'+ v +' - '+perc_offset + ') /  (' + next_perc_offset +' - '+ perc_offset);
-                               var relative_perc =  (v -perc_offset) /  (next_perc_offset - perc_offset);        
-                               //update the current clip:                                                               
+               // jump to the clip in the current percent. 
+               var perc_offset = 0;
+               var next_perc_offset = 0;
+               for ( var i in _this.default_track.clips ) {
+                       var clip = _this.default_track.clips[i];
+                       next_perc_offset += ( clip.getDuration() /  _this.getDuration() ) ;
+                       // js_log('on ' + clip.getDuration() +' next_perc_offset:'+ next_perc_offset);
+                       if ( next_perc_offset > v ) {
+                               // pass along the relative percentage to embed object:                           
+                               // js_log('seek:'+ v +' - '+perc_offset + ') /  (' + next_perc_offset +' - '+ perc_offset);
+                               var relative_perc =  ( v - perc_offset ) /  ( next_perc_offset - perc_offset );
+                               // update the current clip:                                                              
                                _this.updateCurrentClip( clip );
                                
-                               //update the clip relative seek_time_sec
-                               _this.cur_clip.embed.doSeek( relative_perc );                                                           
+                               // update the clip relative seek_time_sec
+                               _this.cur_clip.embed.doSeek( relative_perc );
                                this.play();
                                return '';
                        }
                        perc_offset = next_perc_offset;
-               }        
+               }
        },
-       setCurrentTime: function(pos, callback){
-               js_log('pl:setCurrentTime:' + pos + ' sts:' + this.seek_time_sec );
+       setCurrentTime: function( pos, callback ) {
+               js_log( 'pl:setCurrentTime:' + pos + ' sts:' + this.seek_time_sec );
                var _this = this;
-               var prevClip=null;
+               var prevClip = null;
                
-               //jump to the clip at pos 
+               // jump to the clip at pos 
                var currentOffset = 0;
                var nextTime = 0;
-               for (var i in _this.default_track.clips) {
+               for ( var i in _this.default_track.clips ) {
                        var clip = _this.default_track.clips[i];
                        nextTime = clip.getDuration();
-                       if (currentOffset + nextTime > pos) {
-                               //update the clip relative seek_time_sec
+                       if ( currentOffset + nextTime > pos ) {
+                               // update the clip relative seek_time_sec
                                clipTime = pos - currentOffset;
-                               if (_this.cur_clip.id != clip.id) {
+                               if ( _this.cur_clip.id != clip.id ) {
                                        _this.updateCurrentClip( clip );
-                               }                                                               
-                               _this.cur_clip.embed.setCurrentTime(clipTime, function(){                                       
-                                       if(callback)
-                                               callback();     
-                               });                                                                                     
+                               }
+                               _this.cur_clip.embed.setCurrentTime( clipTime, function() {
+                                       if ( callback )
+                                               callback();
+                               } );
                                _this.currentTime = pos;
                                _this.doSmilActions();
                        }
                        currentOffset += nextTime;
                }
        },
-       //gets playlist controls large control height for sporting 
-       //next prev button and more status display
-       getControlsHTML:function(){
-               //get controls from current clip  (add some playlist specific controls:                                 
+       // gets playlist controls large control height for sporting 
+       // next prev button and more status display
+       getControlsHTML:function() {
+               // get controls from current clip  (add some playlist specific controls:                                        
                return this.ctrlBuilder.getControls( this );
-       },      
-       //ads colors/dividers between tracks
-       colorPlayHead: function(){
+       },
+       // ads colors/dividers between tracks
+       colorPlayHead: function() {
                var _this = this;
                
-               if( !_this.mv_seeker_width)
-                       _this.mv_seeker_width = $j('#' + _this.id + ' .play_head').width();                                     
+               if ( !_this.mv_seeker_width )
+                       _this.mv_seeker_width = $j( '#' + _this.id + ' .play_head' ).width();
        
-               if( !_this.track_len ) 
-                       _this.track_len = $j('#' + _this.id + ' .play_head').width();
+               if ( !_this.track_len )
+                       _this.track_len = $j( '#' + _this.id + ' .play_head' ).width();
                        
-               //total duration:               
+               // total duration:              
                var pl_duration = _this.getDuration();
                
-               var cur_pixle=0;                
-               //set up _this
-               
-               //js_log("do play head total dur: "+pl_duration );
-               $j.each(this.default_track.clips, function(i, clip){            
-                       //(use getSoloDuration to not include transitions and such)      
+               var cur_pixle = 0;
+               // set up _this
+
+               // js_log("do play head total dur: "+pl_duration );
+               $j.each( this.default_track.clips, function( i, clip ) {
+                       // (use getSoloDuration to not include transitions and such)     
                        var perc = ( clip.getSoloDuration() / pl_duration );
-                       var pwidth = Math.round( perc * _this.track_len);
-                       //js_log('pstatus:c:'+ clip.getDuration() + ' of '+ pl_duration+' %:' + perc + ' width: '+ pwidth + ' of total: ' + _this.track_len);
-                       //var pwidth = Math.round( perc  * _this.track_len - (_this.mv_seeker_width*perc) );
-                       
-                       //add the buffer child indicator:                                                
-                       var barHtml= '<div id="cl_status_' + clip.embed.id + '" class="cl_status"  style="' +                                   
-                                       'left:'+cur_pixle +'px;'+
-                                       'width:'+pwidth + 'px;';                                        
-                       //set left or right border based on track pos 
-                       barHtml+=( i == _this.default_track.getClipCount()-1 )?
+                       var pwidth = Math.round( perc * _this.track_len );
+                       // js_log('pstatus:c:'+ clip.getDuration() + ' of '+ pl_duration+' %:' + perc + ' width: '+ pwidth + ' of total: ' + _this.track_len);
+                       // var pwidth = Math.round( perc  * _this.track_len - (_this.mv_seeker_width*perc) );
+
+                       // add the buffer child indicator:                                               
+                       var barHtml = '<div id="cl_status_' + clip.embed.id + '" class="cl_status"  style="' +
+                                       'left:' + cur_pixle + 'px;' +
+                                       'width:' + pwidth + 'px;';
+                       // set left or right border based on track pos 
+                       barHtml += ( i == _this.default_track.getClipCount() - 1 ) ?
                                 'border-left:solid thin black;':
-                                'border-right:solid thin black;';                                                                                      
-                       barHtml+= 'filter:alpha(opacity=40);'+
-                                       '-moz-opacity:.40;">';  
-                       
-                       barHtml+= _this.ctrlBuilder.getMvBufferHtml();
+                                'border-right:solid thin black;';
+                       barHtml += 'filter:alpha(opacity=40);' +
+                                       '-moz-opacity:.40;">';
                        
-                       barHtml+='</div>';
+                       barHtml += _this.ctrlBuilder.getMvBufferHtml();
                        
-                       //background:#DDD +clip.getColor();
+                       barHtml += '</div>';
                        
-                       $j('#' + _this.id + ' .play_head').append(barHtml);
+                       // background:#DDD +clip.getColor();
+
+                       $j( '#' + _this.id + ' .play_head' ).append( barHtml );
                                                                                                                                                                                                                
-                       //js_log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len);
-                       cur_pixle+=pwidth;                                                              
-               });                             
-       },
-       //@@todo currently not really in use
-       setUpHover:function(){
-               js_log('Setup Hover');
-               //set up hover for prev,next 
+                       // js_log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len);
+                       cur_pixle += pwidth;
+               } );
+       },
+       // @@todo currently not really in use
+       setUpHover:function() {
+               js_log( 'Setup Hover' );
+               // set up hover for prev,next 
                var th = 50;
-               var tw = th*this.pl_layout.clip_aspect;
+               var tw = th * this.pl_layout.clip_aspect;
                var _this = this;
-               $j('#mv_prev_link_'+_this.id+',#mv_next_link_'+_this.id).hover(function() {
-                         var clip = (this.id=='mv_prev_link_'+_this.id) ? _this.getPrevClip() : _this.getNextClip();
-                         if(!clip)
-                                 return js_log('missing clip for Hover');
-                         //get the position of #mv_perv|next_link:
-                         var loc = getAbsolutePos(this.id);
-                         //js_log('Hover: x:'+loc.x + ' y:' + loc.y + ' :'+clip.img);
-                          $j("body").append('<div id="mv_Athub" style="position:absolute;' +
-                                  'top:'+loc.y+'px;left:'+loc.x+'px;width:'+tw+'px;height:'+th+'px;">'+
-                               '<img style="border:solid 2px '+clip.getColor()+';position:absolute;top:0px;left:0px;" width="'+tw+'" height="'+th+'" src="'+clip.img+'"/>'+
-                       '</div>');
+               $j( '#mv_prev_link_' + _this.id + ',#mv_next_link_' + _this.id ).hover( function() {
+                         var clip = ( this.id == 'mv_prev_link_' + _this.id ) ? _this.getPrevClip() : _this.getNextClip();
+                         if ( !clip )
+                                 return js_log( 'missing clip for Hover' );
+                         // get the position of #mv_perv|next_link:
+                         var loc = getAbsolutePos( this.id );
+                         // js_log('Hover: x:'+loc.x + ' y:' + loc.y + ' :'+clip.img);
+                          $j( "body" ).append( '<div id="mv_Athub" style="position:absolute;' +
+                                  'top:' + loc.y + 'px;left:' + loc.x + 'px;width:' + tw + 'px;height:' + th + 'px;">' +
+                               '<img style="border:solid 2px ' + clip.getColor() + ';position:absolute;top:0px;left:0px;" width="' + tw + '" height="' + th + '" src="' + clip.img + '"/>' +
+                       '</div>' );
          }, function() {
-                         $j('#mv_Athub').remove();
-         });    
+                         $j( '#mv_Athub' ).remove();
+         } );
        },
-       //@@todo we need to move a lot of this track logic like "cur_clip" to the track Obj
+       // @@todo we need to move a lot of this track logic like "cur_clip" to the track Obj
        // and have the playlist just drive the tracks. 
-       getNextClip:function( track ){
-               if(!track)
-                       track = this.default_track;             
-               var tc = parseInt(this.cur_clip.order) + 1;
-               var cat = track;                
-               if( tc > track.getClipCount() -1 )
+       getNextClip:function( track ) {
+               if ( !track )
+                       track = this.default_track;
+               var tc = parseInt( this.cur_clip.order ) + 1;
+               var cat = track;
+               if ( tc > track.getClipCount() - 1 )
                        return false; // out of range
-               
+
                return   track.getClip( tc );
-       },      
+       },
        getPrevClip:function( track ) {
-               if(!track)
-                       track = this.default_track;             
-               var tc = parseInt(this.cur_clip.order) - 1;
-               if( tc < 0 )
+               if ( !track )
+                       track = this.default_track;
+               var tc = parseInt( this.cur_clip.order ) - 1;
+               if ( tc < 0 )
                        return false;
-               return track.getClip( tc );  
+               return track.getClip( tc );
        },
        /* 
         * generic add Clip to ~default~ track
         */
-       addCliptoTrack: function(clipObj, pos){
-               if( typeof clipObj['track_id'] =='undefined'){
+       addCliptoTrack: function( clipObj, pos ) {
+               if ( typeof clipObj['track_id'] == 'undefined' ) {
                        var track = this.default_track;
-               }else{
+               } else {
                        var track = this.tracks[ clipObj.track_id ]
                }
-               js_log('add clip:' + clipObj.id +' to track: at:' + pos);               
-               //set the first clip to current (maybe deprecated ) 
-               if(clipObj.order==0){
-                       if(!this.cur_clip)this.cur_clip=clipObj;
-               }               
-               track.addClip(clipObj, pos);            
-       },
-       swapClipDesc: function(req_clipID, callback){
-               //hide all but the requested
-               var _this=this;
-               js_log('r:'+req_clipID+' cur:'+_this.id);
-               if(req_clipID==_this.cur_clip.id){
-                       js_log('no swap to same clip');
-               }else{
-                       //fade out clips
-                       req_clip=null;
-                       $j.each(this.default_track.clips, function(i, clip){
-                               if(clip.id!=req_clipID){
-                                       //fade out if display!=none already
-                                       if($j('#clipDesc_'+clip.id).css('display')!='none'){
-                                               $j('#clipDesc_'+clip.id).fadeOut("slow");
+               js_log( 'add clip:' + clipObj.id + ' to track: at:' + pos );
+               // set the first clip to current (maybe deprecated ) 
+               if ( clipObj.order == 0 ) {
+                       if ( !this.cur_clip )this.cur_clip = clipObj;
+               }
+               track.addClip( clipObj, pos );
+       },
+       swapClipDesc: function( req_clipID, callback ) {
+               // hide all but the requested
+               var _this = this;
+               js_log( 'r:' + req_clipID + ' cur:' + _this.id );
+               if ( req_clipID == _this.cur_clip.id ) {
+                       js_log( 'no swap to same clip' );
+               } else {
+                       // fade out clips
+                       req_clip = null;
+                       $j.each( this.default_track.clips, function( i, clip ) {
+                               if ( clip.id != req_clipID ) {
+                                       // fade out if display!=none already
+                                       if ( $j( '#clipDesc_' + clip.id ).css( 'display' ) != 'none' ) {
+                                               $j( '#clipDesc_' + clip.id ).fadeOut( "slow" );
                                        }
-                               }else{
-                                       req_clip =clip;
+                               } else {
+                                       req_clip = clip;
                                }
-                       });
-                       //fade in requested clip *and set req_clip to current
-                       $j('#clipDesc_'+req_clipID).fadeIn("slow", function(){
+                       } );
+                       // fade in requested clip *and set req_clip to current
+                       $j( '#clipDesc_' + req_clipID ).fadeIn( "slow", function() {
                                        _this.cur_clip = req_clip;
-                                       if(callback)
+                                       if ( callback )
                                                callback();
-                       });             
-               }
-       },
-       //this is pretty outdated:       
-       getPLControls: function(){
-               js_log('getPL cont');
-               return   '<a id="mv_prev_link_'+this.id+'" title="Previus Clip" onclick="document.getElementById(\''+this.id+'\').playPrev();return false;" href="#">'+
-                                       getTransparentPng({id:'mv_prev_btn_'+this.id,style:'float:left',width:'27', height:'27', border:"0", 
-                                               src:mv_skin_img_path + 'vid_prev_sm.png' }) + 
-                               '</a>'+
-                               '<a id="mv_next_link_'+this.id+'"  title="Next Clip"  onclick="document.getElementById(\''+this.id+'\').playNext();return false;" href="#">'+
-                                       getTransparentPng({id:'mv_next_btn_'+this.id,style:'float:left',width:'27', height:'27', border:"0", 
-                                               src:mv_skin_img_path + 'vid_next_sm.png' }) + 
-                               '</a>';         
-       },
-       run_transition: function( clip_inx, trans_type){                
-               if(typeof this.default_track.clips[ clip_inx ][ trans_type ] == 'undefined')
+                       } );
+               }
+       },
+       // this is pretty outdated:      
+       getPLControls: function() {
+               js_log( 'getPL cont' );
+               return   '<a id="mv_prev_link_' + this.id + '" title="Previus Clip" onclick="document.getElementById(\'' + this.id + '\').playPrev();return false;" href="#">' +
+                                       getTransparentPng( { id:'mv_prev_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0",
+                                               src:mv_skin_img_path + 'vid_prev_sm.png' } ) +
+                               '</a>' +
+                               '<a id="mv_next_link_' + this.id + '"  title="Next Clip"  onclick="document.getElementById(\'' + this.id + '\').playNext();return false;" href="#">' +
+                                       getTransparentPng( { id:'mv_next_btn_' + this.id, style:'float:left', width:'27', height:'27', border:"0",
+                                               src:mv_skin_img_path + 'vid_next_sm.png' } ) +
+                               '</a>';
+       },
+       run_transition: function( clip_inx, trans_type ) {
+               if ( typeof this.default_track.clips[ clip_inx ][ trans_type ] == 'undefined' )
                        clearInterval( this.default_track.clips[ clip_inx ].timerId );
                else
-                       this.default_track.clips[ clip_inx ][ trans_type ].run_transition();            
+                       this.default_track.clips[ clip_inx ][ trans_type ].run_transition();
        },
        playerPixelWidth : function()
        {
-               var player = $j('#dc_'+this.id).get(0);
-               if(typeof player!='undefined' && player['offsetWidth'])
+               var player = $j( '#dc_' + this.id ).get( 0 );
+               if ( typeof player != 'undefined' && player['offsetWidth'] )
                        return player.offsetWidth;
                else
-                       return parseInt(this.width);
+                       return parseInt( this.width );
        },
        playerPixelHeight : function()
        {
-               var player = $j('#dc_'+this.id).get(0);
-               if(typeof player!='undefined' && player['offsetHeight'])
+               var player = $j( '#dc_' + this.id ).get( 0 );
+               if ( typeof player != 'undefined' && player['offsetHeight'] )
                        return player.offsetHeight;
                else
-                       return parseInt(this.height);
+                       return parseInt( this.height );
        }
 }
 
@@ -1077,16 +1077,16 @@ mvPlayList.prototype = {
  * 
  * @clip... each clip segment is a clip object. 
  * */
-var mvClip = function(o) {     
-       if(o)
-               this.init(o);
+var mvClip = function( o ) {
+       if ( o )
+               this.init( o );
        return this;
 };
-//set up the mvPlaylist object
+// set up the mvPlaylist object
 mvClip.prototype = {
-       id:null, //clip id
+       id:null, // clip id
        pp:null, // parent playlist
-       order:null, //the order/array key for the current clip
+       order:null, // the order/array key for the current clip
        src:null,
        info:null,
        title:null,
@@ -1095,60 +1095,60 @@ mvClip.prototype = {
        img:null,
        duration:null,
        loading:false,
-       isAnimating:false,                      
-       init:function(o){               
-               //init object including pointer to parent
-               for(var i in o){                        
-                       this[i]=o[i];
-               };              
-               js_log('id is: '+ this.id);
-       },
-       //setup the embed object:
-       setUpEmbedObj:function(){       
-               js_log('mvClip:setUpEmbedObj()');       
-               //init:         
-               
+       isAnimating:false,
+       init:function( o ) {
+               // init object including pointer to parent
+               for ( var i in o ) {
+                       this[i] = o[i];
+               };
+               js_log( 'id is: ' + this.id );
+       },
+       // setup the embed object:
+       setUpEmbedObj:function() {
+               js_log( 'mvClip:setUpEmbedObj()' );
+               // init:                
+
                
-               this.embed=null;                
-               //js_log('setup embed for clip '+ this.id + ':id is a function?'); 
-               //set up the pl_mv_embed object:
-               var init_pl_embed={id:'e_'+this.id,
-                       pc:this, //parent clip
+               this.embed = null;
+               // js_log('setup embed for clip '+ this.id + ':id is a function?'); 
+               // set up the pl_mv_embed object:
+               var init_pl_embed = { id:'e_' + this.id,
+                       pc:this, // parent clip
                        src:this.src
                };
 
                this.setBaseEmbedDim( init_pl_embed );
 
                
-               //if in sequence mode hide controls / embed links                
+               // if in sequence mode hide controls / embed links               
                //                      init_pl_embed.play_button=false;
-               //init_pl_embed.controls=true;  
-               //if(this.pp.sequencer=='true'){
-               init_pl_embed.embed_link=null;  
-               init_pl_embed.linkback=null;
+               // init_pl_embed.controls=true; 
+               // if(this.pp.sequencer=='true'){
+               init_pl_embed.embed_link = null;
+               init_pl_embed.linkback = null;
                        
                
-               if(this.poster)init_pl_embed['thumbnail']=this.poster;
+               if ( this.poster )init_pl_embed['thumbnail'] = this.poster;
                
-               if( this.type )init_pl_embed['type'] = this.type;
+               if ( this.type )init_pl_embed['type'] = this.type;
                                
-               this.embed = new PlMvEmbed( init_pl_embed );    
+               this.embed = new PlMvEmbed( init_pl_embed );
                                        
-               //js_log('media Duration:' + this.embed.getDuration() );
-               //js_log('media element:'+ this.embed.media_element.length);
-               //js_log('type of embed:' + typeof(this.embed) + ' seq:' + this.pp.sequencer+' pb:'+ this.embed.play_button);           
-       },
-       doAdjust:function(side, delta){
-               js_log("f:doAdjust: " + side + ' , ' +  delta);
-               if(this.embed){         
-                       if(side=='start'){
-                               var start_offset =parseInt(this.embed.start_offset)+parseInt(delta*-1);                         
-                               this.embed.updateVideoTime( seconds2npt(start_offset), seconds2npt ( this.embed.start_offset + this.embed.getDuration() ) );
-                       }else if(side=='end'){
-                               var end_offset = parseInt(this.embed.start_offset) + parseInt( this.embed.getDuration() ) + parseInt(delta);
-                               this.embed.updateVideoTime( seconds2npt(this.embed.start_offset), seconds2npt(end_offset) );
+               // js_log('media Duration:' + this.embed.getDuration() );
+               // js_log('media element:'+ this.embed.media_element.length);
+               // js_log('type of embed:' + typeof(this.embed) + ' seq:' + this.pp.sequencer+' pb:'+ this.embed.play_button);          
+       },
+       doAdjust:function( side, delta ) {
+               js_log( "f:doAdjust: " + side + ' , ' +  delta );
+               if ( this.embed ) {
+                       if ( side == 'start' ) {
+                               var start_offset = parseInt( this.embed.start_offset ) + parseInt( delta * - 1 );
+                               this.embed.updateVideoTime( seconds2npt( start_offset ), seconds2npt ( this.embed.start_offset + this.embed.getDuration() ) );
+                       } else if ( side == 'end' ) {
+                               var end_offset = parseInt( this.embed.start_offset ) + parseInt( this.embed.getDuration() ) + parseInt( delta );
+                               this.embed.updateVideoTime( seconds2npt( this.embed.start_offset ), seconds2npt( end_offset ) );
                        }
-                       //update everything: 
+                       // update everything: 
                        this.pp.refresh();
                        /*var base_src = this.src.substr(0,this.src.indexOf('?'));
                        js_log("delta:"+ delta);
@@ -1168,20 +1168,20 @@ mvClip.prototype = {
                        //update playlist stuff:
                        this.pp.updateTitle();*/
                }
-       },      
-       getDuration:function(){         
-               if(!this.embed)this.setUpEmbedObj();            
+       },
+       getDuration:function() {
+               if ( !this.embed )this.setUpEmbedObj();
                return this.embed.getDuration();
        },
-       setBaseEmbedDim:function(o){
-               if(!o)o=this;
-               //o.height=Math.round(pl_layout.clip_desc*this.pp.height)-2;//give it some padding:
-               //o.width=Math.round(o.height*pl_layout.clip_aspect)-2;
-               o.height      this.pp.height;
-               o.width =       this.pp.width;  
-       },              
-       //output the detail view:
-       //@@todo
+       setBaseEmbedDim:function( o ) {
+               if ( !o )o = this;
+               // o.height=Math.round(pl_layout.clip_desc*this.pp.height)-2;//give it some padding:
+               // o.width=Math.round(o.height*pl_layout.clip_aspect)-2;
+               o.height =      this.pp.height;
+               o.width =       this.pp.width;
+       },
+       // output the detail view:
+       // @@todo
        /*getDetail:function(){
                //js_log('get detail:' + this.pp.title);
                var th=Math.round( this.pl_layout.clip_desc * this.pp.height ); 
@@ -1210,220 +1210,220 @@ mvClip.prototype = {
                        '</div>');              
                }
        },*/
-       getTitle:function(){
-               if(typeof this.title == 'string')
+       getTitle:function() {
+               if ( typeof this.title == 'string' )
                        return this.title
                        
                return 'untitled clip ' + this.order;
        },
-       getClipImg:function(start_offset, size){
-               js_log('f:getClipImg ' + start_offset + ' s:'+size);    
-               if( !this.img){                 
-                       return mv_default_thumb_url; 
-               }else{
-                       if(!size && !start_offset){                     
+       getClipImg:function( start_offset, size ) {
+               js_log( 'f:getClipImg ' + start_offset + ' s:' + size );
+               if ( !this.img ) {
+                       return mv_default_thumb_url;
+               } else {
+                       if ( !size && !start_offset ) {
                                return this.img;
-                       }else{
-                               //if a metavid image (has request parameters) use size and time args
-                               if(this.img.indexOf('?')!=-1){
-                                       js_log('get with offset: '+ start_offset);
-                                       var time = seconds2npt( start_offset+ (this.embed.start_offset/1000) );
-                                       js_log("time is: " + time);
-                                       this.img = this.img.replace(/t\=[^&]*/gi, "t="+time);
-                                       if(this.img.indexOf('&size=')!=-1){
-                                               this.img = this.img.replace(/size=[^&]*/gi, "size="+size);
-                                       }else{
-                                               this.img+='&size='+size;
+                       } else {
+                               // if a metavid image (has request parameters) use size and time args
+                               if ( this.img.indexOf( '?' ) != - 1 ) {
+                                       js_log( 'get with offset: ' + start_offset );
+                                       var time = seconds2npt( start_offset + ( this.embed.start_offset / 1000 ) );
+                                       js_log( "time is: " + time );
+                                       this.img = this.img.replace( /t\=[^&]*/gi, "t=" + time );
+                                       if ( this.img.indexOf( '&size=' ) != - 1 ) {
+                                               this.img = this.img.replace( / size = [ ^ &] * / gi, "size=" + size );
+                                       } else {
+                                               this.img += '&size=' + size;
                                        }
                                }
-                               return this.img;                                
+                               return this.img;
                        }
                }
        },
-       getColor: function(){
-               //js_log('get color:'+ num +' : '+  num.toString().substr(num.length-1, 1) + ' : '+colors[ num.toString().substr(num.length-1, 1)] );
-               var num = this.id.substr( this.id.length-1, 1);
-               if(!isNaN(num)){
-                       num=num.charCodeAt(0);
+       getColor: function() {
+               // js_log('get color:'+ num +' : '+  num.toString().substr(num.length-1, 1) + ' : '+colors[ num.toString().substr(num.length-1, 1)] );
+               var num = this.id.substr( this.id.length - 1, 1 );
+               if ( !isNaN( num ) ) {
+                       num = num.charCodeAt( 0 );
                }
-               if(num >= 10)num=num % 10;
+               if ( num >= 10 )num = num % 10;
                return mv_clip_colors[num];
-       }       
+       }
 }
 /* mv_embed extensions for playlists */
-var PlMvEmbed=function(vid_init){
-       //js_log('PlMvEmbed: '+ vid_init.id);   
-       //create the div container
-       var ve = document.createElement('div');
-       //extend ve with all this 
-       this.init(vid_init);    
-       for(method in this){
-               if(method!='readyState'){                                       
-                       ve[method]= this[method];
+var PlMvEmbed = function( vid_init ) {
+       // js_log('PlMvEmbed: '+ vid_init.id);  
+       // create the div container
+       var ve = document.createElement( 'div' );
+       // extend ve with all this 
+       this.init( vid_init );
+       for ( method in this ) {
+               if ( method != 'readyState' ) {
+                       ve[method] = this[method];
                }
        }
-       js_log('ve src len:'+ ve.media_element.sources.length);
+       js_log( 've src len:' + ve.media_element.sources.length );
        return ve;
 }
-//all the overwritten and new methods for playlist extension of baseEmbed
-PlMvEmbed.prototype = {        
-       init:function(vid_init){                                
-               //send embed_video a created video element: 
-               ve = document.createElement('div');
-               for(var i in vid_init){         
-                       //set the parent clip pointer:   
-                       if(i=='pc'){
-                               this['pc']=vid_init['pc'];
-                       }else{
-                               ve.setAttribute(i,vid_init[i]);
+// all the overwritten and new methods for playlist extension of baseEmbed
+PlMvEmbed.prototype = {
+       init:function( vid_init ) {
+               // send embed_video a created video element: 
+               ve = document.createElement( 'div' );
+               for ( var i in vid_init ) {
+                       // set the parent clip pointer:  
+                       if ( i == 'pc' ) {
+                               this['pc'] = vid_init['pc'];
+                       } else {
+                               ve.setAttribute( i, vid_init[i] );
                        }
                }
-               var videoInterface = new embedVideo(ve);                        
-               //inherit the videoInterface
-               for( method in videoInterface ){                        
-                       if(method!='style'){
-                               if( this[ method ] ){
-                                       //parent embed method preservation:
-                                       this['pe_'+method]=videoInterface[method];      
-                               }else{
-                                       this[method]=videoInterface[method];
+               var videoInterface = new embedVideo( ve );
+               // inherit the videoInterface
+               for ( method in videoInterface ) {
+                       if ( method != 'style' ) {
+                               if ( this[ method ] ) {
+                                       // parent embed method preservation:
+                                       this['pe_' + method] = videoInterface[method];
+                               } else {
+                                       this[method] = videoInterface[method];
                                }
-                       }                       
-                       //string -> boolean:
-                       if(this[method]=="false")this[method]=false;
-                       if(this[method]=="true")this[method]=true;
-               }                                               
-       },      
-       onClipDone:function(){
-               js_log('pl onClipDone (should go to next)');
-               //go to next in playlist: 
-               this.pc.pp.playNext();                  
-       },      
-       stop:function(){
-               js_log('pl:do stop');
-               //set up convenience pointer to parent playlist
-               var _this = this.pc.pp;                         
+                       }
+                       // string -> boolean:
+                       if ( this[method] == "false" )this[method] = false;
+                       if ( this[method] == "true" )this[method] = true;
+               }
+       },
+       onClipDone:function() {
+               js_log( 'pl onClipDone (should go to next)' );
+               // go to next in playlist: 
+               this.pc.pp.playNext();
+       },
+       stop:function() {
+               js_log( 'pl:do stop' );
+               // set up convenience pointer to parent playlist
+               var _this = this.pc.pp;
                                        
-               var th=Math.round( _this.pl_layout.clip_desc * _this.height );  
-               var tw=Math.round( th * _this.pl_layout.clip_aspect );
+               var th = Math.round( _this.pl_layout.clip_desc * _this.height );
+               var tw = Math.round( th * _this.pl_layout.clip_aspect );
                
-               //run the parent stop:
+               // run the parent stop:
                this.pe_stop();
-               var pl_height = (_this.sequencer=='true')?_this.height+27:_this.height;
+               var pl_height = ( _this.sequencer == 'true' ) ? _this.height + 27:_this.height;
                
                this.getHTML();
        },
-       play:function(){
-               //js_log('pl eb play');         
-               var _this = this.pc.pp; 
-               //check if we are already playing
-               if( !this.thumbnail_disp ){
-                       this.pe_play(); 
+       play:function() {
+               // js_log('pl eb play');                
+               var _this = this.pc.pp;
+               // check if we are already playing
+               if ( !this.thumbnail_disp ) {
+                       this.pe_play();
                        return '';
                }
-               mv_lock_vid_updates=true;                                
-               this.pe_play();                 
+               mv_lock_vid_updates = true;
+               this.pe_play();
        },
-       //do post interface operations
-       postEmbedJS:function(){         
-               //add playlist clips (if plugin supports it) 
-               if(this.pc.pp.cur_clip.embed.playlistSupport())
+       // do post interface operations
+       postEmbedJS:function() {
+               // add playlist clips (if plugin supports it) 
+               if ( this.pc.pp.cur_clip.embed.playlistSupport() )
                        this.pc.pp.loadEmbedPlaylist();
-               //color playlist points (if play_head present)
-               if(this.pc.pp.disp_play_head)
+               // color playlist points (if play_head present)
+               if ( this.pc.pp.disp_play_head )
                        this.pc.pp.colorPlayHead();
-               //setup hover images (for playhead and next/prev buttons)
+               // setup hover images (for playhead and next/prev buttons)
                this.pc.pp.setUpHover();
-               //call the parent postEmbedJS
+               // call the parent postEmbedJS
                this.pe_postEmbedJS();
-               mv_lock_vid_updates=false;
-       },
-       getPlayButton:function(){
-               return this.pe_getPlayButton(this.pc.pp.id);
-       },      
-       setStatus:function(value){              
-               //status updates handled by playlist obj
-       },
-       setSliderValue:function(value){
-               js_log('PlMvEmbed:setSliderValue:' + value);
-               //setSlider value handled by playlist obj       
-       }       
+               mv_lock_vid_updates = false;
+       },
+       getPlayButton:function() {
+               return this.pe_getPlayButton( this.pc.pp.id );
+       },
+       setStatus:function( value ) {
+               // status updates handled by playlist obj
+       },
+       setSliderValue:function( value ) {
+               js_log( 'PlMvEmbed:setSliderValue:' + value );
+               // setSlider value handled by playlist obj      
+       }
 }
 
 /* 
  *  m3u parse
  */
 var m3uPlaylist = {
-       doParse:function(){
-               //for each line not # add as clip 
-               var inx =0;
+       doParse:function() {
+               // for each line not # add as clip 
+               var inx = 0;
                var this_pl = this;
-               //js_log('data:'+ this.data.toString());
-               $j.each(this.data.split("\n"), function(i,n){                   
-                       //js_log('on line '+i+' val:'+n+' len:'+n.length);
-                       if( n.charAt(0) != '#' ){
-                               if( n.length > 3 ){ 
-                                       //@@todo make sure its a valid url
-                                       //js_log('add url: '+i + ' '+ n);
-                                       var cur_clip = new mvClip({type:'srcClip',id:'p_'+this_pl.id+'_c_'+inx,pp:this_pl,src:n,order:inx});
-                                       //setup the embed object 
+               // js_log('data:'+ this.data.toString());
+               $j.each( this.data.split( "\n" ), function( i, n ) {
+                       // js_log('on line '+i+' val:'+n+' len:'+n.length);
+                       if ( n.charAt( 0 ) != '#' ) {
+                               if ( n.length > 3 ) {
+                                       // @@todo make sure its a valid url
+                                       // js_log('add url: '+i + ' '+ n);
+                                       var cur_clip = new mvClip( { type:'srcClip', id:'p_' + this_pl.id + '_c_' + inx, pp:this_pl, src:n, order:inx } );
+                                       // setup the embed object 
                                        cur_clip.setUpEmbedObj();
-                                       js_log('m3uPlaylist len:'+ thisClip.embed.media_element.sources.length);        
-                                       this_pl.addCliptoTrack(cur_clip);                                       
+                                       js_log( 'm3uPlaylist len:' + thisClip.embed.media_element.sources.length );
+                                       this_pl.addCliptoTrack( cur_clip );
                                        inx++;
                                }
                        }
-               });
+               } );
                return true;
        }
 }
 
 var itunesPlaylist = {
-       doParse:function()
-               var properties = { title:'title', linkback:'link', 
-                                                  author:'itunes:author',desc:'description',
+       doParse:function() {
+               var properties = { title:'title', linkback:'link',
+                                                  author:'itunes:author', desc:'description',
                                                   date:'pubDate' };
                var tmpElm = null;
-               for(i in properties){
-                       tmpElm = this.data.getElementsByTagName(properties[i])[0];
-                       if(tmpElm){
+               for ( i in properties ) {
+                       tmpElm = this.data.getElementsByTagName( properties[i] )[0];
+                       if ( tmpElm ) {
                                this[i] = tmpElm.childNodes[0].nodeValue;
-                               //js_log('set '+i+' to '+this[i]);
+                               // js_log('set '+i+' to '+this[i]);
                        }
                }
-               //image src is nested in itunes rss:
-               tmpElm = this.data.getElementsByTagName('image')[0];
-               if(tmpElm){
-                       imgElm = tmpElm.getElementsByTagName('url')[0];
-                               if(imgElm){
+               // image src is nested in itunes rss:
+               tmpElm = this.data.getElementsByTagName( 'image' )[0];
+               if ( tmpElm ) {
+                       imgElm = tmpElm.getElementsByTagName( 'url' )[0];
+                               if ( imgElm ) {
                                        this.img = imgElm.childNodes[0].nodeValue;
                                }
                }
-               //get the clips: 
-               var clips = this.data.getElementsByTagName("item");
+               // get the clips: 
+               var clips = this.data.getElementsByTagName( "item" );
                properties.src = 'guid';
-               for (var i=0;i<clips.length;i++){
-                       var cur_clip = new mvClip({type:'srcClip',id:'p_'+this.id+'_c_'+i,pp:this,order:i});                    
-                       for(var j in properties){
+               for ( var i = 0; i < clips.length; i++ ) {
+                       var cur_clip = new mvClip( { type:'srcClip', id:'p_' + this.id + '_c_' + i, pp:this, order:i } );
+                       for ( var j in properties ) {
                                tmpElm = clips[i].getElementsByTagName( properties[j] )[0];
-                               if(tmpElm!=null){
+                               if ( tmpElm != null ) {
                                        cur_clip[j] = tmpElm.childNodes[0].nodeValue;
-                                       //js_log('set clip property: ' + j+' to '+cur_clip[j]);
+                                       // js_log('set clip property: ' + j+' to '+cur_clip[j]);
                                }
                        }
-                       //image is nested
-                       tmpElm = clips[i].getElementsByTagName('image')[0];
-                       if(tmpElm){
-                               imgElm = tmpElm.getElementsByTagName('url')[0];
-                                       if(imgElm){
+                       // image is nested
+                       tmpElm = clips[i].getElementsByTagName( 'image' )[0];
+                       if ( tmpElm ) {
+                               imgElm = tmpElm.getElementsByTagName( 'url' )[0];
+                                       if ( imgElm ) {
                                                cur_clip.img = imgElm.childNodes[0].nodeValue;
                                        }
                        }
-                       //set up the embed object now that all the values have been set
+                       // set up the embed object now that all the values have been set
                        cur_clip.setUpEmbedObj();
                        
-                       //add the current clip to the clip list
-                       this.addCliptoTrack(cur_clip);
+                       // add the current clip to the clip list
+                       this.addCliptoTrack( cur_clip );
                }
                return true;
        }
@@ -1433,56 +1433,56 @@ var itunesPlaylist = {
  * parse xsfp: 
  * http://www.xspf.org/xspf-v1.html
  */
-var xspfPlaylist ={
-       doParse:function(){
-               //js_log('do xsfp parse: '+ this.data.innerHTML);
-               var properties = { title:'title', linkback:'info', 
-                                                  author:'creator',desc:'annotation',
+var xspfPlaylist = {
+       doParse:function() {
+               // js_log('do xsfp parse: '+ this.data.innerHTML);
+               var properties = { title:'title', linkback:'info',
+                                                  author:'creator', desc:'annotation',
                                                   poster:'image', date:'date' };
                var tmpElm = null;
-               //get the first instance of any of the meta tags (ok that may be the meta on the first clip)
-               //js_log('do loop on properties:' + properties);
-               for(i in properties){
-                       js_log('on property: '+i);                      
-                       tmpElm = this.data.getElementsByTagName(properties[i])[0];
-                       if(tmpElm){
-                               if(tmpElm.childNodes[0]){
+               // get the first instance of any of the meta tags (ok that may be the meta on the first clip)
+               // js_log('do loop on properties:' + properties);
+               for ( i in properties ) {
+                       js_log( 'on property: ' + i );
+                       tmpElm = this.data.getElementsByTagName( properties[i] )[0];
+                       if ( tmpElm ) {
+                               if ( tmpElm.childNodes[0] ) {
                                        this[i] = tmpElm.childNodes[0].nodeValue;
-                                       js_log('set pl property: ' + i+' to '+this[i]);
+                                       js_log( 'set pl property: ' + i + ' to ' + this[i] );
                                }
                        }
                }
-               var clips = this.data.getElementsByTagName("track");
-               js_log('found clips:'+clips.length);
-               //add any clip specific properties 
+               var clips = this.data.getElementsByTagName( "track" );
+               js_log( 'found clips:' + clips.length );
+               // add any clip specific properties 
                properties.src = 'location';
-               for (var i=0;i<clips.length;i++){
-                       var cur_clip = new mvClip({id:'p_'+this.id+'_c_'+i,pp:this,order:i});                   
-                       //js_log('cur clip:'+ cur_clip.id);
-                       for(var j in properties){
+               for ( var i = 0; i < clips.length; i++ ) {
+                       var cur_clip = new mvClip( { id:'p_' + this.id + '_c_' + i, pp:this, order:i } );
+                       // js_log('cur clip:'+ cur_clip.id);
+                       for ( var j in properties ) {
                                tmpElm = clips[i].getElementsByTagName( properties[j] )[0];
-                               if(tmpElm!=null){                               
-                                       if( tmpElm.childNodes.length!=0){
+                               if ( tmpElm != null ) {
+                                       if ( tmpElm.childNodes.length != 0 ) {
                                                cur_clip[j] = tmpElm.childNodes[0].nodeValue;
-                                               js_log('set clip property: ' + j+' to '+cur_clip[j]);
+                                               js_log( 'set clip property: ' + j + ' to ' + cur_clip[j] );
                                        }
                                }
-                       }                       
-                       //add mvClip ref from info link: 
-                       if(cur_clip.linkback){
-                               //if mv linkback
+                       }
+                       // add mvClip ref from info link: 
+                       if ( cur_clip.linkback ) {
+                               // if mv linkback
                                mvInx = 'Stream:';
-                               mvclippos = cur_clip.linkback.indexOf(mvInx);
-                               if(mvclippos!==false){
-                                       cur_clip.mvclip=cur_clip.linkback.substr( mvclippos+mvInx.length );
+                               mvclippos = cur_clip.linkback.indexOf( mvInx );
+                               if ( mvclippos !== false ) {
+                                       cur_clip.mvclip = cur_clip.linkback.substr( mvclippos + mvInx.length );
                                }
-                       }                       
-                       //set up the embed object now that all the values have been set
+                       }
+                       // set up the embed object now that all the values have been set
                        cur_clip.setUpEmbedObj();
-                       //add the current clip to the clip list
-                       this.addCliptoTrack(cur_clip);
+                       // add the current clip to the clip list
+                       this.addCliptoTrack( cur_clip );
                }
-               //js_log('done with parse');
+               // js_log('done with parse');
                return true;
        }
 }
@@ -1490,101 +1490,101 @@ var xspfPlaylist ={
  * SMIL CODE (could be put into another js file / lazy_loaded for improved basic playlist performance / modularity)
  *****************************/
 /*playlist driver extensions to the playlist object*/
-mvPlayList.prototype.monitor = function(){     
-       //js_log('pl:monitor');                 
-       //if paused stop updates
-       if( this.paused ){
-               //clearInterval( this.smil_monitorTimerId );
+mvPlayList.prototype.monitor = function() {
+       // js_log('pl:monitor');                        
+       // if paused stop updates
+       if ( this.paused ) {
+               // clearInterval( this.smil_monitorTimerId );
                return ;
        }
-       //js_log("pl check: " + this.currentTime + ' > '+this.getDuration());
-       //check if we should be done:
-       if( this.currentTime >  this.getDuration() ) 
+       // js_log("pl check: " + this.currentTime + ' > '+this.getDuration());
+       // check if we should be done:
+       if ( this.currentTime >  this.getDuration() )
                this.stop();
        
-       //update the playlist current time: 
-       //check for a trsnOut from the previus clip to subtract
-       this.currentTime = this.cur_clip.dur_offset + this.cur_clip.embed.relativeCurrentTime();        
+       // update the playlist current time: 
+       // check for a trsnOut from the previus clip to subtract
+       this.currentTime = this.cur_clip.dur_offset + this.cur_clip.embed.relativeCurrentTime();
                
-       //update slider: 
-       if(!this.userSlide){
-               this.setStatus(seconds2npt(this.currentTime) + '/' + seconds2npt(this.getDuration()) );                                 
+       // update slider: 
+       if ( !this.userSlide ) {
+               this.setStatus( seconds2npt( this.currentTime ) + '/' + seconds2npt( this.getDuration() ) );
                this.setSliderValue( this.currentTime / this.getDuration() );
        }
-       //pre-load any future clips:
+       // pre-load any future clips:
        this.loadFutureClips();
        
        
-       //status updates are handled by children clips ... playlist mostly manages smil actions
-       this.doSmilActions();   
+       // status updates are handled by children clips ... playlist mostly manages smil actions
+       this.doSmilActions();
        
-       if( ! this.smil_monitorTimerId ){
-               if(document.getElementById(this.id)){
-                       this.smil_monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
+       if ( ! this.smil_monitorTimerId ) {
+               if ( document.getElementById( this.id ) ) {
+                       this.smil_monitorTimerId = setInterval( '$j(\'#' + this.id + '\').get(0).monitor()', 250 );
                }
        }
 }
-//handles the rendering of overlays load of future clips (if necessary)
-//@@todo could be lazy loaded if necessary 
-mvPlayList.prototype.doSmilActions = function( single_frame ){          
-       //js_log('f:doSmilActions: ' + this.cur_clip.id + ' tid: ' + this.cur_clip.transOut );
-       var offSetTime = 0; //offset time should let us start a transition later on if we have to. 
-       var _clip = this.cur_clip;      //setup a local pointer to cur_clip
-       
+// handles the rendering of overlays load of future clips (if necessary)
+// @@todo could be lazy loaded if necessary 
+mvPlayList.prototype.doSmilActions = function( single_frame ) {
+       // js_log('f:doSmilActions: ' + this.cur_clip.id + ' tid: ' + this.cur_clip.transOut );
+       var offSetTime = 0; // offset time should let us start a transition later on if we have to. 
+       var _clip = this.cur_clip;      // setup a local pointer to cur_clip
+
        
-       //do any smil time actions that may change the current clip
-       if( this.userSlide ){
-               //current clip set is set via updateThumbTime function                   
-       }else{
-               //assume playing and go to next: 
-               if( _clip.dur <= _clip.embed.currentTime 
-                        && _clip.order != _clip.pp.getClipCount()-1 ){
-                       //force next clip
-                       js_log('order:'  + _clip.order + ' != count:' + ( _clip.pp.getClipCount()-1 ) +
-                               ' smil dur: ' + _clip.dur + ' <= curTime: ' + _clip.embed.currentTime + ' go to next clip..');          
-                               //do a _play next:
-                               _clip.pp.playNext();                            
-               }
-       }                                               
-       //@@todo could maybe generalize transIn with trasOut into one "flow" with a few scattered if statements 
-       //update/setup all transitions (will render current transition state)   
-       var in_range=false;
-       //pretty similar actions per transition types so group into a loop:
-       var tran_types = {'transIn':true,'transOut':true};
-       for(var tid in tran_types ){                            
-               eval('var tObj =  _clip.'+tid);         
-               if(!tObj)
-                       continue;                       
-               //js_log('f:doSmilActions: ' + _clip.id + ' tid:'+tObj.id + ' tclip_id:'+ tObj.pClip.id);                                       
-               //make sue we are in range: 
-               if( tid=='transIn' )
-                       in_range = (_clip.embed.currentTime <= tObj.dur)?true:false;                    
+       // do any smil time actions that may change the current clip
+       if ( this.userSlide ) {
+               // current clip set is set via updateThumbTime function                  
+       } else {
+               // assume playing and go to next: 
+               if ( _clip.dur <= _clip.embed.currentTime
+                        && _clip.order != _clip.pp.getClipCount() - 1 ) {
+                       // force next clip
+                       js_log( 'order:'  + _clip.order + ' != count:' + ( _clip.pp.getClipCount() - 1 ) +
+                               ' smil dur: ' + _clip.dur + ' <= curTime: ' + _clip.embed.currentTime + ' go to next clip..' );
+                               // do a _play next:
+                               _clip.pp.playNext();
+               }
+       }
+       // @@todo could maybe generalize transIn with trasOut into one "flow" with a few scattered if statements        
+       // update/setup all transitions (will render current transition state)  
+       var in_range = false;
+       // pretty similar actions per transition types so group into a loop:
+       var tran_types = { 'transIn':true, 'transOut':true };
+       for ( var tid in tran_types ) {
+               eval( 'var tObj =  _clip.' + tid );
+               if ( !tObj )
+                       continue;
+               // js_log('f:doSmilActions: ' + _clip.id + ' tid:'+tObj.id + ' tclip_id:'+ tObj.pClip.id);                                      
+               // make sue we are in range: 
+               if ( tid == 'transIn' )
+                       in_range = ( _clip.embed.currentTime <= tObj.dur ) ? true:false;
                
-               if( tid=='transOut' )
-                       in_range = (_clip.embed.currentTime >= (_clip.dur - tObj.dur))?true:false;
+               if ( tid == 'transOut' )
+                       in_range = ( _clip.embed.currentTime >= ( _clip.dur - tObj.dur ) ) ? true:false;
                
-               if( in_range ){
-                       if( this.userSlide || single_frame ){                           
-                               if( tid=='transIn' )
-                                       mvTransLib.doUpdate(tObj, (_clip.embed.currentTime / tObj.dur) );
+               if ( in_range ) {
+                       if ( this.userSlide || single_frame ) {
+                               if ( tid == 'transIn' )
+                                       mvTransLib.doUpdate( tObj, ( _clip.embed.currentTime / tObj.dur ) );
                                        
-                               if( tid=='transOut' )
-                                       mvTransLib.doUpdate(tObj, (_clip.embed.currentTime-(_clip.dur - tObj.dur)) /tObj.dur);
+                               if ( tid == 'transOut' )
+                                       mvTransLib.doUpdate( tObj, ( _clip.embed.currentTime - ( _clip.dur - tObj.dur ) ) / tObj.dur );
                                        
-                       }else{
-                               if( tObj.animation_state==0 ){
-                                       js_log('init/run_transition ');
-                                       tObj.run_transition();  
+                       } else {
+                               if ( tObj.animation_state == 0 ) {
+                                       js_log( 'init/run_transition ' );
+                                       tObj.run_transition();
                                }
                        }
-               }else{
-                       //close up transition if done & still onDispaly
-                       if( tObj.overlay_selector_id ){
-                               js_log('close up transition :'+tObj.overlay_selector_id);
+               } else {
+                       // close up transition if done & still onDispaly
+                       if ( tObj.overlay_selector_id ) {
+                               js_log( 'close up transition :' + tObj.overlay_selector_id );
                                mvTransLib.doCloseTransition( tObj );
                        }
                }
-       }                                                                                                                                                                       
+       }
 }
 
 /*
@@ -1595,7 +1595,7 @@ mvPlayList.prototype.doSmilActions = function( single_frame ){
  * 
  * Smil Transition Effects see:  
  * http://www.w3.org/TR/SMIL3/smil-transitions.html#TransitionEffects-TransitionAttribute
- */                    
+ */
 var mvTransLib = {
        /*
         * function doTransition lookups up the transition in the  mvTransLib obj
@@ -1603,156 +1603,156 @@ var mvTransLib = {
         * @param tObj transition attribute object
         * @param offSetTime default value 0 if we need to start rendering from a given time 
         */
-       doInitTransition:function(tObj){
-               js_log('mvTransLib:f:doInitTransition');                
-               if(!tObj.type){
-                       js_log('transition is missing type attribute');
+       doInitTransition:function( tObj ) {
+               js_log( 'mvTransLib:f:doInitTransition' );
+               if ( !tObj.type ) {
+                       js_log( 'transition is missing type attribute' );
                        return false;
                }
                
-               if(!tObj.subtype){
-                       js_log('transition is missing subtype attribute');
+               if ( !tObj.subtype ) {
+                       js_log( 'transition is missing subtype attribute' );
                        return false;
                }
                
-               if(!this['type'][tObj.type]){
-                       js_log('mvTransLib does not support type: '+tObj.type);
+               if ( !this['type'][tObj.type] ) {
+                       js_log( 'mvTransLib does not support type: ' + tObj.type );
                        return false;
                }
                
-               if(!this['type'][tObj.type][tObj.subtype]){
-                       js_log('mvTransLib does not support subType: '+tObj.subtype);
+               if ( !this['type'][tObj.type][tObj.subtype] ) {
+                       js_log( 'mvTransLib does not support subType: ' + tObj.subtype );
                        return false;
-               }                               
+               }
                                
-               //setup overlay_selector_id                     
-               if(tObj.subtype=='crossfade'){
-                       if(tObj.transAttrType=='transIn')                               
+               // setup overlay_selector_id                    
+               if ( tObj.subtype == 'crossfade' ) {
+                       if ( tObj.transAttrType == 'transIn' )
                                var other_pClip = tObj.pClip.pp.getPrevClip();
-                       if(tObj.transAttrType=='transOut')
+                       if ( tObj.transAttrType == 'transOut' )
                                var other_pClip = tObj.pClip.pp.getNextClip();
                                
-                       if(typeof(other_pClip)=='undefined' || other_pClip === false || other_pClip.id == tObj.pClip.pp.cur_clip.id)
-                               js_log('Error: crossfade without target media asset');
-                       //if not sliding start playback: 
-                       if(!tObj.pClip.pp.userSlide){                   
+                       if ( typeof( other_pClip ) == 'undefined' || other_pClip === false || other_pClip.id == tObj.pClip.pp.cur_clip.id )
+                               js_log( 'Error: crossfade without target media asset' );
+                       // if not sliding start playback: 
+                       if ( !tObj.pClip.pp.userSlide ) {
                                other_pClip.embed.play();
-                               //manualy ad the extra layer to the activeClipList
+                               // manualy ad the extra layer to the activeClipList
                                tObj.pClip.pp.activeClipList.add( other_pClip );
-                       }                                               
-                       tObj.overlay_selector_id = 'clipDesc_'+other_pClip.id;                  
-               }else{
-                       tObj.overlay_selector_id =this.getOverlaySelector(tObj);                                                                                                                                
-               }                               
+                       }
+                       tObj.overlay_selector_id = 'clipDesc_' + other_pClip.id;
+               } else {
+                       tObj.overlay_selector_id = this.getOverlaySelector( tObj );
+               }
                                        
-               //all good call function with  tObj param
-               js_log('should call: '+tObj.type + ' ' + tObj.subtype );
-               this['type'][tObj.type][tObj.subtype].init(tObj);                                       
-       },
-       doCloseTransition:function(tObj){
-               if(tObj.subtype=='crossfade'){
-                       //close up crossfade
-                       js_log("close up crossfade");   
-               }else{
-                       $j('#'+tObj.overlay_selector_id).remove();
-               }
-               //null selector: 
-               tObj.overlay_selector_id=null;
-       },
-       getOverlaySelector:function(tObj){      
-               var overlay_selector_id= tObj.transAttrType + tObj.pClip.id;     
-               js_log('f:getOverlaySelector: '+overlay_selector_id + ' append to: ' +'#videoPlayer_'+tObj.pClip.embed.id );
-               //make sure overlay_selector_id not already here:       
-               if( $j('#'+overlay_selector_id).length == 0  ){                                                                                                                                                                                                          
-                       $j('#videoPlayer_'+tObj.pClip.embed.id).prepend(''+
-                               '<div id="'+overlay_selector_id+'" ' +
+               // all good call function with  tObj param
+               js_log( 'should call: ' + tObj.type + ' ' + tObj.subtype );
+               this['type'][tObj.type][tObj.subtype].init( tObj );
+       },
+       doCloseTransition:function( tObj ) {
+               if ( tObj.subtype == 'crossfade' ) {
+                       // close up crossfade
+                       js_log( "close up crossfade" );
+               } else {
+                       $j( '#' + tObj.overlay_selector_id ).remove();
+               }
+               // null selector: 
+               tObj.overlay_selector_id = null;
+       },
+       getOverlaySelector:function( tObj ) {
+               var overlay_selector_id = tObj.transAttrType + tObj.pClip.id;
+               js_log( 'f:getOverlaySelector: ' + overlay_selector_id + ' append to: ' + '#videoPlayer_' + tObj.pClip.embed.id );
+               // make sure overlay_selector_id not already here:      
+               if ( $j( '#' + overlay_selector_id ).length == 0  ) {
+                       $j( '#videoPlayer_' + tObj.pClip.embed.id ).prepend( '' +
+                               '<div id="' + overlay_selector_id + '" ' +
                                        'style="position:absolute;top:0px;left:0px;' +
-                                       'height:'+parseInt(tObj.pClip.pp.height)+'px;'+
-                                       'width:'+parseInt(tObj.pClip.pp.width)+'px;' +                                  
+                                       'height:' + parseInt( tObj.pClip.pp.height ) + 'px;' +
+                                       'width:' + parseInt( tObj.pClip.pp.width ) + 'px;' +
                                        'z-index:2">' +
-                               '</div>');
-               }                               
-               return overlay_selector_id;     
-       },
-       doUpdate:function(tObj, percent){
-               //init the transition if nessesary:
-               if(!tObj.overlay_selector_id)
-                       this.doInitTransition(tObj);
+                               '</div>' );
+               }
+               return overlay_selector_id;
+       },
+       doUpdate:function( tObj, percent ) {
+               // init the transition if nessesary:
+               if ( !tObj.overlay_selector_id )
+                       this.doInitTransition( tObj );
                
-               //@@todo we should ensure visability outside of doUpate loop                    
-               if(!$j('#'+tObj.overlay_selector_id).is(':visible'))
-                       $j('#'+tObj.overlay_selector_id).show();
+               // @@todo we should ensure visability outside of doUpate loop                   
+               if ( !$j( '#' + tObj.overlay_selector_id ).is( ':visible' ) )
+                       $j( '#' + tObj.overlay_selector_id ).show();
                        
-               //do update:
+               // do update:
                /*js_log('doing update for: '+ tObj.pClip.id + 
                        ' type:' + tObj.transAttrType +
                        ' t_type:'+ tObj.type +
                        ' subypte:'+ tObj.subtype  + 
-                       ' percent:' + percent);*/                                       
+                       ' percent:' + percent);*/
                        
-               this['type'][tObj.type][tObj.subtype].u(tObj,percent);
+               this['type'][tObj.type][tObj.subtype].u( tObj, percent );
        },
-       getTransitionIcon:function( type, subtype){
-               return mv_embed_path +'/skins/common/transition_images/'+ type+'_'+ subtype+ '.png';
+       getTransitionIcon:function( type, subtype ) {
+               return mv_embed_path + '/skins/common/transition_images/' + type + '_' + subtype + '.png';
        },
        /*
         * mvTransLib: functional library mapping:
-        */ 
-       type:{
-               //types:
-               fade:{
-                       fadeFromColor:
-                               'attr':['fadeColor'],                   
-                               'init':function(tObj){                                                                          
-                                       //js_log('f:fadeFromColor: '+tObj.overlay_selector_id +' to color: '+ tObj.fadeColor);
-                                       if(!tObj.fadeColor)
-                                               js_log('missing fadeColor');                                                    
-                                       if($j('#'+tObj.overlay_selector_id).length==0){
-                                               js_log("ERROR can't find: "+ tObj.overlay_selector_id);
-                                       }       
-                                       //set the initial state
-                                       $j('#'+tObj.overlay_selector_id).css({
+        */
+       type: {
+               // types:
+               fade: {
+                       fadeFromColor: {
+                               'attr':['fadeColor'],
+                               'init':function( tObj ) {
+                                       // js_log('f:fadeFromColor: '+tObj.overlay_selector_id +' to color: '+ tObj.fadeColor);
+                                       if ( !tObj.fadeColor )
+                                               js_log( 'missing fadeColor' );
+                                       if ( $j( '#' + tObj.overlay_selector_id ).length == 0 ) {
+                                               js_log( "ERROR can't find: " + tObj.overlay_selector_id );
+                                       }
+                                       // set the initial state
+                                       $j( '#' + tObj.overlay_selector_id ).css( {
                                                'background-color':tObj.fadeColor,
                                                'opacity':"1"
-                                       });
-                               },                      
-                               'u':function(tObj, percent){
-                                       //js_log(':fadeFromColor:update: '+ percent);
-                                       //fade from color (invert the percent)
-                                       var percent = 1- percent;
-                                       $j('#'+tObj.overlay_selector_id).css({
+                                       } );
+                               },
+                               'u':function( tObj, percent ) {
+                                       // js_log(':fadeFromColor:update: '+ percent);
+                                       // fade from color (invert the percent)
+                                       var percent = 1 - percent;
+                                       $j( '#' + tObj.overlay_selector_id ).css( {
                                                "opacity" : percent
-                                       });
+                                       } );
                                }
                        },
-                       //corssFade
-                       crossfade:{
+                       // corssFade
+                       crossfade: {
                                "attr":[],
-                               "init":function(tObj){
-                                       js_log('f:crossfade: '+tObj.overlay_selector_id);
-                                       if($j('#'+tObj.overlay_selector_id).length==0)
-                                               js_log("ERROR overlay selector not found: "+tObj.overlay_selector_id);
+                               "init":function( tObj ) {
+                                       js_log( 'f:crossfade: ' + tObj.overlay_selector_id );
+                                       if ( $j( '#' + tObj.overlay_selector_id ).length == 0 )
+                                               js_log( "ERROR overlay selector not found: " + tObj.overlay_selector_id );
                                        
-                                       //set the initial state show the zero opacity animation 
-                                       $j('#'+tObj.overlay_selector_id).css({'opacity':0}).show();                                                                     
+                                       // set the initial state show the zero opacity animation 
+                                       $j( '#' + tObj.overlay_selector_id ).css( { 'opacity':0 } ).show();
                                },
-                               'u':function(tObj, percent){
-                                       $j('#'+tObj.overlay_selector_id).css({
+                               'u':function( tObj, percent ) {
+                                       $j( '#' + tObj.overlay_selector_id ).css( {
                                                "opacity" : percent
-                                       });
+                                       } );
                                }
-                       }                       
-               }                                                       
+                       }
+               }
        }
 }
 
 /* object to manage embedding html with smil timings 
  *  grabs settings from parent clip 
  */
-var transitionObj = function(element) {                
-       this.init(element);
+var transitionObj = function( element ) {
+       this.init( element );
 };
-transitionObj.prototype = {    
+transitionObj.prototype = {
        supported_attributes : new Array(
                'id',
                'type',
@@ -1760,226 +1760,226 @@ transitionObj.prototype = {
                'fadeColor',
                'dur'
        ),
-       transAttrType:null, //transIn or transOut
+       transAttrType:null, // transIn or transOut
        overlay_selector_id:null,
        pClip:null,
        timerId:null,
-       animation_state:0, //can be 0=unset, 1=running, 2=done 
-       interValCount:0, //inter-intervalCount for animating between time updates
-       dur:2, //default duration of 2  
-       init:function(element){
-               //load supported attributes:     
+       animation_state:0, // can be 0=unset, 1=running, 2=done 
+       interValCount:0, // inter-intervalCount for animating between time updates
+       dur:2, // default duration of 2 
+       init:function( element ) {
+               // load supported attributes:    
                var _this = this;
-               $j.each(this.supported_attributes, function(i, attr){
-                       if(element.getAttribute(attr))
-                               _this[attr]= element.getAttribute(attr);
-               });                             
-               //@@todo process duration (for now just strip s) per: 
-               //http://www.w3.org/TR/SMIL3/smil-timing.html#Timing-ClockValueSyntax
-               if(_this.dur)
-                       _this.dur = smilParseTime(_this.dur);
+               $j.each( this.supported_attributes, function( i, attr ) {
+                       if ( element.getAttribute( attr ) )
+                               _this[attr] = element.getAttribute( attr );
+               } );
+               // @@todo process duration (for now just strip s) per: 
+               // http://www.w3.org/TR/SMIL3/smil-timing.html#Timing-ClockValueSyntax
+               if ( _this.dur )
+                       _this.dur = smilParseTime( _this.dur );
        },
        /* 
         * returns a visual representation of the transition
         */
-       getIconSrc:function(opt){
-               //@@todo support some arguments 
-               return mvTransLib.getTransitionIcon(this.type, this.subtype);                                                                           
+       getIconSrc:function( opt ) {
+               // @@todo support some arguments 
+               return mvTransLib.getTransitionIcon( this.type, this.subtype );
        },
-       getDuration:function(){
+       getDuration:function() {
                return this.dur;
        },
-       //returns the values of supported_attributes: 
-       getAttributeObj:function(){
-               var elmObj = {};
-               for(var i in this.supported_attributes){
+       // returns the values of supported_attributes: 
+       getAttributeObj:function() {
+               var elmObj = { };
+               for ( var i in this.supported_attributes ) {
                        var attr = this.supported_attributes[i];
-                       if(this[attr])
-                               elmObj[ attr ] = this[attr]; 
-               }               
+                       if ( this[attr] )
+                               elmObj[ attr ] = this[attr];
+               }
                return elmObj;
        },
        /*
         * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~
         */
-       run_transition:function(){
-               //js_log('f:run_transition:' + this.interValCount);
-                                                
-               //update the time from the video if native:   
-               if(typeof this.pClip.embed.vid !='undefined'){
-                       this.interValCount=0;
+       run_transition:function() {
+               // js_log('f:run_transition:' + this.interValCount);
+
+               // update the time from the video if native:   
+               if ( typeof this.pClip.embed.vid != 'undefined' ) {
+                       this.interValCount = 0;
                        this.pClip.embed.currentTime = this.pClip.embed.vid.currentTime;
                }
                
-               //}else{
-                       //relay on currentTime update grabs (every 250ms or so) (ie for images)
+               // }else{
+                       // relay on currentTime update grabs (every 250ms or so) (ie for images)
                //      if(this.prev_curtime!=this.pClip.embed.currentTime){    
                //              this.prev_curtime =     this.pClip.embed.currentTime;
                //              this.interValCount=0;
                //      }
-               //            
-               //start_time =asigned by doSmilActions
-               //base_cur_time = pClip.embed.currentTime;
-               //dur = asigned by attribute            
-               if(this.animation_state==0){
-                       mvTransLib.doInitTransition(this);
-                       this.animation_state=1;
-               }
-               //set percentage include difrence of currentTime to prev_curTime 
+               // }            
+               // start_time =asigned by doSmilActions
+               // base_cur_time = pClip.embed.currentTime;
+               // dur = asigned by attribute           
+               if ( this.animation_state == 0 ) {
+                       mvTransLib.doInitTransition( this );
+                       this.animation_state = 1;
+               }
+               // set percentage include difrence of currentTime to prev_curTime 
                // ie updated in-between currentTime updates) 
-               
-               if(this.transAttrType=='transIn')
-                       var percentage = ( this.pClip.embed.currentTime + 
-                                                                       ( (this.interValCount*MV_ANIMATION_CB_RATE)/1000 )
+
+               if ( this.transAttrType == 'transIn' )
+                       var percentage = ( this.pClip.embed.currentTime +
+                                                                       ( ( this.interValCount * MV_ANIMATION_CB_RATE ) / 1000 )
                                                        ) / this.dur ;
                                
-               if(this.transAttrType=='transOut')
-                       var percentage = (this.pClip.embed.currentTime  + 
-                                                                       ( (this.interValCount*MV_ANIMATION_CB_RATE)/1000 )
-                                                                       - (this.pClip.dur - this.dur)
-                                                       ) /this.dur ;                   
+               if ( this.transAttrType == 'transOut' )
+                       var percentage = ( this.pClip.embed.currentTime  +
+                                                                       ( ( this.interValCount * MV_ANIMATION_CB_RATE ) / 1000 )
+                                                                       - ( this.pClip.dur - this.dur )
+                                                       ) / this.dur ;
                
                /*js_log('percentage = ct:'+this.pClip.embed.currentTime + ' + ic:'+this.interValCount +' * cb:'+MV_ANIMATION_CB_RATE +
                          ' / ' + this.dur + ' = ' + percentage );
                */
                
-               //js_log('cur percentage of transition: '+percentage);
-               //update state based on current time + cur_time_offset (for now just use pClip.embed.currentTime)
-               mvTransLib.doUpdate(this, percentage);
+               // js_log('cur percentage of transition: '+percentage);
+               // update state based on current time + cur_time_offset (for now just use pClip.embed.currentTime)
+               mvTransLib.doUpdate( this, percentage );
                
-               if( percentage >= 1 ){
-                       js_log("transition done update with percentage "+percentage);
-                       this.animation_state=2;                                 
-                       clearInterval(this.timerId);    
-                       mvTransLib.doCloseTransition(this)
+               if ( percentage >= 1 ) {
+                       js_log( "transition done update with percentage " + percentage );
+                       this.animation_state = 2;
+                       clearInterval( this.timerId );
+                       mvTransLib.doCloseTransition( this )
                        return true;
                }
                                                
                this.interValCount++;
-               //setInterval in we are still in running state and user is not using the playhead 
-               if( this.animation_state==1 ){
-                       if(!this.timerId){
-                               this.timerId = setInterval('document.getElementById(\'' + this.pClip.pp.id + '\').'+ 
-                                                       'run_transition(\'' + this.pClip.pp.cur_clip.order + '\','+
-                                                               '\''+ this.transAttrType + '\')',
-                                                MV_ANIMATION_CB_RATE);
+               // setInterval in we are still in running state and user is not using the playhead 
+               if ( this.animation_state == 1 ) {
+                       if ( !this.timerId ) {
+                               this.timerId = setInterval( 'document.getElementById(\'' + this.pClip.pp.id + '\').' +
+                                                       'run_transition(\'' + this.pClip.pp.cur_clip.order + '\',' +
+                                                               '\'' + this.transAttrType + '\')',
+                                                MV_ANIMATION_CB_RATE );
                        }
-               }else{
-                       clearInterval(this.timerId);
+               } else {
+                       clearInterval( this.timerId );
                }
                return true;
        },
-       clone:function(){
+       clone :function() {
                var cObj = new this.constructor();
-               for(var i in this)
-                       cObj[i]=this[i];                                
+               for ( var i in this )
+                       cObj[i] = this[i];
                return cObj;
-       }               
+       }
 }
 
-//very limited smile feature set more details soon:  
-//region="video_region" transIn="fromGreen" begin="2s"
-//http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#edef-ref
-var smilPlaylist ={
-       transitions:{},
-       doParse:function(){
+// very limited smile feature set more details soon:  
+// region="video_region" transIn="fromGreen" begin="2s"
+// http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#edef-ref
+var smilPlaylist = {
+       transitions: { },
+       doParse:function() {
                var _this = this;
-               js_log('f:doParse smilPlaylist');
-               //@@todo get/parse meta that we are intersted in: 
-               var meta_tags = this.data.getElementsByTagName('meta');
+               js_log( 'f:doParse smilPlaylist' );
+               // @@todo get/parse meta that we are intersted in: 
+               var meta_tags = this.data.getElementsByTagName( 'meta' );
                var metaNames = {
                        'title':'',
-                       'interface_url':"", 
+                       'interface_url':"",
                        'linkback':"",
-                       'mTitle':"", 
-                       'mTalk':"", 
+                       'mTitle':"",
+                       'mTalk':"",
                        'mTouchedTime':""
-               }; 
-               $j.each(meta_tags, function(i,meta_elm){
-                       //js_log( "on META tag: "+ $j(meta_elm).attr('name') );
-                       if( $j(meta_elm).attr('name') in metaNames){
-                               _this[ $j(meta_elm).attr('name') ] = $j(meta_elm).attr('content');
-                       }                       
-                       //special check for wikiDesc
-                       if(  $j(meta_elm).attr('name') == 'wikiDesc'){
-                               if(meta_elm.firstChild)
+               };
+               $j.each( meta_tags, function( i, meta_elm ) {
+                       // js_log( "on META tag: "+ $j(meta_elm).attr('name') );
+                       if ( $j( meta_elm ).attr( 'name' ) in metaNames ) {
+                               _this[ $j( meta_elm ).attr( 'name' ) ] = $j( meta_elm ).attr( 'content' );
+                       }
+                       // special check for wikiDesc
+                       if (  $j( meta_elm ).attr( 'name' ) == 'wikiDesc' ) {
+                               if ( meta_elm.firstChild )
                                        _this.wikiDesc  = meta_elm.firstChild.nodeValue;
-                       }                       
-               });     
-               //add transition objects: 
-               var transition_tags = this.data.getElementsByTagName('transition');     
-               $j.each(transition_tags, function( i, trans_elm ){              
-                       if( $j(trans_elm).attr("id") ){
-                               _this.transitions[ $j(trans_elm).attr("id")]= new transitionObj( trans_elm );
-                       }else{
-                               js_log('skipping transition: (missing id) ' + trans_elm );
                        }
-               });
-               js_log('loaded transitions:' + _this.transitions.length);                       
-               //add seq (latter we will have support more than one seq tag) / more than one "track" 
-               var seq_tags = this.data.getElementsByTagName('seq');
-               $j.each(seq_tags, function(i,seq_elm){
+               } );
+               // add transition objects: 
+               var transition_tags = this.data.getElementsByTagName( 'transition' );
+               $j.each( transition_tags, function( i, trans_elm ) {
+                       if ( $j( trans_elm ).attr( "id" ) ) {
+                               _this.transitions[ $j( trans_elm ).attr( "id" )] = new transitionObj( trans_elm );
+                       } else {
+                               js_log( 'skipping transition: (missing id) ' + trans_elm );
+                       }
+               } );
+               js_log( 'loaded transitions:' + _this.transitions.length );
+               // add seq (latter we will have support more than one seq tag) / more than one "track" 
+               var seq_tags = this.data.getElementsByTagName( 'seq' );
+               $j.each( seq_tags, function( i, seq_elm ) {
                        var inx = 0;
-                       //get all the clips for the given seq:
-                       $j.each(seq_elm.childNodes, function(i, mediaElement){ 
-                               //~complex~ @@todo to handlde a lot like "switch" "region" etc
-                               //js_log('process: ' + mediaElemnt.tagName); 
-                               if(typeof mediaElement.tagName!='undefined'){
-                                       if( _this.tryAddMedia( mediaElement, inx ) ){
+                       // get all the clips for the given seq:
+                       $j.each( seq_elm.childNodes, function( i, mediaElement ) {
+                               // ~complex~ @@todo to handlde a lot like "switch" "region" etc
+                               // js_log('process: ' + mediaElemnt.tagName); 
+                               if ( typeof mediaElement.tagName != 'undefined' ) {
+                                       if ( _this.tryAddMedia( mediaElement, inx ) ) {
                                                inx++;
                                        }
                                }
-                       });
-               });     
-               js_log("done proc seq tags");           
+                       } );
+               } );
+               js_log( "done proc seq tags" );
                return true;
        },
-       tryAddMediaObj:function(mConfig, order, track_id){              
-               js_log('tryAddMediaObj::');             
-               var mediaElement = document.createElement('div');       
-               for(var i =0; i < mv_smil_ref_supported_attributes.length;i++){         
+       tryAddMediaObj:function( mConfig, order, track_id ) {
+               js_log( 'tryAddMediaObj::' );
+               var mediaElement = document.createElement( 'div' );
+               for ( var i = 0; i < mv_smil_ref_supported_attributes.length; i++ ) {
                        var attr =      mv_smil_ref_supported_attributes[i];
-                       if(mConfig[attr])
-                               $j(mediaElement).attr( attr, mConfig[attr] );
-               }               
-               this.tryAddMedia(mediaElement, order, track_id);
-       },
-       tryAddMedia:function(mediaElement, order, track_id){    
-               js_log('SMIL:tryAddMedia:' + mediaElement);
-               var _this = this;               
-               //set up basic mvSMILClip send it the mediaElemnt & mvClip init: 
-               var clipObj = {};
+                       if ( mConfig[attr] )
+                               $j( mediaElement ).attr( attr, mConfig[attr] );
+               }
+               this.tryAddMedia( mediaElement, order, track_id );
+       },
+       tryAddMedia:function( mediaElement, order, track_id ) {
+               js_log( 'SMIL:tryAddMedia:' + mediaElement );
+               var _this = this;
+               // set up basic mvSMILClip send it the mediaElemnt & mvClip init: 
+               var clipObj = { };
                var cConfig = {
                                                "id":'p_' + _this.id + '_c_' + order,
-                                               "pp":this, //set the parent playlist object pointer
-                                               "order": order                                                                  
-                                       };                              
-               var clipObj = new mvSMILClip(mediaElement, cConfig );
+                                               "pp":this, // set the parent playlist object pointer
+                                               "order": order
+                                       };
+               var clipObj = new mvSMILClip( mediaElement, cConfig );
                        
-               //set optional params track                                                                              
-               if( typeof track_id != 'undefined')
+               // set optional params track                                                                             
+               if ( typeof track_id != 'undefined' )
                        clipObj["track_id"]     = track_id;
                         
                
-               if ( clipObj ){
-                       //set up embed:                                         
-                       clipObj.setUpEmbedObj();        
-                       //inhreit embedObject (only called on "new media" 
-                       clipObj.embed.init_with_sources_loaded();                                       
-                       //add clip to track: 
-                       this.addCliptoTrack( clipObj , order);          
+               if ( clipObj ) {
+                       // set up embed:                                                
+                       clipObj.setUpEmbedObj();
+                       // inhreit embedObject (only called on "new media" 
+                       clipObj.embed.init_with_sources_loaded();
+                       // add clip to track: 
+                       this.addCliptoTrack( clipObj , order );
                        
                        return true;
-               }                       
-               //@@todo we could throw error details here once we integrate try catches everywhere :P
+               }
+               // @@todo we could throw error details here once we integrate try catches everywhere :P
                return false;
-       } 
+       }
 }
-//http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia
-//and added resource description elements
-//@@ supporting the "ID" attribute turns out to be kind of tricky since we use it internally 
+// http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia
+// and added resource description elements
+// @@ supporting the "ID" attribute turns out to be kind of tricky since we use it internally 
 // (for now don't include) 
-var mv_smil_ref_supported_attributes = new Array(              
+var mv_smil_ref_supported_attributes = new Array(
                'src',
                'type',
                'region',
@@ -1988,123 +1988,123 @@ var mv_smil_ref_supported_attributes = new Array(
                'fill',
                'dur',
                'title',
-               //some custom attributes:
-               'uri',                  
+               // some custom attributes:
+               'uri',
                'durationHint',
                'poster'
 );
 /* extension to mvClip to support smil properties */
-var mvSMILClip=function(sClipElm, mvClipInit){
-       return this.init(sClipElm, mvClipInit);
+var mvSMILClip = function( sClipElm, mvClipInit ) {
+       return this.init( sClipElm, mvClipInit );
 }
-//all the overwritten and new methods for SMIL extension of mv_embed
-mvSMILClip.prototype = {       
-       instanceOf:'mvSMILClip',        
-       params : {}, //support param as child of ref clips per SMIL spec  
-       init:function(sClipElm, mvClipInit){    
-               _this = this;                   
-               this.params     = {};           
-               //make new mvCLip with ClipInit vals  
-               var myMvClip = new mvClip( mvClipInit );                
-               //inherit mvClip                
-               for(var method in myMvClip){                    
-                       if(typeof this[method] != 'undefined' ){                                
-                               this['parent_'+method]=myMvClip[method];                                
-                       }else{          
+// all the overwritten and new methods for SMIL extension of mv_embed
+mvSMILClip.prototype = {
+       instanceOf:'mvSMILClip',
+       params : { }, // support param as child of ref clips per SMIL spec  
+       init:function( sClipElm, mvClipInit ) {
+               _this = this;
+               this.params     = { };
+               // make new mvCLip with ClipInit vals  
+               var myMvClip = new mvClip( mvClipInit );
+               // inherit mvClip               
+               for ( var method in myMvClip ) {
+                       if ( typeof this[method] != 'undefined' ) {
+                               this['parent_' + method] = myMvClip[method];
+                       } else {
                                this[method] = myMvClip[method];
-                       }               
-               }               
+                       }
+               }
                
-               //get supported media attr init non-set         
-               for(var i =0; i < mv_smil_ref_supported_attributes.length;i++){         
+               // get supported media attr init non-set                
+               for ( var i = 0; i < mv_smil_ref_supported_attributes.length; i++ ) {
                        var attr =      mv_smil_ref_supported_attributes[i];
-                       if( $j(sClipElm).attr(attr)){
-                               _this[attr] = $j(sClipElm).attr(attr);
+                       if ( $j( sClipElm ).attr( attr ) ) {
+                               _this[attr] = $j( sClipElm ).attr( attr );
                        }
-               }                               
-               this['tagName'] = sClipElm.tagName;     
+               }
+               this['tagName'] = sClipElm.tagName;
                
-               if( sClipElm.firstChild ){
+               if ( sClipElm.firstChild ) {
                        this['wholeText'] = sClipElm.firstChild.nodeValue;
-                       js_log("SET wholeText for: " + this['tagName'] + ' '+ this['wholeText']);
+                       js_log( "SET wholeText for: " + this['tagName'] + ' ' + this['wholeText'] );
                }
-               //debugger;
-               //mv_embed specific property: 
-               if( $j(sClipElm).attr('poster') )
-                       this['img'] = $j(sClipElm).attr('poster');
+               // debugger;
+               // mv_embed specific property: 
+               if ( $j( sClipElm ).attr( 'poster' ) )
+                       this['img'] = $j( sClipElm ).attr( 'poster' );
                
-               //lookup and assign copies of transitions 
+               // lookup and assign copies of transitions 
                // (since transition needs to hold some per-instance state info)                
-               if(this.transIn && this.pp.transitions[ this.transIn ]){                        
-                       this.transIn = this.pp.transitions[ this.transIn ].clone();
+               if ( this.transIn && this.pp.transitions[ this.transIn ] ) {
+                       this.transIn = this.pp.transitions[ this.transIn ]. clone ();
                        this.transIn.pClip = _this;
-                       this.transIn.transAttrType='transIn';            
-               }               
+                       this.transIn.transAttrType = 'transIn';
+               }
                
-               if(this.transOut && this.pp.transitions[ this.transOut ]){              
-                       this.transOut = this.pp.transitions[ this.transOut ].clone();
+               if ( this.transOut && this.pp.transitions[ this.transOut ] ) {
+                       this.transOut = this.pp.transitions[ this.transOut ]. clone ();
                        this.transOut.pClip = _this;
-                       this.transOut.transAttrType = 'transOut';               
-               }               
-               //parse duration / begin times: 
-               if( this.dur )
-                       this.dur = smilParseTime( this.dur );           
-               //parse the media duration hint ( the source media length) 
-               if( this.durationHint )
-                       this.durationHint = smilParseTime( this.durationHint );                                                         
+                       this.transOut.transAttrType = 'transOut';
+               }
+               // parse duration / begin times: 
+               if ( this.dur )
+                       this.dur = smilParseTime( this.dur );
+               // parse the media duration hint ( the source media length) 
+               if ( this.durationHint )
+                       this.durationHint = smilParseTime( this.durationHint );
                
-               //conform type to vido/ogg:
-               if( this.type == 'application/ogg' )
-                       this.type = 'video/ogg'; //conform to 'video/ogg' type
-                               
-               //if unset type and we have innerHTML assume text/html type             
-               if( !this.type  && this.wholeText ){                    
+               // conform type to vido/ogg:
+               if ( this.type == 'application/ogg' )
+                       this.type = 'video/ogg'; // conform to 'video/ogg' type
+
+               // if unset type and we have innerHTML assume text/html type            
+               if ( !this.type  && this.wholeText ) {
                        this.type = 'text/html';
-               }                               
-               //also grab andy child param elements if present: 
-               if( sClipElm.getElementsByTagName('param')[0] ){                                        
-                       for(var i=0; i< sClipElm.getElementsByTagName('param').length; i++){
-                               this.params[ sClipElm.getElementsByTagName('param')[i].getAttribute("name") ] = 
-                                                sClipElm.getElementsByTagName('param')[i].firstChild.nodeValue;
-                       }                       
-               }                                       
-               return this;            
-       },      
-       //returns the values of supported_attributes: 
-       getAttributeObj:function(){
-               var elmObj = {};
-               for(var i=0; i < mv_smil_ref_supported_attributes.length; i++){
+               }
+               // also grab andy child param elements if present: 
+               if ( sClipElm.getElementsByTagName( 'param' )[0] ) {
+                       for ( var i = 0; i < sClipElm.getElementsByTagName( 'param' ).length; i++ ) {
+                               this.params[ sClipElm.getElementsByTagName( 'param' )[i].getAttribute( "name" ) ] =
+                                                sClipElm.getElementsByTagName( 'param' )[i].firstChild.nodeValue;
+                       }
+               }
+               return this;
+       },
+       // returns the values of supported_attributes: 
+       getAttributeObj:function() {
+               var elmObj = { };
+               for ( var i = 0; i < mv_smil_ref_supported_attributes.length; i++ ) {
                        var attr = mv_smil_ref_supported_attributes[i];
-                       if(this[attr])
-                               elmObj[ attr ] = this[attr]; 
-               }               
+                       if ( this[attr] )
+                               elmObj[ attr ] = this[attr];
+               }
                return elmObj;
        },
        /*
         * getDuration
         * @returns duration in int
         */
-       getDuration:function(){                                 
-               //check for smil dur: 
-               if( this.dur )
-                       return this.dur;                        
-               return this.embed.getDuration();                                        
-       },      
-       //gets the duration of the clip subracting transitions
-       getSoloDuration:function(){
+       getDuration:function() {
+               // check for smil dur: 
+               if ( this.dur )
+                       return this.dur;
+               return this.embed.getDuration();
+       },
+       // gets the duration of the clip subracting transitions
+       getSoloDuration:function() {
                var fulldur = this.getDuration();
-               //see if we need to subtract from time eating transitions (transOut)
-               if(this.transOut)
+               // see if we need to subtract from time eating transitions (transOut)
+               if ( this.transOut )
                        fulldur -= this.transOut.getDuration();
 
-               //js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur);
+               // js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur);
                return fulldur;
        },
-       //gets the duration of the original media asset (usefull for bounding setting of in-out-points)
-       getSourceDuration:function(){
-               if( this.durationHint )
+       // gets the duration of the original media asset (usefull for bounding setting of in-out-points)
+       getSourceDuration:function() {
+               if ( this.durationHint )
                        return this.durationHint;
-               //if we have no source duration just return the media dur: 
+               // if we have no source duration just return the media dur: 
                return this.getDuration();
        }
 }
@@ -2117,166 +2117,166 @@ mvSMILClip.prototype = {
  * http://www.w3.org/TR/SMIL3/smil-timing.html#Timing-ClockValueSyntax
  * (probably have to use a Time object to fully support the smil spec
  */
-function smilParseTime( time_str ){
+function smilParseTime( time_str ) {
        time_str = time_str + '';
-       //first check for hh:mm:ss time: 
-       if(time_str.split(':').length == 3){
-               return npt2seconds(time_str);
-       }else{
-               //assume 34s secconds representation 
-               return parseInt(time_str.replace('s', ''));
+       // first check for hh:mm:ss time: 
+       if ( time_str.split( ':' ).length == 3 ) {
+               return npt2seconds( time_str );
+       } else {
+               // assume 34s secconds representation 
+               return parseInt( time_str.replace( 's', '' ) );
        }
 }
-//stores a list pointers to active clips (maybe this should just be a property of clips (but results in lots of seeks) 
-var activeClipList = function(){
+// stores a list pointers to active clips (maybe this should just be a property of clips (but results in lots of seeks) 
+var activeClipList = function() {
        return this.init();
 }
 activeClipList.prototype = {
-       init:function(){
+       init:function() {
                this.clipList = new Array();
        },
-       add:function( clip ){
-               //make sure the clip is not already active: 
-               for(var i =0;i < this.clipList.lenght; i++){
+       add:function( clip ) {
+               // make sure the clip is not already active: 
+               for ( var i = 0; i < this.clipList.lenght; i++ ) {
                        var active_clip = this.clipList[i];
-                       if(clip.id == active_clip.id) //clip already active: 
+                       if ( clip.id == active_clip.id ) // clip already active: 
                                return false;
                }
                this.clipList.push( clip );
                return true;
        },
-       remove:function( clip ){
-               for(var i = 0; i < this.clipList.length; i++){
+       remove:function( clip ) {
+               for ( var i = 0; i < this.clipList.length; i++ ) {
                        var active_clip = this.clipList[i];
-                       if(clip.id == active_clip.id){
-                               this.clipList.splice(i, 1);
+                       if ( clip.id == active_clip.id ) {
+                               this.clipList.splice( i, 1 );
                                return true;
                        }
                }
                return false;
        },
-       getClipList:function(){
+       getClipList:function() {
                return this.clipList;
-       }       
+       }
 }
- var trackObj = function( iObj ){
+ var trackObj = function( iObj ) {
         return this.init( iObj );
  }
  var supported_track_attr =
 trackObj.prototype = {
-       //should be something like "seq" per SMIL spec
-       //http://www.w3.org/TR/SMIL3/smil-timing.html#edef-seq
+       // should be something like "seq" per SMIL spec
+       // http://www.w3.org/TR/SMIL3/smil-timing.html#edef-seq
        // but we don't really support anywhere near the full concept of seq containers yet either
        supported_attributes: new Array(
                'title',
                'desc',
-               'inx'           
-        ),                                     
+               'inx'
+        ),
        disp_mode:'timeline_thumb',
-       init : function(iObj){
-               if(!iObj)
-                       iObj={};
-               //make sure clips is new: 
+       init : function( iObj ) {
+               if ( !iObj )
+                       iObj = { };
+               // make sure clips is new: 
                this.clips = new Array();
                                
                var _this = this;
-               $j.each(this.supported_attributes, function(i, attr){
-                       if(iObj[attr])
+               $j.each( this.supported_attributes, function( i, attr ) {
+                       if ( iObj[attr] )
                                _this[attr] = iObj[attr];
-               });                     
+               } );
        },
-       //returns the values of supported_attributes: 
-       getAttributeObj:function(){
-               var elmObj = {};
-               for(var i in this.supported_attributes){
+       // returns the values of supported_attributes: 
+       getAttributeObj:function() {
+               var elmObj = { };
+               for ( var i in this.supported_attributes ) {
                        var attr = this.supported_attributes[i];
-                       if(this[attr])
-                               elmObj[ attr ] = this[attr]; 
-               }               
+                       if ( this[attr] )
+                               elmObj[ attr ] = this[attr];
+               }
                return elmObj;
        },
-       addClip:function(clipObj, pos){
-               js_log('pl_Track: AddClip at:' + pos + ' clen: ' + this.clips.length);  
-               if( typeof pos == 'undefined' )
-                       pos = this.clips.length;                                
-               //get everything after pos      
-               this.clips.splice(pos, 0, clipObj);                     
-               //keep the clip order values accurate:
-               this.reOrderClips();                            
-               js_log("did add now cLen: " + this.clips.length);
-       },
-       getClip:function( inx ){
-               if( !this.clips[inx] )
+       addClip:function( clipObj, pos ) {
+               js_log( 'pl_Track: AddClip at:' + pos + ' clen: ' + this.clips.length );
+               if ( typeof pos == 'undefined' )
+                       pos = this.clips.length;
+               // get everything after pos     
+               this.clips.splice( pos, 0, clipObj );
+               // keep the clip order values accurate:
+               this.reOrderClips();
+               js_log( "did add now cLen: " + this.clips.length );
+       },
+       getClip:function( inx ) {
+               if ( !this.clips[inx] )
                        return false;
                return this.clips[inx];
        },
-       reOrderClips:function(){
-               for(var k in this.clips){
-                       this.clips[k].order=k;
+       reOrderClips:function() {
+               for ( var k in this.clips ) {
+                       this.clips[k].order = k;
                }
        },
-       getClipCount:function(){                
+       getClipCount:function() {
                return this.clips.length;
        },
-       inheritEmbedObj: function(){
-               $j.each(this.clips, function(i, clip){
+       inheritEmbedObj: function() {
+               $j.each( this.clips, function( i, clip ) {
                        clip.embed.inheritEmbedObj();
-               });
+               } );
        }
-};                     
+};
        
 /* utility functions 
  * (could be combined with other stuff) 
 */
-function getAbsolutePos(objectId) {
+function getAbsolutePos( objectId ) {
        // Get an object left position from the upper left viewport corner
-       o = document.getElementById(objectId);
+       o = document.getElementById( objectId );
        oLeft = o.offsetLeft;                   // Get left position from the parent object     
-       while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
+       while ( o.offsetParent != null ) {   // Parse the parent hierarchy up to the document element
                oParent = o.offsetParent        // Get parent object reference
                oLeft += oParent.offsetLeft // Add parent left position
                o = oParent
-       }       
-       o = document.getElementById(objectId);
+       }
+       o = document.getElementById( objectId );
        oTop = o.offsetTop;
-       while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
+       while ( o.offsetParent != null ) { // Parse the parent hierarchy up to the document element
                oParent = o.offsetParent  // Get parent object reference
                oTop += oParent.offsetTop // Add parent top position
                o = oParent
        }
-       return {x:oLeft,y:oTop};
+       return { x:oLeft, y:oTop };
 }
-String.prototype.htmlEntities = function(){
-  var chars = new Array ('&','à','á','â','ã','ä','å','æ','ç','è','é',
-                                                'ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô',
-                                                'õ','ö','ø','ù','ú','û','ü','ý','þ','ÿ','À',
-                                                'Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë',
-                                                'Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö',
-                                                'Ø','Ù','Ú','Û','Ü','Ý','Þ','€','\"','ß','<',
-                                                '>','¢','£','¤','¥','¦','§','¨','©','ª','«',
-                                                '¬','­','®','¯','°','±','²','³','´','µ','¶',
-                                                '·','¸','¹','º','»','¼','½','¾');
+String.prototype.htmlEntities = function() {
+  var chars = new Array ( '&', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é',
+                                                'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô',
+                                                'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'À',
+                                                'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë',
+                                                'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö',
+                                                'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'Þ', '€', '\"', 'ß', '<',
+                                                '>', '¢', '£', '¤', '¥', '¦', '§', '¨', '©', 'ª', '«',
+                                                '¬', '­', '®', '¯', '°', '±', '²', '³', '´', 'µ', '¶',
+                                                '·', '¸', '¹', 'º', '»', '¼', '½', '¾' );
 
-  var entities = new Array ('amp','agrave','aacute','acirc','atilde','auml','aring',
-                                                       'aelig','ccedil','egrave','eacute','ecirc','euml','igrave',
-                                                       'iacute','icirc','iuml','eth','ntilde','ograve','oacute',
-                                                       'ocirc','otilde','ouml','oslash','ugrave','uacute','ucirc',
-                                                       'uuml','yacute','thorn','yuml','Agrave','Aacute','Acirc',
-                                                       'Atilde','Auml','Aring','AElig','Ccedil','Egrave','Eacute',
-                                                       'Ecirc','Euml','Igrave','Iacute','Icirc','Iuml','ETH','Ntilde',
-                                                       'Ograve','Oacute','Ocirc','Otilde','Ouml','Oslash','Ugrave',
-                                                       'Uacute','Ucirc','Uuml','Yacute','THORN','euro','quot','szlig',
-                                                       'lt','gt','cent','pound','curren','yen','brvbar','sect','uml',
-                                                       'copy','ordf','laquo','not','shy','reg','macr','deg','plusmn',
-                                                       'sup2','sup3','acute','micro','para','middot','cedil','sup1',
-                                                       'ordm','raquo','frac14','frac12','frac34');
+  var entities = new Array ( 'amp', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring',
+                                                       'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave',
+                                                       'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute',
+                                                       'ocirc', 'otilde', 'ouml', 'oslash', 'ugrave', 'uacute', 'ucirc',
+                                                       'uuml', 'yacute', 'thorn', 'yuml', 'Agrave', 'Aacute', 'Acirc',
+                                                       'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute',
+                                                       'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde',
+                                                       'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'Oslash', 'Ugrave',
+                                                       'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'euro', 'quot', 'szlig',
+                                                       'lt', 'gt', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml',
+                                                       'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn',
+                                                       'sup2', 'sup3', 'acute', 'micro', 'para', 'middot', 'cedil', 'sup1',
+                                                       'ordm', 'raquo', 'frac14', 'frac12', 'frac34' );
 
   newString = this;
-  for (var i = 0; i < chars.length; i++)
+  for ( var i = 0; i < chars.length; i++ )
   {
        myRegExp = new RegExp();
-       myRegExp.compile(chars[i],'g')
-       newString = newString.replace (myRegExp, '&' + entities[i] + ';');
+       myRegExp.compile( chars[i], 'g' )
+       newString = newString.replace ( myRegExp, '&' + entities[i] + ';' );
   }
   return newString;
 };
index d75af2e..1e5aeff 100644 (file)
@@ -18,7 +18,7 @@
  *  exports back out to json or inline format
  */
 
-loadGM({
+loadGM( {
        "mwe-menu_clipedit" : "Edit media",
        "mwe-menu_transition" : "Transitions and effects",
        "mwe-menu_cliplib" : "Add media",
@@ -53,16 +53,16 @@ loadGM({
        "mwe-other_options" : "Other options",
        "mwe-contextmenu_opt" : "Enable context menus",
        "mwe-sequencer_credit_line" : "Developed by <a href=\"http:\/\/kaltura.com\">Kaltura, Inc.<\/a> in partnership with the <a href=\"http:\/\/wikimediafoundation.org\/wiki\/Home\">Wikimedia Foundation<\/a> (<a href=\"#\">more information<\/a>)."
-});
- //used to set default values and validate the passed init object
+} );
+ // used to set default values and validate the passed init object
 var sequencerDefaultValues = {
 
-       instance_name:'mvSeq', //for now only one instance by name mvSeq is allowed
+       instance_name:'mvSeq', // for now only one instance by name mvSeq is allowed
 
-       target_sequence_container:null,//text value (so that its a valid property)
+       target_sequence_container:null,// text value (so that its a valid property)
        target_form_text: null,
 
-       //what is our save mode:
+       // what is our save mode:
        // can save to 'api' url or 'form'
        saveMode : 'api',
 
@@ -76,169 +76,169 @@ var sequencerDefaultValues = {
        plObj_id:'seq_pl',
        plObj:'null',
 
-       timeline_scale:.06, //in pixel to second ratio ie 100pixles for every ~30seconds
-       timeline_duration:500, //default timeline length in seconds
+       timeline_scale:.06, // in pixel to second ratio ie 100pixles for every ~30seconds
+       timeline_duration:500, // default timeline length in seconds
        playline_time:0,
        track_thumb_height:60,
        track_text_height:20,
 
-       //default timeline mode: "story" (i-movie like) or "time" (finalCut like)
+       // default timeline mode: "story" (i-movie like) or "time" (finalCut like)
        timeline_mode:'storyboard',
 
        track_clipThumb_height:80, // how large are the i-movie type clips
 
-       base_adj_duration:.5, //default time to subtract or add when adjusting clips.
+       base_adj_duration:.5, // default time to subtract or add when adjusting clips.
 
-       //default clipboard is empty:
+       // default clipboard is empty:
        clipboard:new Array(),
-       //stores the clipboard edit token (if user has rights to edit their User page)
+       // stores the clipboard edit token (if user has rights to edit their User page)
        clipboardEditToken:null,
-       //stores the sequence edit token (if user has rights to edit the current sequence)
+       // stores the sequence edit token (if user has rights to edit the current sequence)
        sequenceEditToken:null,
-       //the time the sequence was last touched (grabbed at time of startup)
+       // the time the sequence was last touched (grabbed at time of startup)
        sequenceTouchedTime:null,
        
-       //the default config for the add media wizard
-       amw_conf: {}, 
+       // the default config for the add media wizard
+       amw_conf: { },
 
 
-       //Msg are all the language specific values ...
+       // Msg are all the language specific values ...
        // (@@todo overwrite by msg values preloaded in the page)
-       //tack/clips can be pushed via json or inline playlist format
-       inline_playlist:'null', //text value so its a valid property
+       // tack/clips can be pushed via json or inline playlist format
+       inline_playlist:'null', // text value so its a valid property
        inline_playlist_id:'null',
        mv_pl_src:'null',
-       //the edit stack:
+       // the edit stack:
        edit_stack:new Array(),
        disp_menu_item:null,
-       //trackObj used to payload playlist Track Object (when inline not present)
-       tracks:{}
+       // trackObj used to payload playlist Track Object (when inline not present)
+       tracks: { }
 }
 var mvSequencer = function( iObj ) {
        return this.init( iObj );
 };
-//set up the mvSequencer object
+// set up the mvSequencer object
 mvSequencer.prototype = {
-       //the menu_items Object contains: default html, js setup/loader functions
+       // the menu_items Object contains: default html, js setup/loader functions
        menu_items : {
-               'clipedit':{
+               'clipedit': {
                        'd':0,
                        'html':'',
-                       'js': function(this_seq){
+                       'js': function( this_seq ) {
                                this_seq.doEditSelectedClip();
                        },
-                       'click_js':function( this_seq ){
+                       'click_js':function( this_seq ) {
                                this_seq.doEditSelectedClip();
                        }
                },
-               'transition':{
+               'transition': {
                        'd':0,
-                       'html' : '<h3>' + gM('mwe-menu_transition') + '</h3>',
-                       'js':function(this_seq){
+                       'html' : '<h3>' + gM( 'mwe-menu_transition' ) + '</h3>',
+                       'js':function( this_seq ) {
                                this_seq.doEditTransitionSelectedClip();
                        },
-                       'click_js':function(this_seq){
-                               //highlight the transition of the selected clip:
+                       'click_js':function( this_seq ) {
+                               // highlight the transition of the selected clip:
                                this_seq.doEditTransitionSelectedClip();
                        }
                },
-               'cliplib':{
+               'cliplib': {
                        'd':0,
-                       'html': gM('mwe-loading_txt'),
-                       'js':function( this_seq ){
-                               //load the search interface with sequence tool targets
+                       'html': gM( 'mwe-loading_txt' ),
+                       'js':function( this_seq ) {
+                               // load the search interface with sequence tool targets
                                mvJsLoader.doLoad( [
                                        'remoteSearchDriver',
                                        'seqRemoteSearchDriver'
-                               ], function(){
-                                        this_seq.mySearch = new seqRemoteSearchDriver(this_seq);
+                               ], function() {
+                                        this_seq.mySearch = new seqRemoteSearchDriver( this_seq );
                                         this_seq.mySearch.doInitDisplay();
-                               });
+                               } );
                        }
                },
-               'options':{
+               'options': {
                        'd':0,
-                       'html' : '<h3>' + gM('mwe-menu_options') + '</h3>' +
-                               gM('mwe-editor_mode') + '<br> ' +
+                       'html' : '<h3>' + gM( 'mwe-menu_options' ) + '</h3>' +
+                               gM( 'mwe-editor_mode' ) + '<br> ' +
                                '<blockquote><input type="radio" value="simple_editor" name="opt_editor">' +
-                                               gM('mwe-simple_editor_desc') + ' </blockquote>' +
+                                               gM( 'mwe-simple_editor_desc' ) + ' </blockquote>' +
                                '<blockquote><input type="radio" value="advanced_editor" name="opt_editor">' +
-                                               gM('mwe-advanced_editor_desc') + ' </blockquote>'+
-                               gM('mwe-other_options') + '<br>' +
+                                               gM( 'mwe-advanced_editor_desc' ) + ' </blockquote>' +
+                               gM( 'mwe-other_options' ) + '<br>' +
                                '<blockquote><input type="checkbox" value="contextmenu_opt" name="contextmenu_opt">' +
-                                               gM('mwe-contextmenu_opt') + ' </blockquote>',
-                       'js':function(this_seq){
-                               $j('#options_ic input[value=\'simple_editor\']').attr({
-                                       'checked':(this_seq.timeline_mode=='storyboard')?true:false
-                               }).click(function(){
+                                               gM( 'mwe-contextmenu_opt' ) + ' </blockquote>',
+                       'js':function( this_seq ) {
+                               $j( '#options_ic input[value=\'simple_editor\']' ).attr( {
+                                       'checked':( this_seq.timeline_mode == 'storyboard' ) ? true:false
+                               } ).click( function() {
                                        this_seq.doSimpleTl();
-                               });
-                               $j('#options_ic input[value=\'advanced_editor\']').attr({
-                                       'checked':( this_seq.timeline_mode=='time' )?true:false
-                               }).click(function(){
+                               } );
+                               $j( '#options_ic input[value=\'advanced_editor\']' ).attr( {
+                                       'checked':( this_seq.timeline_mode == 'time' ) ? true:false
+                               } ).click( function() {
                                        this_seq.doAdvancedTl();
-                               });
-                               //set up the options for context menus
+                               } );
+                               // set up the options for context menus
                        }
                }
        },
 
-       //set up initial key states:
+       // set up initial key states:
        key_shift_down:false,
        key_ctrl_down:false,
        inputFocus:false,
 
-       init:function( iObj ){
-               //set up pointer to this_seq for current scope:
+       init:function( iObj ) {
+               // set up pointer to this_seq for current scope:
                var this_seq = this;
-               //set the default values:
-               for(var i in sequencerDefaultValues){
+               // set the default values:
+               for ( var i in sequencerDefaultValues ) {
                        this[ i ] = sequencerDefaultValues[i];
                }
-               for(var i in iObj){
-                       //js_log('on '+ i + ' :' + iObj[i]);
-                       if(typeof sequencerDefaultValues[i] != 'undefined'){ //make sure its a valid property
+               for ( var i in iObj ) {
+                       // js_log('on '+ i + ' :' + iObj[i]);
+                       if ( typeof sequencerDefaultValues[i] != 'undefined' ) { // make sure its a valid property
                                this[i] = iObj[i];
                        }
                }
 
-               //check for sequence_container
-               if($j(this.target_sequence_container).length === 0){
-                       js_log("Error: missing target_sequence_container");
+               // check for sequence_container
+               if ( $j( this.target_sequence_container ).length === 0 ) {
+                       js_log( "Error: missing target_sequence_container" );
                        return false;
                }
 
-               //$j(this.target_sequence_container).css('position', 'relative');
-               this['base_width']  = $j(this.target_sequence_container).width();
-               this['base_height'] = $j(this.target_sequence_container).height();
+               // $j(this.target_sequence_container).css('position', 'relative');
+               this['base_width']  = $j( this.target_sequence_container ).width();
+               this['base_height'] = $j( this.target_sequence_container ).height();
 
-               //add the container divs (with basic layout ~universal~
-               $j(this.target_sequence_container).html(''+
+               // add the container divs (with basic layout ~universal~
+               $j( this.target_sequence_container ).html( '' +
                        '<div id="' + this.video_container_id + '" style="position:absolute;right:0px;top:0px;' +
-                               'width:' + this.video_width + 'px;height:' + (this.video_height+54) + 'px;"/>'+
+                               'width:' + this.video_width + 'px;height:' + ( this.video_height + 54 ) + 'px;"/>' +
                        '<div id="' + this.timeline_id + '" class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;' +
-                               'left:0px;right:0px;top:'+(this.video_height+60)+'px;bottom:20px;overflow:auto;">'+
-                                       gM('mwe-loading_timeline')+ '</div>'+
-                       '<div class="seq_status" style="position:absolute;left:0px;width:300px;"></div>'+
-                       '<div class="seq_save_cancel" style="position:absolute;'+
-                               'left:5px;bottom:0px;height:15px;">'+
-                                       gM('mwe-loading_user_rights') +
-                       '</div>'+
+                               'left:0px;right:0px;top:' + ( this.video_height + 60 ) + 'px;bottom:20px;overflow:auto;">' +
+                                       gM( 'mwe-loading_timeline' ) + '</div>' +
+                       '<div class="seq_status" style="position:absolute;left:0px;width:300px;"></div>' +
+                       '<div class="seq_save_cancel" style="position:absolute;' +
+                               'left:5px;bottom:0px;height:15px;">' +
+                                       gM( 'mwe-loading_user_rights' ) +
+                       '</div>' +
                        '<div class="about_editor" style="position:absolute;right:5px;bottom:0px;">' +
-                               gM('mwe-sequencer_credit_line') +
-                       '</div>'+
-                       '<div id="'+this.sequence_tools_id+'" style="position:absolute;' +
-                               'left:0px;right:'+(this.video_width+10)+'px;top:0px;height:'+(this.video_height+47)+'px;"/>'
-               ).css({
+                               gM( 'mwe-sequencer_credit_line' ) +
+                       '</div>' +
+                       '<div id="' + this.sequence_tools_id + '" style="position:absolute;' +
+                               'left:0px;right:' + ( this.video_width + 10 ) + 'px;top:0px;height:' + ( this.video_height + 47 ) + 'px;"/>'
+               ).css( {
                        'min-width':'850px'
-               });
+               } );
 
                /*js_log('set: '+this.target_sequence_container + ' html to:'+ "\n"+
                        $j(this.target_sequence_container).html()
                );*/
                
-               //first check if we got a cloned PL object:
-               //(when the editor is invoked with the plalylist already on the page)
+               // first check if we got a cloned PL object:
+               // (when the editor is invoked with the plalylist already on the page)
                /*if( this.plObj != 'null' ){
                        js_log('found plObj clone');
                        //extend with mvSeqPlayList object:
@@ -250,270 +250,270 @@ mvSequencer.prototype = {
                        return ;
                }*/
 
-               //else check for source based sequence editor (a clean page load of the editor)
-               if( this.mv_pl_src != 'null' ) {
+               // else check for source based sequence editor (a clean page load of the editor)
+               if ( this.mv_pl_src != 'null' ) {
                        js_log( ' pl src:: ' + this.mv_pl_src );
-                       var src_attr=' src="' + this.mv_pl_src+'" ';
-               }else{
-                       js_log( ' null playlist src .. (start empty) ');
-                       var src_attr='';
+                       var src_attr = ' src="' + this.mv_pl_src + '" ';
+               } else {
+                       js_log( ' null playlist src .. (start empty) ' );
+                       var src_attr = '';
                }
-               $j('#'+this.video_container_id).html('<playlist ' + src_attr +
-                       ' style="width:' + this.video_width + 'px;height:' + this.video_height + 'px;" '+
-                       ' sequencer="true" id="' + this.plObj_id + '" />');
+               $j( '#' + this.video_container_id ).html( '<playlist ' + src_attr +
+                       ' style="width:' + this.video_width + 'px;height:' + this.video_height + 'px;" ' +
+                       ' sequencer="true" id="' + this.plObj_id + '" />' );
                rewrite_by_id( this.plObj_id );
-               setTimeout(this.instance_name +'.checkReadyPlObj()', 25);
+               setTimeout( this.instance_name + '.checkReadyPlObj()', 25 );
        },
-       updateSeqSaveButtons:function(){
+       updateSeqSaveButtons:function() {
                var _this = this;
-               if( this.sequenceEditToken ){
-                       $j(this.target_sequence_container+' .seq_save_cancel').html(
-                               $j.btnHtml( gM('mwe-edit_save'), 'seq_edit_save', 'close') + ' ' +
-                               $j.btnHtml( gM('mwe-edit_cancel'), 'seq_edit_cancel', 'close')
+               if ( this.sequenceEditToken ) {
+                       $j( this.target_sequence_container + ' .seq_save_cancel' ).html(
+                               $j.btnHtml( gM( 'mwe-edit_save' ), 'seq_edit_save', 'close' ) + ' ' +
+                               $j.btnHtml( gM( 'mwe-edit_cancel' ), 'seq_edit_cancel', 'close' )
                        );
-               }else{
-                       $j(this.target_sequence_container+' .seq_save_cancel').html( cancel_button + gM('mwe-no_edit_permissions') );
+               } else {
+                       $j( this.target_sequence_container + ' .seq_save_cancel' ).html( cancel_button + gM( 'mwe-no_edit_permissions' ) );
                }
-               //assing bindings
-               $j(this.target_sequence_container +' .seq_edit_cancel').unbind().click(function(){
-                       var x = window.confirm( gM('mwe-edit_cancel_confirm') );
-                       if( x ){
+               // assing bindings
+               $j( this.target_sequence_container + ' .seq_edit_cancel' ).unbind().click( function() {
+                       var x = window.confirm( gM( 'mwe-edit_cancel_confirm' ) );
+                       if ( x ) {
                                _this.closeModEditor();
-                       }else{
-                               //close request canceled.
+                       } else {
+                               // close request canceled.
                        }
-               });
-               $j(this.target_sequence_container +' .seq_edit_save').unbind().click(function(){
-                       //pop up progress dialog ~requesting edit line summary~
-                       //remove any other save dialog
-                       $j('#seq_save_dialog').remove();
-                       $j('body').append('<div id="seq_save_dialog" title="'+ gM('mwe-edit_save') +'">' +
-                                               '<span class="mw-summary">'+
+               } );
+               $j( this.target_sequence_container + ' .seq_edit_save' ).unbind().click( function() {
+                       // pop up progress dialog ~requesting edit line summary~
+                       // remove any other save dialog
+                       $j( '#seq_save_dialog' ).remove();
+                       $j( 'body' ).append( '<div id="seq_save_dialog" title="' + gM( 'mwe-edit_save' ) + '">' +
+                                               '<span class="mw-summary">' +
                                                        '<label for="seq_save_summary">Edit summary: </label>' +
-                                               '</span>'+
-                                               '<input id="seq_save_summary" tabindex="1" maxlength="200" value="" size="30" name="seq_save_summary"/>'+
-                                       '</div>');
-                       var bConf = {};
-                       bConf[ gM('mwe-cancel') ] = function(){
-                               $j(this).dialog('close');
+                                               '</span>' +
+                                               '<input id="seq_save_summary" tabindex="1" maxlength="200" value="" size="30" name="seq_save_summary"/>' +
+                                       '</div>' );
+                       var bConf = { };
+                       bConf[ gM( 'mwe-cancel' ) ] = function() {
+                               $j( this ).dialog( 'close' );
                        };
-                       bConf[ gM('mwe-edit_save') ] = function(){
+                       bConf[ gM( 'mwe-edit_save' ) ] = function() {
                                var saveReq = {
                                        'action'        : 'edit',
                                        'title'         : _this.plObj.mTitle,
-                                       //the text is the sequence XML + the description
+                                       // the text is the sequence XML + the description
                                        'text'          : _this.getSeqOutputHLRDXML() + "\n" +
                                                                  _this.plObj.wikiDesc,
                                        'token'         : _this.sequenceEditToken,
-                                       'summary'       : $j('#seq_save_summary').val()
+                                       'summary'       : $j( '#seq_save_summary' ).val()
                                };
-                               //change to progress bar and save:
-                               $j('#seq_save_dialog').html('<div class="progress" /><br>' +
-                                       gM('mwe-saving_wait')
+                               // change to progress bar and save:
+                               $j( '#seq_save_dialog' ).html( '<div class="progress" /><br>' +
+                                       gM( 'mwe-saving_wait' )
                                )
-                               $j('#seq_save_dialog .progress').progressbar({
+                               $j( '#seq_save_dialog .progress' ).progressbar( {
                                        value: 100
-                               });
-                               //run the Seq Save Request:
+                               } );
+                               // run the Seq Save Request:
                                do_api_req( {
                                        'data': saveReq,
                                        'url' : _this.getLocalApiUrl()
-                               },function(data){
-                                       $j('#seq_save_dialog').html( gM('mwe-save_done') );
-                                       $j('#seq_save_dialog').dialog('option',
+                               }, function( data ) {
+                                       $j( '#seq_save_dialog' ).html( gM( 'mwe-save_done' ) );
+                                       $j( '#seq_save_dialog' ).dialog( 'option',
                                                'buttons', {
-                                                       "Done":function(){
-                                                               //refresh the page?
+                                                       "Done":function() {
+                                                               // refresh the page?
                                                                window.location.reload();
                                                        },
                                                        "Do More Edits": function() {
-                                                               $j(this).dialog("close");
+                                                               $j( this ).dialog( "close" );
                                                        }
-                                       });
-                               });
+                                       } );
+                               } );
                        };
-                       //dialog:
-                       $j('#seq_save_dialog').dialog({
+                       // dialog:
+                       $j( '#seq_save_dialog' ).dialog( {
                                bgiframe: true,
                                autoOpen: true,
                                modal: true,
                                buttons: bConf
-                       });
-               })
+                       } );
+               } )
        },
-       //display a menu item (hide the rest)
-       disp:function( item, dispCall ){
-               js_log('menu_item disp: ' + item);
+       // display a menu item (hide the rest)
+       disp:function( item, dispCall ) {
+               js_log( 'menu_item disp: ' + item );
                this.disp_menu_item = item;
-               //update the display and item state:
-               if(this.menu_items[item]){
-                       //update the tabs display:
-                       if(!dispCall)
-                               $j("#seq_menu").tabs('select', this.menu_items[item].inx);
+               // update the display and item state:
+               if ( this.menu_items[item] ) {
+                       // update the tabs display:
+                       if ( !dispCall )
+                               $j( "#seq_menu" ).tabs( 'select', this.menu_items[item].inx );
 
                        this.menu_items[item].d = 1;
-                       //do any click_js actions:getInsertControl
-                       if( this.menu_items[item].click_js )
+                       // do any click_js actions:getInsertControl
+                       if ( this.menu_items[item].click_js )
                                this.menu_items[item].click_js( this );
                }
        },
-       //setup the menu items:
-       setupMenuItems:function(){
-               js_log('loadInitMenuItems');
+       // setup the menu items:
+       setupMenuItems:function() {
+               js_log( 'loadInitMenuItems' );
                var this_seq = this;
-               //do all the menu_items setup:   @@we could defer this to once the menu item is requested
-               for( var i in this.menu_items ){
-                       if    this.menu_items[i].js )
+               // do all the menu_items setup:  @@we could defer this to once the menu item is requested
+               for ( var i in this.menu_items ) {
+                       if (    this.menu_items[i].js )
                                this.menu_items[i].js( this );
                }
        },
-       renderTimeLine:function(){
-               //empty out the top level html:
-               $j('#'+this.timeline_id).html('');
-               //add html general for timeline
-               if( this.timeline_mode == 'time'){
-                       $j('#'+this.timeline_id).html(''+
-                               '<div id="'+this.timeline_id+'_left_cnt" class="mv_tl_left_cnt">'+
-                                       '<div id="'+this.timeline_id+'_head_control" style="position:absolute;top:0px;left:0px;right:0px;height:30px;">' +
-                                               '<a title="'+gM('mwe-play_from_position')+'" href="javascript:'+this.instance_name+'.play_jt()">'+
-                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/control_play_blue.png">'+
-                                               '</a>'+
-                                               '<a title="'+gM('mwe-zoom_in')+'" href="javascript:'+this.instance_name+'.zoom_in()">'+
-                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/zoom_in.png">'+
-                                               '</a>'+
-                                               '<a title="'+gM('mwe-zoom_out')+'" href="javascript:'+this.instance_name+'.zoom_out()">'+
-                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/zoom_out.png">'+
-                                               '</a>'+
-                                               '<a title="'+gM('mwe-cut_clip')+'" href="javascript:'+this.instance_name+'.cut_mode()">'+
-                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/cut.png">'+
-                                                       '</a>'+
+       renderTimeLine:function() {
+               // empty out the top level html:
+               $j( '#' + this.timeline_id ).html( '' );
+               // add html general for timeline
+               if ( this.timeline_mode == 'time' ) {
+                       $j( '#' + this.timeline_id ).html( '' +
+                               '<div id="' + this.timeline_id + '_left_cnt" class="mv_tl_left_cnt">' +
+                                       '<div id="' + this.timeline_id + '_head_control" style="position:absolute;top:0px;left:0px;right:0px;height:30px;">' +
+                                               '<a title="' + gM( 'mwe-play_from_position' ) + '" href="javascript:' + this.instance_name + '.play_jt()">' +
+                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/control_play_blue.png">' +
+                                               '</a>' +
+                                               '<a title="' + gM( 'mwe-zoom_in' ) + '" href="javascript:' + this.instance_name + '.zoom_in()">' +
+                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/zoom_in.png">' +
+                                               '</a>' +
+                                               '<a title="' + gM( 'mwe-zoom_out' ) + '" href="javascript:' + this.instance_name + '.zoom_out()">' +
+                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/zoom_out.png">' +
+                                               '</a>' +
+                                               '<a title="' + gM( 'mwe-cut_clip' ) + '" href="javascript:' + this.instance_name + '.cut_mode()">' +
+                                                       '<img style="width:16px;height:16px;border:0" src="' + mv_embed_path + 'images/cut.png">' +
+                                                       '</a>' +
                                        '</div>' +
                                '</div>' +
-                               '<div id="'+this.timeline_id+'_tracks" class="mv_seq_tracks">' +
-                                       '<div id="'+this.timeline_id+'_head_jump" class="mv_head_jump" style="position:absolute;top:0px;left:0px;height:20px;"></div>'+
-                                       '<div id="'+this.timeline_id+'_playline" class="mv_playline"></div>'+
+                               '<div id="' + this.timeline_id + '_tracks" class="mv_seq_tracks">' +
+                                       '<div id="' + this.timeline_id + '_head_jump" class="mv_head_jump" style="position:absolute;top:0px;left:0px;height:20px;"></div>' +
+                                       '<div id="' + this.timeline_id + '_playline" class="mv_playline"></div>' +
                                '</div>'
                        );
-                       //add playlist hook to update timeline
-                       this.plObj.update_tl_hook = this.instance_name+'.update_tl_hook';
+                       // add playlist hook to update timeline
+                       this.plObj.update_tl_hook = this.instance_name + '.update_tl_hook';
                        var this_sq = this;
-                       var top_pos=25;
-                       //add tracks:
-                       for(var i in this.plObj.tracks){
+                       var top_pos = 25;
+                       // add tracks:
+                       for ( var i in this.plObj.tracks ) {
                                var track = this.plObj.tracks[i];
-                               //js_log("on track: "+ i + ' t:'+ $j('#'+this.timeline_id+'_left_cnt').html() );
-                               //set up track based on disp type
-                               switch(track.disp_mode){
+                               // js_log("on track: "+ i + ' t:'+ $j('#'+this.timeline_id+'_left_cnt').html() );
+                               // set up track based on disp type
+                               switch( track.disp_mode ) {
                                        case 'timeline_thumb':
-                                               var track_height=60;
+                                               var track_height = 60;
                                                var exc_img = 'opened';
-                                               var exc_action='close';
-                                               var exc_msg = gM('mwe-collapse_track');
+                                               var exc_action = 'close';
+                                               var exc_msg = gM( 'mwe-collapse_track' );
                                        break;
                                        case 'text':
-                                               var track_height=20;
+                                               var track_height = 20;
                                                var exc_img = 'closed';
-                                               var exc_action='open';
-                                               var exc_msg = gM('mwe-expand_track');
+                                               var exc_action = 'open';
+                                               var exc_msg = gM( 'mwe-expand_track' );
                                        break;
                                }
-                               //add track name:
-                               $j('#'+this.timeline_id+'_left_cnt').append(
-                                       '<div id="track_cnt_'+i+'" style="top:'+top_pos+'px;height:'+track_height+'px;" class="track_name">'+
-                                               '<a id="mv_exc_'+i+'" title="'+exc_msg+'" href="javascript:'+this_sq.instance_name+'.exc_track('+i+',\''+exc_action+'\')">'+
-                                                       '<img id="'+this_sq.timeline_id+'_close_expand" style="width:16px;height:16px;border:0" '+
-                                                               ' src="'+mv_embed_path + 'images/'+exc_img+'.png">'+
-                                               '</a>'+
-                                       track.title+'</div>'
+                               // add track name:
+                               $j( '#' + this.timeline_id + '_left_cnt' ).append(
+                                       '<div id="track_cnt_' + i + '" style="top:' + top_pos + 'px;height:' + track_height + 'px;" class="track_name">' +
+                                               '<a id="mv_exc_' + i + '" title="' + exc_msg + '" href="javascript:' + this_sq.instance_name + '.exc_track(' + i + ',\'' + exc_action + '\')">' +
+                                                       '<img id="' + this_sq.timeline_id + '_close_expand" style="width:16px;height:16px;border:0" ' +
+                                                               ' src="' + mv_embed_path + 'images/' + exc_img + '.png">' +
+                                               '</a>' +
+                                       track.title + '</div>'
                                );
-                               //also render the clips in the trackset container: (thumb or text view)
-                               $j('#'+this.timeline_id+'_tracks').append(
-                                       '<div id="container_track_'+i+'" style="top:'+top_pos+'px;height:'+(track_height+2)+'px;left:0px;right:0px;" class="container_track" />'
+                               // also render the clips in the trackset container: (thumb or text view)
+                               $j( '#' + this.timeline_id + '_tracks' ).append(
+                                       '<div id="container_track_' + i + '" style="top:' + top_pos + 'px;height:' + ( track_height + 2 ) + 'px;left:0px;right:0px;" class="container_track" />'
                                );
-                               top_pos+=track_height+20;
+                               top_pos += track_height + 20;
                        }
                }
-               if( this.timeline_mode=='storyboard'){
-                       var top_pos=this.plObj.org_control_height;
-                       //debugger;
-                       for(var i in this.plObj.tracks){
-                               var track_height=this.track_clipThumb_height;
+               if ( this.timeline_mode == 'storyboard' ) {
+                       var top_pos = this.plObj.org_control_height;
+                       // debugger;
+                       for ( var i in this.plObj.tracks ) {
+                               var track_height = this.track_clipThumb_height;
                                var timeline_id = this.timeline_id
-                               //add in play box and container tracks
-                               $j('#'+timeline_id).append(''+
+                               // add in play box and container tracks
+                               $j( '#' + timeline_id ).append( '' +
                                        '<div id="interface_container_track_' + i + '" ' +
-                                       '       style="position:absolute;top:5px;height:'+(track_height+30)+'px;left:10px;right:0px;"' +
-                                       '>'+
-                                               '<div id="container_track_'+i+'" style="position:relative;top:0px;' +
-                                                       'height:'+(track_height+30)+'px;left:0px;right:0px;" class="container_track">' +
-                                               '</div>'+
+                                       '       style="position:absolute;top:5px;height:' + ( track_height + 30 ) + 'px;left:10px;right:0px;"' +
+                                       '>' +
+                                               '<div id="container_track_' + i + '" style="position:relative;top:0px;' +
+                                                       'height:' + ( track_height + 30 ) + 'px;left:0px;right:0px;" class="container_track">' +
+                                               '</div>' +
                                                '<div id="' + timeline_id + '_playline" class="mv_story_playline">' +
-                                                       '<div class="mv_playline_top"/>'+
-                                               '</div>'+
+                                                       '<div class="mv_playline_top"/>' +
+                                               '</div>' +
                                        '</div>'
                                );
-                               top_pos+=track_height+20;
+                               top_pos += track_height + 20;
                        }
                }
        },
-       //once playlist is ready continue
-       checkReadyPlObj:function(){
-               //set up pointers from sequencer to pl obj
-               this.plObj = $j('#'+ this.plObj_id ).get(0);
-               //& from seq obj to sequencer
+       // once playlist is ready continue
+       checkReadyPlObj:function() {
+               // set up pointers from sequencer to pl obj
+               this.plObj = $j( '#' + this.plObj_id ).get( 0 );
+               // & from seq obj to sequencer
                this.plObj.pSeq = this;
 
-               if( this.plObj )
-                       if( ! this.plObj.loading )
+               if ( this.plObj )
+                       if ( ! this.plObj.loading )
                                this.plReadyInit();
 
-               //else keep checking for the playlist to be ready
-               if( this.plObj.loading ){
-                       if(this.plReadyTimeout==200){
-                               js_error('error playlist never ready');
-                       }else{
+               // else keep checking for the playlist to be ready
+               if ( this.plObj.loading ) {
+                       if ( this.plReadyTimeout == 200 ) {
+                               js_error( 'error playlist never ready' );
+                       } else {
                                this.plReadyTimeout++;
-                               setTimeout(this.instance_name +'.checkReadyPlObj()', 25);
+                               setTimeout( this.instance_name + '.checkReadyPlObj()', 25 );
                        }
                }
        },
-       getLocalApiUrl:function(){
+       getLocalApiUrl:function() {
                return this.plObj.interface_url;
        },
-       plReadyInit:function(){
+       plReadyInit:function() {
                var _this = this;
-               js_log('plReadyInit');
+               js_log( 'plReadyInit' );
                js_log( this.plObj );
-               //give the playlist a pointer to its parent seq:
+               // give the playlist a pointer to its parent seq:
                this.plObj['seqObj'] = this;
 
-               //update playlist (if its empty right now)
-               if(this.plObj.getClipCount()==0){
-                       $j('#'+this.plObj_id).html('empty playlist');
+               // update playlist (if its empty right now)
+               if ( this.plObj.getClipCount() == 0 ) {
+                       $j( '#' + this.plObj_id ).html( 'empty playlist' );
                }
 
-               //propagate the edit tokens
-               //if on an edit page just grab from the form:
-               this.sequenceEditToken = $j('input[wpEditToken]').val();
+               // propagate the edit tokens
+               // if on an edit page just grab from the form:
+               this.sequenceEditToken = $j( 'input[wpEditToken]' ).val();
 
-               if(typeof this.sequenceEditToken == 'undefined' && this.getLocalApiUrl()!=null){
-                       get_mw_token(_this.plObj.mTitle, _this.getLocalApiUrl(),
-                               function(token){
-                                       if(token){
+               if ( typeof this.sequenceEditToken == 'undefined' && this.getLocalApiUrl() != null ) {
+                       get_mw_token( _this.plObj.mTitle, _this.getLocalApiUrl(),
+                               function( token ) {
+                                       if ( token ) {
                                                _this.sequenceEditToken = token;
                                                _this.updateSeqSaveButtons();
                                        }
                                }
                        );
-                       get_mw_token(_this.plObj.mTalk, _this.getLocalApiUrl(),
-                               function(token){
+                       get_mw_token( _this.plObj.mTalk, _this.getLocalApiUrl(),
+                               function( token ) {
                                        _this.clipboardEditToken = token;
                                }
                        );
-                       //also grab permissions for sending clipboard commands to the server
+                       // also grab permissions for sending clipboard commands to the server
 
-                       //(calling the sequencer inline) try and get edit token via api call:
-                       //(somewhat fragile way to get at the api... should move to config
+                       // (calling the sequencer inline) try and get edit token via api call:
+                       // (somewhat fragile way to get at the api... should move to config
                        /*var token_url = this.plObj.interface_url.replace(/index\.php/, 'api.php');
                        token_url += '?action=query&format=xml&prop=info&intoken=edit&titles=';
                        $j.ajax({
@@ -527,7 +527,7 @@ mvSequencer.prototype = {
 
                                }
                        });*/
-                       //also grab permissions for sending clipboard commands to the server
+                       // also grab permissions for sending clipboard commands to the server
                        /*$j.ajax({
                                type:"GET",
                                url: token_url + this_seq.plObj.mTalk,
@@ -541,912 +541,912 @@ mvSequencer.prototype = {
                }
 
 
-               //render the menu tabs::
-               var item_containers ='';
+               // render the menu tabs::
+               var item_containers = '';
                var inx = 0;
                var selected_tab = 0;
-               var tabc ='';
-               var o='<div id="seq_menu" style="width:100%;height:100%">';
-               o+='<ul>';
-               for(var tab_id in this.menu_items){
+               var tabc = '';
+               var o = '<div id="seq_menu" style="width:100%;height:100%">';
+               o += '<ul>';
+               for ( var tab_id in this.menu_items ) {
                        menu_item = this.menu_items[tab_id];
                        menu_item.inx = inx;
-                       if(menu_item.d){
-                               selected_tab=inx;
-                               _this.disp_menu_item =tab_id;
+                       if ( menu_item.d ) {
+                               selected_tab = inx;
+                               _this.disp_menu_item = tab_id;
                        }
 
-                       o+='<li>' +
-                               '<a id="mv_menu_item_'+tab_id+'" href="#' + tab_id + '_ic">'+gM('mwe-menu_' + tab_id ) + '</a>' +
+                       o += '<li>' +
+                               '<a id="mv_menu_item_' + tab_id + '" href="#' + tab_id + '_ic">' + gM( 'mwe-menu_' + tab_id ) + '</a>' +
                        '</li>';
 
                        tabc += '<div id="' + tab_id + '_ic" style="overflow:auto;height:268px;" >';
-                               tabc += (menu_item.html) ? menu_item.html : '<h3>' + gM('mwe-menu_'+tab_id) + '</h3>';
-                       tabc +='</div>';
+                               tabc += ( menu_item.html ) ? menu_item.html : '<h3>' + gM( 'mwe-menu_' + tab_id ) + '</h3>';
+                       tabc += '</div>';
                        inx++;
                };
-               o+='</ul>';
-               o+=tabc;
-               $j('#'+this.sequence_tools_id).html( o );
+               o += '</ul>';
+               o += tabc;
+               $j( '#' + this.sequence_tools_id ).html( o );
 
 
-               $j("#seq_menu").tabs({
+               $j( "#seq_menu" ).tabs( {
                        selected:selected_tab,
-                       select: function(event, ui) {
-                               _this.disp( $j(ui.tab).attr('id').replace('mv_menu_item_', ''), true );
+                       select: function( event, ui ) {
+                               _this.disp( $j( ui.tab ).attr( 'id' ).replace( 'mv_menu_item_', '' ), true );
                        }
-               //add sorting
-               }).find(".ui-tabs-nav").sortable({ axis : 'x' });
+               // add sorting
+               } ).find( ".ui-tabs-nav" ).sortable( { axis : 'x' } );
 
 
-               //render the timeline
+               // render the timeline
                this.renderTimeLine();
                this.do_refresh_timeline();
 
-               //load init content into containers
+               // load init content into containers
                this.setupMenuItems();
 
                this.doFocusBindings();
 
-               //set up key bidnings
-               $j(window).keydown(function(e){
-                       js_log('pushed down on:' + e.which);
-                       if( e.which == 16 )
+               // set up key bidnings
+               $j( window ).keydown( function( e ) {
+                       js_log( 'pushed down on:' + e.which );
+                       if ( e.which == 16 )
                                _this.key_shift_down = true;
 
-                       if( e.which == 17)
+                       if ( e.which == 17 )
                                _this.key_ctrl_down = true;
 
-                       if( (e.which == 67 && _this.key_ctrl_down) && !_this.inputFocus)
+                       if ( ( e.which == 67 && _this.key_ctrl_down ) && !_this.inputFocus )
                                _this.copySelectedClips();
 
-                       if( (e.which == 88 && _this.key_ctrl_down) && !_this.inputFocus)
+                       if ( ( e.which == 88 && _this.key_ctrl_down ) && !_this.inputFocus )
                                _this.cutSelectedClips();
 
-                       //paste cips on v + ctrl while not focused on a text area:
-                       if( (e.which == 86 && _this.key_ctrl_down) && !_this.inputFocus)
+                       // paste cips on v + ctrl while not focused on a text area:
+                       if ( ( e.which == 86 && _this.key_ctrl_down ) && !_this.inputFocus )
                                _this.pasteClipBoardClips();
 
-               });
-               $j(window).keyup(function(e){
-                       js_log('key up on ' + e.which);
-                       //user let go of "shift" turn off multi-select
-                       if( e.which == 16 )
+               } );
+               $j( window ).keyup( function( e ) {
+                       js_log( 'key up on ' + e.which );
+                       // user let go of "shift" turn off multi-select
+                       if ( e.which == 16 )
                                _this.key_shift_down = false;
 
-                       if( e.which == 17 )
+                       if ( e.which == 17 )
                                _this.key_ctrl_down = false;
 
-                       //escape key (for now deselect)
-                       if( e.which == 27 )
+                       // escape key (for now deselect)
+                       if ( e.which == 27 )
                                _this.deselectClip();
 
 
-                       //backspace or delete key while not focused on a text area:
-                       if( (e.which == 8 || e.which == 46) && !_this.inputFocus)
+                       // backspace or delete key while not focused on a text area:
+                       if ( ( e.which == 8 || e.which == 46 ) && !_this.inputFocus )
                                _this.removeSelectedClips();
-               });
+               } );
        },
-       //check all nodes for focus
-       //@@todo it would probably be faster to search a given subnode instead of all text
-       doFocusBindings:function(){
+       // check all nodes for focus
+       // @@todo it would probably be faster to search a given subnode instead of all text
+       doFocusBindings:function() {
                var _this = this;
-               //if an input or text area has focus disable delete key binding
-               $j("input,textarea").focus(function () {
-                       js_log("inputFocus:true");
+               // if an input or text area has focus disable delete key binding
+               $j( "input,textarea" ).focus( function () {
+                       js_log( "inputFocus:true" );
                        _this.inputFocus = true;
-               });
-               $j("input,textarea").blur( function () {
-                       js_log("inputFocus:blur");
+               } );
+               $j( "input,textarea" ).blur( function () {
+                       js_log( "inputFocus:blur" );
                        _this.inputFocus = false;
-               })
+               } )
        },
-       update_tl_hook:function(jh_time_ms){
-               //put into seconds scale:
-               var jh_time_sec_float = jh_time_ms/1000;
-               //render playline at given time
-               //js_log('tl scale: '+this.timeline_scale);
-               $j('#'+this.timeline_id+'_playline').css('left', Math.round(jh_time_sec_float/this.timeline_scale)+'px' );
-               //js_log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale));
+       update_tl_hook:function( jh_time_ms ) {
+               // put into seconds scale:
+               var jh_time_sec_float = jh_time_ms / 1000;
+               // render playline at given time
+               // js_log('tl scale: '+this.timeline_scale);
+               $j( '#' + this.timeline_id + '_playline' ).css( 'left', Math.round( jh_time_sec_float / this.timeline_scale ) + 'px' );
+               // js_log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale));
        },
        /*returns a xml or json representation of the current sequence */
-       getSeqOutputJSON:function(){
-               js_log('json output:');
+       getSeqOutputJSON:function() {
+               js_log( 'json output:' );
        },
-       getSeqOutputHLRDXML:function(){
-               var o='<sequence_hlrd>' +"\n";
-               o+="\t<head>\n";
-               //get transitions
-               for(var i in this.plObj.transitions){
-                       if( this.plObj.transitions[i] ){
+       getSeqOutputHLRDXML:function() {
+               var o = '<sequence_hlrd>' + "\n";
+               o += "\t<head>\n";
+               // get transitions
+               for ( var i in this.plObj.transitions ) {
+                       if ( this.plObj.transitions[i] ) {
                                var tObj = this.plObj.transitions[i].getAttributeObj();
-                               o+="\t\t<transition ";
-                               for(var j in tObj){
-                                       o+=' '+j+'="' + tObj[j] + '"\n\t\t';
+                               o += "\t\t<transition ";
+                               for ( var j in tObj ) {
+                                       o += ' ' + j + '="' + tObj[j] + '"\n\t\t';
                                }
-                               o+='/>'+"\n"; //transitions don't have children
+                               o += '/>' + "\n"; // transitions don't have children
                        }
                }
-               o+="\t</head>\n";
+               o += "\t</head>\n";
 
-               //get clips
-               o+="\t<body>\n";
-               //output each track:
-               for(var i in this.plObj.tracks){
+               // get clips
+               o += "\t<body>\n";
+               // output each track:
+               for ( var i in this.plObj.tracks ) {
                        var curTrack = this.plObj.tracks[i];
-                       o+="\t<seq";
+                       o += "\t<seq";
                                var tAttr = curTrack.getAttributeObj();
-                               for(var j in  tAttr){
-                                       o+=' '+j+'="' + tAttr[j] + '"\n\t\t\t';
+                               for ( var j in  tAttr ) {
+                                       o += ' ' + j + '="' + tAttr[j] + '"\n\t\t\t';
                                }
-                       o+=">\n";
-                       for( var k in curTrack.clips ){
+                       o += ">\n";
+                       for ( var k in curTrack.clips ) {
                                var curClip = curTrack.clips[k];
-                               o+="\t\t<ref ";
+                               o += "\t\t<ref ";
                                        var cAttr = curClip.getAttributeObj();
                                        var lt = '';
-                                       for(var j in  cAttr){
-                                               var val =  (j=='transIn' || j=='transOut') ? cAttr[j].id : cAttr[j];
-                                               o+=lt + j+'="' + val + '"';
-                                               lt ="\n\t\t";
+                                       for ( var j in  cAttr ) {
+                                               var val =  ( j == 'transIn' || j == 'transOut' ) ? cAttr[j].id : cAttr[j];
+                                               o += lt + j + '="' + val + '"';
+                                               lt = "\n\t\t";
                                        }
-                               o+=">\n" //close the clip
-                               for(var pName in curClip.params){
+                               o += ">\n" // close the clip
+                               for ( var pName in curClip.params ) {
                                        var pVal = curClip.params[pName];
-                                       o+="\t\t\t" + '<param name="'+ pName + '">' + pVal + '</param>' + "\n";
+                                       o += "\t\t\t" + '<param name="' + pName + '">' + pVal + '</param>' + "\n";
                                }
-                               o+="\t\t</ref>\n\n";
+                               o += "\t\t</ref>\n\n";
                        }
-                       o+="\n</seq>\n";
+                       o += "\n</seq>\n";
                }
-               o+="\t</body>\n";
-               //close the tag
-               o+='</sequence_hlrd>';
+               o += "\t</body>\n";
+               // close the tag
+               o += '</sequence_hlrd>';
 
                return o;
        },
-       editClip:function(track_inx, clip_inx){
+       editClip:function( track_inx, clip_inx ) {
                var cObj = this.plObj.tracks[ track_inx ].clips[ clip_inx ];
                this.doEditClip( cObj );
        },
-       doEditTransitionSelectedClip:function(){
+       doEditTransitionSelectedClip:function() {
                var _this = this;
-               js_log("f:doEditTransitionSelectedClip:" + $j('.mv_selected_clip').length);
-               if( $j('.mv_selected_clip').length == 1){
-                       _this.doEditTransition( _this.getClipFromSeqID( $j('.mv_selected_clip').parent().attr('id') ) );
-               }else if( $j('.mv_selected_clip').length === 0){
-                       //no clip selected warning:
-                       $j('#transition_ic').html( gM('mwe-no_selected_resource') );
-               }else{
-                       //multiple clip selected warning:
-                       $j('#transition_ic').html( gM('mwe-error_edit_multiple') );
+               js_log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length );
+               if ( $j( '.mv_selected_clip' ).length == 1 ) {
+                       _this.doEditTransition( _this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) );
+               } else if ( $j( '.mv_selected_clip' ).length === 0 ) {
+                       // no clip selected warning:
+                       $j( '#transition_ic' ).html( gM( 'mwe-no_selected_resource' ) );
+               } else {
+                       // multiple clip selected warning:
+                       $j( '#transition_ic' ).html( gM( 'mwe-error_edit_multiple' ) );
                }
        },
-       doEditSelectedClip:function(){
-               js_log("f:doEditSelectedClip:");
-               //and only one clip selected
-               if( $j('.mv_selected_clip').length == 1){
-                       this.doEditClip( this.getClipFromSeqID( $j('.mv_selected_clip').parent().attr('id') ) );
-               }else if( $j('.mv_selected_clip').length === 0){
-                       //no clip selected warning:
-                       $j('#clipedit_ic').html( gM('mwe-no_selected_resource') );
-               }else{
-                       //multiple clip selected warning:
-                       $j('#clipedit_ic').html( gM('mwe-error_edit_multiple') );
+       doEditSelectedClip:function() {
+               js_log( "f:doEditSelectedClip:" );
+               // and only one clip selected
+               if ( $j( '.mv_selected_clip' ).length == 1 ) {
+                       this.doEditClip( this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) );
+               } else if ( $j( '.mv_selected_clip' ).length === 0 ) {
+                       // no clip selected warning:
+                       $j( '#clipedit_ic' ).html( gM( 'mwe-no_selected_resource' ) );
+               } else {
+                       // multiple clip selected warning:
+                       $j( '#clipedit_ic' ).html( gM( 'mwe-error_edit_multiple' ) );
                }
        },
-       doEditTransition:function( cObj ){
-               js_log("sequence:doEditTransition");
+       doEditTransition:function( cObj ) {
+               js_log( "sequence:doEditTransition" );
                var _this = this;
                mv_get_loading_img( '#transitions_ic' );
-               mvJsLoader.doLoad([
+               mvJsLoader.doLoad( [
                        '$j.fn.ColorPicker',
                        'mvTimedEffectsEdit'
-               ],function(){
-                       //no idea why this works / is needed.
+               ], function() {
+                       // no idea why this works / is needed.
                        var localSeqRef = _this;
-                       _this.myEffectEdit = new mvTimedEffectsEdit({
+                       _this.myEffectEdit = new mvTimedEffectsEdit( {
                                'rObj'           : cObj,
                                'control_ct' : 'transition_ic',
                                'pSeq'   : localSeqRef
-                       });
-               })
+                       } );
+               } )
        },
-       //updates the clip details div if edit resource is set
-       doEditClip:function( cObj){
-               js_log('seq:doEditClip');
+       // updates the clip details div if edit resource is set
+       doEditClip:function( cObj ) {
+               js_log( 'seq:doEditClip' );
                var _this = this;
 
-               //set default edit action (maybe edit_action can be sent via by context click)
+               // set default edit action (maybe edit_action can be sent via by context click)
                var edit_action = 'fileopts';
 
                mv_get_loading_img( '#clipedit_ic' );
-               //load the clipEdit library if not already loaded:
+               // load the clipEdit library if not already loaded:
                mvJsLoader.doLoad( [
                        'mvClipEdit'
-               ], function(){                  
-                       //zero out the current editor: 
-                       _this.myClipEditor = {};
-                       //setup the cliploader
-                       _this.myClipEditor = new mvClipEdit({
+               ], function() {
+                       // zero out the current editor: 
+                       _this.myClipEditor = { };
+                       // setup the cliploader
+                       _this.myClipEditor = new mvClipEdit( {
                                'rObj'                  : cObj,
                                'control_ct'    : 'clipedit_ic',
                                'clip_disp_ct'  : cObj.id,
                                'edit_action'   : edit_action,
                                'p_seqObj'              : _this,
                                'profile'               : 'sequence'
-                       });
-               });
+                       } );
+               } );
        },
-       //save new clip segment
-       saveClipEdit:function(){
-               //saves the clip updates
+       // save new clip segment
+       saveClipEdit:function() {
+               // saves the clip updates
        },
-       closeModEditor:function(){
-               //unset the sequencer
+       closeModEditor:function() {
+               // unset the sequencer
                _global['mvSeq'] = null;
-               $j(this.target_sequence_container + ',.ui-widget-overlay').remove();
+               $j( this.target_sequence_container + ',.ui-widget-overlay' ).remove();
        },
-       pasteClipBoardClips:function(){
-               js_log('f:pasteClipBoardClips');
-               //@@todo query the server for updated clipboard
-               //paste before the "current clip"
+       pasteClipBoardClips:function() {
+               js_log( 'f:pasteClipBoardClips' );
+               // @@todo query the server for updated clipboard
+               // paste before the "current clip"
                this.addClips( this.clipboard, this.plObj.cur_clip.order );
        },
-       copySelectedClips:function(){
+       copySelectedClips:function() {
                var this_seq = this;
-               //set all the selected clips
+               // set all the selected clips
                this.clipboard = new Array();
-               $j('.mv_selected_clip').each(function(){
-                       //add each clip to the clip board:
-                       var cur_clip = this_seq.getClipFromSeqID( $j(this).parent().attr('id') );
+               $j( '.mv_selected_clip' ).each( function() {
+                       // add each clip to the clip board:
+                       var cur_clip = this_seq.getClipFromSeqID( $j( this ).parent().attr( 'id' ) );
                        this_seq.clipboard.push( cur_clip.getAttributeObj() );
-               });
-               //upload clipboard to the server (if possible)
-               if( parseUri(  document.URL ).host != parseUri( this_seq.plObj.interface_url ).host ){
-                       js_log('error: presently we can\'t copy clips across domains');
-               }else{
-                       //@@we need a api entry point to store a "clipboard"
-                       if( this_seq.clipboardEditToken && this_seq.plObj.interface_url ){
-                               var req_url = this_seq.plObj.interface_url.replace(/api.php/, 'index.php') + '?action=ajax&rs=mv_seqtool_clipboard&rsargs[]=copy';
-                               $j.ajax({
+               } );
+               // upload clipboard to the server (if possible)
+               if ( parseUri(  document.URL ).host != parseUri( this_seq.plObj.interface_url ).host ) {
+                       js_log( 'error: presently we can\'t copy clips across domains' );
+               } else {
+                       // @@we need a api entry point to store a "clipboard"
+                       if ( this_seq.clipboardEditToken && this_seq.plObj.interface_url ) {
+                               var req_url = this_seq.plObj.interface_url.replace( / api.php / , 'index.php' ) + '?action=ajax&rs=mv_seqtool_clipboard&rsargs[]=copy';
+                               $j.ajax( {
                                        type: "POST",
                                        url:req_url,
                                        data: $j.param( {
                                                "clipboard_data": $j.toJSON( this_seq.clipboard ),
                                                "clipboardEditToken": this_seq.clipboardEditToken
-                                       }),
-                                       success:function(data){
-                                               //callback( data );
-                                               js_log('did clipboard push ' + $j.toJSON( this_seq.clipboard ) );
+                                       } ),
+                                       success:function( data ) {
+                                               // callback( data );
+                                               js_log( 'did clipboard push ' + $j.toJSON( this_seq.clipboard ) );
                                        }
-                               });
-                       }else{
-                               js_log('error: no clipboardEditToken to uplaod clipboard to server');
+                               } );
+                       } else {
+                               js_log( 'error: no clipboardEditToken to uplaod clipboard to server' );
                        }
                }
        },
-       cutSelectedClips:function(){
+       cutSelectedClips:function() {
                this.copySelectedClips();
                this.removeSelectedClips();
        },
-       removeSelectedClips:function(){
-               var remove_clip_ary=new Array();
-               //remove selected clips from display
-               $j('.container_track .mv_selected_clip').each(function(){
-                       //grab the track index from the id (assumes track_#_clip_#
-                       remove_clip_ary.push ( $j(this).parent().attr('id').replace('track_','').replace('clip_','').split('_') );
-               });
-               if(remove_clip_ary.length !=0 )
-                       this.removeClips(remove_clip_ary);
-
-               //doEdit selected clips (updated selected resource)
-               //@@todo refresh menu of current
+       removeSelectedClips:function() {
+               var remove_clip_ary = new Array();
+               // remove selected clips from display
+               $j( '.container_track .mv_selected_clip' ).each( function() {
+                       // grab the track index from the id (assumes track_#_clip_#
+                       remove_clip_ary.push ( $j( this ).parent().attr( 'id' ).replace( 'track_', '' ).replace( 'clip_', '' ).split( '_' ) );
+               } );
+               if ( remove_clip_ary.length != 0 )
+                       this.removeClips( remove_clip_ary );
+
+               // doEdit selected clips (updated selected resource)
+               // @@todo refresh menu of current
                this.doEditSelectedClip();
        },
-       addClip:function( clip, before_clip_pos, track_inx){
-               this.addClips([clip],  before_clip_pos, track_inx)
+       addClip:function( clip, before_clip_pos, track_inx ) {
+               this.addClips( [clip],  before_clip_pos, track_inx )
        },
-       //add a single or set of clips
-       //to a given position and track_inx
-       addClips:function( clipSet, before_clip_pos, track_inx){
+       // add a single or set of clips
+       // to a given position and track_inx
+       addClips:function( clipSet, before_clip_pos, track_inx ) {
                this_seq = this;
 
-               if(!track_inx)
+               if ( !track_inx )
                        track_inx = this.plObj.default_track.inx;
 
-               if(!before_clip_pos)
-                       before_clip_pos= this.plObj.default_track.getClipCount();
+               if ( !before_clip_pos )
+                       before_clip_pos = this.plObj.default_track.getClipCount();
 
-               js_log("seq: add clip: at: "+ before_clip_pos + ' in track: ' + track_inx);
+               js_log( "seq: add clip: at: " + before_clip_pos + ' in track: ' + track_inx );
                var cur_pos = before_clip_pos;
 
-               $j.each(clipSet, function(inx, clipInitDom){
-                       var mediaElement = document.createElement('ref');
-                       for(var i in clipInitDom){
-                               js_log("set: " + i + ' to ' + clipInitDom[i]);
-                               if(i!='id')
-                                       $j(mediaElement).attr(i, clipInitDom[i]);
+               $j.each( clipSet, function( inx, clipInitDom ) {
+                       var mediaElement = document.createElement( 'ref' );
+                       for ( var i in clipInitDom ) {
+                               js_log( "set: " + i + ' to ' + clipInitDom[i] );
+                               if ( i != 'id' )
+                                       $j( mediaElement ).attr( i, clipInitDom[i] );
                        }
-                       if( this_seq.plObj.tryAddMedia( mediaElement, cur_pos, track_inx ) )
+                       if ( this_seq.plObj.tryAddMedia(        mediaElement, cur_pos, track_inx ) )
                                cur_pos++;
-               });
-               //debugger;
+               } );
+               // debugger;
                this.do_refresh_timeline();
        },
-       removeClips:function( remove_clip_ary ){
+       removeClips:function( remove_clip_ary ) {
                var this_seq = this;
-               var jselect = coma ='';
-               js_log('clip count before removal : ' + this_seq.plObj.default_track.clips.length + ' should remove ' + remove_clip_ary.length );
+               var jselect = coma = '';
+               js_log( 'clip count before removal : ' + this_seq.plObj.default_track.clips.length + ' should remove ' + remove_clip_ary.length );
                var afected_tracks = new Array();
-               //add order to track_clip before we start removing:
-               $j.each( remove_clip_ary, function(inx, track_clip){
+               // add order to track_clip before we start removing:
+               $j.each( remove_clip_ary, function( inx, track_clip ) {
                        remove_clip_ary[inx]['order'] = this_seq.plObj.tracks[ track_clip[0] ].clips[ track_clip[1] ].order;
-               });
-               $j.each( remove_clip_ary, function(inx, track_clip){
+               } );
+               $j.each( remove_clip_ary, function( inx, track_clip ) {
                        var track_inx = track_clip[0];
                        var clip_inx = track_clip[1];
                        var clip_rm_order = track_clip['order'];
-                       js_log('remove t:' + track_inx + ' c:'+ clip_inx + ' id:' +' #track_'+track_inx+'_clip_'+clip_inx + ' order:' + clip_rm_order);
-                       //remove the clips from the base tracks
-                       for(var i in this_seq.plObj.tracks[ track_inx ].clips){
+                       js_log( 'remove t:' + track_inx + ' c:' + clip_inx + ' id:' + ' #track_' + track_inx + '_clip_' + clip_inx + ' order:' + clip_rm_order );
+                       // remove the clips from the base tracks
+                       for ( var i in this_seq.plObj.tracks[ track_inx ].clips ) {
                                cur_clip = this_seq.plObj.tracks[ track_inx ].clips[i]
-                               if(cur_clip.order == clip_rm_order){
-                                       this_seq.plObj.tracks[ track_clip[0] ].clips.splice( i, 1);
+                               if ( cur_clip.order == clip_rm_order ) {
+                                       this_seq.plObj.tracks[ track_clip[0] ].clips.splice( i, 1 );
                                }
                        }
-                       //add track to affected track list:
-                       afected_tracks[ track_inx ]=true;
-                       jselect += coma + '#track_' +track_inx + '_clip_' + clip_inx;
-                       coma=',';
-               });
-               //update/ reorder:
-               $j.each(afected_tracks, function(track_inx, affected){
+                       // add track to affected track list:
+                       afected_tracks[ track_inx ] = true;
+                       jselect += coma + '#track_' + track_inx + '_clip_' + clip_inx;
+                       coma = ',';
+               } );
+               // update/ reorder:
+               $j.each( afected_tracks, function( track_inx, affected ) {
                        this_seq.plObj.tracks[track_inx].reOrderClips();
-               });
+               } );
 
-               js_log('clip count after removal : ' + this_seq.plObj.default_track.clips.length);
-               //animate the removal (@@todo should be able to call the resulting fadeOut only once without a flag)
-               var done_with_refresh=false;
-               $j(jselect).fadeOut("slow", function(){
-                       if( !done_with_refresh )
+               js_log( 'clip count after removal : ' + this_seq.plObj.default_track.clips.length );
+               // animate the removal (@@todo should be able to call the resulting fadeOut only once without a flag)
+               var done_with_refresh = false;
+               $j( jselect ).fadeOut( "slow", function() {
+                       if ( !done_with_refresh )
                                this_seq.do_refresh_timeline();
-                       done_with_refresh=true;
-               }).empty(); //empty to remove any persistent bindings
+                       done_with_refresh = true;
+               } ).empty(); // empty to remove any persistent bindings
        },
-       doEdit:function( editObj ){
-               //add the current editObj to the edit stack (should allow for "undo")
+       doEdit:function( editObj ) {
+               // add the current editObj to the edit stack (should allow for "undo")
                this.edit_stack.push( editObj );
-               //make the adjustments
+               // make the adjustments
                this.makeAdjustment( editObj );
        },
        /*
        * takes adjust ment object with options:
        * track_inx, clip_inx, start, end delta
        */
-       makeAdjustment:function(e){
-               switch(e.type){
+       makeAdjustment:function( e ) {
+               switch( e.type ) {
                        case 'resize_start':
-                               this.plObj.tracks[e.track_inx].clips[e.clip_inx].doAdjust('start', e.delta);
+                               this.plObj.tracks[e.track_inx].clips[e.clip_inx].doAdjust( 'start', e.delta );
                        break;
                        case 'resize_end':
-                                this.plObj.tracks[e.track_inx].clips[e.clip_inx].doAdjust('end', e.delta);
+                                this.plObj.tracks[e.track_inx].clips[e.clip_inx].doAdjust( 'end', e.delta );
                        break;
                }
-               js_log('re render: '+e.track_inx);
-               //refresh the playlist after adjustment
+               js_log( 're render: ' + e.track_inx );
+               // refresh the playlist after adjustment
                this.do_refresh_timeline();
        },
-       //@@todo set up key bindings for undo
-       undoEdit:function(){
+       // @@todo set up key bindings for undo
+       undoEdit:function() {
                var editObj = this.edit_stack.pop();
-               //invert the delta
+               // invert the delta
 
        },
-       exc_track:function(inx,req){
+       exc_track:function( inx, req ) {
                this_seq = this;
-               if(req=='close'){
-                       $j('#mv_exc_'+inx).attr('href', 'javascript:'+this.instance_name+'.exc_track('+inx+',\'open\')');
-                       $j('#mv_exc_'+inx + ' > img').attr('src',mv_embed_path + 'images/closed.png');
-                       $j('#track_cnt_'+inx+',#container_track_'+inx).animate({height:this.track_text_height}, "slow",'',
-                               function(){
-                                       this_seq.plObj.tracks[inx].disp_mode='text';
+               if ( req == 'close' ) {
+                       $j( '#mv_exc_' + inx ).attr( 'href', 'javascript:' + this.instance_name + '.exc_track(' + inx + ',\'open\')' );
+                       $j( '#mv_exc_' + inx + ' > img' ).attr( 'src', mv_embed_path + 'images/closed.png' );
+                       $j( '#track_cnt_' + inx + ',#container_track_' + inx ).animate( { height:this.track_text_height }, "slow", '',
+                               function() {
+                                       this_seq.plObj.tracks[inx].disp_mode = 'text';
+                                       this_seq.render_tracks( inx );
+                               } );
+               } else if ( req == 'open' ) {
+                       $j( '#mv_exc_' + inx ).attr( 'href', 'javascript:' + this.instance_name + '.exc_track(' + inx + ',\'close\')' );
+                       $j( '#mv_exc_' + inx + ' > img' ).attr( 'src', mv_embed_path + 'images/opened.png' );
+                       $j( '#track_cnt_' + inx + ',#container_track_' + inx ).animate( { height:this.track_thumb_height }, "slow", '',
+                               function() {
+                                       this_seq.plObj.tracks[inx].disp_mode = 'timeline_thumb';
                                        this_seq.render_tracks( inx );
-                               });
-               }else if(req=='open'){
-                       $j('#mv_exc_'+inx).attr('href', 'javascript:'+this.instance_name+'.exc_track('+inx+',\'close\')');
-                       $j('#mv_exc_'+inx + ' > img').attr('src',mv_embed_path + 'images/opened.png');
-                       $j('#track_cnt_'+inx+',#container_track_'+inx).animate({height:this.track_thumb_height}, "slow",'',
-                               function(){
-                                       this_seq.plObj.tracks[inx].disp_mode='timeline_thumb';
-                                       this_seq.render_tracks(inx);
-                               });
+                               } );
 
                }
        },
-       //adds tracks
-       add_track:function(inx, track){
+       // adds tracks
+       add_track:function( inx, track ) {
 
        },
-       //toggle cut mode (change icon to cut)
-       cut_mode:function(){
-               js_log('do cut mode');
-               //add cut layer ontop of clips
+       // toggle cut mode (change icon to cut)
+       cut_mode:function() {
+               js_log( 'do cut mode' );
+               // add cut layer ontop of clips
        },
-       doAdvancedTl:function(){
-               this.timeline_mode='time';
+       doAdvancedTl:function() {
+               this.timeline_mode = 'time';
                this.renderTimeLine();
                this.do_refresh_timeline();
                return false;
        },
-       doSimpleTl:function(){
-               this.timeline_mode='storyboard';
+       doSimpleTl:function() {
+               this.timeline_mode = 'storyboard';
                this.renderTimeLine();
                this.do_refresh_timeline();
                return false;
        },
-       //renders updates the timeline based on the current scale
-       render_tracks:function( track_inx ){
-               js_log("f::render track: "+track_inx);
+       // renders updates the timeline based on the current scale
+       render_tracks:function( track_inx ) {
+               js_log( "f::render track: " + track_inx );
                var this_seq = this;
-               //inject the tracks into the timeline (if not already there)
-               for(var track_id in this.plObj.tracks){
-                       if( track_inx==track_id || typeof track_inx=='undefined' ){
-                               //empty out the track container:
-                               //$j('#container_track_'+track_id).empty();
-                               var track_html=droppable_html='';
-                               //set up per track vars:
+               // inject the tracks into the timeline (if not already there)
+               for ( var track_id in this.plObj.tracks ) {
+                       if ( track_inx == track_id || typeof track_inx == 'undefined' ) {
+                               // empty out the track container:
+                               // $j('#container_track_'+track_id).empty();
+                               var track_html = droppable_html = '';
+                               // set up per track vars:
                                var track = this.plObj.tracks[track_id];
-                               var cur_clip_time=0;
+                               var cur_clip_time = 0;
 
-                               //set up some constants for timeline_mode == storyboard:
-                               if(this.timeline_mode == 'storyboard'){
+                               // set up some constants for timeline_mode == storyboard:
+                               if ( this.timeline_mode == 'storyboard' ) {
                                        var frame_width = Math.round( this.track_clipThumb_height * 1.3333333 );
-                                       var container_width = frame_width+60;
+                                       var container_width = frame_width + 60;
                                }
 
-                               //for each clip:
-                               for(var j in track.clips){
+                               // for each clip:
+                               for ( var j in track.clips ) {
                                        clip = track.clips[j];
-                                       //var img = clip.getClipImg('icon');
-                                       if( this.timeline_mode == 'storyboard' ){
-                                               clip.left_px = j*container_width;
+                                       // var img = clip.getClipImg('icon');
+                                       if ( this.timeline_mode == 'storyboard' ) {
+                                               clip.left_px = j * container_width;
                                                clip.width_px = container_width;
-                                               var base_id = 'track_'+track_id+'_clip_'+j;
-                                               track_html += '<span id="'+base_id+'" '+
-                                                                               'class="mv_storyboard_container mv_clip_drag" '+
-                                                                               'style="'+
-                                                                               'left:'+clip.left_px+'px;'+
-                                                                               'height:' + (this.track_clipThumb_height+30) + 'px;' +
-                                                                               'width:'+(container_width)+'px;" >';
-                                               track_html += clip.embed.renderTimelineThumbnail({
+                                               var base_id = 'track_' + track_id + '_clip_' + j;
+                                               track_html += '<span id="' + base_id + '" ' +
+                                                                               'class="mv_storyboard_container mv_clip_drag" ' +
+                                                                               'style="' +
+                                                                               'left:' + clip.left_px + 'px;' +
+                                                                               'height:' + ( this.track_clipThumb_height + 30 ) + 'px;' +
+                                                                               'width:' + ( container_width ) + 'px;" >';
+                                               track_html += clip.embed.renderTimelineThumbnail( {
                                                                                'width' : frame_width,
                                                                                'thumb_class' : 'mv_clip_thumb',
                                                                                'height':this.track_clipThumb_height,
                                                                                'time':0
-                                                                       });
-                                               //render out edit button
+                                                                       } );
+                                               // render out edit button
                                                /*track_html+='<div class="clip_edit_button clip_edit_base clip_control"/>';*/
 
-                                               //check if the clip has transitions
+                                               // check if the clip has transitions
                                                var imgHtml = '';
                                                var imsrc = '';
                                                var cat = clip;
-                                               if(clip.transIn || clip.transOut){
-                                                       if( clip.transIn && clip.transIn.getIconSrc )
+                                               if ( clip.transIn || clip.transOut ) {
+                                                       if ( clip.transIn && clip.transIn.getIconSrc )
                                                                imsrc = clip.transIn.getIconSrc();
-                                                       //@@todo put transOut somewhere else
-                                                       if( clip.transOut && clip.transOut.getIconSrc )
+                                                       // @@todo put transOut somewhere else
+                                                       if ( clip.transOut && clip.transOut.getIconSrc )
                                                                imsrc = clip.transOut.getIconSrc();
-                                                       if(imsrc != '')
+                                                       if ( imsrc != '' )
                                                                imgHtml = '<img style="width:32px;height:32px" src="' + imsrc + '" />';
                                                }
-                                               //render out transition edit box
+                                               // render out transition edit box
                                                track_html +=   '<div id="tb_' + base_id + '"  class="clip_trans_box">' +
                                                                                        imgHtml +
                                                                                '</div>'
 
-                                               //render out adjustment text
+                                               // render out adjustment text
                                                /*track_html+='<div id="' + base_id + '_adj' + '" class="mv_adj_text" style="top:'+ (this.track_clipThumb_height+10 )+'px;">'+
                                                                                '<span class="mv_adjust_click" onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'-\')" /> - </span>'+
                                                                                  ( (clip.getDuration() > 60 )? seconds2npt(clip.getDuration()): clip.getDuration() )  +
                                                                                '<span class="mv_adjust_click" onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'+\')" /> + </span>'+
                                                                        '</div>';
                                                */
-                                               track_html+='</span>';
+                                               track_html += '</span>';
 
                                        }
-                                       //do timeline_mode rendering:
-                                       if(this.timeline_mode == 'time'){
-                                               clip.left_px = Math.round( cur_clip_time/this.timeline_scale);
-                                               clip.width_px = Math.round( Math.round( clip.getDuration() )/this.timeline_scale);
+                                       // do timeline_mode rendering:
+                                       if ( this.timeline_mode == 'time' ) {
+                                               clip.left_px = Math.round( cur_clip_time / this.timeline_scale );
+                                               clip.width_px = Math.round( Math.round( clip.getDuration() ) / this.timeline_scale );
                                                clip.height_px = 60;
-                                               js_log('at time:' + cur_clip_time + ' left: ' +clip.left_px + ' clip dur: ' +  Math.round( clip.getDuration() ) + ' clip width:' + clip.width_px);
-
-                                               //for every clip_width pixle output image
-                                               if(track.disp_mode=='timeline_thumb'){
-                                                       track_html+='<span id="track_'+track_id+'_clip_'+j+'" '+
-                                                                                       'class="mv_tl_clip mv_clip_drag" '+
-                                                                                       'style="'+
-                                                                                               'left:' + clip.left_px + 'px;'+
-                                                                                               'width:'+ clip.width_px + 'px;'+
-                                                                                               'height:'+ clip.height_px + 'px" >';
-                                                       track_html+= this.render_clip_frames( clip );
-                                               }else if(track.disp_mode=='text'){
-                                                       //'+left_px+
-                                                       track_html+='<span id="track_'+track_id+'_clip_'+j+'" style="left:'+clip.left_px+'px;'+
-                                                               'width:'+clip.width_px+'px;background:'+clip.getColor()+
-                                                                       '" class="mv_time_clip_text mv_clip_drag">'+clip.title;
+                                               js_log( 'at time:' + cur_clip_time + ' left: ' + clip.left_px + ' clip dur: ' +  Math.round( clip.getDuration() ) + ' clip width:' + clip.width_px );
+
+                                               // for every clip_width pixle output image
+                                               if ( track.disp_mode == 'timeline_thumb' ) {
+                                                       track_html += '<span id="track_' + track_id + '_clip_' + j + '" ' +
+                                                                                       'class="mv_tl_clip mv_clip_drag" ' +
+                                                                                       'style="' +
+                                                                                               'left:' + clip.left_px + 'px;' +
+                                                                                               'width:' + clip.width_px + 'px;' +
+                                                                                               'height:' + clip.height_px + 'px" >';
+                                                       track_html += this.render_clip_frames( clip );
+                                               } else if ( track.disp_mode == 'text' ) {
+                                                       // '+left_px+
+                                                       track_html += '<span id="track_' + track_id + '_clip_' + j + '" style="left:' + clip.left_px + 'px;' +
+                                                               'width:' + clip.width_px + 'px;background:' + clip.getColor() +
+                                                                       '" class="mv_time_clip_text mv_clip_drag">' + clip.title;
                                                }
-                                               //add in per clip controls
-                                               track_html+='<div title="'+gM('mwe-clip_in')+' '+clip.embed.start_ntp+'" class="ui-resizable-w ui-resizable-handle" style="width: 16px; height: 16px; left: 0px; top: 2px;background:url(\''+mv_embed_path+'images/application_side_contract.png\');" ></div>'+"\n";
-                                               track_html+='<div title="'+gM('mwe-clip_out')+' '+clip.embed.end_ntp+'" class="ui-resizable-e ui-resizable-handle" style="width: 16px; height: 16px; right: 0px; top: 2px;background:url(\''+mv_embed_path+'images/application_side_expand.png\');" ></div>'+"\n";
-                                               track_html+='<div title="'+gM('mwe-rmclip')+'" onClick="'+this.instance_name + '.removeClips(new Array([' + track_id + ',' + j + ']))" style="position:absolute;cursor:pointer;width: 16px; height: 16px; left: 0px; bottom:2px;background:url(\''+mv_embed_path+'images/delete.png\');"></div>'+"\n";
-                                               track_html+='<span style="display:none;" class="mv_clip_stats"></span>';
-
-                                               track_html+='</span>';
-                                               //droppable_html+='<div id="dropBefore_'+i+'_c_'+j+'" class="mv_droppable" style="height:'+this.track_thumb_height+'px;left:'+clip.left_px+'px;width:'+Math.round(clip.width_px/2)+'px"></div>';
-                                               //droppable_html+='<div id="dropAfter_'+i+'_c_'+j+'" class="mv_droppable" style="height:'+this.track_thumb_height+'px;left:'+(clip.left_px+Math.round(clip.width_px/2))+'px;width:'+(clip.width_px/2)+'px"></div>';
-                                               cur_clip_time+=Math.round( clip.getDuration() ); //increment cur_clip_time
+                                               // add in per clip controls
+                                               track_html += '<div title="' + gM( 'mwe-clip_in' ) + ' ' + clip.embed.start_ntp + '" class="ui-resizable-w ui-resizable-handle" style="width: 16px; height: 16px; left: 0px; top: 2px;background:url(\'' + mv_embed_path + 'images/application_side_contract.png\');" ></div>' + "\n";
+                                               track_html += '<div title="' + gM( 'mwe-clip_out' ) + ' ' + clip.embed.end_ntp + '" class="ui-resizable-e ui-resizable-handle" style="width: 16px; height: 16px; right: 0px; top: 2px;background:url(\'' + mv_embed_path + 'images/application_side_expand.png\');" ></div>' + "\n";
+                                               track_html += '<div title="' + gM( 'mwe-rmclip' ) + '" onClick="' + this.instance_name + '.removeClips(new Array([' + track_id + ',' + j + ']))" style="position:absolute;cursor:pointer;width: 16px; height: 16px; left: 0px; bottom:2px;background:url(\'' + mv_embed_path + 'images/delete.png\');"></div>' + "\n";
+                                               track_html += '<span style="display:none;" class="mv_clip_stats"></span>';
+
+                                               track_html += '</span>';
+                                               // droppable_html+='<div id="dropBefore_'+i+'_c_'+j+'" class="mv_droppable" style="height:'+this.track_thumb_height+'px;left:'+clip.left_px+'px;width:'+Math.round(clip.width_px/2)+'px"></div>';
+                                               // droppable_html+='<div id="dropAfter_'+i+'_c_'+j+'" class="mv_droppable" style="height:'+this.track_thumb_height+'px;left:'+(clip.left_px+Math.round(clip.width_px/2))+'px;width:'+(clip.width_px/2)+'px"></div>';
+                                               cur_clip_time += Math.round( clip.getDuration() ); // increment cur_clip_time
                                        }
 
                                }
 
-                               //js_log("new htmL for track i: "+track_id + ' html:'+track_html);
-                               $j('#container_track_'+track_id).html( track_html );
+                               // js_log("new htmL for track i: "+track_id + ' html:'+track_html);
+                               $j( '#container_track_' + track_id ).html( track_html );
 
-                               //apply transition click action
-                               $j('.clip_trans_box').click(function(){
-                                       if($j(this).hasClass('mv_selected_transition')){
-                                               $j(this).removeClass('mv_selected_transition');
-                                               this_seq.deselectClip( $j(this).siblings('.mv_clip_thumb').get(0) );
-                                       }else{
-                                               //deselect others
+                               // apply transition click action
+                               $j( '.clip_trans_box' ).click( function() {
+                                       if ( $j( this ).hasClass( 'mv_selected_transition' ) ) {
+                                               $j( this ).removeClass( 'mv_selected_transition' );
+                                               this_seq.deselectClip( $j( this ).siblings( '.mv_clip_thumb' ).get( 0 ) );
+                                       } else {
+                                               // deselect others
                                                this_seq.deselectClip();
-                                               $j('.clip_trans_box').removeClass('mv_selected_transition');
-                                               $j(this).addClass("mv_selected_transition");
-                                               $j(this).siblings('.mv_clip_thumb').addClass("mv_selected_clip");
-                                               var sClipObj = this_seq.getClipFromSeqID( $j(this).parent().attr('id') );
-                                               //jump to the current clip
+                                               $j( '.clip_trans_box' ).removeClass( 'mv_selected_transition' );
+                                               $j( this ).addClass( "mv_selected_transition" );
+                                               $j( this ).siblings( '.mv_clip_thumb' ).addClass( "mv_selected_clip" );
+                                               var sClipObj = this_seq.getClipFromSeqID( $j( this ).parent().attr( 'id' ) );
+                                               // jump to the current clip
                                                this_seq.plObj.updateCurrentClip( sClipObj  );
-                                               //display the transition edit tab:
+                                               // display the transition edit tab:
                                                this_seq.disp( 'transition' );
                                        }
-                               });
-
-                               //apply edit button mouse over effect:
-                               $j('.clip_edit_button').hover(function(){
-                                       $j(this).removeClass("clip_edit_base").addClass("clip_edit_over");
-                               },function(){
-                                       $j(this).removeClass("clip_edit_over").addClass("clip_edit_base");
-                               }).click(function(){
-                                       //deselect everything else:
-                                       $j('.mv_selected_clip').each(function(inx, selected_clip){
+                               } );
+
+                               // apply edit button mouse over effect:
+                               $j( '.clip_edit_button' ).hover( function() {
+                                       $j( this ).removeClass( "clip_edit_base" ).addClass( "clip_edit_over" );
+                               }, function() {
+                                       $j( this ).removeClass( "clip_edit_over" ).addClass( "clip_edit_base" );
+                               } ).click( function() {
+                                       // deselect everything else:
+                                       $j( '.mv_selected_clip' ).each( function( inx, selected_clip ) {
                                                this_seq.deselectClip( this );
-                                       });
+                                       } );
 
-                                       var sClipObj = this_seq.getClipFromSeqID( $j(this).parent().attr('id') );
+                                       var sClipObj = this_seq.getClipFromSeqID( $j( this ).parent().attr( 'id' ) );
                                        this_seq.plObj.updateCurrentClip( sClipObj  );
-                                       //get the clip (siblings with mv_clip_thumb class)
-                                       var cur_clip_elm =  $j(this).siblings('.mv_clip_thumb');
-                                       //select the clip (add mv_selected_clip if not already selected)
-                                       if( ! $j( cur_clip_elm ).hasClass("mv_selected_clip") ){
-                                               $j( cur_clip_elm ).addClass('mv_selected_clip');
-                                               $j('#' + $j( cur_clip_elm ).parent().attr("id") + '_adj').fadeIn("fast");
+                                       // get the clip (siblings with mv_clip_thumb class)
+                                       var cur_clip_elm =  $j( this ).siblings( '.mv_clip_thumb' );
+                                       // select the clip (add mv_selected_clip if not already selected)
+                                       if ( ! $j( cur_clip_elm ).hasClass( "mv_selected_clip" ) ) {
+                                               $j( cur_clip_elm ).addClass( 'mv_selected_clip' );
+                                               $j( '#' + $j( cur_clip_elm ).parent().attr( "id" ) + '_adj' ).fadeIn( "fast" );
                                        }
-                                       //display the edit tab:
+                                       // display the edit tab:
                                        this_seq.disp( 'clipedit' );
-                                       //display edit dialog:
+                                       // display edit dialog:
                                        this_seq.doEditClip( sClipObj );
-                               });
+                               } );
 
-                               //apply onClick edit controls:
-                               $j('.mv_clip_thumb').click(function(){
+                               // apply onClick edit controls:
+                               $j( '.mv_clip_thumb' ).click( function() {
                                        var cur_clip_click = this;
-                                       //if not in multi select mode remove all existing selections
-                                       //(except for the current click which is handled down below)
-                                       js_log(' ks: ' + this_seq.key_shift_down + '  ctrl_down:' +this_seq.key_ctrl_down);
-                                       if( ! this_seq.key_shift_down && ! this_seq.key_ctrl_down){
-                                               $j('.mv_selected_clip').each(function(inx, selected_clip){
-                                                       if( $j(this).parent().attr('id') != $j(cur_clip_click).parent().attr('id')
-                                                               || ( $j('.mv_selected_clip').length > 1 ) ){
+                                       // if not in multi select mode remove all existing selections
+                                       // (except for the current click which is handled down below)
+                                       js_log( ' ks: ' + this_seq.key_shift_down + '  ctrl_down:' + this_seq.key_ctrl_down );
+                                       if ( ! this_seq.key_shift_down && ! this_seq.key_ctrl_down ) {
+                                               $j( '.mv_selected_clip' ).each( function( inx, selected_clip ) {
+                                                       if ( $j( this ).parent().attr( 'id' ) != $j( cur_clip_click ).parent().attr( 'id' )
+                                                               || ( $j( '.mv_selected_clip' ).length > 1 ) ) {
                                                                        this_seq.deselectClip( this );
                                                        }
-                                               });
+                                               } );
                                        }
 
-                                       //jump to clip time
-                                       var sClipObj = this_seq.getClipFromSeqID( $j(this).parent().attr('id') );
+                                       // jump to clip time
+                                       var sClipObj = this_seq.getClipFromSeqID( $j( this ).parent().attr( 'id' ) );
                                        this_seq.plObj.updateCurrentClip( sClipObj  );
-                                       if( $j(this).hasClass("mv_selected_clip") ){
-                                               $j(this).removeClass("mv_selected_clip");
-                                               $j('#' + $j(this).parent().attr("id") + '_adj').fadeOut("fast");
-                                       }else{
-                                               $j(this).addClass('mv_selected_clip');
-                                               $j('#' + $j(this).parent().attr("id") + '_adj').fadeIn("fast");
+                                       if ( $j( this ).hasClass( "mv_selected_clip" ) ) {
+                                               $j( this ).removeClass( "mv_selected_clip" );
+                                               $j( '#' + $j( this ).parent().attr( "id" ) + '_adj' ).fadeOut( "fast" );
+                                       } else {
+                                               $j( this ).addClass( 'mv_selected_clip' );
+                                               $j( '#' + $j( this ).parent().attr( "id" ) + '_adj' ).fadeIn( "fast" );
                                        }
-                                       //if shift select is down select the in-between clips
-                                       if( this_seq.key_shift_down ){
-                                               //get the min max of current selection (within the current track)
+                                       // if shift select is down select the in-between clips
+                                       if ( this_seq.key_shift_down ) {
+                                               // get the min max of current selection (within the current track)
                                                var max_order = 0;
                                                var min_order = 999999999;
-                                               $j('.mv_selected_clip').each(function(){
-                                                       var cur_clip = this_seq.getClipFromSeqID( $j(this).parent().attr('id') );
-                                                       //get min max
-                                                       if(cur_clip.order < min_order)
+                                               $j( '.mv_selected_clip' ).each( function() {
+                                                       var cur_clip = this_seq.getClipFromSeqID( $j( this ).parent().attr( 'id' ) );
+                                                       // get min max
+                                                       if ( cur_clip.order < min_order )
                                                                min_order = cur_clip.order;
-                                                       if(cur_clip.order > max_order)
+                                                       if ( cur_clip.order > max_order )
                                                                max_order = cur_clip.order;
-                                               });
-                                               //select all non-selected between max or min
-                                               js_log('sOrder: ' + sClipObj.order + ' min:' + min_order + ' max:'+ max_order);
-                                               if( sClipObj.order <= min_order ){
-                                                       for( var i = sClipObj.order; i <= max_order; i++ ){
-                                                               $j('#track_' + track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass('mv_selected_clip');
+                                               } );
+                                               // select all non-selected between max or min
+                                               js_log( 'sOrder: ' + sClipObj.order + ' min:' + min_order + ' max:' + max_order );
+                                               if ( sClipObj.order <= min_order ) {
+                                                       for ( var i = sClipObj.order; i <= max_order; i++ ) {
+                                                               $j( '#track_' + track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass( 'mv_selected_clip' );
                                                        }
                                                }
-                                               if( sClipObj.order >= max_order ){
-                                                       for( var i =min_order; i <= max_order; i++ ){
-                                                               $j('#track_' + track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass('mv_selected_clip');
+                                               if ( sClipObj.order >= max_order ) {
+                                                       for ( var i = min_order; i <= max_order; i++ ) {
+                                                               $j( '#track_' + track_id + '_clip_' + i + ' > .mv_clip_thumb' ).addClass( 'mv_selected_clip' );
                                                        }
                                                }
                                        }
                                        this_seq.doEditSelectedClip();
-                               });
-                               //add in control for time based display
-                               //debugger;
-                               if(this.timeline_mode == 'time'){
-                                       $j('.ui-resizable-handle').mousedown( function(){
-                                               js_log('hid: ' +  $j(this).attr('class'));
-                                               this_seq.resize_mode = ($j(this).attr('class').indexOf('ui-resizable-e')!=-1)?
+                               } );
+                               // add in control for time based display
+                               // debugger;
+                               if ( this.timeline_mode == 'time' ) {
+                                       $j( '.ui-resizable-handle' ).mousedown( function() {
+                                               js_log( 'hid: ' +  $j( this ).attr( 'class' ) );
+                                               this_seq.resize_mode = ( $j( this ).attr( 'class' ).indexOf( 'ui-resizable-e' ) != - 1 ) ?
                                                                                'resize_end':'resize_start';
-                                       });
+                                       } );
                                }
-                               var insert_key='na';
+                               var insert_key = 'na';
                                // drag hooks:
-                               //@@todo support multiple clips
-                               for(var j in track.clips){
-                                       $j('#track_'+track_id+'_clip_'+j).draggable({
+                               // @@todo support multiple clips
+                               for ( var j in track.clips ) {
+                                       $j( '#track_' + track_id + '_clip_' + j ).draggable( {
                                                axis:'x',
-                                               containment:'#container_track_'+track_id,
+                                               containment:'#container_track_' + track_id,
                                                opacity:50,
                                                handle: ":not(.clip_control)",
                                                scroll:true,
-                                               drag:function(e, ui){
-                                                       //debugger;
-                                                       insert_key = this_seq.clipDragUpdate(ui, this);
+                                               drag:function( e, ui ) {
+                                                       // debugger;
+                                                       insert_key = this_seq.clipDragUpdate( ui, this );
                                                },
-                                               start:function(e,ui){
-                                                       js_log('start drag:' + this.id);
-                                                       //make sure we are ontop
-                                                       $j(this).css({top:'0px',zindex:10});
+                                               start:function( e, ui ) {
+                                                       js_log( 'start drag:' + this.id );
+                                                       // make sure we are ontop
+                                                       $j( this ).css( { top:'0px', zindex:10 } );
                                                },
-                                               stop:function(e, ui){
-                                                       $j(this).css({top:'0px',zindex:0});
+                                               stop:function( e, ui ) {
+                                                       $j( this ).css( { top:'0px', zindex:0 } );
 
-                                                       var id_parts = this.id.split('_');
+                                                       var id_parts = this.id.split( '_' );
                                                        var track_inx = id_parts[1];
                                                        var clip_inx = id_parts[3];
                                                        var clips = this_seq.plObj.tracks[track_inx].clips;
                                                        var cur_drag_clip = clips[clip_inx];
 
-                                                       if(insert_key!='na' && insert_key!='end' ){
-                                                               cur_drag_clip.order=insert_key-.5;
-                                                       }else if (insert_key=='end'){
-                                                               cur_drag_clip.order=clips.length;
+                                                       if ( insert_key != 'na' && insert_key != 'end' ) {
+                                                               cur_drag_clip.order = insert_key - .5;
+                                                       } else if ( insert_key == 'end' ) {
+                                                               cur_drag_clip.order = clips.length;
                                                        }
-                                                       //reorder array based on new order
-                                                       clips.sort(sort_func);
-                                                       function sort_func(a, b){
+                                                       // reorder array based on new order
+                                                       clips.sort( sort_func );
+                                                       function sort_func( a, b ) {
                                                                return a.order - b.order;
                                                        }
-                                                       //assign keys back to order:
+                                                       // assign keys back to order:
                                                        this_seq.plObj.tracks[track_inx].reOrderClips();
-                                                       //redraw:
+                                                       // redraw:
                                                        this_seq.do_refresh_timeline();
                                                }
-                                       });
-                                       //add in resize hook if in time mode:
-                                       if(this.timeline_mode == 'time'){
-                                               $j('#track_'+track_id+'_clip_'+j).resizable({
+                                       } );
+                                       // add in resize hook if in time mode:
+                                       if ( this.timeline_mode == 'time' ) {
+                                               $j( '#track_' + track_id + '_clip_' + j ).resizable( {
                                                        minWidth:10,
                                                        maxWidth:6000,
-                                                       start: function(e,ui) {
-                                                               //set border to red
-                                                               $j(this).css({'border':'solid thin red'});
-                                                               //fade In Time stats (end or start based on handle)
-                                                               //dragging east (adjusting end time)
-                                                               js_log( 'append to: '+ this.id);
-                                                               $j('#' + this.id + ' > .mv_clip_stats').fadeIn("fast");
+                                                       start: function( e, ui ) {
+                                                               // set border to red
+                                                               $j( this ).css( { 'border':'solid thin red' } );
+                                                               // fade In Time stats (end or start based on handle)
+                                                               // dragging east (adjusting end time)
+                                                               js_log( 'append to: ' + this.id );
+                                                               $j( '#' + this.id + ' > .mv_clip_stats' ).fadeIn( "fast" );
                                                        },
-                                                       stop: function(e,ui) {
-                                                               js_log('stop resize');
-                                                               //restore border
-                                                               $j(this).css('border', 'solid thin white');
-                                                               //remove stats
+                                                       stop: function( e, ui ) {
+                                                               js_log( 'stop resize' );
+                                                               // restore border
+                                                               $j( this ).css( 'border', 'solid thin white' );
+                                                               // remove stats
                                                                var clip_drag = this;
-                                                               $j('#'+this.id+' > .mv_clip_stats').fadeOut("fast",function(){
-                                                                       var id_parts = clip_drag.id.split('_');
+                                                               $j( '#' + this.id + ' > .mv_clip_stats' ).fadeOut( "fast", function() {
+                                                                       var id_parts = clip_drag.id.split( '_' );
                                                                        var track_inx = id_parts[1];
                                                                        var clip_inx = id_parts[3];
-                                                                       //update clip
-                                                                       this_seq.doEdit({
+                                                                       // update clip
+                                                                       this_seq.doEdit( {
                                                                                type:this_seq.resize_mode,
                                                                                delta:this_seq.edit_delta,
                                                                                track_inx:track_inx,
-                                                                               clip_inx:clip_inx})
-                                                                       });
+                                                                               clip_inx:clip_inx } )
+                                                                       } );
                                                        },
-                                                       resize: function(e,ui) {
-                                                               //update time stats & render images:
-                                                               this_seq.update_clip_resize(this);
+                                                       resize: function( e, ui ) {
+                                                               // update time stats & render images:
+                                                               this_seq.update_clip_resize( this );
                                                        }
-                                               });
+                                               } );
                                        }
                                }
-                               $j('#container_track_'+track_id).width(Math.round(      this.timeline_duration / this.timeline_scale));
+                               $j( '#container_track_' + track_id ).width( Math.round( this.timeline_duration / this.timeline_scale ) );
                        }
-                       //debugger;
+                       // debugger;
                }
        },
-       clipDragUpdate:function( ui, clipElm){
+       clipDragUpdate:function( ui, clipElm ) {
                var this_seq = this;
 
-               var insert_key='na';
-               //animate re-arrange by left position:
-               //js_log('left: '+ui.position.left);
-               //locate clip (based on clip duration not animate)
-               var id_parts = clipElm.id.split('_');
+               var insert_key = 'na';
+               // animate re-arrange by left position:
+               // js_log('left: '+ui.position.left);
+               // locate clip (based on clip duration not animate)
+               var id_parts = clipElm.id.split( '_' );
                var track_inx = id_parts[1];
                var clip_inx = id_parts[3];
                var clips = this_seq.plObj.tracks[track_inx].clips;
                var cur_drag_clip = clips[clip_inx];
                var return_org = true;
-               $j(clipElm).css('zindex',10);
-               //find out where we are inserting and set left border to solid red thick
-               for(var k in clips){
-                       if    ui.position.left > clips[k].left_px &&
-                               ui.position.left < (clips[k].left_px + clips[k].width_px)){
-                               if(clip_inx!=k){
-                                       //also make sure we are not where we started
-                                       if(k-1!=clip_inx){
-                                               $j('#track_'+track_inx+'_clip_'+k).css('border-left', 'solid thick red');
-                                               insert_key=k;
-                                       }else{
-                                               insert_key='na';
+               $j( clipElm ).css( 'zindex', 10 );
+               // find out where we are inserting and set left border to solid red thick
+               for ( var k in clips ) {
+                       if (    ui.position.left > clips[k].left_px &&
+                               ui.position.left < ( clips[k].left_px + clips[k].width_px ) ) {
+                               if ( clip_inx != k ) {
+                                       // also make sure we are not where we started
+                                       if ( k - 1 != clip_inx ) {
+                                               $j( '#track_' + track_inx + '_clip_' + k ).css( 'border-left', 'solid thick red' );
+                                               insert_key = k;
+                                       } else {
+                                               insert_key = 'na';
                                        }
-                               }else{
-                                       insert_key='na';
+                               } else {
+                                       insert_key = 'na';
                                }
-                       }else{
-                               $j('#track_'+track_inx+'_clip_'+k).css('border-left', 'solid thin white');
+                       } else {
+                               $j( '#track_' + track_inx + '_clip_' + k ).css( 'border-left', 'solid thin white' );
                        }
                }
-               //if greater than the last k insert after
-               if(ui.position.left > (clips[k].left_px + clips[k].width_px) &&
-                       k!=clip_inx ){
-                               $j('#track_'+track_inx+'_clip_'+k).css('border-right', 'solid thick red');
-                               insert_key='end';
-               }else{
-                       $j('#track_'+track_inx+'_clip_'+k).css('border-right', 'solid thin white');
+               // if greater than the last k insert after
+               if ( ui.position.left > ( clips[k].left_px + clips[k].width_px ) &&
+                       k != clip_inx ) {
+                               $j( '#track_' + track_inx + '_clip_' + k ).css( 'border-right', 'solid thick red' );
+                               insert_key = 'end';
+               } else {
+                       $j( '#track_' + track_inx + '_clip_' + k ).css( 'border-right', 'solid thin white' );
                }
                return insert_key;
        },
-       deselectClip:function( clipElm ){
-               if(!clipElm){
-                       $j('.mv_selected_clip').removeClass("mv_selected_clip");
-               }else{
-                       $j(clipElm).removeClass("mv_selected_clip");
-                       //make sure the transition sibling is removed:
-                       $j(clipElm).siblings('.clip_trans_box').removeClass( 'mv_selected_transition' );
-                       $j('#' + $j(clipElm).parent().attr("id") + '_adj').fadeOut("fast");
+       deselectClip:function( clipElm ) {
+               if ( !clipElm ) {
+                       $j( '.mv_selected_clip' ).removeClass( "mv_selected_clip" );
+               } else {
+                       $j( clipElm ).removeClass( "mv_selected_clip" );
+                       // make sure the transition sibling is removed:
+                       $j( clipElm ).siblings( '.clip_trans_box' ).removeClass( 'mv_selected_transition' );
+                       $j( '#' + $j( clipElm ).parent().attr( "id" ) + '_adj' ).fadeOut( "fast" );
                }
        },
-       getClipFromSeqID:function( clip_seq_id ){
-               js_log('get id from: ' + clip_seq_id);
-               var ct = clip_seq_id.replace('track_','').replace('clip_','').split('_');
+       getClipFromSeqID:function( clip_seq_id ) {
+               js_log( 'get id from: ' + clip_seq_id );
+               var ct = clip_seq_id.replace( 'track_', '' ).replace( 'clip_', '' ).split( '_' );
                return this.plObj.tracks[ ct[0] ].clips[ ct[1] ];
        },
-       //renders clip frames
-       render_clip_frames:function(clip, frame_offset_count){
-               js_log('f:render_clip_frames: ' + clip.id + ' foc:' + frame_offset_count);
-               var clip_frames_html='';
-               var frame_width = Math.round(this.track_thumb_height*1.3333333);
-
-               var pint = (frame_offset_count==null)?0:frame_offset_count*frame_width;
-
-               //js_log("pinit: "+ pint+ ' < '+clip.width_px+' ++'+frame_width);
-               for(var p=pint;p<clip.width_px;p+=frame_width){
-                       var clip_time = (p==0)?0:Math.round(p*this.timeline_scale);
-                       js_log('rendering clip frames: p:' +p+' pts:'+ (p*this.timeline_scale)+' time:' + clip_time + ' height:'+this.track_thumb_height);
-                       clip_frames_html+=clip.embed.renderTimelineThumbnail({
+       // renders clip frames
+       render_clip_frames:function( clip, frame_offset_count ) {
+               js_log( 'f:render_clip_frames: ' + clip.id + ' foc:' + frame_offset_count );
+               var clip_frames_html = '';
+               var frame_width = Math.round( this.track_thumb_height * 1.3333333 );
+
+               var pint = ( frame_offset_count == null ) ? 0:frame_offset_count * frame_width;
+
+               // js_log("pinit: "+ pint+ ' < '+clip.width_px+' ++'+frame_width);
+               for ( var p = pint; p < clip.width_px; p += frame_width ) {
+                       var clip_time = ( p == 0 ) ? 0:Math.round( p * this.timeline_scale );
+                       js_log( 'rendering clip frames: p:' + p + ' pts:' + ( p * this.timeline_scale ) + ' time:' + clip_time + ' height:' + this.track_thumb_height );
+                       clip_frames_html += clip.embed.renderTimelineThumbnail( {
                                'width':  frame_width,
                                'thumb_class':'mv_tl_thumb',
                                'height': this.track_thumb_height,
-                               'size' : "icon", //set size to "icon" preset
+                               'size' : "icon", // set size to "icon" preset
                                'time':   clip_time
-                       });
+                       } );
                }
-               js_log('render_clip_frames:'+clip_frames_html);
+               js_log( 'render_clip_frames:' + clip_frames_html );
                return clip_frames_html;
        },
-       update_clip_resize:function(clip_element){
-               //js_log('update_clip_resize');
+       update_clip_resize:function( clip_element ) {
+               // js_log('update_clip_resize');
                var this_seq = this;
-               var id_parts = clip_element.id.split('_');
+               var id_parts = clip_element.id.split( '_' );
                track_inx = id_parts[1];
                clip_inx = id_parts[3];
-               //set clip:
+               // set clip:
                var clip = this.plObj.tracks[ track_inx ].clips[ clip_inx ];
-               var clip_desc ='';
-               //would be nice if getting the width did not flicker the border
-               //@@todo do a work around e in resize function has some screen based offset values
-               clip.width_px = $j(clip_element).width();
-               var width_dif = clip.width_px - Math.round( Math.round( clip.getDuration() )/this.timeline_scale);
-               //var left_px = $j(clip_element).css('left');
-
-               var new_clip_dur = Math.round( clip.width_px*this.timeline_scale );
-               var clip_dif = (new_clip_dur - clip.getDuration() );
-               var clip_dif_str = (clip_dif >0)?'+'+clip_dif:clip_dif;
-               //set the edit global delta
+               var clip_desc = '';
+               // would be nice if getting the width did not flicker the border
+               // @@todo do a work around e in resize function has some screen based offset values
+               clip.width_px = $j( clip_element ).width();
+               var width_dif = clip.width_px - Math.round( Math.round( clip.getDuration() ) / this.timeline_scale );
+               // var left_px = $j(clip_element).css('left');
+
+               var new_clip_dur = Math.round( clip.width_px * this.timeline_scale );
+               var clip_dif = ( new_clip_dur - clip.getDuration() );
+               var clip_dif_str = ( clip_dif > 0 ) ? '+' + clip_dif:clip_dif;
+               // set the edit global delta
                this.edit_delta = clip_dif;
 
-               //get new length:
-               clip_desc+='length: ' + seconds2npt(new_clip_dur) +'('+clip_dif_str+')';
-               if(this_seq.resize_mode=='resize_end'){
-                       //expanding right
-                       var new_end = seconds2npt(npt2seconds(clip.embed.end_ntp)+clip_dif);
-                       clip_desc+='<br>end time: ' + new_end;
-                       //also shift all the other clips (after the current)
-                       //js_log("track_inx: " + track_inx + ' clip inx:'+clip_inx);
-                       //$j('#container_track_'+track_inx+' > .mv_clip_drag :gt('+clip_inx+')').each(function(){
-                       $j('#container_track_'+track_inx+' > :gt('+clip_inx+')').each(function(){
-                               var move_id_parts = this.id.split('_');
+               // get new length:
+               clip_desc += 'length: ' + seconds2npt( new_clip_dur ) + '(' + clip_dif_str + ')';
+               if ( this_seq.resize_mode == 'resize_end' ) {
+                       // expanding right
+                       var new_end = seconds2npt( npt2seconds( clip.embed.end_ntp ) + clip_dif );
+                       clip_desc += '<br>end time: ' + new_end;
+                       // also shift all the other clips (after the current)
+                       // js_log("track_inx: " + track_inx + ' clip inx:'+clip_inx);
+                       // $j('#container_track_'+track_inx+' > .mv_clip_drag :gt('+clip_inx+')').each(function(){
+                       $j( '#container_track_' + track_inx + ' > :gt(' + clip_inx + ')' ).each( function() {
+                               var move_id_parts = this.id.split( '_' );
                                var move_clip = this_seq.plObj.tracks[move_id_parts[1]].clips[move_id_parts[3]];
-                               //js_log('should move:'+ this.id);
-                               $j(this).css('left', move_clip.left_px + width_dif);
-                       });
-               }else{
-                       //expanding left (resize_start)
-                       var new_start = seconds2npt(npt2seconds(clip.embed.start_ntp)+clip_dif);
-                       clip_desc+='<br>start time: ' + new_start;
+                               // js_log('should move:'+ this.id);
+                               $j( this ).css( 'left', move_clip.left_px + width_dif );
+                       } );
+               } else {
+                       // expanding left (resize_start)
+                       var new_start = seconds2npt( npt2seconds( clip.embed.start_ntp ) + clip_dif );
+                       clip_desc += '<br>start time: ' + new_start;
                }
 
-               //update clip stats:
-               $j('#'+clip_element.id+' > .mv_clip_stats').html(clip_desc);
-               var frame_width = Math.round(this.track_thumb_height*1.3333333);
-               //check if we need to append some images:
-               var frame_count = $j('#'+clip_element.id+' > img').length;
-               if(clip.width_px > (frame_count *  frame_width) ){
-                       //if dragging left append
-                       js_log('width_px:'+clip.width_px+' framecount:'+frame_count+' Xcw='+(frame_count *  frame_width));
-                       $j('#'+clip_element.id).append(this.render_clip_frames(clip, frame_count));
+               // update clip stats:
+               $j( '#' + clip_element.id + ' > .mv_clip_stats' ).html( clip_desc );
+               var frame_width = Math.round( this.track_thumb_height * 1.3333333 );
+               // check if we need to append some images:
+               var frame_count = $j( '#' + clip_element.id + ' > img' ).length;
+               if ( clip.width_px > ( frame_count *  frame_width ) ) {
+                       // if dragging left append
+                       js_log( 'width_px:' + clip.width_px + ' framecount:' + frame_count + ' Xcw=' + ( frame_count *  frame_width ) );
+                       $j( '#' + clip_element.id ).append( this.render_clip_frames( clip, frame_count ) );
                }
        },
-       //renders cnt_time
-       render_playheadhead_seeker:function(){
-               js_log('render_playheadhead_seeker');
-               //render out time stamps and time "jump" links
-               //first get total width
-
-               //remove the old one if its still there
-               $j('#'+this.timeline_id +'_pl_control').remove();
-               //render out a playlist clip wide and all the way to the right (only playhead and play button) (outside of timeline)
-               $j(this.target_sequence_container).append('<div id="'+ this.timeline_id +'_pl_control"'+
-                       ' style="position:absolute;top:' + (this.plObj.height) +'px;'+
-                       'right:1px;width:'+this.plObj.width+'px;height:'+this.plObj.org_control_height+'" '+
-                       'class="' + this.plObj.ctrlBuilder.pClass + '"><div class="ui-widget ui-corner-bottom ui-state-default control-bar">'+
+       // renders cnt_time
+       render_playheadhead_seeker:function() {
+               js_log( 'render_playheadhead_seeker' );
+               // render out time stamps and time "jump" links
+               // first get total width
+
+               // remove the old one if its still there
+               $j( '#' + this.timeline_id + '_pl_control' ).remove();
+               // render out a playlist clip wide and all the way to the right (only playhead and play button) (outside of timeline)
+               $j( this.target_sequence_container ).append( '<div id="' + this.timeline_id + '_pl_control"' +
+                       ' style="position:absolute;top:' + ( this.plObj.height ) + 'px;' +
+                       'right:1px;width:' + this.plObj.width + 'px;height:' + this.plObj.org_control_height + '" ' +
+                       'class="' + this.plObj.ctrlBuilder.pClass + '"><div class="ui-widget ui-corner-bottom ui-state-default control-bar">' +
                                         this.plObj.getControlsHTML() +
-                                '</div>'+
-                       '</div>');
-               //update time and render out clip dividers .. should be used to show load progress
+                                '</div>' +
+                       '</div>' );
+               // update time and render out clip dividers .. should be used to show load progress
                this.plObj.updateBaseStatus();
 
-               //once the controls are in the DOM add hooks:
-               this.plObj.ctrlBuilder.addControlHooks( $j('#' + this.timeline_id + '_pl_control' ) );
+               // once the controls are in the DOM add hooks:
+               this.plObj.ctrlBuilder.addControlHooks( $j( '#' + this.timeline_id + '_pl_control' ) );
 
-               //render out the "jump" div
-               if(this.timeline_mode=='time'){
+               // render out the "jump" div
+               if ( this.timeline_mode == 'time' ) {
                        /*$j('#'+this.timeline_id+'_head_jump').width(pixle_length);
                        //output times every 50pixles
                        var out='';
@@ -1463,106 +1463,106 @@ mvSequencer.prototype = {
 
                }
        },
-       jt:function( jh_time ){
-               js_log('jt:' + jh_time);
+       jt:function( jh_time ) {
+               js_log( 'jt:' + jh_time );
                var this_seq = this;
                this.playline_time = jh_time;
-               js_log('time: ' + seconds2npt(jh_time) + ' ' + Math.round(jh_time/this.timeline_scale));
-               //render playline at given time
-               $j('#'+this.timeline_id+'_playline').css('left', Math.round(jh_time/this.timeline_scale)+'px' );
-               cur_pl_time=0;
-               //update the thumb with the requested time:
+               js_log( 'time: ' + seconds2npt( jh_time ) + ' ' + Math.round( jh_time / this.timeline_scale ) );
+               // render playline at given time
+               $j( '#' + this.timeline_id + '_playline' ).css( 'left', Math.round( jh_time / this.timeline_scale ) + 'px' );
+               cur_pl_time = 0;
+               // update the thumb with the requested time:
                this.plObj.updateThumbTime( jh_time );
        },
-       //adjusts the current scale
-       zoom_in:function(){
-               this.timeline_scale = this.timeline_scale*.75;
+       // adjusts the current scale
+       zoom_in:function() {
+               this.timeline_scale = this.timeline_scale * .75;
                this.do_refresh_timeline();
-               js_log('zoomed in:'+this.timeline_scale);
+               js_log( 'zoomed in:' + this.timeline_scale );
        },
-       zoom_out:function(){
-               this.timeline_scale = this.timeline_scale*(1+(1/3));
+       zoom_out:function() {
+               this.timeline_scale = this.timeline_scale * ( 1 + ( 1 / 3 ) );
                this.do_refresh_timeline();
-               js_log('zoom out: '+this.timeline_scale);
+               js_log( 'zoom out: ' + this.timeline_scale );
        },
-       do_refresh_timeline:function( preserve_selection ){
-               js_log('Sequencer:do_refresh_timeline()');
-               //@@todo should "lock" interface while refreshing timeline
+       do_refresh_timeline:function( preserve_selection ) {
+               js_log( 'Sequencer:do_refresh_timeline()' );
+               // @@todo should "lock" interface while refreshing timeline
                var pSelClips = [];
-               if(preserve_selection){
-                       $j('.mv_selected_clip').each(function(){
-                               pSelClips.push( $j(this).parent().attr('id') );
-                       });
+               if ( preserve_selection ) {
+                       $j( '.mv_selected_clip' ).each( function() {
+                               pSelClips.push( $j( this ).parent().attr( 'id' ) );
+                       } );
                }
-               //regen duration
+               // regen duration
                this.plObj.getDuration( true );
-               //refresh player:
+               // refresh player:
                this.plObj.getHTML();
 
-               //this.render_playheadhead_seeker();
+               // this.render_playheadhead_seeker();
                this.render_tracks();
-               this.jt(this.playline_time);
+               this.jt( this.playline_time );
 
-               if(preserve_selection){
-                       for(var i=0;i < pSelClips.length; i++){
-                               $j('#' + pSelClips[i] + ' .mv_clip_thumb').addClass('mv_selected_clip');
+               if ( preserve_selection ) {
+                       for ( var i = 0; i < pSelClips.length; i++ ) {
+                               $j( '#' + pSelClips[i] + ' .mv_clip_thumb' ).addClass( 'mv_selected_clip' );
                        }
                }
        }
 
 }
 /* extension to mvPlayList to support sequencer features properties */
-var mvSeqPlayList = function( element ){
+var mvSeqPlayList = function( element ) {
        return this.init( element );
 }
 mvSeqPlayList.prototype = {
-       init:function(element){
-               var myPlObj = new mvPlayList(element);
-
-               //inherit mvClip
-               for(var method in myPlObj){
-                       if(typeof this[method] != 'undefined' ){
-                               this[ 'parent_' + method ]=myPlObj[method];
-                       }else{
+       init:function( element ) {
+               var myPlObj = new mvPlayList( element );
+
+               // inherit mvClip
+               for ( var method in myPlObj ) {
+                       if ( typeof this[method] != 'undefined' ) {
+                               this[ 'parent_' + method ] = myPlObj[method];
+                       } else {
                                this[method] = myPlObj[method];
                        }
                }
 
                this.org_control_height = this.pl_layout.control_height;
-               //do specific mods:(controls and title are managed by the sequencer)
-               this.pl_layout.title_bar_height=0;
-               this.pl_layout.control_height=0;
+               // do specific mods:(controls and title are managed by the sequencer)
+               this.pl_layout.title_bar_height = 0;
+               this.pl_layout.control_height = 0;
        },
-       setSliderValue:function( perc ){
-               js_log('setSliderValue::'+ perc);
-               //get the track_clipThumb_height from parent mvSequencer
+       setSliderValue:function( perc ) {
+               js_log( 'setSliderValue::' + perc );
+               // get the track_clipThumb_height from parent mvSequencer
                var frame_width = Math.round( this.pSeq.track_clipThumb_height * 1.3333333 );
-               var container_width = frame_width+60;
+               var container_width = frame_width + 60;
 
                var perc_clip = this.cur_clip.embed.currentTime / this.cur_clip.getDuration();
 
-               var left_px = parseInt( (this.cur_clip.order * container_width) + (frame_width*perc_clip) ) + 'px';
-               js_log("set " + perc + ' of cur_clip: ' + this.cur_clip.order + ' lp:'+left_px);
+               var left_px = parseInt( ( this.cur_clip.order * container_width ) + ( frame_width * perc_clip ) ) + 'px';
+               js_log( "set " + perc + ' of cur_clip: ' + this.cur_clip.order + ' lp:' + left_px );
 
 
-               //update the timeline playhead and
-               $j('#' + this.seqObj.timeline_id + '_playline').css('left', left_px);
+               // update the timeline playhead and
+               $j( '#' + this.seqObj.timeline_id + '_playline' ).css( 'left', left_px );
 
-               //pass update request to parent:
+               // pass update request to parent:
                this.parent_setSliderValue( perc );
        },
-       getControlsHTML:function(){
-               //get controls from current clip add some playlist specific controls:
+       getControlsHTML:function() {
+               // get controls from current clip add some playlist specific controls:
                this.cur_clip.embed.supports['prev_next'] = true;
                this.cur_clip.embed.supports['options']   = false;
                return ctrlBuilder.getControls( this.cur_clip.embed );
        },
-       //override renderDisplay
-       renderDisplay:function(){
-               js_log('mvSequence:renderDisplay');
-               //setup layout for title and dc_ clip container
-               $j(this).html('<div id="dc_'+this.id+'" style="width:'+this.width+'px;' +
-                               'height:'+(this.height)+'px;position:relative;" />');
+       // override renderDisplay
+       renderDisplay:function() {
+               js_log( 'mvSequence:renderDisplay' );
+               // setup layout for title and dc_ clip container
+               $j( this ).html( '<div id="dc_' + this.id + '" style="width:' + this.width + 'px;' +
+                               'height:' + ( this.height ) + 'px;position:relative;" />' );
 
                this.setupClipDisplay();
        }
index 516efed..0edb752 100644 (file)
@@ -5,8 +5,8 @@
 *
 */
 
-//add our local msgs
-loadGM({
+// add our local msgs
+loadGM( {
        "mwe-transition_in" : "Transition in",
        "mwe-transition_out" : "Transition out",
        "mwe-effects" : "Effects stack",
@@ -14,254 +14,254 @@ loadGM({
        "mwe-edit_transin" : "Edit transition into clip",
        "mwe-edit_transout" : "Edit transition out of clip",
        "mwe-add-transition" : "Add a transition"
-});
+} );
 
 var default_timed_effect_values = {
        'rObj': null,            // the resource object
-       'clip_disp_ct':null, //target clip disp
-       'control_ct':null,       //control container
+       'clip_disp_ct':null, // target clip disp
+       'control_ct':null,       // control container
 
-       'parent_ct': null,       //parent container
-       'pSeq': null,    //parent sequence Object
+       'parent_ct': null,       // parent container
+       'pSeq': null,    // parent sequence Object
 
-       'edit_action': null, //the requested edit action
+       'edit_action': null, // the requested edit action
 };
 
-var mvTimedEffectsEdit =function(iObj) {
-       return this.init(iObj);
+var mvTimedEffectsEdit = function( iObj ) {
+       return this.init( iObj );
 };
-//set up the mvSequencer object
+// set up the mvSequencer object
 mvTimedEffectsEdit.prototype = {
-       //the menu_items Object contains: default html, js setup/loader functions
+       // the menu_items Object contains: default html, js setup/loader functions
        menu_items : {
-               'transin':{
-                       'title':gM('mwe-transition_in'),
+               'transin': {
+                       'title':gM( 'mwe-transition_in' ),
                        'clip_attr':'transIn',
-                       'doEdit':function(_this){
-                               _this.doTransitionDisplayEdit('transin');
+                       'doEdit':function( _this ) {
+                               _this.doTransitionDisplayEdit( 'transin' );
                        }
                },
-               'transout':{
-                       'title':gM('mwe-transition_out'),
+               'transout': {
+                       'title':gM( 'mwe-transition_out' ),
                        'clip_attr':'transOut',
-                       'doEdit':function(_this){
-                               _this.doTransitionDisplayEdit('transout');
+                       'doEdit':function( _this ) {
+                               _this.doTransitionDisplayEdit( 'transout' );
                        }
                },
-               'effects':{
-                       'title':gM('mwe-effects'),
+               'effects': {
+                       'title':gM( 'mwe-effects' ),
                        'clip_attr':'Effects',
-                       'doEdit':function(_this){
-                               //display
+                       'doEdit':function( _this ) {
+                               // display
                                _this.doEditEffectDisplayEdit();
                        }
                }
        },
-       init:function(iObj){
-               //init object:
-               for(var i in default_timed_effect_values){
-                       if( iObj[i] ){
+       init:function( iObj ) {
+               // init object:
+               for ( var i in default_timed_effect_values ) {
+                       if ( iObj[i] ) {
                                this[i] = iObj[i];
                        }
                }
                this.doEditMenu();
        },
-       doEditMenu:function(){
-               js_log('mvTimedEffects : doEditMenu::');
+       doEditMenu:function() {
+               js_log( 'mvTimedEffects : doEditMenu::' );
                var _this = this;
-               //add in subMenus if set
-               //check for submenu and add to item container
+               // add in subMenus if set
+               // check for submenu and add to item container
 
-               //update the default edit display (if we have a target)
+               // update the default edit display (if we have a target)
                var tTarget = 'transin';
-               if(this.rObj.transOut)
+               if ( this.rObj.transOut )
                        tTarget = 'transout';
-               if(this.rObj.effects)
+               if ( this.rObj.effects )
                        tTarget = 'effects';
 
-               var o='';
-               var tabc ='';
-               o+= '<div id="mv_submenu_timedeffect">';
-               o+='<ul>';
-               var inx =0;
-               var selected_tab=0;
-               $j.each(this.menu_items, function(sInx, mItem){
-                       if( sInx == tTarget){
+               var o = '';
+               var tabc = '';
+               o += '<div id="mv_submenu_timedeffect">';
+               o += '<ul>';
+               var inx = 0;
+               var selected_tab = 0;
+               $j.each( this.menu_items, function( sInx, mItem ) {
+                       if ( sInx == tTarget ) {
                                selected_tab = inx;
                        }
-                       //check if the given editType is valid for our given media type
-                       o+=     '<li>'+
-                                       '<a id="mv_te_'+sInx+'" href="#te_' + sInx + '">' + mItem.title + '</a>'+
+                       // check if the given editType is valid for our given media type
+                       o +=    '<li>' +
+                                       '<a id="mv_te_' + sInx + '" href="#te_' + sInx + '">' + mItem.title + '</a>' +
                                '</li>';
                        tabc += '<div id="te_' + sInx + '" style="overflow:auto;" ></div>';
                        inx++;
-               });
-               o+= '</ul>' + tabc;
-               o+= '</div>';
-               //add sub menu container with menu html:
-               $j('#'+this.control_ct).html( o ) ;
-               js_log('should have set: #'+this.control_ct + ' to: ' + o);
-               //set up bindins:
-               $j('#mv_submenu_timedeffect').tabs({
+               } );
+               o += '</ul>' + tabc;
+               o += '</div>';
+               // add sub menu container with menu html:
+               $j( '#' + this.control_ct ).html( o ) ;
+               js_log( 'should have set: #' + this.control_ct + ' to: ' + o );
+               // set up bindins:
+               $j( '#mv_submenu_timedeffect' ).tabs( {
                        selected: selected_tab,
-                       select: function(event, ui) {
-                               _this.doDisplayEdit( $j(ui.tab).attr('id').replace('mv_te_', '') );
+                       select: function( event, ui ) {
+                               _this.doDisplayEdit( $j( ui.tab ).attr( 'id' ).replace( 'mv_te_', '' ) );
                        }
-               }).addClass('ui-tabs-vertical ui-helper-clearfix');
-               //close left:
-               $j("#mv_submenu_clipedit li").removeClass('ui-corner-top').addClass('ui-corner-left');
-               _this.doDisplayEdit(tTarget);
+               } ).addClass( 'ui-tabs-vertical ui-helper-clearfix' );
+               // close left:
+               $j( "#mv_submenu_clipedit li" ).removeClass( 'ui-corner-top' ).addClass( 'ui-corner-left' );
+               _this.doDisplayEdit( tTarget );
        },
-       doDisplayEdit:function( tab_id ){
-               //@@todo fix the double display of doDisplayEdit
-               js_log("doDisplayEdit::");
-               if( !this.menu_items[ tab_id ] ){
-                       js_log('error: doDisplayEdit missing item:' + tab_id);
-               }else{
-                       //use the menu_item config to map to function display
-                       this.menu_items[tab_id].doEdit(this);
+       doDisplayEdit:function( tab_id ) {
+               // @@todo fix the double display of doDisplayEdit
+               js_log( "doDisplayEdit::" );
+               if ( !this.menu_items[ tab_id ] ) {
+                       js_log( 'error: doDisplayEdit missing item:' + tab_id );
+               } else {
+                       // use the menu_item config to map to function display
+                       this.menu_items[tab_id].doEdit( this );
                }
        },
-       doEditEffectDisplayEdit:function(){
+       doEditEffectDisplayEdit:function() {
                var _this = this;
                var appendTarget = '#te_effects';
-               js_log('type:' + _this.rObj['type']);
-               $j(appendTarget).html(gM('mwe-loading_txt'));
-               //@@todo integrate into core and loading system:
-               loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/editor.js?' + getMwReqParam() );
-               loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
-               loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/ui.js?' + getMwReqParam() );
-               loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/uidata.js?' + getMwReqParam() );
-               loadExternalCss(mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
+               js_log( 'type:' + _this.rObj['type'] );
+               $j( appendTarget ).html( gM( 'mwe-loading_txt' ) );
+               // @@todo integrate into core and loading system:
+               loadExternalJs( mv_embed_path + 'libClipEdit/pixastic-editor/editor.js?' + getMwReqParam() );
+               loadExternalJs( mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
+               loadExternalJs( mv_embed_path + 'libClipEdit/pixastic-editor/ui.js?' + getMwReqParam() );
+               loadExternalJs( mv_embed_path + 'libClipEdit/pixastic-editor/uidata.js?' + getMwReqParam() );
+               loadExternalCss( mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
 
-               var isPixasticReady = function(){
-                       if(typeof PixasticEditor != 'undefined'){
-                               $j(appendTarget).html('<a href="#" class="run_effect_demo">Run Pixastic Editor Demo</a> (not yet fully integrated/ super alpha)<br> best to view <a href="http://www.pixastic.com/editor-test/">stand alone</a>');
-                               $j(appendTarget + ' .run_effect_demo').click(function(){
+               var isPixasticReady = function() {
+                       if ( typeof PixasticEditor != 'undefined' ) {
+                               $j( appendTarget ).html( '<a href="#" class="run_effect_demo">Run Pixastic Editor Demo</a> (not yet fully integrated/ super alpha)<br> best to view <a href="http://www.pixastic.com/editor-test/">stand alone</a>' );
+                               $j( appendTarget + ' .run_effect_demo' ).click( function() {
                                        var cat = _this;
-                                       var imgElm = $j( '.clip_container:visible  img').get(0);
-                                       PixasticEditor.load(imgElm);
-                               });
-                       }else{
-                               setTimeout(isPixasticReady, 100)
+                                       var imgElm = $j( '.clip_container:visible  img' ).get( 0 );
+                                       PixasticEditor.load( imgElm );
+                               } );
+                       } else {
+                               setTimeout( isPixasticReady, 100 )
                        }
                }
                isPixasticReady();
        },
-       doTransitionDisplayEdit:function(target_item){
+       doTransitionDisplayEdit:function( target_item ) {
                var _this = this;
-               js_log("doTransitionDisplayEdit: "+ target_item);
+               js_log( "doTransitionDisplayEdit: " + target_item );
                var apendTarget = '#te_' + target_item;
-               //check if we have a transition of type clip_attr
-               if(!this.rObj[ this.menu_items[ target_item ].clip_attr ]){
-                       //empty append the transition list:
+               // check if we have a transition of type clip_attr
+               if ( !this.rObj[ this.menu_items[ target_item ].clip_attr ] ) {
+                       // empty append the transition list:
                        this.getTransitionListControl( apendTarget );
                        return ;
                }
                var cTran = this.rObj[ this.menu_items[ target_item ].clip_attr ];
-               var o='<h3>' + gM('mwe-edit_'+target_item ) + '</h3>';
-               o+='Type: ' +
+               var o = '<h3>' + gM( 'mwe-edit_' + target_item ) + '</h3>';
+               o += 'Type: ' +
                        '<select class="te_select_type">';
-               for(var typeKey in mvTransLib.type){
-                       var selAttr = (cTran.type == typeKey)?' selected':'';
-                       o+='<option     value="'+typeKey+'"'+ selAttr +'>'+typeKey+'</option>';
+               for ( var typeKey in mvTransLib.type ) {
+                       var selAttr = ( cTran.type == typeKey ) ? ' selected':'';
+                       o += '<option   value="' + typeKey + '"' + selAttr + '>' + typeKey + '</option>';
                }
-               o+='</select><br>';
-               o+='<span class="te_subtype_container"></span>';
+               o += '</select><br>';
+               o += '<span class="te_subtype_container"></span>';
 
-               //add html and select bindings
-               $j(apendTarget).html(o).children('.te_select_type')
-                       .change(function(){
-                               var selectedType = $j(this).val();
-                               //update subtype listing:
-                               _this.getSubTypeControl(target_item, selectedType, apendTarget + ' .te_subtype_container' );
-                       });
-               //add subtype control
+               // add html and select bindings
+               $j( apendTarget ).html( o ).children( '.te_select_type' )
+                       .change( function() {
+                               var selectedType = $j( this ).val();
+                               // update subtype listing:
+                               _this.getSubTypeControl( target_item, selectedType, apendTarget + ' .te_subtype_container' );
+                       } );
+               // add subtype control
                _this.getSubTypeControl( target_item, cTran.type, apendTarget + ' .te_subtype_container' );
 
-               //add remove transition button:
-               $j(apendTarget).append( '<br><br>' + $j.btnHtml(gM('mwe-remove_transition'), 'te_remove_transition', 'close'  ) )
-                       .children('.te_remove_transition')
-                       .click(function(){
-                               //remove the transtion from the playlist
+               // add remove transition button:
+               $j( apendTarget ).append( '<br><br>' + $j.btnHtml( gM( 'mwe-remove_transition' ), 'te_remove_transition', 'close'  ) )
+                       .children( '.te_remove_transition' )
+                       .click( function() {
+                               // remove the transtion from the playlist
                                _this.pSeq.plObj.transitions[cTran.id] = null;
-                               //remove the transtion from the clip:
+                               // remove the transtion from the clip:
                                _this.rObj[ _this.menu_items[ target_item ].clip_attr ] = null;
-                               //update the interface:
+                               // update the interface:
                                _this.doTransitionDisplayEdit( target_item );
-                               //update the sequence
+                               // update the sequence
                                _this.pSeq.do_refresh_timeline();
-                       });
+                       } );
        },
-       getSubTypeControl:function(target_item, transition_type, htmlTarget){
+       getSubTypeControl:function( target_item, transition_type, htmlTarget ) {
                var _this = this;
                var cTran = this.rObj[ this.menu_items[ target_item ].clip_attr ];
-               var o='Sub Type:<select class="te_subtype_select">';
-               for(var subTypeKey in mvTransLib.type[ transition_type ]){
-                       var selAttr = (cTran.subtype == subTypeKey) ? ' selected' : '';
-                       o+='<option     value="'+subTypeKey+'"'+ selAttr +'>'+subTypeKey+'</option>';
+               var o = 'Sub Type:<select class="te_subtype_select">';
+               for ( var subTypeKey in mvTransLib.type[ transition_type ] ) {
+                       var selAttr = ( cTran.subtype == subTypeKey ) ? ' selected' : '';
+                       o += '<option   value="' + subTypeKey + '"' + selAttr + '>' + subTypeKey + '</option>';
                }
-               o+='</select><br>';
-               $j(htmlTarget).html(o)
-                       .children('.te_subtype_select')
-                       .change(function(){
-                               //update the property
-                               cTran.subtype = $j(this).val();
-                               //re-gen timeline / playlist
+               o += '</select><br>';
+               $j( htmlTarget ).html( o )
+                       .children( '.te_subtype_select' )
+                       .change( function() {
+                               // update the property
+                               cTran.subtype = $j( this ).val();
+                               // re-gen timeline / playlist
                                _this.pSeq.do_refresh_timeline();
-                               //(re-select self?)
-                               _this.getSubTypeControl(target_item, transition_type, htmlTarget);
-               });
-               var o='';
-               //check for extra properties control:
-               for(var i=0; i < mvTransLib.type[ transition_type ][ cTran.subtype ].attr.length; i++){
-                       var tAttr =mvTransLib.type[ transition_type ][ cTran.subtype ].attr[i]
-                       switch(tAttr){
+                               // (re-select self?)
+                               _this.getSubTypeControl( target_item, transition_type, htmlTarget );
+               } );
+               var o = '';
+               // check for extra properties control:
+               for ( var i = 0; i < mvTransLib.type[ transition_type ][ cTran.subtype ].attr.length; i++ ) {
+                       var tAttr = mvTransLib.type[ transition_type ][ cTran.subtype ].attr[i]
+                       switch( tAttr ) {
                                case 'fadeColor':
-                                       var cColor = (cTran['fadeColor'])?cTran['fadeColor']:'';
-                                       $j(htmlTarget).append('Select Color: <div class="colorSelector"><div class="colorIndicator" style="background-color: '+cColor+'"></div></div>');
-                                       js_log('cs target: '+htmlTarget +' .colorSelector' );
+                                       var cColor = ( cTran['fadeColor'] ) ? cTran['fadeColor']:'';
+                                       $j( htmlTarget ).append( 'Select Color: <div class="colorSelector"><div class="colorIndicator" style="background-color: ' + cColor + '"></div></div>' );
+                                       js_log( 'cs target: ' + htmlTarget + ' .colorSelector' );
 
 
-                                       $j(htmlTarget + ' .colorSelector').ColorPicker({
+                                       $j( htmlTarget + ' .colorSelector' ).ColorPicker( {
                                                color: cColor,
-                                               onShow: function (colpkr) {
-                                                       //make sure its ontop:
-                                                       $j(colpkr).css("zIndex", "12");
-                                                       $j(colpkr).fadeIn(500);
+                                               onShow: function ( colpkr ) {
+                                                       // make sure its ontop:
+                                                       $j( colpkr ).css( "zIndex", "12" );
+                                                       $j( colpkr ).fadeIn( 500 );
                                                        return false;
                                                },
-                                               onHide: function (colpkr) {
-                                                       $j(colpkr).fadeOut(500);
-                                                       _this.pSeq.plObj.setCurrentTime(0, function(){
-                                                               js_log("render ready");
-                                                       });
+                                               onHide: function ( colpkr ) {
+                                                       $j( colpkr ).fadeOut( 500 );
+                                                       _this.pSeq.plObj.setCurrentTime( 0, function() {
+                                                               js_log( "render ready" );
+                                                       } );
                                                        return false;
                                                },
-                                               onChange: function (hsb, hex, rgb) {
-                                                       $j(htmlTarget + ' .colorIndicator').css('backgroundColor', '#' + hex);
-                                                       //update the transition
+                                               onChange: function ( hsb, hex, rgb ) {
+                                                       $j( htmlTarget + ' .colorIndicator' ).css( 'backgroundColor', '#' + hex );
+                                                       // update the transition
                                                        cTran['fadeColor'] =  '#' + hex;
                                                }
-                                       })
+                                       } )
                                break;
                        }
                }
-               //and finally add effect timeline scruber (for timed effects this also stores keyframes)
+               // and finally add effect timeline scruber (for timed effects this also stores keyframes)
 
        },
-       getTransitionListControl : function(target_out){
-               js_log("getTransitionListControl");
-               var o= '<h3>' + gM('mwe-add-transition') +'</h3>';
-               for(var type in mvTransLib['type']){
-                       js_log('on tran type: ' + i);
+       getTransitionListControl : function( target_out ) {
+               js_log( "getTransitionListControl" );
+               var o = '<h3>' + gM( 'mwe-add-transition' ) + '</h3>';
+               for ( var type in mvTransLib['type'] ) {
+                       js_log( 'on tran type: ' + i );
                        var base_trans_name = i;
                        var tLibSet = mvTransLib['type'][ type ];
-                       for(var subtype in tLibSet){
-                               o+='<img style="float:left;padding:10px;" '+
-                                       'src="' + mvTransLib.getTransitionIcon(type, subtype)+ '">';
+                       for ( var subtype in tLibSet ) {
+                               o += '<img style="float:left;padding:10px;" ' +
+                                       'src="' + mvTransLib.getTransitionIcon( type, subtype ) + '">';
                        }
                }
-               $j(target_out).html(o);
+               $j( target_out ).html( o );
        }
 };
index 3e3f5a7..8f8e477 100644 (file)
         extends the base remote search driver with sequence specific stuff
 */
 
-var seqRemoteSearchDriver = function(iObj){
+var seqRemoteSearchDriver = function( iObj ) {
        return this.init( iObj )
 }
 seqRemoteSearchDriver.prototype = {
        sequence_add_target:false,
-       init:function( this_seq ){
+       init:function( this_seq ) {
                var _this = this;
-               js_log("init:seqRemoteSearchDriver");
-               //setup remote search driver with a seq parent:
+               js_log( "init:seqRemoteSearchDriver" );
+               // setup remote search driver with a seq parent:
                this.pSeq = this_seq;
                var iObj = {
                        'target_container'      : '#cliplib_ic',
                        'local_wiki_api_url': this_seq.getLocalApiUrl(),
                        'instance_name'         : this_seq.instance_name + '.mySearch',
                        'default_query'         : this.pSeq.plObj.title
-               }               
-               if(typeof this_seq.amw_conf != 'undefined')
-                       $j.extend(iObj,  this_seq.amw_conf);
+               }
+               if ( typeof this_seq.amw_conf != 'undefined' )
+                       $j.extend( iObj,  this_seq.amw_conf );
                        
        
-               //inherit the remoteSearchDriver properties:n
+               // inherit the remoteSearchDriver properties:n
                var tmpRSD = new remoteSearchDriver( iObj );
-               for(var i in tmpRSD){
-                       if(this[i]){
-                               this['parent_'+i] = tmpRSD[i];
-                       }else{
+               for ( var i in tmpRSD ) {
+                       if ( this[i] ) {
+                               this['parent_' + i] = tmpRSD[i];
+                       } else {
                                this[i] = tmpRSD[i];
                        }
-               }                       
-               //extend parent_do_refresh_timeline actions:
-               if(!this.pSeq.parent_do_refresh_timeline){
+               }
+               // extend parent_do_refresh_timeline actions:
+               if ( !this.pSeq.parent_do_refresh_timeline ) {
                        this.pSeq.parent_do_refresh_timeline = this.pSeq.do_refresh_timeline;
-                       this.pSeq.do_refresh_timeline = function(){
-                               js_log("seqRemoteSearchDriver::" + _this.pSeq.disp_menu_item);
-                               //call the parent
+                       this.pSeq.do_refresh_timeline = function() {
+                               js_log( "seqRemoteSearchDriver::" + _this.pSeq.disp_menu_item );
+                               // call the parent
                                _this.pSeq.parent_do_refresh_timeline();
-                               //add our local bindings
+                               // add our local bindings
                                _this.addResultBindings();
                                return true;
                        }
                }
        },
-       resourceEdit:function(){
+       resourceEdit:function() {
                var _this = this;
 
        },
-       addResultBindings:function(){
-               //set up seq:
+       addResultBindings:function() {
+               // set up seq:
                var _this = this;
-               //setup parent bindings:
+               // setup parent bindings:
                this.parent_addResultBindings();
 
-               //Add an additional click binding
-               $j('.rsd_res_item').click(function(){
-                       js_log('SeqRemoteSearch: rsd_res_item: click (remove sequence_add_target)');
-                       _this.sequence_add_target =false;
-               });
+               // Add an additional click binding
+               $j( '.rsd_res_item' ).click( function() {
+                       js_log( 'SeqRemoteSearch: rsd_res_item: click (remove sequence_add_target)' );
+                       _this.sequence_add_target = false;
+               } );
 
-               //Add an additional drag binding
-               $j( '.rsd_res_item' ).draggable('destroy').draggable({
-                       helper:function(){
-                               return $j( this ).clone().appendTo('body').css({'z-index':9999}).get(0);
+               // Add an additional drag binding
+               $j( '.rsd_res_item' ).draggable( 'destroy' ).draggable( {
+                       helper:function() {
+                               return $j( this ). clone ().appendTo( 'body' ).css( { 'z-index':9999 } ).get( 0 );
                        },
                        revert:'invalid',
-                       start:function(){
-                               js_log('start drag');
+                       start:function() {
+                               js_log( 'start drag' );
                        }
-               });
-               $j(".mv_clip_drag").droppable( 'destroy' ).droppable({
+               } );
+               $j( ".mv_clip_drag" ).droppable( 'destroy' ).droppable( {
                        accept: '.rsd_res_item',
-                       over:function(event, ui){
-                               //js_log("over : mv_clip_drag: " + $j(this).attr('id') );
-                               $j(this).css('border-right', 'solid thick red');
+                       over:function( event, ui ) {
+                               // js_log("over : mv_clip_drag: " + $j(this).attr('id') );
+                               $j( this ).css( 'border-right', 'solid thick red' );
                        },
-                       out:function(event, ui){
-                               $j(this).css('border-right', 'solid thin white');
+                       out:function( event, ui ) {
+                               $j( this ).css( 'border-right', 'solid thin white' );
                        },
-                       drop: function(event, ui) {
-                               $j(this).css('border-right', 'solid thin white');
-                               js_log("Droped: "+ $j(ui.draggable).attr('id') +' on ' +  $j(this).attr('id') );
-                               _this.sequence_add_target =  $j(this).attr('id');
-                               //load the orginal draged item
-                               var rObj = _this.getResourceFromId( $j(ui.draggable).attr('id') );
-                               _this.resourceEdit(rObj, ui.draggable);
+                       drop: function( event, ui ) {
+                               $j( this ).css( 'border-right', 'solid thin white' );
+                               js_log( "Droped: " + $j( ui.draggable ).attr( 'id' ) + ' on ' +  $j( this ).attr( 'id' ) );
+                               _this.sequence_add_target =  $j( this ).attr( 'id' );
+                               // load the orginal draged item
+                               var rObj = _this.getResourceFromId( $j( ui.draggable ).attr( 'id' ) );
+                               _this.resourceEdit( rObj, ui.draggable );
                        }
-               });
+               } );
 
        },
-       insertResource:function(rObj){
+       insertResource:function( rObj ) {
                var _this = this;
-               js_log("SEQ insert resource after:" + _this.sequence_add_target  + ' of type: ' + rObj.mime);
-               if(_this.sequence_add_target ){
+               js_log( "SEQ insert resource after:" + _this.sequence_add_target  + ' of type: ' + rObj.mime );
+               if ( _this.sequence_add_target ) {
                        var tClip = _this.pSeq.getClipFromSeqID( _this.sequence_add_target );
                        var target_order = false;
-                       if(tClip)
+                       if ( tClip )
                                var target_order = tClip.order;
                }
-               //@@todo show watting of sorts.
+               // @@todo show watting of sorts.
 
-               //get target order:
+               // get target order:
                var cat = rObj;
-               //check for target insert path
-               this.checkImportResource( rObj, function(){
+               // check for target insert path
+               this.checkImportResource( rObj, function() {
 
                        var clipConfig = {
                                'type'   : rObj.mime,
                                'uri'    : _this.cFileNS + ':' + rObj.target_resource_title,
                                'title'  : rObj.title
                        };
-                       //set via local properites if avaliable
-                       clipConfig['src'] = (rObj.local_src) ? rObj.local_src : rObj.src;
+                       // set via local properites if avaliable
+                       clipConfig['src'] = ( rObj.local_src ) ? rObj.local_src : rObj.src;
                        clipConfig['poster'] = ( rObj.local_poster ) ? rObj.local_poster : rObj.poster;
 
-                       if(rObj.start_time && rObj.end_time){
+                       if ( rObj.start_time && rObj.end_time ) {
                                clipConfig['dur'] = npt2seconds( rObj.end_time ) - npt2seconds( rObj.start_time );
-                       }else{
-                               //provide a default duration if none set
+                       } else {
+                               // provide a default duration if none set
                                clipConfig['dur'] = 4;
                        }
 
-                       //create the media element (target order+1 (since we insert (after)
-                       _this.pSeq.plObj.tryAddMediaObj( clipConfig, (parseInt(target_order) + 1) );
-                       //refresh the timeline:
+                       // create the media element (target order+1 (since we insert (after)
+                       _this.pSeq.plObj.tryAddMediaObj( clipConfig, ( parseInt( target_order ) + 1 ) );
+                       // refresh the timeline:
                        _this.pSeq.do_refresh_timeline();
-                       js_log("run close all: ");
+                       js_log( "run close all: " );
                        _this.closeAll();
-               });
+               } );
        },
-       getClipEditControlActions:function(){
+       getClipEditControlActions:function() {
                var _this = this;
                return {
-                       'insert_seq':function(rObj){
+                       'insert_seq':function( rObj ) {
                                _this.insertResource( rObj )
                        },
-                       'cancel':function(rObj){
+                       'cancel':function( rObj ) {
                                _this.cancelClipEditCB( rObj )
                        }
                };
        },
-       resourceEdit:function(rObj, rsdElement){
+       resourceEdit:function( rObj, rsdElement ) {
                var _this = this;
-               //don't resize to default (full screen behavior)
-               _this.dmodalCss = {};
-               //open up a new target_contaienr:
-               if( $j('#seq_resource_import').length == 0 )
-                       $j('body').append('<div id="seq_resource_import" style="position:relative"></div>');
-               var bConf = {};
+               // don't resize to default (full screen behavior)
+               _this.dmodalCss = { };
+               // open up a new target_contaienr:
+               if ( $j( '#seq_resource_import' ).length == 0 )
+                       $j( 'body' ).append( '<div id="seq_resource_import" style="position:relative"></div>' );
+               var bConf = { };
                bConf[ gM( 'mwe-cancel' ) ] = function() {
-                       $j(this).dialog("close");
+                       $j( this ).dialog( "close" );
                }
-               $j('#seq_resource_import').dialog('destroy').dialog({
+               $j( '#seq_resource_import' ).dialog( 'destroy' ).dialog( {
                        bgiframe: true,
                        width:750,
                        height:480,
                        modal: true,
                        buttons: bConf
-               });
+               } );
                _this.target_container = '#seq_resource_import';
-               //do parent resource edit (with updated target)
-               this.parent_resourceEdit(rObj, rsdElement);
+               // do parent resource edit (with updated target)
+               this.parent_resourceEdit( rObj, rsdElement );
        },
-       closeAll:function(){
-               js_log( 'should close: seq_resource_import');
-               $j('#seq_resource_import').dialog('close').dialog('destroy').remove();
+       closeAll:function() {
+               js_log( 'should close: seq_resource_import' );
+               $j( '#seq_resource_import' ).dialog( 'close' ).dialog( 'destroy' ).remove();
                this.parent_closeAll();
        },
-       getEditToken:function(callback){
-               if(this.pSeq.sequenceEditToken){
+       getEditToken:function( callback ) {
+               if ( this.pSeq.sequenceEditToken ) {
                        callback( this.pSeq.sequenceEditToken )
-               }else{
-                       this.parent_getEditToken(callback);
+               } else {
+                       this.parent_getEditToken( callback );
                }
        },
-       cancelClipEditCB:function(){
-               js_log('seqRSD:cancelClipEditCB');
-               $j('#seq_resource_import').dialog('close').dialog('destroy').remove();
+       cancelClipEditCB:function() {
+               js_log( 'seqRSD:cancelClipEditCB' );
+               $j( '#seq_resource_import' ).dialog( 'close' ).dialog( 'destroy' ).remove();
        }
 };
 
index a901962..0e63f20 100644 (file)
@@ -1,75 +1,75 @@
-loadGM({
+loadGM( {
        "mwe-select_transcript_set" : "Select subtitles",
        "mwe-auto_scroll" : "auto scroll",
        "mwe-close" : "close",
        "mwe-improve_transcript" : "Improve",
        "mwe-no_text_tracks_found" : "No text subtitles found",
        "mwe-add-edit-subs"     : "Add/edit subtitles"
-})
+} )
 // text interface object (for inline display captions)
-var mvTextInterface = function( parentEmbed ){
+var mvTextInterface = function( parentEmbed ) {
        return this.init( parentEmbed );
 }
 mvTextInterface.prototype = {
        text_lookahead_time:0,
        body_ready:false,
-       default_time_range: "source", //by default just use the source don't get a time-range
+       default_time_range: "source", // by default just use the source don't get a time-range
        transcript_set:null,
        autoscroll:true,
        add_to_end_on_this_pass:false,
-       scrollTimerId:0,        
+       scrollTimerId:0,
        editlink: '',
-       suportedMime:{
+       suportedMime: {
            'srt': 'text/x-srt',
            'cmml': 'text/cmml'
        },
-       init:function( parentEmbed ){
-               //init a new availableTracks obj:
+       init:function( parentEmbed ) {
+               // init a new availableTracks obj:
                this.availableTracks = new Array();
-               //set the parent embed object:
+               // set the parent embed object:
                this.pe = parentEmbed;
-               //parse roe if not already done:
+               // parse roe if not already done:
                this.getTextTracks();
        },
-       //@@todo separate out data loader & data display
-       getTextTracks:function(){
-               //js_log("load timed text from roe: "+ this.pe.roe);
+       // @@todo separate out data loader & data display
+       getTextTracks:function() {
+               // js_log("load timed text from roe: "+ this.pe.roe);
                var _this = this;
-               //if roe not yet loaded do load it:
-               if(this.pe.roe || _this.pe.wikiTitleKey ){
-                       if(!this.pe.media_element.addedROEData){
-                               $j('#mv_txt_load_'+_this.pe.id).show(); //show the loading icon
-                               if( _this.pe.roe ){
-                                       do_request( _this.pe.roe, function(data)
+               // if roe not yet loaded do load it:
+               if ( this.pe.roe || _this.pe.wikiTitleKey ) {
+                       if ( !this.pe.media_element.addedROEData ) {
+                               $j( '#mv_txt_load_' + _this.pe.id ).show(); // show the loading icon
+                               if ( _this.pe.roe ) {
+                                       do_request( _this.pe.roe, function( data )
                                        {
-                                               _this.pe.media_element.addROE(data);
+                                               _this.pe.media_element.addROE( data );
                                                _this.getParseTimedText_rowReady();
-                                       });
-                               }else if( _this.pe.wikiTitleKey ){                              
-                                       //check for a clear namespace key:
-                                       _this.getTextTracksWikiTitle()                                  
+                                       } );
+                               } else if ( _this.pe.wikiTitleKey ) {
+                                       // check for a clear namespace key:
+                                       _this.getTextTracksWikiTitle()
                                }
-                       }else{
-                               js_log('row data ready (no roe request)');
+                       } else {
+                               js_log( 'row data ready (no roe request)' );
                                _this.getParseTimedText_rowReady();
                        }
-               }else{
-                       if( this.pe.media_element.timedTextSources() ){
+               } else {
+                       if ( this.pe.media_element.timedTextSources() ) {
                                _this.getParseTimedText_rowReady();
-                       }else{
-                               js_log('no roe data or timed text sources');
+                       } else {
+                               js_log( 'no roe data or timed text sources' );
                        }
                }
        },
-       getTextTracksWikiTitle:function(){
+       getTextTracksWikiTitle:function() {
                var apiUrl = mw.getLocalApiUrl();
                var _this = this;
                
-               var timedtext_ns = 102;                                 
-               if( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext']){
+               var timedtext_ns = 102;
+               if ( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext'] ) {
                        timedtext_ns = wgNamespaceIds['timedtext'];
                }
-               do_api_req({
+               do_api_req( {
                                'url' : apiUrl,
                                'data': {
                                        'list' : 'allpages',
@@ -78,262 +78,262 @@ mvTextInterface.prototype = {
                                        'prop':'revisions'
                                }
                }, function( subData ) {
-                       if(     subData.error && subData.error.code == 'apunknown_apnamespace'){
-                               do_api_req({
+                       if (    subData.error && subData.error.code == 'apunknown_apnamespace' ) {
+                               do_api_req( {
                                        'url' : apiUrl,
                                        'data': {
                                                'list' : 'allpages',
                                                'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey,
                                        }
                                }, function( subData ) {
-                                       _this.doProcSubPages( subData, wgServer + wgScriptPath);
-                               });
-                       }else{
-                               _this.doProcSubPages( subData, wgServer + wgScriptPath);
+                                       _this.doProcSubPages( subData, wgServer + wgScriptPath );
+                               } );
+                       } else {
+                               _this.doProcSubPages( subData, wgServer + wgScriptPath );
                        }
-               });
+               } );
        },
-       doProcSubPages: function( subData, hostPath ){
+       doProcSubPages: function( subData, hostPath ) {
                var _this = this;
-               //look for text tracks:
+               // look for text tracks:
                var foundTextTracks = false;
                
-               //get all the known languages:
-               do_api_req({
+               // get all the known languages:
+               do_api_req( {
                        'url':  hostPath + '/api.php',
                        'data': {
                                'meta' : 'siteinfo',
                                'siprop' : 'languages'
                        }
                }, function( langDataRaw ) {
-                               var langData = {};
+                               var langData = { };
                                var lagRaw = langDataRaw.query.languages;
-                               for(var j in lagRaw){
+                               for ( var j in lagRaw ) {
                                        langData[ lagRaw[j].code ] = lagRaw[j]['*'];
                                }
-                               for(var i in subData.query.allpages){
+                               for ( var i in subData.query.allpages ) {
                                        var subPage = subData.query.allpages[i];
-                                       var langKey = subPage.title.split('.');
+                                       var langKey = subPage.title.split( '.' );
                                        var extension = langKey.pop();
                                        langKey = langKey.pop();
-                                       if( ! _this.suportedMime[ extension ] ){
-                                               js_log('Error: unknown extension:'+ extension);
+                                       if ( ! _this.suportedMime[ extension ] ) {
+                                               js_log( 'Error: unknown extension:' + extension );
                                                continue;
                                        }
 
-                                       if( !langData[ langKey] ){
-                                               js_log('Error: langkey:'+ langKey + ' not found');
-                                       }else{                                                                                  
-                                               var textElm = document.createElement('text');
-                                               $j(textElm).attr({
+                                       if ( !langData[ langKey] ) {
+                                               js_log( 'Error: langkey:' + langKey + ' not found' );
+                                       } else {
+                                               var textElm = document.createElement( 'text' );
+                                               $j( textElm ).attr( {
                                                        'category' : 'SUB',
                                                        'lang'  : langKey,
                                                        'type'  : _this.suportedMime[ extension ],
-                                                       'title' : langData[ langKey]                                                                    
-                                               });
+                                                       'title' : langData[ langKey]
+                                               } );
                                                // We use the api since ?action raw on the real title has cache issues 
-                                               $j( textElm ).attr({
+                                               $j( textElm ).attr( {
                                                        'apisrc'        : hostPath + '/api.php',
                                                        'titleKey'      : subPage.title
-                                               });
+                                               } );
                                                _this.pe.media_element.tryAddSource( textElm );
-                                               foundTextTracks = true;                                                                                 
+                                               foundTextTracks = true;
                                        }
                                }
-                               //after all text loaded (or we have allready checked commons
-                               if(foundTextTracks || hostPath.indexOf('commons.wikimedia') !== -1){
-                                       //alert('calling                        getParseTimedText_rowReady ');          
-                                       _this.getParseTimedText_rowReady();                             
-                               }else {
+                               // after all text loaded (or we have allready checked commons
+                               if ( foundTextTracks || hostPath.indexOf( 'commons.wikimedia' ) !== - 1 ) {
+                                       // alert('calling                       getParseTimedText_rowReady ');          
+                                       _this.getParseTimedText_rowReady();
+                               } else {
                                        _this.checkSharedRepo();
                                }
-                       });     //do_api_req({
+                       } );    // do_api_req({
        },
-       checkSharedRepo:function(){
+       checkSharedRepo:function() {
                var _this = this;
-               js_log('checking for shared value of image');
-               //check if its a shared repo
-               do_api_req({
-                       'data':{
+               js_log( 'checking for shared value of image' );
+               // check if its a shared repo
+               do_api_req( {
+                       'data': {
                                'action':'query',
-                               'titles': 'File:' + _this.pe.wikiTitleKey, 
+                               'titles': 'File:' + _this.pe.wikiTitleKey,
                                'prop' : 'imageinfo'
                        }
-               },function( data ){                     
-                       if( data.query.pages && data.query.pages['-1'] && data.query.pages['-1'].imagerepository == 'shared'){
-                               js_log('image is shared checking commons for subtitles');
-                               //found shared repo assume commons: 
-                               do_api_req({
+               }, function( data ) {
+                       if ( data.query.pages && data.query.pages['-1'] && data.query.pages['-1'].imagerepository == 'shared' ) {
+                               js_log( 'image is shared checking commons for subtitles' );
+                               // found shared repo assume commons: 
+                               do_api_req( {
                                        'url': mw.commons_api_url,
-                                       'data':{
+                                       'data': {
                                                'list' : 'allpages',
                                                'apprefix' : _this.pe.wikiTitleKey,
                                                'apnamespace' : 102
                                        }
-                               },function( data ){             
-                                       _this.editlink = 'http://commons.wikimedia.org/wiki/TimedText:' +  _this.pe.wikiTitleKey +'.'+ wgUserLanguage +'.srt';
+                               }, function( data ) {
+                                       _this.editlink = 'http://commons.wikimedia.org/wiki/TimedText:' +  _this.pe.wikiTitleKey + '.' + wgUserLanguage + '.srt';
                                        _this.doProcSubPages( data, 'http://commons.wikimedia.org/w/' );
-                               });
-                       }else{
-                               //no shared repo do normal proc
+                               } );
+                       } else {
+                               // no shared repo do normal proc
                                _this.getParseTimedText_rowReady();
                        }
-               });
+               } );
        },
-       getParseTimedText_rowReady: function (){                
-               var _this = this;               
+       getParseTimedText_rowReady: function () {
+               var _this = this;
                var found_tracks = false;
-               //create timedTextObj           
-               js_log("mv_txt_load_:SHOW mv_txt_load_");
-               $j('#mv_txt_load_'+_this.pe.id).show(); //show the loading icon
-               
-               //setup edit link: 
-               if( _this.editlink == ''){
-                       if( this.pe.media_element.linkback ){                   
+               // create timedTextObj          
+               js_log( "mv_txt_load_:SHOW mv_txt_load_" );
+               $j( '#mv_txt_load_' + _this.pe.id ).show(); // show the loading icon
+
+               // setup edit link: 
+               if ( _this.editlink == '' ) {
+                       if ( this.pe.media_element.linkback ) {
                                _this.editlink = this.pe.media_element.linkback;
-                       }else if(this.pe.wikiTitleKey && wgServer && wgScript) { //check for wikiTitleKey (for edit linkback)
-                               //only local:
-                               _this.editlink = wgServer + wgScript + '?title=TimedText:' + this.pe.wikiTitleKey +'.'+ wgUserLanguage + '.srt&action=edit';    
+                       } else if ( this.pe.wikiTitleKey && wgServer && wgScript ) { // check for wikiTitleKey (for edit linkback)
+                               // only local:
+                               _this.editlink = wgServer + wgScript + '?title=TimedText:' + this.pe.wikiTitleKey + '.' + wgUserLanguage + '.srt&action=edit';
                        }
-               }               
-               $j.each( this.pe.media_element.sources, function(inx, source){
-                       if( typeof source.id == 'undefined' || source.id == null ){
+               }
+               $j.each( this.pe.media_element.sources, function( inx, source ) {
+                       if ( typeof source.id == 'undefined' || source.id == null ) {
                                source.id = 'text_' + inx;
                        }
                        var tObj = new timedTextObj( source );
-                       //make sure its a valid timed text format (we have not loaded or parsed yet) : (
-                       if( tObj.lib != null ){ 
-                               _this.availableTracks.push( tObj );                             
-                               //display requested language if we can know that: 
-                               if( ( typeof wgUserLanguage != 'undefined' && source['lang'] == wgUserLanguage ) || source['default'] == "true" ){
-                                       //we did set at least one track by default tag
-                                       found_tracks = true;                                    
-                                       _this.loadAndDisplay( _this.availableTracks.length -1 );
-                               }else{
-                                       //don't load the track and don't display                                        
+                       // make sure its a valid timed text format (we have not loaded or parsed yet) : (
+                       if ( tObj.lib != null ) {
+                               _this.availableTracks.push( tObj );
+                               // display requested language if we can know that: 
+                               if ( ( typeof wgUserLanguage != 'undefined' && source['lang'] == wgUserLanguage ) || source['default'] == "true" ) {
+                                       // we did set at least one track by default tag
+                                       found_tracks = true;
+                                       _this.loadAndDisplay( _this.availableTracks.length - 1 );
+                               } else {
+                                       // don't load the track and don't display                                       
                                }
                        }
-               });
+               } );
                
-               //no default clip found take the userLanguage key if set:
-               if( !found_tracks ){                    
-                       $j.each( _this.availableTracks, function(inx, source){                          
+               // no default clip found take the userLanguage key if set:
+               if ( !found_tracks ) {
+                       $j.each( _this.availableTracks, function( inx, source ) {
                                _this.loadAndDisplay( inx );
-                               found_tracks=true;
-                               //return after loading first available
+                               found_tracks = true;
+                               // return after loading first available
                                return false;
-                       });
+                       } );
                }
                
-           //if nothing found anywhere give the not found msg: 
-               if(!found_tracks){
-                       $j( '#metaBox_' + _this.pe.id).html( ''+
-                               '<h3>' + gM('mwe-no_text_tracks_found') + '</h3>' +
-                               '<a href="' + _this.editlink + '">'+ gM('mwe-add-edit-subs') + '</a>'
-                       );                      
+           // if nothing found anywhere give the not found msg: 
+               if ( !found_tracks ) {
+                       $j( '#metaBox_' + _this.pe.id ).html( '' +
+                               '<h3>' + gM( 'mwe-no_text_tracks_found' ) + '</h3>' +
+                               '<a href="' + _this.editlink + '">' + gM( 'mwe-add-edit-subs' ) + '</a>'
+                       );
                }
        },
-       loadAndDisplay: function ( track_id){
+       loadAndDisplay: function ( track_id ) {
                var _this = this;
-               $j('#mv_txt_load_'+_this.pe.id).show();//show the loading icon
-               _this.availableTracks[ track_id ].load( _this.default_time_range, function(){
-                       $j('#mv_txt_load_'+_this.pe.id).hide();
+               $j( '#mv_txt_load_' + _this.pe.id ).show();// show the loading icon
+               _this.availableTracks[ track_id ].load( _this.default_time_range, function() {
+                       $j( '#mv_txt_load_' + _this.pe.id ).hide();
                        _this.addTrack( track_id );
-               });
-       },      
-       addTrack: function( track_id ){
-               js_log('f:displayTrack:'+ track_id);
+               } );
+       },
+       addTrack: function( track_id ) {
+               js_log( 'f:displayTrack:' + track_id );
                var _this = this;
-               //set the display flag to true:
-               _this.availableTracks[ track_id ].display=true;
-               //setup the layout:
+               // set the display flag to true:
+               _this.availableTracks[ track_id ].display = true;
+               // setup the layout:
                this.setup_layout();
-               js_log( "SHOULD ADD: track:" + track_id + ' count:' +  _this.availableTracks[ track_id ].textNodes.length);
+               js_log( "SHOULD ADD: track:" + track_id + ' count:' +  _this.availableTracks[ track_id ].textNodes.length );
 
-               //a flag to avoid checking all clips if we know we are adding to the end:
+               // a flag to avoid checking all clips if we know we are adding to the end:
                _this.add_to_end_on_this_pass = false;
 
-               //run clip adding on a timed interval to not lock the browser on large srt file merges (should use worker threads)
-               var i =0;
+               // run clip adding on a timed interval to not lock the browser on large srt file merges (should use worker threads)
+               var i = 0;
                var track_id = track_id;
-               var addNextClip = function(){
+               var addNextClip = function() {
                        var text_clip = _this.availableTracks[ track_id ].textNodes[i];
-                       if(     text_clip ){    
-                               _this.add_merge_text_clip(text_clip, track_id);
+                       if (    text_clip ) {
+                               _this.add_merge_text_clip( text_clip, track_id );
                                i++;
-                               if(i < _this.availableTracks[ track_id ].textNodes.length){
-                                       setTimeout(addNextClip, 1);
+                               if ( i < _this.availableTracks[ track_id ].textNodes.length ) {
+                                       setTimeout( addNextClip, 1 );
                                }
                        }
                }
                addNextClip();
        },
-       add_merge_text_clip: function( text_clip, track_id ){
+       add_merge_text_clip: function( text_clip, track_id ) {
                var _this = this;
-               //make sure the clip does not already exist:
-               if( $j('#tc_'+text_clip.id).length==0 ){
+               // make sure the clip does not already exist:
+               if ( $j( '#tc_' + text_clip.id ).length == 0 ) {
                        var inserted = false;
                        var text_clip_start_time = npt2seconds( text_clip.start );
 
-                       var insertHTML = '<div id="tc_'+text_clip.id+'" ' +
+                       var insertHTML = '<div id="tc_' + text_clip.id + '" ' +
                                'start_sec="' + text_clip_start_time + '" ' +
-                               'start="'+text_clip.start+'" end="'+text_clip.end + '" ' +
+                               'start="' + text_clip.start + '" end="' + text_clip.end + '" ' +
                                'class="mvtt track_' + track_id + '">' +
-                                       '<div class="mvttseek" style="top:0px;left:0px;right:0px;height:20px;font-size:small">'+
-                                               text_clip.start + ' to ' +text_clip.end+
-                                       '</div>'+
+                                       '<div class="mvttseek" style="top:0px;left:0px;right:0px;height:20px;font-size:small">' +
+                                               text_clip.start + ' to ' + text_clip.end +
+                                       '</div>' +
                                        text_clip.body +
                        '</div>';
-                       if(!_this.add_to_end_on_this_pass){
-                               $j('#mmbody_'+this.pe.id +' .mvtt').each(function(){
-                                       if(!inserted){
-                                               if( $j(this).attr('start_sec') > text_clip_start_time){
-                                                       inserted=true;
-                                                       $j(this).before(insertHTML);
+                       if ( !_this.add_to_end_on_this_pass ) {
+                               $j( '#mmbody_' + this.pe.id + ' .mvtt' ).each( function() {
+                                       if ( !inserted ) {
+                                               if ( $j( this ).attr( 'start_sec' ) > text_clip_start_time ) {
+                                                       inserted = true;
+                                                       $j( this ).before( insertHTML );
                                                }
-                                       }else{
+                                       } else {
                                                _this.add_to_end = true;
                                        }
-                               });
+                               } );
                        }
-                       //js_log('should just add to end: '+insertHTML);
-                       if(!inserted){
-                               $j('#mmbody_'+this.pe.id ).append(insertHTML);
+                       // js_log('should just add to end: '+insertHTML);
+                       if ( !inserted ) {
+                               $j( '#mmbody_' + this.pe.id ).append( insertHTML );
                        }
 
-                       //apply the mouse over transcript seek/click functions:
-                       $j(".mvttseek").click( function() {
-                               _this.pe.doSeek( $j(this).parent().attr("start_sec") / _this.pe.getDuration() );
-                       });
-                       $j(".mvttseek").hoverIntent({
-                               interval:200, //polling interval
-                               timeout:200, //delay before onMouseOut
+                       // apply the mouse over transcript seek/click functions:
+                       $j( ".mvttseek" ).click( function() {
+                               _this.pe.doSeek( $j( this ).parent().attr( "start_sec" ) / _this.pe.getDuration() );
+                       } );
+                       $j( ".mvttseek" ).hoverIntent( {
+                               interval:200, // polling interval
+                               timeout:200, // delay before onMouseOut
                                over:function () {
-                                         js_log('mvttseek: over');
-                                         $j(this).parent().addClass('tt_highlight');
-                                       //do section highlight
+                                         js_log( 'mvttseek: over' );
+                                         $j( this ).parent().addClass( 'tt_highlight' );
+                                       // do section highlight
                                        _this.pe.highlightPlaySection( {
-                                               'start' : $j(this).parent().attr("start"),
-                                               'end'   : $j(this).parent().attr("end")
-                                       });
+                                               'start' : $j( this ).parent().attr( "start" ),
+                                               'end'   : $j( this ).parent().attr( "end" )
+                                       } );
                                },
                                out:function () {
-                                         js_log('mvttseek: out');
-                                         $j(this).parent().removeClass('tt_highlight');
-                                         //de highlight section
+                                         js_log( 'mvttseek: out' );
+                                         $j( this ).parent().removeClass( 'tt_highlight' );
+                                         // de highlight section
                                        _this.pe.hideHighlight();
                                }
                          }
                        );
                }
        },
-       setup_layout:function(){
+       setup_layout:function() {
                var _this = this;
-               //check if we have already loaded the menu/body:
-               if($j('#tt_mmenu_'+this.pe.id).length==0){
-                       //alert( this.availableTracks.length );
-                       if( this.availableTracks.length != 0 ){
-                               $j('#metaBox_'+this.pe.id).html(
+               // check if we have already loaded the menu/body:
+               if ( $j( '#tt_mmenu_' + this.pe.id ).length == 0 ) {
+                       // alert( this.availableTracks.length );
+                       if ( this.availableTracks.length != 0 ) {
+                               $j( '#metaBox_' + this.pe.id ).html(
                                        this.getMenu() +
                                        this.getBody()
                                );
@@ -341,189 +341,189 @@ mvTextInterface.prototype = {
                        }
                }
        },
-       show:function(){
-               //setup layout if not already done:
+       show:function() {
+               // setup layout if not already done:
                this.setup_layout();
-               //display the interface if not already displayed:
-               $j('#metaBox_'+this.pe.id).fadeIn("fast");
-               //start the autoscroll timer:
-               if( this.autoscroll )
+               // display the interface if not already displayed:
+               $j( '#metaBox_' + this.pe.id ).fadeIn( "fast" );
+               // start the autoscroll timer:
+               if ( this.autoscroll )
                        this.setAutoScroll();
        },
-       close:function(){
-               //the meta box:
-               $j('#metaBox_'+this.pe.id).fadeOut('fast');
-               //the icon link:
-               $j('#metaButton_'+this.pe.id).fadeIn('fast');
+       close:function() {
+               // the meta box:
+               $j( '#metaBox_' + this.pe.id ).fadeOut( 'fast' );
+               // the icon link:
+               $j( '#metaButton_' + this.pe.id ).fadeIn( 'fast' );
        },
-       getBody:function(){
-               return '<div id="mmbody_'+this.pe.id+'" ' +
+       getBody:function() {
+               return '<div id="mmbody_' + this.pe.id + '" ' +
                                'style="position:absolute;top:30px;left:0px;' +
                                'right:0px;bottom:0px;' +
-                               'height:'+(this.pe.height-30)+
-                               'px;overflow:auto;"><span style="display:none;" id="mv_txt_load_' + this.pe.id + '">'+
-                                       mv_get_loading_img() +'</span>' +
+                               'height:' + ( this.pe.height - 30 ) +
+                               'px;overflow:auto;"><span style="display:none;" id="mv_txt_load_' + this.pe.id + '">' +
+                                       mv_get_loading_img() + '</span>' +
                                '</div>';
        },
-       getTsSelect:function(){
+       getTsSelect:function() {
                var _this = this;
-               js_log('getTsSelect');
+               js_log( 'getTsSelect' );
                var selHTML = '<div id="mvtsel_' + this.pe.id + '" style="position:absolute;background:#FFF;top:30px;left:0px;right:0px;bottom:0px;overflow:auto;">';
-               selHTML+='<b>' + gM('mwe-select_transcript_set') + '</b><ul>';
-               //debugger;
-               for(var i in _this.availableTracks){ //for in loop ok on object
+               selHTML += '<b>' + gM( 'mwe-select_transcript_set' ) + '</b><ul>';
+               // debugger;
+               for ( var i in _this.availableTracks ) { // for in loop ok on object
                        var checked = ( _this.availableTracks[i].display ) ? 'checked' : '';
-                       selHTML+='<li><input name="language" value="'+i+'" class="mvTsSelect" type="radio" ' + checked + '>'+
+                       selHTML += '<li><input name="language" value="' + i + '" class="mvTsSelect" type="radio" ' + checked + '>' +
                                _this.availableTracks[i].getTitle() + '</li>';
                }
-               selHTML+='</ul>' +
+               selHTML += '</ul>' +
                                 '</div>';
-               $j('#metaBox_'+_this.pe.id).append( selHTML );
-               $j('.mvTsSelect').click(function(){                     
+               $j( '#metaBox_' + _this.pe.id ).append( selHTML );
+               $j( '.mvTsSelect' ).click( function() {
                        _this.applyTsSelect();
-               });
+               } );
        },
-       applyTsSelect:function(){
+       applyTsSelect:function() {
                var _this = this;
-               //update availableTracks
-               $j('#mvtsel_' + this.pe.id + ' .mvTsSelect').each(function(){
-                       var track_id = $j(this).val();
-                       if(this.checked){
-                               //if not yet loaded now would be a good time
-                               if(! _this.availableTracks[ track_id ].loaded ){
-                                       _this.loadAndDisplay( track_id);
-                               }else{
-                                       _this.availableTracks[track_id].display=true;
-                                       //display the named class:
-                                       $j('#mmbody_'+_this.pe.id +' .track_'+track_id ).show();
+               // update availableTracks
+               $j( '#mvtsel_' + this.pe.id + ' .mvTsSelect' ).each( function() {
+                       var track_id = $j( this ).val();
+                       if ( this.checked ) {
+                               // if not yet loaded now would be a good time
+                               if ( ! _this.availableTracks[ track_id ].loaded ) {
+                                       _this.loadAndDisplay( track_id );
+                               } else {
+                                       _this.availableTracks[track_id].display = true;
+                                       // display the named class:
+                                       $j( '#mmbody_' + _this.pe.id + ' .track_' + track_id ).show();
                                }
-                       }else{
-                               if(_this.availableTracks[track_id].display){
-                                       _this.availableTracks[track_id].display=false;
-                                       //hide unchecked                                
-                                       $j('#mmbody_'+_this.pe.id +' .track_'+track_id ).hide();
+                       } else {
+                               if ( _this.availableTracks[track_id].display ) {
+                                       _this.availableTracks[track_id].display = false;
+                                       // hide unchecked                               
+                                       $j( '#mmbody_' + _this.pe.id + ' .track_' + track_id ).hide();
                                }
                        }
-               });
-               $j('#mvtsel_'+_this.pe.id).fadeOut("fast").remove();
+               } );
+               $j( '#mvtsel_' + _this.pe.id ).fadeOut( "fast" ).remove();
        },
-       monitor:function(){
+       monitor:function() {
                _this = this;
-               //grab the time from the video object
+               // grab the time from the video object
                var cur_time = this.pe.currentTime ;
-               if( cur_time!=0 ){
+               if ( cur_time != 0 ) {
                        var search_for_range = true;
-                       //check if the current transcript is already where we want:
-                       if($j('#mmbody_' + this.pe.id + ' .tt_scroll_highlight').length != 0){
-                               var curhl = $j('#mmbody_'+this.pe.id +' .tt_scroll_highlight').get(0);
-                               if(npt2seconds($j(curhl).attr('start') ) < cur_time &&
-                                  npt2seconds($j(curhl).attr('end') ) > cur_time){
+                       // check if the current transcript is already where we want:
+                       if ( $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).length != 0 ) {
+                               var curhl = $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).get( 0 );
+                               if ( npt2seconds( $j( curhl ).attr( 'start' ) ) < cur_time &&
+                                  npt2seconds( $j( curhl ).attr( 'end' ) ) > cur_time ) {
                                        /*js_log('in range of current hl: ' +
                                                npt2seconds($j(curhl).attr('start')) +  ' to ' +  npt2seconds($j(curhl).attr('end')));
                                        */
                                        search_for_range = false;
-                               }else{
+                               } else {
                                        search_for_range = true;
-                                       //remove the highlight from all:
-                                       $j('#mmbody_'+this.pe.id +' .tt_scroll_highlight').removeClass('tt_scroll_highlight');
+                                       // remove the highlight from all:
+                                       $j( '#mmbody_' + this.pe.id + ' .tt_scroll_highlight' ).removeClass( 'tt_scroll_highlight' );
                                }
                        };
                        /*js_log('search_for_range:'+search_for_range +  ' for: '+ cur_time);*/
-                       if( search_for_range ){
-                               //search for current time: add tt_scroll_highlight to clip
+                       if ( search_for_range ) {
+                               // search for current time: add tt_scroll_highlight to clip
                                // optimize:
                                //  should do binnary search not iterative
                                //  avoid jquery function calls do native loops
-                               $j('#mmbody_'+this.pe.id +' .mvtt').each(function(){
-                                       if(npt2seconds($j(this).attr('start') ) < cur_time &&
-                                          npt2seconds($j(this).attr('end') ) > cur_time){
-                                               _this.prevTimeScroll=cur_time;
-                                               $j('#mmbody_'+_this.pe.id).animate({
-                                                       scrollTop: $j(this).get(0).offsetTop
-                                               }, 'slow');
-                                               $j(this).addClass('tt_scroll_highlight');
-                                               //js_log('should add class to: ' + $j(this).attr('id'));
-                                               //done with loop
+                               $j( '#mmbody_' + this.pe.id + ' .mvtt' ).each( function() {
+                                       if ( npt2seconds( $j( this ).attr( 'start' ) ) < cur_time &&
+                                          npt2seconds( $j( this ).attr( 'end' ) ) > cur_time ) {
+                                               _this.prevTimeScroll = cur_time;
+                                               $j( '#mmbody_' + _this.pe.id ).animate( {
+                                                       scrollTop: $j( this ).get( 0 ).offsetTop
+                                               }, 'slow' );
+                                               $j( this ).addClass( 'tt_scroll_highlight' );
+                                               // js_log('should add class to: ' + $j(this).attr('id'));
+                                               // done with loop
                                                return false;
                                        }
-                               });
+                               } );
                        }
                }
        },
-       setAutoScroll:function( timer ){
+       setAutoScroll:function( timer ) {
                var _this = this;
-               this.autoscroll = ( typeof timer=='undefined' )?this.autoscroll:timer;
-               if(this.autoscroll){
-                       //start the timer if its not already running
-                       if(!this.scrollTimerId){
-                               this.scrollTimerId = setInterval('$j(\'#'+_this.pe.id+'\').get(0).textInterface.monitor()', 500);
+               this.autoscroll = ( typeof timer == 'undefined' ) ? this.autoscroll:timer;
+               if ( this.autoscroll ) {
+                       // start the timer if its not already running
+                       if ( !this.scrollTimerId ) {
+                               this.scrollTimerId = setInterval( '$j(\'#' + _this.pe.id + '\').get(0).textInterface.monitor()', 500 );
                        }
-                       //jump to the current position:
-                       var cur_time = parseInt (this.pe.currentTime );
-                       js_log('cur time: '+ cur_time);
+                       // jump to the current position:
+                       var cur_time = parseInt ( this.pe.currentTime );
+                       js_log( 'cur time: ' + cur_time );
 
                        _this = this;
-                       var scroll_to_id='';
-                       $j('#mmbody_'+this.pe.id +' .mvtt').each(function(){
-                               if(cur_time > npt2seconds($j(this).attr('start'))  ){
-                                       _this.prevTimeScroll=cur_time;
-                                       if( $j(this).attr('id') )
-                                               scroll_to_id = $j(this).attr('id');
+                       var scroll_to_id = '';
+                       $j( '#mmbody_' + this.pe.id + ' .mvtt' ).each( function() {
+                               if ( cur_time > npt2seconds( $j( this ).attr( 'start' ) )  ) {
+                                       _this.prevTimeScroll = cur_time;
+                                       if ( $j( this ).attr( 'id' ) )
+                                               scroll_to_id = $j( this ).attr( 'id' );
                                }
-                       });
-                       if(scroll_to_id != '')
-                               $j( '#mmbody_' + _this.pe.id ).animate( { scrollTop: $j('#'+scroll_to_id).position().top } , 'slow' );
-               }else{
-                       //stop the timer
-                       clearInterval(this.scrollTimerId);
-                       this.scrollTimerId=0;
+                       } );
+                       if ( scroll_to_id != '' )
+                               $j( '#mmbody_' + _this.pe.id ).animate( { scrollTop: $j( '#' + scroll_to_id ).position().top } , 'slow' );
+               } else {
+                       // stop the timer
+                       clearInterval( this.scrollTimerId );
+                       this.scrollTimerId = 0;
                }
        },
-       getMenu:function(){
-               var out='';
+       getMenu:function() {
+               var out = '';
                var _this = this;
-               //add in loading icon:
-               var as_checked = (this.autoscroll)?'checked':'';
-               out += '<div id="tt_mmenu_'+this.pe.id+'" class="ui-widget-header" style="font-size:.6em;position:absolute;top:0;height:30px;left:0px;right:0px;">';
-               out += $j.btnHtml( gM('mwe-select_transcript_set'), 'tt-select', 'shuffle');
+               // add in loading icon:
+               var as_checked = ( this.autoscroll ) ? 'checked':'';
+               out += '<div id="tt_mmenu_' + this.pe.id + '" class="ui-widget-header" style="font-size:.6em;position:absolute;top:0;height:30px;left:0px;right:0px;">';
+               out += $j.btnHtml( gM( 'mwe-select_transcript_set' ), 'tt-select', 'shuffle' );
                                
-               if(_this.editlink!='')
-                       out+=' ' + $j.btnHtml(gM('mwe-improve_transcript'), 'tt-improve' );
+               if ( _this.editlink != '' )
+                       out += ' ' + $j.btnHtml( gM( 'mwe-improve_transcript' ), 'tt-improve' );
                
-               out+= '<input class="tt-scroll" type="checkbox" '+ as_checked + '>' + gM('mwe-auto_scroll');
+               out += '<input class="tt-scroll" type="checkbox" ' + as_checked + '>' + gM( 'mwe-auto_scroll' );
                
-               out+=' ' + $j.btnHtml(gM('mwe-close'), 'tt-close', 'circle-close');
+               out += ' ' + $j.btnHtml( gM( 'mwe-close' ), 'tt-close', 'circle-close' );
                
-               out+='</div>';
+               out += '</div>';
                return out;
        },
-       doMenuBindings:function(){
+       doMenuBindings:function() {
            var _this = this;
-           var mt = '#tt_mmenu_'+ _this.pe.id;
-           $j(mt + ' .tt-close').unbind().btnBind().click(function(){
-              $j( '#' + _this.pe.id).get(0).closeTextInterface();
+           var mt = '#tt_mmenu_' + _this.pe.id;
+           $j( mt + ' .tt-close' ).unbind().btnBind().click( function() {
+              $j( '#' + _this.pe.id ).get( 0 ).closeTextInterface();
               return false;
-           });
-           $j(mt + ' .tt-select').unbind().btnBind().click(function(){
-              $j( '#' +  _this.pe.id).get(0).textInterface.getTsSelect();
+           } );
+           $j( mt + ' .tt-select' ).unbind().btnBind().click( function() {
+              $j( '#' +  _this.pe.id ).get( 0 ).textInterface.getTsSelect();
               return false;
-           });
-           $j(mt + ' .tt-scroll').click(function(){
-               _this.setAutoScroll(this.checked);              
-            });
-           $j(mt + ' .tt-improve').unbind().btnBind().click(function(){                        
+           } );
+           $j( mt + ' .tt-scroll' ).click( function() {
+               _this.setAutoScroll( this.checked );
+            } );
+           $j( mt + ' .tt-improve' ).unbind().btnBind().click( function() {
                document.location.href =  _this.editlink;
-           });                     
+           } );
        }
 }
 
 /* text format objects
 *  @@todo allow loading from external lib set
 */
-var timedTextObj = function( source ){
-       //@@todo in the future we could support timed text in oggs if they can be accessed via javascript
-       //we should be able to do a HEAD request to see if we can read transcripts from the file.
-       switch( source.mime_type ){
+var timedTextObj = function( source ) {
+       // @@todo in the future we could support timed text in oggs if they can be accessed via javascript
+       // we should be able to do a HEAD request to see if we can read transcripts from the file.
+       switch( source.mime_type ) {
                case 'text/cmml':
                        this.lib = 'CMML';
                break;
@@ -532,33 +532,33 @@ var timedTextObj = function( source ){
                        this.lib = 'SRT';
                break;
                default:
-                       js_log( source.mime_type + ' is not suported timed text fromat');
+                       js_log( source.mime_type + ' is not suported timed text fromat' );
                        return ;
                break;
        }
-       //extend with the per-mime type lib:
-       eval('var tObj = timedText' + this.lib + ';');
-       for( var i in tObj ){
+       // extend with the per-mime type lib:
+       eval( 'var tObj = timedText' + this.lib + ';' );
+       for ( var i in tObj ) {
                this[ i ] = tObj[i];
        }
        return this.init( source );
 }
 
-//base timedText object
+// base timedText object
 timedTextObj.prototype = {
        loaded: false,
        lib:null,
        display: false,
        textNodes:new Array(),
-       init: function( source ){
-               //copy source properties
+       init: function( source ) {
+               // copy source properties
                this.source = source;
                this.id = source.id;
        },
-       getTitle:function(){
+       getTitle:function() {
                return this.source.title;
        },
-       getSRC:function(){
+       getSRC:function() {
                return this.source.src;
        }
 }
@@ -566,118 +566,118 @@ timedTextObj.prototype = {
 // Specific Timed Text formats:
 
 timedTextCMML = {
-       load: function( range, callback ){
+       load: function( range, callback ) {
                var _this = this;
-               js_log('textCMML: loading track: '+ this.src);
+               js_log( 'textCMML: loading track: ' + this.src );
 
-               //:: Load transcript range ::
+               // :: Load transcript range ::
                var pcurl =  parseUri( _this.getSRC() );
-               //check for urls without time keys:
-               if( typeof pcurl.queryKey['t'] == 'undefined'){
-                       //in which case just get the full time req:
-                       do_request( this.getSRC(), function(data){
+               // check for urls without time keys:
+               if ( typeof pcurl.queryKey['t'] == 'undefined' ) {
+                       // in which case just get the full time req:
+                       do_request( this.getSRC(), function( data ) {
                                _this.doParse( data );
-                               _this.loaded=true;
+                               _this.loaded = true;
                                callback();
-                       });
+                       } );
                        return ;
                }
-               //temporal urls: 
-               var req_time = pcurl.queryKey['t'].split('/');
-               req_time[0]=npt2seconds(req_time[0]);
-               req_time[1]=npt2seconds(req_time[1]);
-               if(req_time[1]-req_time[0]> _this.request_length){
-                       //longer than 5 min will only issue a (request 5 min)
-                       req_time[1] = req_time[0]+_this.request_length;
+               // temporal urls: 
+               var req_time = pcurl.queryKey['t'].split( '/' );
+               req_time[0] = npt2seconds( req_time[0] );
+               req_time[1] = npt2seconds( req_time[1] );
+               if ( req_time[1] - req_time[0] > _this.request_length ) {
+                       // longer than 5 min will only issue a (request 5 min)
+                       req_time[1] = req_time[0] + _this.request_length;
                }
-               //set up request url:
-               url = pcurl.protocol + '://' + pcurl.authority + pcurl.path +'?';
-               $j.each(pcurl.queryKey, function(key, val){
-                       if( key != 't'){
-                               url+=key+'='+val+'&';
-                       }else{
-                               url+= 't=' + seconds2npt(req_time[0]) + '/' + seconds2npt(req_time[1]) + '&';
+               // set up request url:
+               url = pcurl.protocol + '://' + pcurl.authority + pcurl.path + '?';
+               $j.each( pcurl.queryKey, function( key, val ) {
+                       if ( key != 't' ) {
+                               url += key + '=' + val + '&';
+                       } else {
+                               url += 't=' + seconds2npt( req_time[0] ) + '/' + seconds2npt( req_time[1] ) + '&';
                        }
-               });
-               do_request( url, function(data){
-                       js_log("load track clip count:" + data.getElementsByTagName('clip').length );
+               } );
+               do_request( url, function( data ) {
+                       js_log( "load track clip count:" + data.getElementsByTagName( 'clip' ).length );
                        _this.doParse( data );
-                       _this.loaded=true;
+                       _this.loaded = true;
                        callback();
-               });
+               } );
        },
-       doParse: function(data){
+       doParse: function( data ) {
                var _this = this;
-               $j.each(data.getElementsByTagName('clip'), function(inx, clip){
-                       //js_log(' on clip ' + clip.id);
+               $j.each( data.getElementsByTagName( 'clip' ), function( inx, clip ) {
+                       // js_log(' on clip ' + clip.id);
                        var text_clip = {
-                               start: $j(clip).attr('start').replace('npt:', ''),
-                               end: $j(clip).attr('end').replace('npt:', ''),
+                               start: $j( clip ).attr( 'start' ).replace( 'npt:', '' ),
+                               end: $j( clip ).attr( 'end' ).replace( 'npt:', '' ),
                                type_id: _this.id,
-                               id: $j(clip).attr('id')
+                               id: $j( clip ).attr( 'id' )
                        }
-                       $j.each( clip.getElementsByTagName('body'), function(binx, bn ){
-                               if(bn.textContent){
+                       $j.each( clip.getElementsByTagName( 'body' ), function( binx, bn ) {
+                               if ( bn.textContent ) {
                                        text_clip.body = bn.textContent;
-                               }else if(bn.text){
+                               } else if ( bn.text ) {
                                        text_clip.body = bn.text;
                                }
-                       });
+                       } );
                        _this.textNodes.push( text_clip );
-               });
+               } );
        }
 }
 timedTextSRT = {
-       load: function( range, callback ){
+       load: function( range, callback ) {
                var _this = this;
-               js_log('textSRT: loading : '+ _this.getSRC() );
-               if( _this.getSRC() ){
-                       do_request( _this.getSRC() , function(data){
+               js_log( 'textSRT: loading : ' + _this.getSRC() );
+               if ( _this.getSRC() ) {
+                       do_request( _this.getSRC() , function( data ) {
                                _this.doParse( data );
-                               _this.loaded=true;
+                               _this.loaded = true;
                                callback();
-                       });
-               }else if( _this.source.apisrc ){
-                       do_api_req({
-                               'url' : _this.source.apisrc, 
+                       } );
+               } else if ( _this.source.apisrc ) {
+                       do_api_req( {
+                               'url' : _this.source.apisrc,
                                'data': {
                                        'titles': _this.source.titleKey,
                                        'prop':'revisions',
                                        'rvprop':'content'
                                }
-                       },function(data){
-                               if(data && data.query && data.query.pages){
-                                       for(var i in data.query.pages){
+                       }, function( data ) {
+                               if ( data && data.query && data.query.pages ) {
+                                       for ( var i in data.query.pages ) {
                                                var page = data.query.pages[i];
-                                               if(page.revisions){
-                                                       for(var j in page.revisions){
-                                                               if( page.revisions[j]['*'] ){
+                                               if ( page.revisions ) {
+                                                       for ( var j in page.revisions ) {
+                                                               if ( page.revisions[j]['*'] ) {
                                                                        _this.doParse( page.revisions[j]['*'] );
-                                                                       _this.loaded=true;
+                                                                       _this.loaded = true;
                                                                        callback();
                                                                }
                                                        }
                                                }
                                        }
                                }
-                       });
+                       } );
                }
        },
-       doParse:function( data ){
-               //split up the transcript chunks:
-               //strip any \r's
-               var tc = data.split(/[\r]?\n[\r]?\n/);
-               //pushing can take time
-               for(var s=0; s < tc.length ; s++) {
-                       var st = tc[s].split('\n');
-                       if(st.length >=2) {
+       doParse:function( data ) {
+               // split up the transcript chunks:
+               // strip any \r's
+               var tc = data.split( /[\r]?\n[\r]?\n/ );
+               // pushing can take time
+               for ( var s = 0; s < tc.length ; s++ ) {
+                       var st = tc[s].split( '\n' );
+                       if ( st.length >= 2 ) {
                                var n = st[0];
-                               var i = st[1].split(' --> ')[0].replace(/^\s+|\s+$/g,"");
-                               var o = st[1].split(' --> ')[1].replace(/^\s+|\s+$/g,"");
+                               var i = st[1].split( ' --> ' )[0].replace( /^\s+|\s+$/g, "" );
+                               var o = st[1].split( ' --> ' )[1].replace( /^\s+|\s+$/g, "" );
                                var t = st[2];
-                               if(st.length > 2) {
-                                       for(j=3; j<st.length;j++)
-                                               t += '\n'+st[j];
+                               if ( st.length > 2 ) {
+                                       for ( j = 3; j < st.length; j++ )
+                                               t += '\n' + st[j];
                                }
                                var text_clip = {
                                        "start": i,
index c266997..787e2f4 100644 (file)
  */
 
 // Setup configuration vars (if not set already)
-if( !mwAddMediaConfig )
-  var mwAddMediaConfig = {};
+if ( !mwAddMediaConfig )
+  var mwAddMediaConfig = { };
 
-var mvTimedTextEdit = {};
+var mvTimedTextEdit = { };
 
-loadGM({
+loadGM( {
   "mwe-upload-subs-file" : "Upload subtitle",
   "mwe-add-subs-file-title" : "Select subtitle to upload",
   "mwe-error-only-srt" : "You can only upload srt files.",
   "mwe-watch-video" : "Watch video",
   "mwe-select-other-language" : "Select other language",
   "mwe-saving" : "saving..."
-})
+} )
 
 
 js2AddOnloadHook( function() {
-  function getSubtitle(f) {
+  function getSubtitle( f ) {
       var name = f.files[0].name;
       var srtData = f.files[0].getAsBinary();
-      srtData = srtData.replace('\r\n', '\n');
+      srtData = srtData.replace( '\r\n', '\n' );
       return srtData;
   }
   function getVideoTitle() {
-    var videoTitle = wgPageName.split('.');
+    var videoTitle = wgPageName.split( '.' );
     videoTitle.pop();
     videoTitle.pop();
-    videoTitle = videoTitle.join('.').replace('TimedText:', 'File:');
+    videoTitle = videoTitle.join( '.' ).replace( 'TimedText:', 'File:' );
     return videoTitle;
   }
   function uploadSubtitles() {
-    do_api_req({
+    do_api_req( {
       'data': {
         'meta' : 'siteinfo',
         'siprop' : 'languages'
       }
       }, function( langDataRaw ) {
-        var apprefix = wgTitle.split('.');
+        var apprefix = wgTitle.split( '.' );
         apprefix.pop();
         apprefix.pop();
-        apprefix = apprefix.join('.');
-                         do_api_req({
+        apprefix = apprefix.join( '.' );
+                         do_api_req( {
                                          'data': {
                                                  'list' : 'allpages',
                                                  'apprefix' : apprefix
                                          }
                          }, function( subData ) {
-                           var availableSubtitles = {};
-                                       for(var i in subData.query.allpages){
+                           var availableSubtitles = { };
+                                       for ( var i in subData.query.allpages ) {
                                                var subPage = subData.query.allpages[i];
-                                               var langKey = subPage.title.split('.');
+                                               var langKey = subPage.title.split( '.' );
                                                var extension = langKey.pop();
                                                langKey = langKey.pop();
                                                availableSubtitles[langKey] = subPage.title;
           }
-          var langData = {};
+          var langData = { };
           var languageSelect = '<select id="timed_text_language">';
 
           var lagRaw = langDataRaw.query.languages;
-          for(var j in lagRaw){
+          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+') +';
+            languageSelect += '<option value="' + code + '">';
+            if ( availableSubtitles[code] ) {
+              languageSelect += language + '(' + code + ') +';
             } else {
-              languageSelect += language+'('+code+') -';
+              languageSelect += language + '(' + code + ') -';
             }
             languageSelect += '</option>';
           }
           languageSelect += '/</select>';
-          var cBtn = {};
-          cBtn[ gM('mwe-cancel') ] = function(){
-            $j(this).dialog('close');
+          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 = wgPageName.split('.');
+          cBtn[ gM( 'mwe-ok' ) ] = function() {
+               // get language from form
+            langKey = $j( '#timed_text_language' ).val();
+            var title = wgPageName.split( '.' );
             title.pop();
             title.pop();
-            title = title.join('.') + '.' + langKey + '.srt';
+            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');
+            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 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 ( !mimeTypes[ extension ] ) {
+              js_log( 'Error: unknown extension:' + extension );
             }
             
 
-            if(extension == "srt") {
-              var srt = getSubtitle(file[0]);
-              $j(this).text( gM('mwe-saving' ) );
-              $j('.ui-dialog-buttonpane').remove();
+            if ( extension == "srt" ) {
+              var srt = getSubtitle( file[0] );
+              $j( this ).text( gM( 'mwe-saving' ) );
+              $j( '.ui-dialog-buttonpane' ).remove();
 
-              var editToken = $j('input[name=wpEditToken]').val();
+              var editToken = $j( 'input[name=wpEditToken]' ).val();
             
-              do_api_req({
+              do_api_req( {
                 'data': {
                   'action' : 'edit',
                   'title' : title,
                   'text' : srt,
                   'token': editToken
                 }
-              }, function(dialog) {
+              }, function( dialog ) {
                   return function( result ) {
-                    document.location.href = wgArticlePath.replace('/$1', '?title=' + title + '&action=edit');
-                    $j(dialog).dialog('close');
-                 }}(this)
+                    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( this ).html( gM( "mwe-error-only-srt" ) );
             }
           }
-          $j.addDialog(gM("mwe-add-subs-file-title"),
+          $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('.');
+             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( '#timed_text_language' ).val( langKey );
             }
-          });
-      });
-    });
+          } );
+      } );
+    } );
   }
-  var tselect = ($j('#wikiEditor-ui-top').length != 0)?'#wikiEditor-ui-top':'#toolbar';
-  $j(tselect).hide();
-  var ttoolbar = $j('<div>');
-  $j(tselect).after(ttoolbar);
+  var tselect = ( $j( '#wikiEditor-ui-top' ).length != 0 ) ? '#wikiEditor-ui-top':'#toolbar';
+  $j( tselect ).hide();
+  var ttoolbar = $j( '<div>' );
+  $j( tselect ).after( ttoolbar );
 
-  var button = $j('<button>');
-         button.click(uploadSubtitles)
-         button.text(gM("mwe-upload-subs-file"));
-         ttoolbar.append(button);
-  ttoolbar.append(' ');
+  var button = $j( '<button>' );
+         button.click( uploadSubtitles )
+         button.text( gM( "mwe-upload-subs-file" ) );
+         ttoolbar.append( button );
+  ttoolbar.append( ' ' );
 
-  var button = $j('<button>');
-         button.click(function() { document.location.href = wgArticlePath.replace('$1', getVideoTitle()); })
-         button.text(gM("mwe-watch-video"));
-  ttoolbar.append(button);
+  var button = $j( '<button>' );
+         button.click( function() { document.location.href = wgArticlePath.replace( '$1', getVideoTitle() ); } )
+         button.text( gM( "mwe-watch-video" ) );
+  ttoolbar.append( button );
 
-});
+} );
 
index d800d10..4fdf21f 100644 (file)
  *             if it's an array, $j.className becomes jquery.className.js
  *             if it's an associative object then key => value pairs are used
  */
-if( typeof mvAutoLoadClasses == 'undefined' )
-       mvAutoLoadClasses = {};
+if ( typeof mvAutoLoadClasses == 'undefined' )
+       mvAutoLoadClasses = { };
 
 // The script that loads the class set
-function lcPaths( classSet ){
-       for( var i in classSet ) {
+function lcPaths( classSet ) {
+       for ( var i in classSet ) {
                mvAutoLoadClasses[i] = classSet[i];
        }
 }
 
-function mvGetClassPath(k){
-       if( mvAutoLoadClasses[k] ) {
-               //js_log('got class path:' + k +  ' : '+ mvClassPaths[k]);
+function mvGetClassPath( k ) {
+       if ( mvAutoLoadClasses[k] ) {
+               // js_log('got class path:' + k +  ' : '+ mvClassPaths[k]);
                return mvAutoLoadClasses[k];
        } else {
-               js_log('Error:: Could not find path for requested class ' + k );
+               js_log( 'Error:: Could not find path for requested class ' + k );
                return false;
        }
 }
 
-if( typeof mvCssPaths == 'undefined' )
-       mvCssPaths = {};
+if ( typeof mvCssPaths == 'undefined' )
+       mvCssPaths = { };
 
 function lcCssPath( cssSet ) {
-       for( var i in cssSet ) {
+       for ( var i in cssSet ) {
                mvCssPaths[i] = mv_embed_path + cssSet[i];
        }
 }
@@ -65,7 +65,7 @@ function lcCssPath( cssSet ) {
  * we could support direct file requests to the script loader instead 
  * of shared class names read from a central location.
  */
-lcPaths({
+lcPaths( {
        "mv_embed"                      : "mv_embed.js",
        "window.jQuery"         : "jquery/jquery-1.3.2.js",
        "$j.fn.pngFix"          : "jquery/plugins/jquery.pngFix.js",
@@ -149,39 +149,39 @@ lcPaths({
 
        "mvTextInterface"       : "libTimedText/mvTextInterface.js",
        "mvTimeTextEdit"        : "libTimedText/mvTimeTextEdit.js"
-});
+} );
 
 // Dependency mapping for CSS files for self-contained included plugins:
-lcCssPath({
+lcCssPath( {
        '$j.Jcrop'                      : 'libClipEdit/Jcrop/css/jquery.Jcrop.css',
        '$j.fn.ColorPicker'     : 'libClipEdit/colorpicker/css/colorpicker.css'
-})
+} )
 
 
 // parseUri 1.2.2
 // (c) Steven Levithan <stevenlevithan.com>
 // MIT License
-function parseUri (str) {
+function parseUri ( str ) {
        var     o   = parseUri.options,
-               m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
-               uri = {},
+               m   = o.parser[o.strictMode ? "strict" : "loose"].exec( str ),
+               uri = { },
                i   = 14;
 
-       while (i--) uri[o.key[i]] = m[i] || "";
+       while ( i-- ) uri[o.key[i]] = m[i] || "";
 
-       uri[o.q.name] = {};
-       uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
-               if ($1) uri[o.q.name][$1] = $2;
-       });
+       uri[o.q.name] = { };
+       uri[o.key[12]].replace( o.q.parser, function ( $0, $1, $2 ) {
+               if ( $1 ) uri[o.q.name][$1] = $2;
+       } );
 
        return uri;
 };
 parseUri.options = {
        strictMode: false,
-       key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+       key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"],
        q:   {
                name:   "queryKey",
-               parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+               parser: / ( ? : ^ | & )( [ ^ &= ] * ) = ? ( [ ^ &] * ) / g
        },
        parser: {
                strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
@@ -192,23 +192,23 @@ parseUri.options = {
 // For use when mv_embed with script-loader is in the root MediaWiki path
 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
 
-//The global scope: will be depreciated once we get everything into mw
-var _global = this; 
+// The global scope: will be depreciated once we get everything into mw
+var _global = this;
 
 /*
 * setup the empty global mw object
 * will ensure all our functions and variables are properly namespaced
 * reducing chance of conflicts
 */
-if(!window['mw']){
-       window['mw'] = {}
+if ( !window['mw'] ) {
+       window['mw'] = { }
 }
 
-//@@todo move these into mw
+// @@todo move these into mw
 var global_req_cb = new Array(); // The global request callback array
 
 // Get the mv_embed location if it has not been set
-if( !mv_embed_path ) {
+if ( !mv_embed_path ) {
        var mv_embed_path = getMvEmbedPath();
 }
 /**
@@ -217,23 +217,23 @@ if( !mv_embed_path ) {
 * Any global functions/classes that are not jQuery plugins should make
 * there way into the mw namespace
 */
-(function( $ ) {
+( function( $ ) {
        /*
         * global config
         */
        $.conf = {
                'skin_name' : 'mvpcf',
                'jui_skin' : 'redmond',
-               'video_size' : '400x300'        
+               'video_size' : '400x300'
        }
-       //list valid skins here:
+       // list valid skins here:
        $.valid_skins = ['mvpcf', 'kskin'];
        // the version of mwEmbed
        $.version = '1.0r21';
        
-       //special case of commons api url 
-       //(used for default subtitles server for media with a "wikiTitleKey" atm)
-       //(@@todo eventually we should have  wikiTitleKey be namespaced with interwiki ns
+       // special case of commons api url 
+       // (used for default subtitles server for media with a "wikiTitleKey" atm)
+       // (@@todo eventually we should have  wikiTitleKey be namespaced with interwiki ns
        $.commons_api_url = 'http://commons.wikimedia.org/w/api.php';
        /*
        * some global containers flags 
@@ -243,7 +243,7 @@ if( !mv_embed_path ) {
        $.cb_count = 0;
        $.player_list = new Array(), // The global player list per page
        $.req_cb = new Array() // The global request callback array     
-        
+
        /*
        * Language classes mw.lang
        *
@@ -251,12 +251,12 @@ if( !mv_embed_path ) {
        * It contains methods for loading and transforming msg text
        *
        */
-       $.lang = {};
+       $.lang = { };
        /**
        * Setup the lang object
        */
-       var gMsg = {};
-       var gRuleSet = {};
+       var gMsg = { };
+       var gRuleSet = { };
 
        /**
        * loadGM function
@@ -264,8 +264,8 @@ if( !mv_embed_path ) {
        *
        * @param json msgSet The set of msgs to be loaded
        */
-       $.lang.loadGM = function( msgSet ){
-               for( var i in msgSet ) {
+       $.lang.loadGM = function( msgSet ) {
+               for ( var i in msgSet ) {
                        gMsg[ i ] = msgSet[i];
                }
        },
@@ -276,8 +276,8 @@ if( !mv_embed_path ) {
        *
        * @param json ruleSet The ruleset object ( extends  gRuleSet )
        */
-       $.lang.loadRS = function( ruleSet ){
-               for( var i in ruleSet){
+       $.lang.loadRS = function( ruleSet ) {
+               for ( var i in ruleSet ) {
                        gRuleSet[ i ] = ruleSet[ i ];
                }
        }
@@ -294,26 +294,26 @@ if( !mv_embed_path ) {
         * @return string
         */
        $.lang.gM = function( key , args ) {
-               if(! gMsg[ key ])
+               if ( ! gMsg[ key ] )
                        return '&lt;' + key + '&gt;';// Missing key placeholder
 
-               //swap in the arg values
-               var ms =  $.lang.gMsgSwap( key, args) ;
+               // swap in the arg values
+               var ms =  $.lang.gMsgSwap( key, args ) ;
                
                
                
-               //a quick check to see if we need to send the msg via the 'parser'
-               //(we can add more detailed check once we support more wiki syntax)
-               if( ms.indexOf('{{') === -1 && ms.indexOf('[') === -1){
+               // a quick check to see if we need to send the msg via the 'parser'
+               // (we can add more detailed check once we support more wiki syntax)
+               if ( ms.indexOf( '{{' ) === - 1 && ms.indexOf( '[' ) === - 1 ) {
                        return ms;
                }
 
-               //make sure we have the lagMagic setup:
-               //@@todo move to init
+               // make sure we have the lagMagic setup:
+               // @@todo move to init
                $.lang.magicSetup();
-               //send the msg key through the parser
-               var pObj = $.parser.pNew( ms );         
-               //return the transformed msg
+               // send the msg key through the parser
+               var pObj = $.parser.pNew( ms );
+               // return the transformed msg
                return pObj.getHTML();
        }
        /**
@@ -323,21 +323,21 @@ if( !mv_embed_path ) {
        * @param [mixed] args  An array or string to be replaced
        * @return string
        */
-       $.lang.gMsgSwap = function( key , args ){
-               if(! gMsg[ key ])
+       $.lang.gMsgSwap = function( key , args ) {
+               if ( ! gMsg[ key ] )
                        return '&lt;' + key + '&gt;';// Missing key placeholder
-               //get the messeage string:
+               // get the messeage string:
                var ms = gMsg[ key ];
 
-               //replace values
-               if( typeof args == 'object' || typeof args == 'array' ) {
-                       for( var v in args ) {
+               // replace values
+               if ( typeof args == 'object' || typeof args == 'array' ) {
+                       for ( var v in args ) {
                                // Message test replace arguments start at 1 instead of zero:
-                               var rep = new RegExp('\\$'+ ( parseInt(v) + 1 ), 'g');
+                               var rep = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' );
                                ms = ms.replace( rep, args[v] );
                        }
-               } else if( typeof args =='string' || typeof args =='number' ) {
-                       ms = ms.replace(/\$1/g, args);
+               } else if ( typeof args == 'string' || typeof args == 'number' ) {
+                       ms = ms.replace( /\$1/g, args );
                }
                return ms;
        }
@@ -347,8 +347,8 @@ if( !mv_embed_path ) {
        *
        * @returns string The msg key without transforming it
        */
-       $.lang.gMsgNoTrans = function( key ){
-               if( gMsg[ key ] )
+       $.lang.gMsgNoTrans = function( key ) {
+               if ( gMsg[ key ] )
                        return gMsg[ key ]
 
                // Missing key placeholder
@@ -358,12 +358,12 @@ if( !mv_embed_path ) {
        * Add Supported Magic Words to parser
        */
        // Set the setupflag to false:
-       $.lang.doneSetup=false;
-       $.lang.magicSetup = function(){
-               if(!$.lang.doneSetup){
+       $.lang.doneSetup = false;
+       $.lang.magicSetup = function() {
+               if ( !$.lang.doneSetup ) {
                        $.parser.addMagic ( {
                                'PLURAL' : $.lang.procPLURAL
-                       })
+                       } )
 
                        $.lang.doneSetup = true;
                }
@@ -372,60 +372,60 @@ if( !mv_embed_path ) {
        /**
        * Process the PLURAL special language template key:
        */
-       $.lang.procPLURAL = function( tObj ){
-               //setup shortcuts
+       $.lang.procPLURAL = function( tObj ) {
+               // setup shortcuts
                // (gRuleSet is loaded from script-loader to contains local ruleset)
                var rs = gRuleSet['PLURAL'];
 
                /*
                 * Plural matchRuleTest
                 */
-               function matchRuleTest(cRule, val){
-                       //js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
-
-                       function checkValue(compare, val){
-                               if(typeof compare == 'string'){
-                                       range = compare.split('-');
-                                       if( range.length >= 1 ){
-                                               if( val >= range[0] &&  val <= range[1] )
+               function matchRuleTest( cRule, val ) {
+                       // js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
+
+                       function checkValue( compare, val ) {
+                               if ( typeof compare == 'string' ) {
+                                       range = compare.split( '-' );
+                                       if ( range.length >= 1 ) {
+                                               if ( val >= range[0] &&  val <= range[1] )
                                                        return true;
                                        }
                                }
-                               //else do a direct compare
-                               if(compare == val){
+                               // else do a direct compare
+                               if ( compare == val ) {
                                        return true;
                                }
                                return false;
                        }
-                       //check for simple cRule type:
-                       if( typeof cRule == 'number'){
-                               return ( parseInt( val ) == parseInt( cRule) );
-                       }else if( typeof cRule == 'object' ){
-                               var cmatch = {};
-                               //if a list we need to match all for rule match
-                               for(var i in  cRule){
+                       // check for simple cRule type:
+                       if ( typeof cRule == 'number' ) {
+                               return ( parseInt( val ) == parseInt( cRule ) );
+                       } else if ( typeof cRule == 'object' ) {
+                               var cmatch = { };
+                               // if a list we need to match all for rule match
+                               for ( var i in  cRule ) {
                                        var cr = cRule[i];
-                                       //set cr type
+                                       // set cr type
                                        var crType =  '';
-                                       for( var j in cr ){
-                                               if(j == 'mod')
+                                       for ( var j in cr ) {
+                                               if ( j == 'mod' )
                                                        crType = 'mod'
                                        }
-                                       switch(crType){
+                                       switch( crType ) {
                                                case 'mod':
-                                                       if( cr ['is'] ){
-                                                               if( checkValue( val % cr['mod'], cr ['is'] ) )
+                                                       if ( cr ['is'] ) {
+                                                               if ( checkValue( val % cr['mod'], cr ['is'] ) )
                                                                        cmatch[i] = true;
-                                                       }else if( cr['not']){
-                                                               if( ! checkValue( val % cr['mod'], cr ['not'] ) )
+                                                       } else if ( cr['not'] ) {
+                                                               if ( ! checkValue( val % cr['mod'], cr ['not'] ) )
                                                                        cmatch[i] = true;
                                                        }
                                                break;
                                        }
                                }
-                               //check all the matches (taking into consideration "or" order)
-                               for(var i in cRule){
-                                       if( ! cmatch[i] )
+                               // check all the matches (taking into consideration "or" order)
+                               for ( var i in cRule ) {
+                                       if ( ! cmatch[i] )
                                                return false;
                                }
                                return true;
@@ -438,26 +438,26 @@ if( !mv_embed_path ) {
                 * if index is out of range return last param
                 * @param
                 */
-               function getTempParamFromRuleInx(tObj, ruleInx ){
-                       //js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
-                       if( ruleInx     >= tObj.param.length )
-                               return  tObj.param[  tObj.param.length -1 ];
-                       //else return the requested index:
+               function getTempParamFromRuleInx( tObj, ruleInx ) {
+                       // js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
+                       if ( ruleInx    >= tObj.param.length )
+                               return  tObj.param[  tObj.param.length - 1 ];
+                       // else return the requested index:
                        return tObj.param[ ruleInx ];
                }
-               var rCount=0
-               //run the actual rule lookup:
-               for(var ruleInx in rs){
+               var rCount = 0
+               // run the actual rule lookup:
+               for ( var ruleInx in rs ) {
                        cRule = rs[ruleInx];
-                       if( matchRuleTest( cRule, tObj.arg ) ){
-                               //js_log("matched rule: " + ruleInx );
-                               return getTempParamFromRuleInx(tObj, rCount );
+                       if ( matchRuleTest( cRule, tObj.arg ) ) {
+                               // js_log("matched rule: " + ruleInx );
+                               return getTempParamFromRuleInx( tObj, rCount );
                        }
                        rCount ++;
                }
-               //js_log('no match found for: ' + tObj.arg + ' using last/other : ' +  tObj.param [ tObj.param.length -1 ] );
-               //return the last /"other" template param
-               return tObj.param [ tObj.param.length -1 ];
+               // js_log('no match found for: ' + tObj.arg + ' using last/other : ' +  tObj.param [ tObj.param.length -1 ] );
+               // return the last /"other" template param
+               return tObj.param [ tObj.param.length - 1 ];
        }
 
        /**
@@ -468,33 +468,33 @@ if( !mv_embed_path ) {
         */
        $.lang.gMsgLoadRemote = function( msgSet, callback ) {
                var ammessages = '';
-               if( typeof msgSet == 'object' ) {
-                       for( var i in msgSet ) {
+               if ( typeof msgSet == 'object' ) {
+                       for ( var i in msgSet ) {
                                ammessages += msgSet[i] + '|';
                        }
-               } else if( typeof msgSet == 'string' ) {
+               } else if ( typeof msgSet == 'string' ) {
                        ammessages += msgSet;
                }
-               if( ammessages == '' ) {
+               if ( ammessages == '' ) {
                        js_log( 'gMsgLoadRemote: no message set requested' );
                        return false;
                }
-               do_api_req({
+               do_api_req( {
                        'data': {
                                'meta': 'allmessages',
                                'ammessages': ammessages
                        }
                }, function( data ) {
-                       if( data.query.allmessages ) {
+                       if ( data.query.allmessages ) {
                                var msgs = data.query.allmessages;
-                               for( var i in msgs ) {
-                                       var ld = {};
+                               for ( var i in msgs ) {
+                                       var ld = { };
                                        ld[ msgs[i]['name'] ] = msgs[i]['*'];
                                        loadGM( ld );
                                }
                        }
                        callback();
-               });
+               } );
        }
        /**
         * Format a size in bytes for output, using an appropriate
@@ -507,13 +507,13 @@ if( !mv_embed_path ) {
                // For small sizes no decimal places are necessary
                var round = 0;
                var msg = '';
-               if( size > 1024 ) {
+               if ( size > 1024 ) {
                        size = size / 1024;
-                       if( size > 1024 ) {
+                       if ( size > 1024 ) {
                                size = size / 1024;
                                // For MB and bigger two decimal places are smarter
                                round = 2;
-                               if( size > 1024 ) {
+                               if ( size > 1024 ) {
                                        size = size / 1024;
                                        msg = 'mwe-size-gigabytes';
                                } else {
@@ -526,34 +526,34 @@ if( !mv_embed_path ) {
                        msg = 'mwe-size-bytes';
                }
                // JavaScript does not let you choose the precision when rounding
-               var p = Math.pow(10,round);
+               var p = Math.pow( 10, round );
                var size = Math.round( size * p ) / p;
                return gM( msg , size );
        };
        
-       $.lang.formatNumber = function( num ){
+       $.lang.formatNumber = function( num ) {
                /*
                *       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){
+               */
+               function addSeparatorsNF( nStr, outD, sep ) {
                        nStr += '';
                        var dpos = nStr.indexOf( '.' );
                        var nStrEnd = '';
-                       if (dpos != -1) {
-                               nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
-                               nStr = nStr.substring(0, dpos);
+                       if ( dpos != - 1 ) {
+                               nStrEnd = outD + nStr.substring( dpos + 1, nStr.length );
+                               nStr = nStr.substring( 0, dpos );
                        }
                        var rgx = /(\d+)(\d{3})/;
-                       while (rgx.test(nStr)) {
-                               nStr = nStr.replace(rgx, '$1' + sep + '$2');
+                       while ( rgx.test( nStr ) ) {
+                               nStr = nStr.replace( rgx, '$1' + sep + '$2' );
                        }
                        return nStr + nStrEnd;
-               }               
-               //@@todo read language code and give periods or comas: 
-               return addSeparatorsNF( num, '.', ',');
+               }
+               // @@todo read language code and give periods or comas: 
+               return addSeparatorsNF( num, '.', ',' );
        }
        
        
@@ -568,8 +568,8 @@ if( !mv_embed_path ) {
        * @return parserObj returns a parser object that has methods for getting at
        * things you would want
        */
-       $.parser = {};
-       var pMagicSet = {};
+       $.parser = { };
+       var pMagicSet = { };
        /**
         * parser addMagic
         *
@@ -577,30 +577,30 @@ if( !mv_embed_path ) {
         *
         * @param object magicSet key:callback
         */
-       $.parser.addMagic = function( magicSet ){
-               for(var i in magicSet)
+       $.parser.addMagic = function( magicSet ) {
+               for ( var i in magicSet )
                        pMagicSet[ i ] = magicSet[i];
        }
 
-       //actual parse call (returns parser object)
-       $.parser.pNew = function( wikiText, opt ){
-               var parseObj = function( wikiText, opt){
+       // actual parse call (returns parser object)
+       $.parser.pNew = function( wikiText, opt ) {
+               var parseObj = function( wikiText, opt ) {
                        return this.init( wikiText, opt )
                }
                parseObj.prototype = {
-                       //the wikiText "DOM"... stores the parsed wikiText structure
-                       //wtDOM : {}, (not yet supported )
+                       // the wikiText "DOM"... stores the parsed wikiText structure
+                       // wtDOM : {}, (not yet supported )
 
-                       pOut : '', //the parser output string container
-                       init  :function( wikiText ){
+                       pOut : '', // the parser output string container
+                       init  :function( wikiText ) {
                                this.wikiText = wikiText;
                        },
-                       updateText : function( wikiText ){
+                       updateText : function( wikiText ) {
                                this.wikiText = wikiText;
-                               //invalidate the output (will force a re-parse )
+                               // invalidate the output (will force a re-parse )
                                this.pOut = '';
                        },
-                       parse : function(){
+                       parse : function() {
                                /*
                                 * quickly recursive / parse out templates:
                                 */
@@ -608,30 +608,30 @@ 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 differently)
                                // or at least expose something similar to: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
-                               
+
                                // ... but I am having fun with recursion so here it is...
-                               function rdpp ( txt , cn){                              
-                                       var node = {};                                  
-                                       //inspect each char
-                                       for(var a=0; a < txt.length; a++){
-                                               if( txt[a] == '{' && txt[a+1] == '{' ){
-                                                       a=a+2;
+                               function rdpp ( txt , cn ) {
+                                       var node = { };
+                                       // inspect each char
+                                       for ( var a = 0; a < txt.length; a++ ) {
+                                               if ( txt[a] == '{' && txt[a + 1] == '{' ) {
+                                                       a = a + 2;
                                                        node['p'] = node;
-                                                       if(!node['c'])
+                                                       if ( !node['c'] )
                                                                node['c'] = new Array();
 
-                                                       node['c'].push( rdpp( txt.substr( a ), true ) );                                                                                                                                                                                                                                                                                                                                        
-                                               }else if( txt[a] == '}' && txt[a+1] == '}'){                                                    
-                                                       a=a+2;
-                                                       if( !node['p'] ){
+                                                       node['c'].push( rdpp( txt.substr( a ), true ) );
+                                               } else if ( txt[a] == '}' && txt[a + 1] == '}' ) {
+                                                       a = a + 2;
+                                                       if ( !node['p'] ) {
                                                                return node;
-                                                       }                                                       
-                                                       node = node['p'];                                                       
+                                                       }
+                                                       node = node['p'];
                                                }
-                                               if(!node['t'])
-                                                       node['t']='';
-                                               //don't put closures into output:
-                                               if( txt[a] &&  txt[a]!='}' )
+                                               if ( !node['t'] )
+                                                       node['t'] = '';
+                                               // don't put closures into output:
+                                               if ( txt[a] &&  txt[a] != '}' )
                                                                node['t'] += txt[a];
                                                                
                                        }
@@ -640,53 +640,53 @@ if( !mv_embed_path ) {
                                /**
                                 * parse template text as template name and named params
                                 */
-                               function parseTmplTxt( ts ){                            
-                                       var tObj = {};
-                                       //Get template name:
-                                       tname = ts.split('\|').shift() ;
-                                       tname = tname.split('\{').shift() ;
+                               function parseTmplTxt( ts ) {
+                                       var tObj = { };
+                                       // Get template name:
+                                       tname = ts.split( '\|' ).shift() ;
+                                       tname = tname.split( '\{' ).shift() ;
                                        tname = tname.replace( /^\s+|\s+$/g, "" ); //trim
 
-                                       //check for arguments:
-                                       if( tname.split(':').length == 1 ){
+                                       // check for arguments:
+                                       if ( tname.split( ':' ).length == 1 ) {
                                                tObj["name"] = tname;
-                                       }else{
-                                               tObj["name"] = tname.split(':').shift();
-                                               tObj["arg"] = tname.split(':').pop();
+                                       } else {
+                                               tObj["name"] = tname.split( ':' ).shift();
+                                               tObj["arg"] = tname.split( ':' ).pop();
                                        }
                                                                                
-                                       var pSet = ts.split('\|');
-                                       pSet.splice(0,1);                                       
-                                       if( pSet.length ){
+                                       var pSet = ts.split( '\|' );
+                                       pSet.splice( 0, 1 );
+                                       if ( pSet.length ) {
                                                tObj.param = new Array();
-                                               for(var pInx in pSet){                                                  
+                                               for ( var pInx in pSet ) {
                                                        var tStr = pSet[ pInx ];
-                                                       //check for empty param
-                                                       if(tStr==''){
+                                                       // check for empty param
+                                                       if ( tStr == '' ) {
                                                                tObj.param[ pInx ] = '';
                                                                continue;
                                                        }
-                                                       for(var b=0 ; b < tStr.length ; b++){
-                                                               if(tStr[b] == '=' && b>0 && b<tStr.length && tStr[b-1]!='\\'){
-                                                                       //named param
-                                                                       tObj.param[ tStr.split('=').shift() ] = tStr.split('=').pop();
-                                                               }else{
-                                                                       //indexed param
+                                                       for ( var b = 0 ; b < tStr.length ; b++ ) {
+                                                               if ( tStr[b] == '=' && b > 0 && b < tStr.length && tStr[b - 1] != '\\' ) {
+                                                                       // named param
+                                                                       tObj.param[ tStr.split( '=' ).shift() ] =       tStr.split( '=' ).pop();
+                                                               } else {
+                                                                       // indexed param
                                                                        tObj.param[ pInx ] = tStr;
                                                                }
                                                        }
                                                }
-                                       }                                                       
+                                       }
                                        return tObj;
                                }
-                               function getMagicTxtFromTempNode( node ){
+                               function getMagicTxtFromTempNode( node ) {
                                        node.tObj = parseTmplTxt ( node.t );
-                                       //do magic swap if template key found in pMagicSet
-                                       if( node.tObj.name in pMagicSet){
+                                       // do magic swap if template key found in pMagicSet
+                                       if ( node.tObj.name in pMagicSet ) {
                                                var nt = pMagicSet[ node.tObj.name ]( node.tObj );
                                                return nt;
-                                       }else{
-                                               //don't swap just return text
+                                       } else {
+                                               // don't swap just return text
                                                return node.t;
                                        }
                                }
@@ -696,37 +696,37 @@ if( !mv_embed_path ) {
                                 * go last child first swap upward: (could probably be integrated above somehow)
                                 */
                                var pNode = null;
-                               function recurse_magic_swap( node ){
-                                       if( !pNode )
+                               function recurse_magic_swap( node ) {
+                                       if ( !pNode )
                                                pNode = node;
 
-                                       if( node['c'] ){
-                                               //swap all the kids:
-                                               for(var i in node['c']){
+                                       if ( node['c'] ) {
+                                               // swap all the kids:
+                                               for ( var i in node['c'] ) {
                                                        var nt = recurse_magic_swap( node['c'][i] );
-                                                       //swap it into current
-                                                       if( node.t ){
-                                                               node.t = node.t.replace( node['c'][i].t, nt);
+                                                       // swap it into current
+                                                       if ( node.t ) {
+                                                               node.t = node.t.replace( node['c'][i].t, nt );
                                                        }
-                                                       //swap into parent
-                                                       pNode.t  = pNode.t.replace( node['c'][i].t, nt);
+                                                       // swap into parent
+                                                       pNode.t  = pNode.t.replace( node['c'][i].t, nt );
                                                }
-                                               //do the current node:
+                                               // do the current node:
                                                var nt = getMagicTxtFromTempNode( node );
-                                               pNode.t = pNode.t.replace(node.t , nt);
-                                               //run the swap for the outer most node
+                                               pNode.t = pNode.t.replace( node.t , nt );
+                                               // run the swap for the outer most node
                                                return node.t;
-                                       }else{
-                                               //node.t = getMagicFromTempObj( node.t )
+                                       } else {
+                                               // node.t = getMagicFromTempObj( node.t )
                                                return getMagicTxtFromTempNode( node );
                                        }
                                }
-                               //parse out the template node structure:
+                               // parse out the template node structure:
                                this.pNode = rdpp ( this.wikiText );
-                               //strip out the parent from the root    
+                               // strip out the parent from the root   
                                this.pNode['p'] = null;
                                
-                               //do the recursive magic swap text:
+                               // do the recursive magic swap text:
                                this.pOut = recurse_magic_swap( this.pNode );
 
                        },
@@ -736,27 +736,27 @@ if( !mv_embed_path ) {
                        * 
                        * @returns {Array} template vars names
                        */
-                       getTemplateVars:function(){
-                               //do a regular ex to get the ~likely~ template values
-                               //(of course this sucks)
-                               //but maybe this will make its way into the api sometime soon to support wysiwyg type editors
-                               //ideally it would expose a good deal of info about the template params
-                               js_log('matching against: ' + this.wikiText);
-                               var tempVars = this.wikiText.match(/\{\{\{([^\}]*)\}\}\}/gi);
-                               //clean up results:
+                       getTemplateVars:function() {
+                               // do a regular ex to get the ~likely~ template values
+                               // (of course this sucks)
+                               // but maybe this will make its way into the api sometime soon to support wysiwyg type editors
+                               // ideally it would expose a good deal of info about the template params
+                               js_log( 'matching against: ' + this.wikiText );
+                               var tempVars = this.wikiText.match( /\{\{\{([^\}]*)\}\}\}/gi );
+                               // clean up results:
                                var tVars = new Array();
-                               for(var i=0; i < tempVars.length; i++){
-                                       var tvar = tempVars[i].replace('{{{','').replace('}}}','');
+                               for ( var i = 0; i < tempVars.length; i++ ) {
+                                       var tvar = tempVars[i].replace( '{{{', '' ).replace( '}}}', '' );
                                        // Strip anything after a |
-                                       if(tvar.indexOf('|') != -1){
-                                               tvar = tvar.substr(0, tvar.indexOf('|'));
+                                       if ( tvar.indexOf( '|' ) != - 1 ) {
+                                               tvar = tvar.substr( 0, tvar.indexOf( '|' ) );
                                        }
                                        // Add if not already there
-                                       if( $j.inArray(tvar, tVars) == -1)
-                                                tVars.push( tvar );                                    
+                                       if ( $j.inArray( tvar, tVars ) == - 1 )
+                                                tVars.push( tvar );
                                }
                                return tVars;
-                       },                      
+                       },
                        /*
                         * parsed template api ~loosely based off of ~POM~
                         * http://www.mediawiki.org/wiki/Extension:Page_Object_Model
@@ -768,24 +768,24 @@ if( !mv_embed_path ) {
                         * gets a requested template from the wikitext (if available)
                         *  
                         */
-                       templates: function( tname ){
+                       templates: function( tname ) {
                                this.parse();
                                var tmplSet = new Array();
-                               function getMatchingTmpl( node ){
-                                       if( node['c'] ){
-                                               for(var i in node['c']){
+                               function getMatchingTmpl( node ) {
+                                       if ( node['c'] ) {
+                                               for ( var i in node['c'] ) {
                                                        getMatchingTmpl( node['c'] );
                                                }
-                                       }                                       
-                                       if( tname && node.tObj){
-                                               if( node.tObj['name'] == tname )
+                                       }
+                                       if ( tname && node.tObj ) {
+                                               if ( node.tObj['name'] == tname )
                                                        tmplSet.push( node.tObj );
-                                       }else if( node.tObj ){
+                                       } else if ( node.tObj ) {
                                                tmplSet.push( node.tObj );
                                        }
-                               }                               
-                               getMatchingTmpl( this.pNode );                          
-                               return tmplSet;                         
+                               }
+                               getMatchingTmpl( this.pNode );
+                               return tmplSet;
                        },
                        /**
                         * Returns the transformed wikitext
@@ -799,42 +799,42 @@ if( !mv_embed_path ) {
                         *              When editing you update the data structure directly
                         *              Then in output time you just go DOM->html-ish output without re-parsing anything                           
                         */
-                       getHTML : function(){
-                               //wikiText updates should invalidate pOut
-                               if( this.pOut == ''){
+                       getHTML : function() {
+                               // wikiText updates should invalidate pOut
+                               if ( this.pOut == '' ) {
                                        this.parse();
-                               }                               
+                               }
                                return this.pOut;
                        }
                };
-               //return the parserObj
-               return new parseObj( wikiText, opt) ;
+               // return the parserObj
+               return new parseObj( wikiText, opt ) ;
        }
                
        /* 
        * API and request functions
        */
        $.getLocalApiUrl = function() {
-               if ( typeof wgServer != 'undefined' && typeof wgScriptPath  != 'undefined') {
+               if ( typeof wgServer != 'undefined' && typeof wgScriptPath  != 'undefined' ) {
                        return wgServer + wgScriptPath + '/api.php';
                }
                return false;
        }
                
-})(window.mw);
+} )( window.mw );
 
-//load in js2 stopgap into proper location: 
-if( typeof gMsg != 'undefined'){
+// load in js2 stopgap into proper location: 
+if ( typeof gMsg != 'undefined' ) {
        mw.lang.loadGM( gMsg )
 }
 
-//setup legacy global shortcuts:
+// setup legacy global shortcuts:
 var loadGM = mw.lang.loadGM;
 var loadRS = mw.lang.loadRS;
 var gM = mw.lang.gM;
 
 // All default messages in [English] should be overwritten by the CMS language message system.
-mw.lang.loadGM({
+mw.lang.loadGM( {
        "mwe-loading_txt" : "Loading ...",
        "mwe-size-gigabytes" : "$1 GB",
        "mwe-size-megabytes" : "$1 MB",
@@ -846,30 +846,30 @@ mw.lang.loadGM({
        "mwe-load-drag-item" : "Loading dragged item",
        "mwe-ok" : "OK",
        "mwe-cancel" : "Cancel"
-});
+} );
 
 
 // Get the loading image
-function mv_get_loading_img( style, class_attr ){
-       var style_txt = (style)?style:'';
-       var class_attr = (class_attr) ? 'class="' + class_attr + '"' : 'class="mv_loading_img"';
-       return '<div '+class_attr+' style="' + style +'"></div>';
+function mv_get_loading_img( style, class_attr ) {
+       var style_txt = ( style ) ? style:'';
+       var class_attr = ( class_attr ) ? 'class="' + class_attr + '"' : 'class="mv_loading_img"';
+       return '<div ' + class_attr + ' style="' + style + '"></div>';
 }
 
-function mv_set_loading(target, load_id){
-       var id_attr = ( load_id )?' id="' + load_id + '" ':'';
-       $j(target).append('<div '+id_attr+' style="position:absolute;top:0px;left:0px;height:100%;width:100%;'+
+function mv_set_loading( target, load_id ) {
+       var id_attr = ( load_id ) ? ' id="' + load_id + '" ':'';
+       $j( target ).append( '<div ' + id_attr + ' style="position:absolute;top:0px;left:0px;height:100%;width:100%;' +
                'background-color:#FFF;">' +
-                       mv_get_loading_img('top:30px;left:30px') +
-               '</div>');
+                       mv_get_loading_img( 'top:30px;left:30px' ) +
+               '</div>' );
 }
 
 /**
 * mvJsLoader class handles initialization and js file loads
 */
 var mvJsLoader = {
-       libreq : {},
-       libs : {},
+       libreq : { },
+       libs : { },
 
        // Base lib flags
        onReadyEvents: new Array(),
@@ -887,102 +887,102 @@ var mvJsLoader = {
        missing_path : null,
        doLoad: function( loadLibs, callback ) {
                this.ctime++;
-               if( loadLibs && loadLibs.length != 0 ) {
-                       //js_log("doLoad setup::" + JSON.stringify( loadLibs ) );
+               if ( loadLibs && loadLibs.length != 0 ) {
+                       // js_log("doLoad setup::" + JSON.stringify( loadLibs ) );
                        // Set up this.libs
                        // First check if we already have this library loaded
                        var all_libs_loaded = true;
-                       for( var i = 0; i< loadLibs.length; i++ ) {
+                       for ( var i = 0; i < loadLibs.length; i++ ) {
                                // Check if the library is already loaded
-                               if( ! this.checkObjPath( loadLibs[i] ) ) {
+                               if ( ! this.checkObjPath( loadLibs[i] ) ) {
                                        all_libs_loaded = false;
                                }
                        }
-                       if( all_libs_loaded ) {
+                       if ( all_libs_loaded ) {
                                js_log( 'Libraries ( ' + loadLibs  +  ') already loaded... skipping load request' );
                                callback();
                                return;
                        }
                        // Do a check for any CSS we may need and get it
-                       for( var i = 0; i < loadLibs.length; i++ ) {
-                               if( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) {
+                       for ( var i = 0; i < loadLibs.length; i++ ) {
+                               if ( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) {
                                        loadExternalCss( mvCssPaths[ loadLibs[i] ] );
                                }
                        }
 
                        // Check if we should use the script loader to combine all the requests into one
-                       if( typeof mwSlScript != 'undefined' ) {
+                       if ( typeof mwSlScript != 'undefined' ) {
                                var class_set = '';
                                var last_class = '';
                                var coma = '';
-                               for( var i = 0; i < loadLibs.length; i++ ) {
+                               for ( var i = 0; i < loadLibs.length; i++ ) {
                                        var curLib = loadLibs[i];
                                        // Only add if not included yet:
-                                       if( ! this.checkObjPath( curLib ) ) {
+                                       if ( ! this.checkObjPath( curLib ) ) {
                                                class_set += coma + curLib;
                                                last_class = curLib;
                                                coma = ',';
                                        }
                                }
-                               //Build the url to the scriptServer striping its request parameters:
+                               // Build the url to the scriptServer striping its request parameters:
                                var puri = parseUri( getMvEmbedURL() );
-                               if( ( getMvEmbedURL().indexOf('://') != -1 )
+                               if ( ( getMvEmbedURL().indexOf( '://' ) != - 1 )
                                        && puri.host != parseUri( document.URL ).host )
                                {
                                        var scriptPath = puri.protocol + '://' + puri.authority + puri.path;
-                               }else{
+                               } else {
                                        var scriptPath = puri.path;
                                }
-                               //js_log('scriptServer Path is: ' + scriptPath + "\n host script path:" + getMvEmbedURL() );                            
+                               // js_log('scriptServer Path is: ' + scriptPath + "\n host script path:" + getMvEmbedURL() );                           
                                this.libs[ last_class ] = scriptPath + '?class=' + class_set +
                                        '&' + getMwReqParam();
 
                        } else {
                                // Do many requests
-                               for( var i = 0; i < loadLibs.length; i++ ) {
+                               for ( var i = 0; i < loadLibs.length; i++ ) {
                                        var curLib = loadLibs[i];
-                                       if( curLib ) {
+                                       if ( curLib ) {
                                                var libLoc = mvGetClassPath( curLib );
                                                // Do a direct load of the file (pass along unique request id from
                                                // request or mv_embed Version )
-                                               var qmark = (libLoc.indexOf( '?' ) !== true) ? '?' : '&';
+                                               var qmark = ( libLoc.indexOf( '?' ) !== true ) ? '?' : '&';
                                                this.libs[curLib] = mv_embed_path + libLoc + qmark + getMwReqParam();
                                        }
                                }
                        }
                }
                
-               if( callback ) {
+               if ( callback ) {
                        this.callbacks.push( callback );
                }
-               if( this.checkLoading() ) {
-                       //@@todo we should check the <script> Element .onLoad property to
-                       //make sure its just not a very slow connection
-                       //(even though the class is not loaded)
-                       if( this.load_time++ > 4000 ){ // Time out after ~80 seconds
-                               js_log( gM('mwe-error_load_lib', [mvGetClassPath(this.missing_path),  this.missing_path]) );
+               if ( this.checkLoading() ) {
+                       // @@todo we should check the <script> Element .onLoad property to
+                       // make sure its just not a very slow connection
+                       // (even though the class is not loaded)
+                       if ( this.load_time++ > 4000 ) { // Time out after ~80 seconds
+                               js_log( gM( 'mwe-error_load_lib', [mvGetClassPath( this.missing_path ),  this.missing_path] ) );
                                this.load_error = true;
                        } else {
                                setTimeout( 'mvJsLoader.doLoad()', 20 );
                        }
                } else {
-                       //js_log('checkLoading passed. Running callbacks...');
+                       // js_log('checkLoading passed. Running callbacks...');
                        // Only do callbacks if we are in the same instance (weird concurrency issue)
-                       var cb_count=0;
-                       for( var i = 0; i < this.callbacks.length; i++ )
+                       var cb_count = 0;
+                       for ( var i = 0; i < this.callbacks.length; i++ )
                                cb_count++;
-                       //js_log('RESET LIBS: loading is: '+ loading + ' callback count: '+cb_count +
+                       // js_log('RESET LIBS: loading is: '+ loading + ' callback count: '+cb_count +
                        //      ' p:'+ this.ptime +' c:'+ this.ctime);
 
                        // Reset the libs
-                       this.libs = {};
-                       //js_log('done loading, do call: ' + this.callbacks[0] );
-                       while( this.callbacks.length != 0 ) {
-                               if( this.ptime == this.ctime - 1 ) { // Enforce thread consistency
+                       this.libs = { };
+                       // js_log('done loading, do call: ' + this.callbacks[0] );
+                       while ( this.callbacks.length != 0 ) {
+                               if ( this.ptime == this.ctime - 1 ) { // Enforce thread consistency
                                        this.callbacks.pop()();
-                                       //func = this.callbacks.pop();
-                                       //js_log(' run: '+this.ctime+ ' p: ' + this.ptime + ' ' +loading+ ' :'+ func);
-                                       //func();
+                                       // func = this.callbacks.pop();
+                                       // js_log(' run: '+this.ctime+ ' p: ' + this.ptime + ' ' +loading+ ' :'+ func);
+                                       // func();
                                } else {
                                        // Re-issue doLoad ( ptime will be set to ctime so we should catch up)
                                        setTimeout( 'mvJsLoader.doLoad()', 25 );
@@ -994,10 +994,10 @@ var mvJsLoader = {
        },
        doLoadDepMode: function( loadChain, callback ) {
                // Firefox executes JS in the order in which it is included, so just directly issue the request
-               if( $j.browser.firefox ) {
+               if ( $j.browser.firefox ) {
                        var loadSet = [];
-                       for( var i = 0; i < loadChain.length; i++ ) {
-                               for( var j = 0; j < loadChain[i].length; j++ ) {
+                       for ( var i = 0; i < loadChain.length; i++ ) {
+                               for ( var j = 0; j < loadChain[i].length; j++ ) {
                                        loadSet.push( loadChain[i][j] );
                                }
                        }
@@ -1005,38 +1005,38 @@ var mvJsLoader = {
                } else {
                        // Safari and IE tend to execute out of order so load with dependency checks
                        mvJsLoader.doLoad( loadChain.shift(), function() {
-                               if( loadChain.length != 0 ) {
+                               if ( loadChain.length != 0 ) {
                                        mvJsLoader.doLoadDepMode( loadChain, callback );
                                } else {
                                        callback();
                                }
-                       });
+                       } );
                }
        },
        checkLoading: function() {
                var loading = 0;
                var i = null;
-               for( var i in this.libs ) { // for/in loop is OK on an object
-                       if( !this.checkObjPath( i ) ) {
-                               if( !this.libreq[i] ) {
+               for ( var i in this.libs ) { // for/in loop is OK on an object
+                       if ( !this.checkObjPath( i ) ) {
+                               if ( !this.libreq[i] ) {
                                        loadExternalJs( this.libs[i] );
                                }
                                this.libreq[i] = 1;
-                               //js_log("has not yet loaded: " + i);
+                               // js_log("has not yet loaded: " + i);
                                loading = 1;
                        }
                }
                return loading;
        },
        checkObjPath: function( libVar ) {
-               if( !libVar )
+               if ( !libVar )
                        return false;
                var objPath = libVar.split( '.' )
                var cur_path = '';
-               for( var p = 0; p < objPath.length; p++ ) {
-                       cur_path = (cur_path == '') ? cur_path + objPath[p] : cur_path + '.' + objPath[p];
-                       eval( 'var ptest = typeof ( '+ cur_path + ' ); ');
-                       if( ptest == 'undefined' ) {
+               for ( var p = 0; p < objPath.length; p++ ) {
+                       cur_path = ( cur_path == '' ) ? cur_path + objPath[p] : cur_path + '.' + objPath[p];
+                       eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
+                       if ( ptest == 'undefined' ) {
                                this.missing_path = cur_path;
                                return false;
                        }
@@ -1048,32 +1048,32 @@ var mvJsLoader = {
         * checks for jQuery and adds the $j noConflict var
         */
        jQueryCheck: function( callback ) {
-               //js_log( 'jQueryCheck::' + this.jQuerySetupFlag);
+               // js_log( 'jQueryCheck::' + this.jQuerySetupFlag);
                var _this = this;
                // Skip stuff if $j is already loaded:
-               if( _global['$j'] ){
-                       callback(); //call the callback now
-                       callback=null;
+               if ( _global['$j'] ) {
+                       callback(); // call the callback now
+                       callback = null;
                        // This is tricky because js2stopgap registers $j without doing the "setup" 
-                       if( _this.jQuerySetupFlag )
+                       if ( _this.jQuerySetupFlag )
                                return ;
-               }               
+               }
                // Load jQuery
-               _this.doLoad([
+               _this.doLoad( [
                        'window.jQuery'
                ], function() {
-                       //only do the $j setup once:
-                       if(!_global['$j']){
+                       // only do the $j setup once:
+                       if ( !_global['$j'] ) {
                                _global['$j'] = jQuery.noConflict();
                        }
-                       if( _this.jQuerySetupFlag == false){
-                               //js_log('setup mv_embed jQuery bindings');
+                       if ( _this.jQuerySetupFlag == false ) {
+                               // js_log('setup mv_embed jQuery bindings');
                                // 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'] + '/';
                                _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/images/';
-                               _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg';                   
+                               _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg';
 
                                // Make sure the skin/style sheets are always available:
                                loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
@@ -1081,31 +1081,31 @@ var mvJsLoader = {
 
                                // Set up AJAX to not send dynamic URLs for loading scripts (we control that with
                                // the scriptLoader)
-                               $j.ajaxSetup({
+                               $j.ajaxSetup( {
                                        cache: true
-                               });
+                               } );
 
                                js_log( 'jQuery loaded into $j' );
                                // Set up mvEmbed jQuery bindings and config based dependencies
                                mv_jqueryBindings();
                                _this.jQuerySetupFlag = true;
                                
-                               //js_log('should run callback: ' + callback);
+                               // js_log('should run callback: ' + callback);
                                // Run the callback if not already run above
-                               if( callback ) {
+                               if ( callback ) {
                                        callback();
                                }
-                       }                       
-               });
+                       }
+               } );
        },
        embedVideoCheck:function( callback ) {
                var _this = this;
                js_log( 'embedVideoCheck:' );
                // Make sure we have jQuery
                _this.jQueryCheck( function() {
-                       //set class videonojs to loading
-                       $j('.videonojs').html( gM('mwe-loading_txt') );
-                       //Set up the embed video player class request: (include the skin js as well)
+                       // set class videonojs to loading
+                       $j( '.videonojs' ).html( gM( 'mwe-loading_txt' ) );
+                       // Set up the embed video player class request: (include the skin js as well)
                        var depReq = [
                                [
                                        '$j.ui',
@@ -1118,44 +1118,44 @@ var mvJsLoader = {
                                ]
                        ];
                        
-                       //add any requested skins (supports multiple skins per single page)
-                       if( mw.skin_list ){
-                               for(var i in mw.skin_list  ){
+                       // 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 )
+                       if ( $j.browser.msie || $j.browser.version < 7 )
                                depReq[0].push( '$j.fn.pngFix' );
 
-                       //load the video libs:
+                       // load the video libs:
                        _this.doLoadDepMode( depReq, function() {
                                embedTypes.init();
                                callback();
-                               $j('.videonojs').remove();
-                       });
-               });
+                               $j( '.videonojs' ).remove();
+                       } );
+               } );
        },
        addLoadEvent: function( fn ) {
-               //js_log('add ready event: ' + fn );
+               // js_log('add ready event: ' + fn );
                this.onReadyEvents.push( fn );
        },
        // Check the jQuery flag. This way, when remote embedding, we don't load jQuery
        // unless js2AddOnloadHook was used or there is video on the page.
        runQueuedFunctions: function() {
-               js_log("runQueuedFunctions");           
-               var _this = this;               
-               this.jQueryCheck( function() {                  
+               js_log( "runQueuedFunctions" );
+               var _this = this;
+               this.jQueryCheck( function() {
                        _this.runReadyEvents();
                        _this.doneReadyEvents = true;
-               });
+               } );
        },
        runReadyEvents: function() {
                js_log( "runReadyEvents" +  this.onReadyEvents.length );
-               while( this.onReadyEvents.length ) {    
+               while ( this.onReadyEvents.length ) {
                        var func = this.onReadyEvents.shift();
-                       //js_log('run onReady:: ' + func );
+                       // js_log('run onReady:: ' + func );
                        func();
                }
        }
@@ -1165,7 +1165,7 @@ var mvJsLoader = {
 function mwLoad( loadSet, callback ) {
        mvJsLoader.doLoad( loadSet, callback );
 }
-//mw.shortcut
+// mw.shortcut
 mw.load = mwLoad;
 
 // Load an external JS file. Similar to jquery .require plugin,
@@ -1180,7 +1180,7 @@ mw.load = mwLoad;
  * $j(document).ready( function(){ */
 function mwdomReady( force ) {
        js_log( 'f:mwdomReady:' );
-       if( !force && mw.init_done ) {
+       if ( !force && mw.init_done ) {
                js_log( "mw done, do nothing..." );
                return false;
        }
@@ -1193,43 +1193,43 @@ function mwdomReady( force ) {
                document.getElementsByTagName( "audio" ),
                document.getElementsByTagName( "playlist" )
        ];
-       if( e[0].length != 0 || e[1].length != 0 || e[2].length != 0 ) {
-               //look for any skin classes we have to load: 
-               for(var j in e){
-                       for(var k in e[j]){
-                               if(e[j][k] && typeof( e[j][k]) == 'object'){
-                                       var     sn = e[j][k].getAttribute('class');                             
-                                       if( sn && sn != ''){
-                                               for(var n=0;n< mw.valid_skins.length;n++){ 
-                                                       if( sn.indexOf(mw.valid_skins[n]) !== -1){
+       if ( e[0].length != 0 || e[1].length != 0 || e[2].length != 0 ) {
+               // look for any skin classes we have to load: 
+               for ( var j in e ) {
+                       for ( var k in e[j] ) {
+                               if ( e[j][k] && typeof( e[j][k] ) == 'object' ) {
+                                       var     sn = e[j][k].getAttribute( 'class' );
+                                       if ( sn && sn != '' ) {
+                                               for ( var n = 0; n < mw.valid_skins.length; n++ ) {
+                                                       if ( sn.indexOf( mw.valid_skins[n] ) !== - 1 ) {
                                                                mw.skin_list.push( mw.valid_skins[n] );
                                                        }
                                                }
                                        }
                                }
                        }
-               }                               
+               }
                // Load libs and process videos
                mvJsLoader.embedVideoCheck( function() {
                        // Run any queued global events:
                        mv_video_embed( function() {
                                mvJsLoader.runQueuedFunctions();
-                       });
-               });
+                       } );
+               } );
        } else {
                mvJsLoader.runQueuedFunctions();
        }
 }
 
-//js2AddOnloadHook: ensure jQuery and the DOM are ready
-function js2AddOnloadHook( func ) {    
-       //js_log('js2AddOnloadHook:: jquery:' +func);   
+// js2AddOnloadHook: ensure jQuery and the DOM are ready
+function js2AddOnloadHook( func ) {
+       // js_log('js2AddOnloadHook:: jquery:' +func);  
        // If we are ready run directly else add load event: 
-       if( mvJsLoader.doneReadyEvents ) {
-               js_log('run queued event: ' + func);    
+       if ( mvJsLoader.doneReadyEvents ) {
+               js_log( 'run queued event: ' + func );
                func();
        } else {
-               js_log('add to load event: ' + func);           
+               js_log( 'add to load event: ' + func );
                mvJsLoader.addLoadEvent( func );
        }
 }
@@ -1243,7 +1243,7 @@ function rewrite_by_id( vid_id, ready_callback ) {
        // Force a re-check of the DOM for playlist or video elements:
        mvJsLoader.embedVideoCheck( function() {
                mv_video_embed( ready_callback, vid_id );
-       });
+       } );
 }
 
 
@@ -1255,12 +1255,12 @@ if ( document.addEventListener ) {
        document.addEventListener( "DOMContentLoaded", mwdomReady, false );
 }
 var temp_f;
-if( window.onload ) {
+if ( window.onload ) {
     temp_f = window.onload;
 }
 // Use the onload method as a backup
 window.onload = function () {
-    if( temp_f )
+    if ( temp_f )
         temp_f();
        mwdomReady();
 }
@@ -1276,71 +1276,71 @@ window.onload = function () {
  */
 function mv_jqueryBindings() {
        js_log( 'mv_jqueryBindings' );
-       (function( $ ) {
+       ( function( $ ) {
                /*
                * dragDrop file loader 
                */
-               $.fn.dragFileUpload = function ( conf ){
-                       if( this.selector ){    
-                               var _this = this;       
-                               //load the dragger and "setup"
-                               mw.load( ['$j.fn.dragDropFile'], function(){
-                                       $j(_this.selector).dragDropFile();                                                      
-                               }); 
-                       }                                        
+               $.fn.dragFileUpload = function ( conf ) {
+                       if ( this.selector ) {
+                               var _this = this;
+                               // load the dragger and "setup"
+                               mw.load( ['$j.fn.dragDropFile'], function() {
+                                       $j( _this.selector ).dragDropFile();
+                               } );
+                       }
                }
                /*
                 * apiProxy Loader loader:
                 * 
                 * @param mode is either 'server' or 'client'
-                */                             
-               $.apiProxy = function( mode, pConf, callback ){
-                       js_log('do apiProxy setup');                    
+                */
+               $.apiProxy = function( mode, pConf, callback ) {
+                       js_log( 'do apiProxy setup' );
                        mvJsLoader.doLoad( [
                                'mw.proxy',
                                'JSON'
-                       ], function(){                          
-                               //do the proxy setup or 
-                               if( mode == 'client'){
-                                       //just do the setup (no callbcak for client setup) 
+                       ], function() {
+                               // do the proxy setup or 
+                               if ( mode == 'client' ) {
+                                       // just do the setup (no callbcak for client setup) 
                                        mw.proxy.client( pConf );
-                                       if( callback )
+                                       if ( callback )
                                                callback();
-                               }else if( mode=='server' ){
-                                       //do the request with the callback
+                               } else if ( mode == 'server' ) {
+                                       // do the request with the callback
                                        mw.proxy.server( pConf , callback );
                                }
-                       });     
+                       } );
                }
                
-               //non selector based add-media-wizard direct invocation with loader
-               $.addMediaWiz = function( iObj, callback ){                     
-                       js_log(".addMediaWiz call");
-                       //check if already loaded:
-                       if( _global['rsdMVRS'] ){
+               // non selector based add-media-wizard direct invocation with loader
+               $.addMediaWiz = function( iObj, callback ) {
+                       js_log( ".addMediaWiz call" );
+                       // check if already loaded:
+                       if ( _global['rsdMVRS'] ) {
                                _global['rsdMVRS'].doReDisplay();
-                               if( callback )
+                               if ( callback )
                                        callback( _global['rsdMVRS'] );
                                return ;
                        }
-                       //display a loader: 
-                       $.addLoaderDialog( gM('mwe-loading-add-media-wiz') );
-                       //load the addMedia wizard without a target: 
-                       $.fn.addMediaWiz ( iObj, function( amwObj ){
-                               //close the dialog
+                       // display a loader: 
+                       $.addLoaderDialog( gM( 'mwe-loading-add-media-wiz' ) );
+                       // load the addMedia wizard without a target: 
+                       $.fn.addMediaWiz ( iObj, function( amwObj ) {
+                               // close the dialog
                                $.closeLoaderDialog();
-                               //do the add-media-wizard display
-                               amwObj.doInitDisplay();                         
-                               //call the parent callback:
-                               if( callback )
-                                       callback( _global['rsdMVRS'] ); 
-                       });
+                               // do the add-media-wizard display
+                               amwObj.doInitDisplay();
+                               // call the parent callback:
+                               if ( callback )
+                                       callback( _global['rsdMVRS'] );
+                       } );
                }
-               $.fn.addMediaWiz = function( iObj, callback ) {                 
-                       if( this.selector ){                    
+               $.fn.addMediaWiz = function( iObj, callback ) {
+                       if ( this.selector ) {
                                // First set the cursor for the button to "loading"
                                $j( this.selector ).css( 'cursor', 'wait' ).attr( 'title', gM( 'mwe-loading_txt' ) );
-                               //set the target: 
+                               // set the target: 
                                iObj['target_invocation'] = this.selector;
                        }
 
@@ -1350,12 +1350,12 @@ function mv_jqueryBindings() {
                        // Load all the required libs:
                        mvJsLoader.jQueryCheck( function() {
                                // Load with staged dependencies (for IE that does not execute in order)
-                               mvJsLoader.doLoadDepMode([
+                               mvJsLoader.doLoadDepMode( [
                                        [       'remoteSearchDriver',
                                                '$j.cookie',
                                                '$j.fn.textSelection',
                                                '$j.ui'
-                                       ],[
+                                       ], [
                                                '$j.ui.resizable',
                                                '$j.ui.draggable',
                                                '$j.ui.dialog',
@@ -1364,13 +1364,13 @@ function mv_jqueryBindings() {
                                        ]
                                ], function() {
                                        iObj['instance_name'] = 'rsdMVRS';
-                                       if( ! _global['rsdMVRS'] )
+                                       if ( ! _global['rsdMVRS'] )
                                                _global['rsdMVRS'] = new remoteSearchDriver( iObj );
-                                       if( callback ) {
+                                       if ( callback ) {
                                                callback( _global['rsdMVRS'] );
                                        }
-                               });
-                       });
+                               } );
+                       } );
                }
                /*
                * Sequencer loader
@@ -1385,7 +1385,7 @@ function mv_jqueryBindings() {
                        // element is on the page)
                        mvJsLoader.embedVideoCheck( function() {
                                // Load the playlist object and then the jQuery UI stuff:
-                               mvJsLoader.doLoadDepMode([
+                               mvJsLoader.doLoadDepMode( [
                                        [
                                                'mvPlayList',
                                                '$j.ui',
@@ -1408,22 +1408,22 @@ function mv_jqueryBindings() {
                                        js_log( 'calling new mvSequencer' );
                                        // Initialise the sequence object (it will take over from there)
                                        // No more than one mvSeq obj for now:
-                                       if( !_global['mvSeq'] ) {
+                                       if ( !_global['mvSeq'] ) {
                                                _global['mvSeq'] = new mvSequencer( iObj );
                                        } else {
                                                js_log( 'mvSeq already init' );
                                        }
-                               });
-                       });
+                               } );
+                       } );
                }
                /*
                 * The Firefogg jQuery function:
                 * @@note This Firefogg invocation could be made to work more like real jQuery plugins
-                */             
-               var queuedFirefoggConf = {};
+                */
+               var queuedFirefoggConf = { };
                $.fn.firefogg = function( iObj, callback ) {
-                       if( !iObj )
-                               iObj = {};
+                       if ( !iObj )
+                               iObj = { };
                        // Add the base theme CSS:
                        loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
                        loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
@@ -1431,16 +1431,16 @@ function mv_jqueryBindings() {
                        // Check if we already have Firefogg loaded (the call just updates the element's
                        // properties)
                        var sElm = $j( this.selector ).get( 0 );
-                       if( sElm['firefogg'] ) {
-                               if( sElm['firefogg'] == 'loading' ) {
+                       if ( sElm['firefogg'] ) {
+                               if ( sElm['firefogg'] == 'loading' ) {
                                        js_log( "Queued firefogg operations ( firefogg " +
                                                "not done loading ) " );
                                        $j.extend( queuedFirefoggConf, iObj );
                                        return false;
                                }
                                // Update properties
-                               for( var i in iObj ) {
-                                       js_log( "firefogg::updated: " + i + ' to '+ iObj[i] );
+                               for ( var i in iObj ) {
+                                       js_log( "firefogg::updated: " + i + ' to ' + iObj[i] );
                                        sElm['firefogg'][i] = iObj[i];
                                }
                                return sElm['firefogg'];
@@ -1463,43 +1463,43 @@ function mv_jqueryBindings() {
                                        '$j.ui.draggable'
                                ]
                        ];
-                       if( iObj.encoder_interface ) {
-                               loadSet.push([
+                       if ( iObj.encoder_interface ) {
+                               loadSet.push( [
                                        'mvAdvFirefogg',
                                        '$j.cookie',
                                        '$j.ui.accordion',
                                        '$j.ui.slider',
                                        '$j.ui.datepicker'
-                               ]);
+                               ] );
                        }
                        // Make sure we have everything loaded that we need:
                        mvJsLoader.doLoadDepMode( loadSet, function() {
                                        js_log( 'firefogg libs loaded. target select:' + iObj.selector );
                                        // Select interface provider based on whether we want to include the
                                        // encoder interface or not
-                                       if( iObj.encoder_interface ) {
+                                       if ( iObj.encoder_interface ) {
                                                var myFogg = new mvAdvFirefogg( iObj );
                                        } else {
                                                var myFogg = new mvFirefogg( iObj );
                                        }
-                                       if( myFogg ) {
+                                       if ( myFogg ) {
                                                myFogg.doRewrite( callback );
                                                var selectorElement = $j( iObj.selector ).get( 0 );
                                                selectorElement['firefogg'] = myFogg;
                                                
-                                               js_log('pre:'+ selectorElement['firefogg']['firefogg_form_action'])
-                                               if(queuedFirefoggConf)
-                                                       $j.extend(selectorElement['firefogg'], queuedFirefoggConf);
-                                               js_log('post:'+ selectorElement['firefogg']['firefogg_form_action'])
+                                               js_log( 'pre:' + selectorElement['firefogg']['firefogg_form_action'] )
+                                               if ( queuedFirefoggConf )
+                                                       $j.extend( selectorElement['firefogg'], queuedFirefoggConf );
+                                               js_log( 'post:' + selectorElement['firefogg']['firefogg_form_action'] )
                                        }
-                       });
+                       } );
                }
                // Take an input player as the selector and expose basic rendering controls
                $.fn.firefoggRender = function( iObj, callback ) {
                        // Check if we already have render loaded then just pass on updates/actions
                        var sElm = $j( this.selector ).get( 0 );
-                       if( sElm['fogg_render'] ) {
-                               if( sElm['fogg_render'] == 'loading' ) {
+                       if ( sElm['fogg_render'] ) {
+                               if ( sElm['fogg_render'] == 'loading' ) {
                                        js_log( "Error: called firefoggRender while loading" );
                                        return false;
                                }
@@ -1508,18 +1508,18 @@ function mv_jqueryBindings() {
                        sElm['fogg_render'] = 'loading';
                        // Add the selector
                        iObj['player_target'] = this.selector;
-                       mvJsLoader.doLoad([
+                       mvJsLoader.doLoad( [
                                'mvFirefogg',
                                'mvFirefoggRender'
                        ], function() {
                                sElm['fogg_render'] = new mvFirefoggRender( iObj );
-                               if( callback && typeof callback == 'function' )
+                               if ( callback && typeof callback == 'function' )
                                        callback( sElm['fogg_render'] );
-                       });
+                       } );
                }
 
-               $.fn.baseUploadInterface = function(iObj) {
-                       mvJsLoader.doLoadDepMode([
+               $.fn.baseUploadInterface = function( iObj ) {
+                       mvJsLoader.doLoadDepMode( [
                                [
                                        'mvBaseUploadInterface',
                                        '$j.ui',
@@ -1531,20 +1531,20 @@ function mv_jqueryBindings() {
                        ], function() {
                                myUp = new mvBaseUploadInterface( iObj );
                                myUp.setupForm();
-                       });
+                       } );
                }
 
                // Shortcut to a themed button
                $.btnHtml = function( msg, className, iconId, opt ) {
-                       if( !opt )
-                               opt = {};
-                       var href = (opt.href) ? opt.href : '#';
-                       var target_attr = (opt.target) ? ' target="' + opt.target + '" ' : '';
-                       var style_attr = (opt.style) ? ' style="' + opt.style + '" ' : '';
+                       if ( !opt )
+                               opt = { };
+                       var href = ( opt.href ) ? opt.href : '#';
+                       var target_attr = ( opt.target ) ? ' target="' + opt.target + '" ' : '';
+                       var style_attr = ( opt.style ) ? ' style="' + opt.style + '" ' : '';
                        return '<a href="' + href + '" ' + target_attr + style_attr +
                                ' class="ui-state-default ui-corner-all ui-icon_link ' +
                                className + '"><span class="ui-icon ui-icon-' + iconId + '" />' +
-                               '<span class="btnText">'+ msg +'<span></a>';
+                               '<span class="btnText">' + msg + '<span></a>';
                }
                // Shortcut to bind hover state
                $.fn.btnBind = function() {
@@ -1561,21 +1561,21 @@ function mv_jqueryBindings() {
                /**
                * resize the dialog to fit the window
                */
-               $.fn.dialogFitWindow = function(opt){                   
-                       var opt_default = {'hspace':50,'vspace':50};
-                       if(!opt)
-                               var opt={};                     
-                       $j.extend(opt, opt_default);
-                       $j( this.selector).dialog('option', 'width', $j(window).width() - opt.hspace );
-                       $j( this.selector).dialog('option', 'height', $j(window).height() - opt.vspace );
-                       $j( this.selector).dialog('option', 'position','center');
-                               //update the child position: (some of this should be pushed up-stream via dialog config options
-                       $j( this.selector +'~ .ui-dialog-buttonpane').css({
+               $.fn.dialogFitWindow = function( opt ) {
+                       var opt_default = { 'hspace':50, 'vspace':50 };
+                       if ( !opt )
+                               var opt = { };
+                       $j.extend( opt, opt_default );
+                       $j( this.selector ).dialog( 'option', 'width', $j( window ).width() - opt.hspace );
+                       $j( this.selector ).dialog( 'option', 'height', $j( window ).height() - opt.vspace );
+                       $j( this.selector ).dialog( 'option', 'position', 'center' );
+                               // update the child position: (some of this should be pushed up-stream via dialog config options
+                       $j( this.selector + '~ .ui-dialog-buttonpane' ).css( {
                                'position':'absolute',
                                'left':'0px',
                                'right':'0px',
                                'bottom':'0px',
-                       });                     
+                       } );
                }
                
                /**
@@ -1585,24 +1585,24 @@ function mv_jqueryBindings() {
                *
                * @param msg text text of the loader msg
                */
-               $.addLoaderDialog = function( msg_txt ){                        
-                       $.addDialog( msg_txt, msg_txt + '<br>' + mv_get_loading_img() );                
-               }                                               
+               $.addLoaderDialog = function( msg_txt ) {
+                       $.addDialog( msg_txt, msg_txt + '<br>' + mv_get_loading_img() );
+               }
                
-               $.addDialog = function ( title, msg_txt, btn ){
-                       $('#mwe_tmp_loader').remove();
-                       //append the style free loader ontop: 
-                       $('body').append('<div id="mwe_tmp_loader" style="display:none" title="' + title + '" >' +
+               $.addDialog = function ( title, msg_txt, btn ) {
+                       $( '#mwe_tmp_loader' ).remove();
+                       // append the style free loader ontop: 
+                       $( 'body' ).append( '<div id="mwe_tmp_loader" style="display:none" title="' + title + '" >' +
                                        msg_txt +
-                       '</div>');                      
-                       //special btn == ok gives empty give a single "oky" -> "close"
-                       if( btn == 'ok' ){
-                               btn[ gM('mwe-ok') ] = function(){
-                                       $j('#mwe_tmp_loader').close();
+                       '</div>' );
+                       // special btn == ok gives empty give a single "oky" -> "close"
+                       if ( btn == 'ok' ) {
+                               btn[ gM( 'mwe-ok' ) ] = function() {
+                                       $j( '#mwe_tmp_loader' ).close();
                                }
                        }
-                       //turn the loader into a real dialog loader: 
-                       mvJsLoader.doLoadDepMode([
+                       // turn the loader into a real dialog loader: 
+                       mvJsLoader.doLoadDepMode( [
                                [
                                        '$j.ui'
                                ],
@@ -1610,36 +1610,36 @@ function mv_jqueryBindings() {
                                        '$j.ui.dialog'
                                ]
                        ], function() {
-                               $('#mwe_tmp_loader').dialog({
+                               $( '#mwe_tmp_loader' ).dialog( {
                                        bgiframe: true,
                                        draggable: false,
-                                       resizable: false,                                       
+                                       resizable: false,
                                        modal: true,
                                        width:400,
                                        buttons: btn
-                               });
-                       });
+                               } );
+                       } );
                }
-               $.closeLoaderDialog = function(){               
-                       mvJsLoader.doLoadDepMode([
+               $.closeLoaderDialog = function() {
+                       mvJsLoader.doLoadDepMode( [
                                [
                                        '$j.ui'
                                ],
                                [
                                        '$j.ui.dialog'
                                ]
-                       ], function() { 
-                               $j('#mwe_tmp_loader').dialog('close');
-                       });
+                       ], function() {
+                               $j( '#mwe_tmp_loader' ).dialog( 'close' );
+                       } );
                }
        
-               $.mwProxy = function( apiConf ){
-                       mvJsLoader.doLoad( ['mw.apiProxy'], 
-                       function(){
+               $.mwProxy = function( apiConf ) {
+                       mvJsLoader.doLoad( ['mw.apiProxy'],
+                       function() {
                                mw.apiProxy( apiConf );
-                       });
+                       } );
                }
-       })(jQuery);
+       } )( jQuery );
 }
 /*
 * Utility functions:
@@ -1647,23 +1647,23 @@ function mv_jqueryBindings() {
 // Simple URL rewriter (could probably be refactored into an inline regular exp)
 function getURLParamReplace( url, opt ) {
        var pSrc = parseUri( url );
-       if( pSrc.protocol != '' ) {
+       if ( pSrc.protocol != '' ) {
                var new_url = pSrc.protocol + '://' + pSrc.authority + pSrc.path + '?';
        } else {
                var new_url = pSrc.path + '?';
        }
        var amp = '';
-       for( var key in pSrc.queryKey ) {
+       for ( var key in pSrc.queryKey ) {
                var val = pSrc.queryKey[ key ];
                // Do override if requested
-               if( opt[ key ] )
+               if ( opt[ key ] )
                        val = opt[ key ];
                new_url += amp + key + '=' + val;
                amp = '&';
        };
        // Add any vars that were not already there:
-       for( var i in opt ) {
-               if( !pSrc.queryKey[i] ) {
+       for ( var i in opt ) {
+               if ( !pSrc.queryKey[i] ) {
                        new_url += amp + i + '=' + opt[i];
                        amp = '&';
                }
@@ -1677,22 +1677,22 @@ function getURLParamReplace( url, opt ) {
  * @param boolean If we should show milliseconds or not.
  */
 function seconds2npt( sec, show_ms ) {
-       if( isNaN( sec ) ) {
+       if ( isNaN( sec ) ) {
                // js_log("warning: trying to get npt time on NaN:" + sec);
                return '0:0:0';
        }
        var hours = Math.floor( sec / 3600 );
-       var minutes = Math.floor( (sec / 60) % 60 );
+       var minutes = Math.floor( ( sec / 60 ) % 60 );
        var seconds = sec % 60;
        // Round the number of seconds to the required number of significant digits
-       if( show_ms ) {
+       if ( show_ms ) {
                seconds = Math.round( seconds * 1000 ) / 1000;
        } else {
                seconds = Math.round( seconds );
        }
-       if( seconds < 10 )
+       if ( seconds < 10 )
                seconds = '0' + seconds;
-       if( minutes < 10 )
+       if ( minutes < 10 )
                minutes = '0' + minutes;
 
        return hours + ":" + minutes + ":" + seconds;
@@ -1701,8 +1701,8 @@ function seconds2npt( sec, show_ms ) {
  * Take hh:mm:ss,ms or hh:mm:ss.ms input, return the number of seconds
  */
 function npt2seconds( npt_str ) {
-       if( !npt_str ) {
-               //js_log('npt2seconds:not valid ntp:'+ntp);
+       if ( !npt_str ) {
+               // js_log('npt2seconds:not valid ntp:'+ntp);
                return false;
        }
        // Strip "npt:" time definition if present
@@ -1713,20 +1713,20 @@ function npt2seconds( npt_str ) {
        var sec = 0;
 
        times = npt_str.split( ':' );
-       if( times.length == 3 ){
+       if ( times.length == 3 ) {
                sec = times[2];
                min = times[1];
                hour = times[0];
-       }else if(times.length == 2){
+       } else if ( times.length == 2 ) {
                sec = times[1];
                min = times[0];
-       }else{
+       } else {
                sec = times[0];
        }
        // Sometimes a comma is used instead of period for ms
        sec = sec.replace( /,\s?/, '.' );
        // Return seconds float
-       return parseInt( hour * 3600) + parseInt( min * 60 ) + parseFloat( sec );
+       return parseInt( hour * 3600 ) + parseInt( min * 60 ) + parseFloat( sec );
 }
 /*
  * Simple helper to grab an edit token
@@ -1737,7 +1737,7 @@ function npt2seconds( npt_str ) {
  */
 function get_mw_token( title, api_url, callback ) {
        js_log( ':get_mw_token:' );
-       if( !title && wgUserName ) {
+       if ( !title && wgUserName ) {
                title = 'User:' + wgUserName;
        }
        var reqObj = {
@@ -1749,10 +1749,10 @@ function get_mw_token( title, api_url, callback ) {
        do_api_req( {
                'data': reqObj,
                'url' : api_url
-               }, function(data) {
-                       for( var i in data.query.pages ) {
-                               if( data.query.pages[i]['edittoken'] ) {
-                                       if( typeof callback == 'function' )
+               }, function( data ) {
+                       for ( var i in data.query.pages ) {
+                               if ( data.query.pages[i]['edittoken'] ) {
+                                       if ( typeof callback == 'function' )
                                                callback ( data.query.pages[i]['edittoken'] );
                                }
                        }
@@ -1762,36 +1762,36 @@ function get_mw_token( title, api_url, callback ) {
        );
 }
 // Do a remote or local API request based on request URL
-//@param options: url, data, cbParam, callback
+// @param options: url, data, cbParam, callback
 function do_api_req( options, callback ) {
-       if( typeof options.data != 'object' ) {
+       if ( typeof options.data != 'object' ) {
                return js_error( 'Error: request paramaters must be an object' );
        }
        // Generate the URL if it's missing
-       if( typeof options.url == 'undefined' || !options.url ) {
-               if( typeof wgServer == 'undefined' ) {
-                       return js_error('Error: no api url for api request');
+       if ( typeof options.url == 'undefined' || !options.url ) {
+               if ( typeof wgServer == 'undefined' ) {
+                       return js_error( 'Error: no api url for api request' );
                }
                options.url = mw.getLocalApiUrl();
        }
-       if( typeof options.data == 'undefined' )
-               options.data = {};
+       if ( typeof options.data == 'undefined' )
+               options.data = { };
 
        // Force format to JSON
        options.data['format'] = 'json';
 
        // If action is not set, assume query
-       if( ! options.data['action'] )
+       if ( ! options.data['action'] )
                options.data['action'] = 'query';
 
        // js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );     
-       if( options.url == 'proxy' && mw.proxy){
-               //assume the proxy is already "setup" since mw.proxy is defined.
+       if ( options.url == 'proxy' && mw.proxy ) {
+               // assume the proxy is already "setup" since mw.proxy is defined.
                // @@todo we probably integrate that setup into the api call
-               mw.proxy.doRequest( options.data,  callback);   
-       }else if( parseUri( document.URL ).host == parseUri( options.url ).host ) {
+               mw.proxy.doRequest( options.data,  callback );
+       } else if ( parseUri( document.URL ).host == parseUri( options.url ).host ) {
                // Local request: do API request directly
-               $j.ajax({
+               $j.ajax( {
                        type: "POST",
                        url: options.url,
                        data: options.data,
@@ -1803,17 +1803,17 @@ function do_api_req( options, callback ) {
                        error: function( e ) {
                                js_error( ' error' + e + ' in getting: ' + options.url );
                        }
-               });
+               } );
        } else {
                // Remote request
                // Set the callback param if it's not already set
-               if( typeof options.jsonCB == 'undefined' )
+               if ( typeof options.jsonCB == 'undefined' )
                        options.jsonCB = 'callback';
 
                var req_url = options.url;
-               var paramAnd = ( req_url.indexOf( '?' ) == -1 ) ? '?' : '&';
+               var paramAnd = ( req_url.indexOf( '?' ) == - 1 ) ? '?' : '&';
                // Put all the parameters into the URL
-               for( var i in options.data ) {
+               for ( var i in options.data ) {
                        req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] );
                        paramAnd = '&';
                }
@@ -1827,37 +1827,37 @@ function do_api_req( options, callback ) {
 function do_request( req_url, callback ) {
        js_log( 'do_request::req_url:' + req_url + ' != ' +  parseUri( req_url ).host );
        // If we are doing a request to the same domain or relative link, do a normal GET
-       if( parseUri( document.URL ).host == parseUri( req_url ).host ||
-               req_url.indexOf('://') == -1 ) // Relative url
+       if ( parseUri( document.URL ).host == parseUri( req_url ).host ||
+               req_url.indexOf( '://' ) == - 1 ) // Relative url
        {
                // Do a direct request
-               $j.ajax({
+               $j.ajax( {
                        type: "GET",
                        url: req_url,
                        async: false,
                        success: function( data ) {
                                callback( data );
                        }
-               });
+               } );
        } else {
                // Get data via DOM injection with callback
                global_req_cb.push( callback );
                // Prepend json_ to feed_format if not already requesting json format (metavid specific)
-               if( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 )
-                       req_url = req_url.replace( /feed_format=/, 'feed_format=json_' );               
+               if ( req_url.indexOf( "feed_format=" ) != - 1 && req_url.indexOf( "feed_format=json" ) == - 1 )
+                       req_url = req_url.replace( / feed_format = / , 'feed_format=json_' );
                
-               loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length - 1) );
+               loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + ( global_req_cb.length - 1 ) );
        }
 }
 
 function mv_jsdata_cb( response ) {
-       js_log( 'f:mv_jsdata_cb:'+ response['cb_inx'] );
+       js_log( 'f:mv_jsdata_cb:' + response['cb_inx'] );
        // Run the callback from the global request callback object
-       if( !global_req_cb[response['cb_inx']] ) {
+       if ( !global_req_cb[response['cb_inx']] ) {
                js_log( 'missing req cb index' );
                return false;
        }
-       if( !response['pay_load'] ) {
+       if ( !response['pay_load'] ) {
                js_log( "missing pay load" );
                return false;
        }
@@ -1865,24 +1865,24 @@ function mv_jsdata_cb( response ) {
                case 'text/plain':
                break;
                case 'text/xml':
-                       if( typeof response['pay_load'] == 'string' ) {
-                               //js_log('load string:'+"\n"+ response['pay_load']);
+                       if ( typeof response['pay_load'] == 'string' ) {
+                               // js_log('load string:'+"\n"+ response['pay_load']);
                                // Debugger;
-                               if( $j.browser.msie ) {
+                               if ( $j.browser.msie ) {
                                        // Attempt to parse as XML for IE
-                                       var xmldata = new ActiveXObject("Microsoft.XMLDOM");
+                                       var xmldata = new ActiveXObject( "Microsoft.XMLDOM" );
                                        xmldata.async = "false";
                                        xmldata.loadXML( response['pay_load'] );
                                } else {
                                        // For others (Firefox, Safari etc.)
                                        try {
-                                               var xmldata = (new DOMParser()).parseFromString( response['pay_load'], "text/xml" );
-                                       } catch( e ) {
+                                               var xmldata = ( new DOMParser() ).parseFromString( response['pay_load'], "text/xml" );
+                                       } catch ( e ) {
                                                js_log( 'XML parse ERROR: ' + e.message );
                                        }
                                }
-                               //@@todo handle XML parser errors
-                               if( xmldata )response['pay_load'] = xmldata;
+                               // @@todo handle XML parser errors
+                               if ( xmldata )response['pay_load'] = xmldata;
                        }
                break
                default:
@@ -1894,30 +1894,30 @@ function mv_jsdata_cb( response ) {
 }
 // Load external JS via DOM injection
 function loadExternalJs( url, callback ) {
-       js_log( 'load js: '+ url );
-       //if(window['$j']) // use jquery call:
+       js_log( 'load js: ' + url );
+       // if(window['$j']) // use jquery call:
                /*$j.ajax({
                        type: "GET",
                        url: url,
                        dataType: 'script',
                        cache: true
                });*/
-       //else{
+       // else{
                var e = document.createElement( "script" );
                e.setAttribute( 'src', url );
                e.setAttribute( 'type', "text/javascript" );
                /*if(callback)
                        e.onload = callback;
                */
-               //e.setAttribute('defer', true);
+               // e.setAttribute('defer', true);
                document.getElementsByTagName( "head" )[0].appendChild( e );
        // }
 }
 function styleSheetPresent( url ) {
        style_elements = document.getElementsByTagName( 'link' );
-       if( style_elements.length > 0 ) {
-               for( i = 0; i < style_elements.length; i++ ) {
-                       if( style_elements[i].href == url )
+       if ( style_elements.length > 0 ) {
+               for ( i = 0; i < style_elements.length; i++ ) {
+                       if ( style_elements[i].href == url )
                                return true;
                }
        }
@@ -1926,17 +1926,17 @@ function styleSheetPresent( url ) {
 function loadExternalCss( url ) {
        // We could have the script loader group these CSS requests.
        // But it's debatable: it may hurt more than it helps with caching and all
-       if( typeof url =='object' ) {
-               for( var i in url ) {
+       if ( typeof url == 'object' ) {
+               for ( var i in url ) {
                        loadExternalCss( url[i] );
                }
                return ;
        }
 
-       if( url.indexOf('?') == -1 ) {
+       if ( url.indexOf( '?' ) == - 1 ) {
                url += '?' + getMwReqParam();
        }
-       if( !styleSheetPresent( url ) ) {
+       if ( !styleSheetPresent( url ) ) {
                js_log( 'load css: ' + url );
                var e = document.createElement( "link" );
                e.href = url;
@@ -1946,16 +1946,16 @@ function loadExternalCss( url ) {
        }
 }
 function getMvEmbedURL() {
-       if( _global['mv_embed_url'] )
+       if ( _global['mv_embed_url'] )
                return _global['mv_embed_url'];
        var js_elements = document.getElementsByTagName( "script" );
-       for( var i = 0; i < js_elements.length; i++ ) {
+       for ( var i = 0; i < js_elements.length; i++ ) {
                // Check for mv_embed.js and/or script loader
                var src = js_elements[i].getAttribute( "src" );
-               if( src ) {
-                       if( src.indexOf( 'mv_embed.js' ) != -1 || (
-                               ( src.indexOf( 'mwScriptLoader.php' ) != -1 || src.indexOf('jsScriptLoader.php') != -1 )
-                               && src.indexOf('mv_embed') != -1) ) //(check for class=mv_embed script_loader call)
+               if ( src ) {
+                       if ( src.indexOf( 'mv_embed.js' ) != - 1 || (
+                               ( src.indexOf( 'mwScriptLoader.php' ) != - 1 || src.indexOf( 'jsScriptLoader.php' ) != - 1 )
+                               && src.indexOf( 'mv_embed' ) != - 1 ) ) // (check for class=mv_embed script_loader call)
                        {
                                _global['mv_embed_url'] = src;
                                return src;
@@ -1966,29 +1966,29 @@ function getMvEmbedURL() {
        return false;
 }
 // Get a unique request ID to ensure fresh JavaScript
-function getMwReqParam() {     
-       if( _global['req_param'] )
+function getMwReqParam() {
+       if ( _global['req_param'] )
                return _global['req_param'];
        var mv_embed_url = getMvEmbedURL();
        
        var req_param = '';
        
        // If we have a URI, add it to the req
-       var urid = parseUri( mv_embed_url ).queryKey['urid']    
+       var urid = parseUri( mv_embed_url ).queryKey['urid']
        // If we're in debug mode, get a fresh unique request key and pass on "debug" param
-       if( parseUri( mv_embed_url ).queryKey['debug'] == 'true' ){
+       if ( parseUri( mv_embed_url ).queryKey['debug'] == 'true' ) {
                var d = new Date();
-               req_param += 'urid=' + d.getTime() + '&debug=true';             
-       }else if( urid ) {
+               req_param += 'urid=' + d.getTime() + '&debug=true';
+       } else if ( urid ) {
                // Set from request urid:
                req_param += 'urid=' + urid;
-       }else{
+       } else {
                // Otherwise, just use the mv_embed version
                req_param += 'urid=' + mw.version;
        }
-       //add the lang param:
+       // add the lang param:
        var langKey = parseUri( mv_embed_url ).queryKey['uselang'];
-       if( langKey )
+       if ( langKey )
                req_param += '&uselang=' + langKey;
                        
        _global['req_param'] = req_param;
@@ -1999,12 +1999,12 @@ function getMwReqParam() {
  * Set the global mv_embed path based on the script's location
  */
 function getMvEmbedPath() {
-       if( _global['mv_embed_path'] )
+       if ( _global['mv_embed_path'] )
                return _global['mv_embed_path'];
        var mv_embed_url = getMvEmbedURL();
-       if( mv_embed_url.indexOf( 'mv_embed.js' ) !== -1 ) {
+       if ( mv_embed_url.indexOf( 'mv_embed.js' ) !== - 1 ) {
                mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mv_embed.js' ) );
-       } else if( mv_embed_url.indexOf( 'mwScriptLoader.php' ) !== -1 ) {
+       } else if ( mv_embed_url.indexOf( 'mwScriptLoader.php' ) !== - 1 ) {
                // Script loader is in the root of MediaWiki, so include the default mv_embed extension path
                mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mwScriptLoader.php' ) )
                        + mediaWiki_mvEmbed_path;
@@ -2012,13 +2012,13 @@ function getMvEmbedPath() {
                mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'jsScriptLoader.php' ) );
        }
        // Make an absolute URL (if it's relative and we don't have an mv_embed path)
-       if( mv_embed_path.indexOf( '://' ) == -1 ) {
+       if ( mv_embed_path.indexOf( '://' ) == - 1 ) {
                var pURL = parseUri( document.URL );
-               if( mv_embed_path.charAt( 0 ) == '/' ) {
+               if ( mv_embed_path.charAt( 0 ) == '/' ) {
                        mv_embed_path = pURL.protocol + '://' + pURL.authority + mv_embed_path;
                } else {
                        // Relative
-                       if( mv_embed_path == '' ) {
+                       if ( mv_embed_path == '' ) {
                                mv_embed_path = pURL.protocol + '://' + pURL.authority + pURL.directory + mv_embed_path;
                        }
                }
@@ -2028,7 +2028,7 @@ function getMvEmbedPath() {
 }
 
 if ( typeof DOMParser == "undefined" ) {
-       DOMParser = function () {}
+       DOMParser = function () { }
        DOMParser.prototype.parseFromString = function ( str, contentType ) {
                if ( typeof ActiveXObject != "undefined" ) {
                        var d = new ActiveXObject( "MSXML.DomDocument" );
@@ -2036,10 +2036,10 @@ if ( typeof DOMParser == "undefined" ) {
                        return d;
                } else if ( typeof XMLHttpRequest != "undefined" ) {
                        var req = new XMLHttpRequest;
-                       req.open( "GET", "data:" + (contentType || "application/xml") +
-                                       ";charset=utf-8," + encodeURIComponent(str), false );
+                       req.open( "GET", "data:" + ( contentType || "application/xml" ) +
+                                       ";charset=utf-8," + encodeURIComponent( str ), false );
                        if ( req.overrideMimeType ) {
-                               req.overrideMimeType(contentType);
+                               req.overrideMimeType( contentType );
                        }
                        req.send( null );
                        return req.responseXML;
@@ -2051,10 +2051,10 @@ if ( typeof DOMParser == "undefined" ) {
 */
 function js_log( string ) {
        // Add any prepend debug strings if necessary (used for cross browser)
-       if( mw.conf['debug_pre'] )
-               string = mw.conf['debug_pre']+ string;
+       if ( mw.conf['debug_pre'] )
+               string = mw.conf['debug_pre'] + string;
                        
-       if( window.console ) {                          
+       if ( window.console ) {
                window.console.log( string );
        } else {
                /*
index 8067ee4..d775746 100644 (file)
@@ -1,4 +1,4 @@
-//set the dismissNativeWarn flag:
+// set the dismissNativeWarn flag:
 _global['dismissNativeWarn'] = false;
 
 /**
@@ -17,74 +17,74 @@ var ctrlBuilder = function( embedObj ) {
  * controlsBuilder prototype:
  */
 ctrlBuilder.prototype = {
-       init:function( embedObj, opt ){
+       init:function( embedObj, opt ) {
                var _this = this;
                this.embedObj = embedObj;
 
-               //check for skin overrides for ctrlBuilder
-               if( _global[ embedObj.skin_name + 'Config'] ){
-                       //clone as to not override prototype:   
-                       var _this = $j.extend(true, {}, this, _global[ embedObj.skin_name + 'Config']);
+               // check for skin overrides for ctrlBuilder
+               if ( _global[ embedObj.skin_name + 'Config'] ) {
+                       // clone as to not override prototype:  
+                       var _this = $j.extend( true, { }, this, _global[ embedObj.skin_name + 'Config'] );
                        return _this;
                }
-               return this;            
+               return this;
        },
        pClass : 'mv-player',
        long_time_disp: true,
        body_options : true,
-       //default volume layout is "vertical"
+       // default volume layout is "vertical"
        volume_layout : 'vertical',
        height:29,
-       supports:{
+       supports: {
                  'options':true,
                  'borders':true
        },
        menu_items:[
                'playerselect',
                'download',
-               'share',  
+               'share',
                'credits',
-       ],      
-       getControls:function(){
-               //set up local pointer to the embedObj
+       ],
+       getControls:function() {
+               // set up local pointer to the embedObj
                var embedObj = this.embedObj;
-               //set up loadl ctrlBuilder ref
+               // set up loadl ctrlBuilder ref
                var _this = this;
 
-               js_log('f:controlsBuilder:: opt:' + this.options);
-               this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id;
+               js_log( 'f:controlsBuilder:: opt:' + this.options );
+               this.id = ( embedObj.pc ) ? embedObj.pc.pp.id:embedObj.id;
                this.available_width = embedObj.playerPixelWidth();
-               //make pointer to the embedObj
-               this.embedObj =embedObj;
+               // make pointer to the embedObj
+               this.embedObj = embedObj;
                var _this = this;
-               for(var i in embedObj.supports){
+               for ( var i in embedObj.supports ) {
                        _this.supports[i] = embedObj.supports[i];
                };
 
-               //special case vars:
-               if( ( embedObj.roe ||
+               // special case vars:
+               if ( ( embedObj.roe ||
                          embedObj.wikiTitleKey ||
                                ( embedObj.media_element.timedTextSources &&
                                embedObj.media_element.timedTextSources() )
                        )  && embedObj.show_meta_link  )
-                       this.supports['closed_captions']=true;
+                       this.supports['closed_captions'] = true;
 
 
-               //append options to body (if not already there)
-               if( _this.body_options && $j('#mv_vid_options_' + this.id).length == 0 )
-                       $j('body').append( this.components['mv_embedded_options'].o( this ) );
+               // append options to body (if not already there)
+               if ( _this.body_options && $j( '#mv_vid_options_' + this.id ).length == 0 )
+                       $j( 'body' ).append( this.components['mv_embedded_options'].o( this ) );
 
-               var o='';
-               for( var i in this.components ){
-                       if( this.supports[i] ){
-                               if( this.available_width > this.components[i].w ){
-                                       //special case with playhead don't add unless we have 60px
-                                       if( i == 'play_head' && this.available_width < 60 )
+               var o = '';
+               for ( var i in this.components ) {
+                       if ( this.supports[i] ) {
+                               if ( this.available_width > this.components[i].w ) {
+                                       // special case with playhead don't add unless we have 60px
+                                       if ( i == 'play_head' && this.available_width < 60 )
                                                continue;
-                                       o+=this.components[i].o( this  );
+                                       o += this.components[i].o( this  );
                                        this.available_width -= this.components[i].w;
-                               }else{
-                                       js_log('not enough space for control component:' + i);
+                               } else {
+                                       js_log( 'not enough space for control component:' + i );
                                }
                        }
                }
@@ -94,232 +94,232 @@ ctrlBuilder.prototype = {
         * addControlHooks
         * to be run once controls are attached to the dom
         */
-       addControlHooks:function( $tp ){                
-               //set up local pointer to the embedObj
+       addControlHooks:function( $tp ) {
+               // set up local pointer to the embedObj
                var embedObj = this.embedObj;
-               var _this = this;       
-               //var embed_id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;             
-                               
-               if( !$tp )
+               var _this = this;
+               // var embed_id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;            
+
+               if ( !$tp )
                        $tp = $j( '#' + embedObj.id );
                
                
-               //add play hook:
-               $tp.find('.play-btn').unbind().btnBind().click(function(){
-                       $j('#' + embedObj.id).get(0).play();
-               })
+               // add play hook:
+               $tp.find( '.play-btn' ).unbind().btnBind().click( function() {
+                       $j( '#' + embedObj.id ).get( 0 ).play();
+               } )
 
-               //do play-btn-large binding:
-               $tp.find('.play-btn-large' ).unbind().btnBind().click(function(){
-                       $j('#' + embedObj.id).get(0).play();
-               });
+               // do play-btn-large binding:
+               $tp.find( '.play-btn-large' ).unbind().btnBind().click( function() {
+                       $j( '#' + embedObj.id ).get( 0 ).play();
+               } );
 
-               //add recommend firefox if we have non-native playback:
-               if( embedObj.doNativeWarningCheck() ){
-                       $j('#dc_'+ embedObj.id).hover(
-                               function(){
-                                       if($j('#gnp_' + embedObj.id).length==0){
-                                               var toppos = ( embedObj.instanceOf == 'mvPlayList')?25:10;
-                                               $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
-                                                       'style="position:absolute;display:none;background:#FFF;top:'+toppos+'px;left:10px;right:10px;">' +
-                                                       gM('mwe-for_best_experience') +
-                                               '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
-                                                       gM('mwe-do_not_warn_again') +
-                                               '</div>');
-                                               $j('#ffwarn_'+embedObj.id).click(function(){
-                                                       if( $j(this).is(':checked') ){
-                                                               //set up a cookie for 7 days:
-                                                               $j.cookie('dismissNativeWarn', true, { expires: 7 });
-                                                               //set the current instance
+               // add recommend firefox if we have non-native playback:
+               if ( embedObj.doNativeWarningCheck() ) {
+                       $j( '#dc_' + embedObj.id ).hover(
+                               function() {
+                                       if ( $j( '#gnp_' + embedObj.id ).length == 0 ) {
+                                               var toppos = ( embedObj.instanceOf == 'mvPlayList' ) ? 25:10;
+                                               $j( this ).append( '<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
+                                                       'style="position:absolute;display:none;background:#FFF;top:' + toppos + 'px;left:10px;right:10px;">' +
+                                                       gM( 'mwe-for_best_experience' ) +
+                                               '<br><input id="ffwarn_' + embedObj.id + '" type=\"checkbox\">' +
+                                                       gM( 'mwe-do_not_warn_again' ) +
+                                               '</div>' );
+                                               $j( '#ffwarn_' + embedObj.id ).click( function() {
+                                                       if ( $j( this ).is( ':checked' ) ) {
+                                                               // set up a cookie for 7 days:
+                                                               $j.cookie( 'dismissNativeWarn', true, { expires: 7 } );
+                                                               // set the current instance
                                                                _global['dismissNativeWarn'] = true;
-                                                               $j('#gnp_' + embedObj.id).fadeOut('slow');
-                                                       }else{
+                                                               $j( '#gnp_' + embedObj.id ).fadeOut( 'slow' );
+                                                       } else {
                                                                _global['adismissNativeWarn'] = false;
-                                                               $j.cookie('dismissNativeWarn', false);
+                                                               $j.cookie( 'dismissNativeWarn', false );
                                                        }
 
-                                               });
+                                               } );
                                        }
-                                       if( ($j.cookie('dismissNativeWarn') !== true) &&
-                                               _global['dismissNativeWarn'] === false  ){
-                                               $j('#gnp_' + embedObj.id).fadeIn('slow');
+                                       if ( ( $j.cookie( 'dismissNativeWarn' ) !== true ) &&
+                                               _global['dismissNativeWarn'] === false  ) {
+                                               $j( '#gnp_' + embedObj.id ).fadeIn( 'slow' );
                                        }
                                },
-                               function(){
-                                       $j('#gnp_' + embedObj.id).fadeOut('slow');
+                               function() {
+                                       $j( '#gnp_' + embedObj.id ).fadeOut( 'slow' );
                                }
                        );
                }
 
-               if( $j.browser.msie  &&  $j.browser.version <= 6){
+               if ( $j.browser.msie  &&  $j.browser.version <= 6 ) {
                        $j( embedObj.id + ' .play-btn-large' ).pngFix();
                }
 
 
-               //captions binding:
-               $tp.find('.timed-text').unbind().btnBind().click(function(){
-                       $j('#' + embedObj.id).get(0).showTextInterface();
-               });
+               // captions binding:
+               $tp.find( '.timed-text' ).unbind().btnBind().click( function() {
+                       $j( '#' + embedObj.id ).get( 0 ).showTextInterface();
+               } );
 
-               //options binding:
-               $tp.find('.options-btn').unbind().btnBind().click(function(){
-                       $j('#' +embedObj.id).get(0).doOptionsHTML();
-               });
+               // options binding:
+               $tp.find( '.options-btn' ).unbind().btnBind().click( function() {
+                       $j( '#' + embedObj.id ).get( 0 ).doOptionsHTML();
+               } );
 
-               //fullscreen binding:
-               $tp.find('.fullscreen-btn').unbind().btnBind().click(function(){
-                       $j('#' +embedObj.id).get(0).fullscreen();
-               });
+               // fullscreen binding:
+               $tp.find( '.fullscreen-btn' ).unbind().btnBind().click( function() {
+                       $j( '#' + embedObj.id ).get( 0 ).fullscreen();
+               } );
 
-               js_log(" should add slider binding: " + $tp.find('.play_head').length);
-               $tp.find('.play_head').slider({
+               js_log( " should add slider binding: " + $tp.find( '.play_head' ).length );
+               $tp.find( '.play_head' ).slider( {
                        range: "min",
                        value: 0,
                        min: 0,
                        max: 1000,
-                       start: function(event, ui){
-                               var id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;
-                               embedObj.userSlide=true;
-                               $j( id + ' .play-btn-large').fadeOut('fast');
-                               //if playlist always start at 0
-                               embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0:
-                                                               npt2seconds(embedObj.getTimeReq().split('/')[0]);
+                       start: function( event, ui ) {
+                               var id = ( embedObj.pc != null ) ? embedObj.pc.pp.id:embedObj.id;
+                               embedObj.userSlide = true;
+                               $j( id + ' .play-btn-large' ).fadeOut( 'fast' );
+                               // if playlist always start at 0
+                               embedObj.start_time_sec = ( embedObj.instanceOf == 'mvPlayList' ) ? 0:
+                                                               npt2seconds( embedObj.getTimeReq().split( '/' )[0] );
                        },
-                       slide: function(event, ui) {
-                               var perc = ui.value/1000;
-                               embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
-                               //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+  this.jump_time);
-                               if( _this.long_time_disp ){
-                                       embedObj.setStatus( gM('mwe-seek_to', embedObj.jump_time ) );
-                               }else{
+                       slide: function( event, ui ) {
+                               var perc = ui.value / 1000;
+                               embedObj.jump_time = seconds2npt( parseFloat( parseFloat( embedObj.getDuration() ) * perc ) + embedObj.start_time_sec );
+                               // js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+  this.jump_time);
+                               if ( _this.long_time_disp ) {
+                                       embedObj.setStatus( gM( 'mwe-seek_to', embedObj.jump_time ) );
+                               } else {
                                        embedObj.setStatus( embedObj.jump_time );
                                }
-                               //update the thumbnail / frame
-                               if(embedObj.isPlaying==false){
+                               // update the thumbnail / frame
+                               if ( embedObj.isPlaying == false ) {
                                        embedObj.updateThumbPerc( perc );
                                }
                        },
-                       change:function(event, ui){
-                               //only run the onChange event if done by a user slide:
-                               if( embedObj.userSlide ){
-                                       embedObj.userSlide=false;
-                                       embedObj.seeking=true;
-                                       //stop the monitor timer (if we can)
-                                       if(embedObj.stopMonitor)
+                       change:function( event, ui ) {
+                               // only run the onChange event if done by a user slide:
+                               if ( embedObj.userSlide ) {
+                                       embedObj.userSlide = false;
+                                       embedObj.seeking = true;
+                                       // stop the monitor timer (if we can)
+                                       if ( embedObj.stopMonitor )
                                                embedObj.stopMonitor();
 
-                                       var perc = ui.value/1000;
-                                       //set seek time (in case we have to do a url seek)
+                                       var perc = ui.value / 1000;
+                                       // set seek time (in case we have to do a url seek)
                                        embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true );
-                                       js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec);
-                                       embedObj.setStatus( gM('mwe-seeking') );
+                                       js_log( 'do jump to: ' + embedObj.jump_time + ' perc:' + perc + ' sts:' + embedObj.seek_time_sec );
+                                       embedObj.setStatus( gM( 'mwe-seeking' ) );
                                        embedObj.doSeek( perc );
                                }
                        }
-               });
-               //up the z-index of the default status indicator:
-               $tp.find('.play_head .ui-slider-handle').css('z-index', 4);
-               $tp.find('.play_head .ui-slider-range').addClass('ui-corner-all').css('z-index', 2);
-               //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highlighter)
-               $tp.find('.play_head').append( this.getMvBufferHtml() );
+               } );
+               // up the z-index of the default status indicator:
+               $tp.find( '.play_head .ui-slider-handle' ).css( 'z-index', 4 );
+               $tp.find( '.play_head .ui-slider-range' ).addClass( 'ui-corner-all' ).css( 'z-index', 2 );
+               // extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highlighter)
+               $tp.find( '.play_head' ).append( this.getMvBufferHtml() );
                        
-               $opt = $j('#mv_vid_options_'+embedObj.id);
-               //videoOptions ... @@todo should be merged with something more like kskin.js:
-               $opt.find('.vo_selection').click(function(){
+               $opt = $j( '#mv_vid_options_' + embedObj.id );
+               // videoOptions ... @@todo should be merged with something more like kskin.js:
+               $opt.find( '.vo_selection' ).click( function() {
                        embedObj.displayHTML();
-                       embedObj.showPlayerselect( $tp.find('.videoOptionsComplete') );
+                       embedObj.showPlayerselect( $tp.find( '.videoOptionsComplete' ) );
                        $opt.hide();
                        return false;
-               });
-               $opt.find('.vo_download').click(function(){
+               } );
+               $opt.find( '.vo_download' ).click( function() {
                        embedObj.displayHTML();
-                       embedObj.showDownload( $tp.find('.videoOptionsComplete') );
+                       embedObj.showDownload( $tp.find( '.videoOptionsComplete' ) );
                        $opt.hide();
                        return false;
-               })
-               $opt.find('.vo_showcode').click(function(){     
-                       embedObj.displayHTML();         
-                       embedObj.showShare( $tp.find('.videoOptionsComplete') );                        
+               } )
+               $opt.find( '.vo_showcode' ).click( function() {
+                       embedObj.displayHTML();
+                       embedObj.showShare( $tp.find( '.videoOptionsComplete' ) );
                        $opt.hide();
                        return false;
-               });
-               this.doVolumeBinding();         
+               } );
+               this.doVolumeBinding();
                
-               //check if we have any custom skin hooks to run (only one per skin) 
-               if( this.addSkinControlHooks && typeof( this.addSkinControlHooks) == 'function')
+               // check if we have any custom skin hooks to run (only one per skin) 
+               if ( this.addSkinControlHooks && typeof( this.addSkinControlHooks ) == 'function' )
                        this.addSkinControlHooks();
        },
-       doVolumeBinding:function(){
+       doVolumeBinding:function() {
                var embedObj = this.embedObj;
                var _this = this;
-               var $tp=$j('#' + embedObj.id);          
-               $tp.find('.volume_control').unbind().btnBind().click(function(){
-                       js_log('clicked volume control');
-                       $j('#' +embedObj.id).get(0).toggleMute();
-               });
-               //add vertical volume display hover
-               if( this.volume_layout == 'vertical'){
-                       //default volume binding:
+               var $tp = $j( '#' + embedObj.id );
+               $tp.find( '.volume_control' ).unbind().btnBind().click( function() {
+                       js_log( 'clicked volume control' );
+                       $j( '#' + embedObj.id ).get( 0 ).toggleMute();
+               } );
+               // add vertical volume display hover
+               if ( this.volume_layout == 'vertical' ) {
+                       // default volume binding:
                        var hoverOverDelay = false;
-                       var $tpvol = $tp.find('.vol_container');
-                       $tp.find('.volume_control').hover(
-                               function(){                                             
-                                       $tpvol.addClass('vol_container_top');                                   
-                                       //set to "below" if playing and embedType != native
-                                       if(embedObj && embedObj.isPlaying && embedObj.isPlaying() && !embedObj.supports['overlays']){
-                                               $tpvol.removeClass('vol_container_top').addClass('vol_container_below');
-                                       }       
-                                       $tpvol.fadeIn('fast');
+                       var $tpvol = $tp.find( '.vol_container' );
+                       $tp.find( '.volume_control' ).hover(
+                               function() {
+                                       $tpvol.addClass( 'vol_container_top' );
+                                       // set to "below" if playing and embedType != native
+                                       if ( embedObj && embedObj.isPlaying && embedObj.isPlaying() && !embedObj.supports['overlays'] ) {
+                                               $tpvol.removeClass( 'vol_container_top' ).addClass( 'vol_container_below' );
+                                       }
+                                       $tpvol.fadeIn( 'fast' );
                                        hoverOverDelay = true;
                                },
-                               function(){
-                                       hoverOverDelay= false;
-                                       setTimeout(function doHideVolume(){
-                                               if(!hoverOverDelay){
-                                                       $tpvol.fadeOut('fast');
+                               function() {
+                                       hoverOverDelay = false;
+                                       setTimeout( function doHideVolume() {
+                                               if ( !hoverOverDelay ) {
+                                                       $tpvol.fadeOut( 'fast' );
                                                }
-                                       }, 500);
+                                       }, 500 );
                                }
                        );
                }
                
-               //setup slider:
+               // setup slider:
                var sliderConf = {
                        range: "min",
                        value: 80,
                        min: 0,
                        max: 100,
-                       slide: function(event, ui) {
-                               var perc = ui.value/100;
-                               //js_log('update volume:' + perc);
-                               embedObj.updateVolumen(perc);
+                       slide: function( event, ui ) {
+                               var perc = ui.value / 100;
+                               // js_log('update volume:' + perc);
+                               embedObj.updateVolumen( perc );
                        },
-                       change:function(event, ui){
-                               var perc = ui.value/100;
-                               if ( perc==0 ) {
-                                       $tp.find('.volume_control span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
-                               }else{
-                                       $tp.find('.volume_control span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
+                       change:function( event, ui ) {
+                               var perc = ui.value / 100;
+                               if ( perc == 0 ) {
+                                       $tp.find( '.volume_control span' ).removeClass( 'ui-icon-volume-on' ).addClass( 'ui-icon-volume-off' );
+                               } else {
+                                       $tp.find( '.volume_control span' ).removeClass( 'ui-icon-volume-off' ).addClass( 'ui-icon-volume-on' );
                                }
-                               var perc = ui.value/100;
-                               embedObj.updateVolumen(perc);
+                               var perc = ui.value / 100;
+                               embedObj.updateVolumen( perc );
                        }
                }
                
-               if( this.volume_layout == 'vertical')
+               if ( this.volume_layout == 'vertical' )
                        sliderConf['orientation'] = "vertical";
                
-               $tp.find( '.volume-slider' ).slider( sliderConf );      
+               $tp.find( '.volume-slider' ).slider( sliderConf );
        },
-       getMvBufferHtml:function(){
+       getMvBufferHtml:function() {
                return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' +
-                               'ui-state-highlight ui-corner-all '+
+                               'ui-state-highlight ui-corner-all ' +
                                'mv_buffer" style="width:0px;height:100%;z-index:1;top:0px" />';
        },
        getComponent:function( component ) {
-               if( this.components[ component ] ){
+               if ( this.components[ component ] ) {
                        return this.components[ component ].o( this );
-               }else{
+               } else {
                        return false;
                }
        },
@@ -327,114 +327,114 @@ ctrlBuilder.prototype = {
        * components take in the embedObj and return some html for the given component.
        * components can be overwritten by skin javascript
        */
-       components:{
-               'borders':{
+       components: {
+               'borders': {
                        'w':8,
-                       'o':function( ctrlObj ){
+                       'o':function( ctrlObj ) {
                                return  '';
                        }
-               }, 
-               'play-btn-large':{
+               },
+               'play-btn-large': {
                        'w' : 130,
                        'h' : 96,
-                       'o':function( ctrlObj ){
-                               //get dynamic position for big play button (@@todo maybe use margin:auto ? )
-                               return $j('<div/>').attr({
-                                                               'title' : gM('mwe-play_clip'),
+                       'o':function( ctrlObj ) {
+                               // get dynamic position for big play button (@@todo maybe use margin:auto ? )
+                               return $j( '<div/>' ).attr( {
+                                                               'title' : gM( 'mwe-play_clip' ),
                                                                'class' : "ui-state-default play-btn-large"
-                                                       })
-                                                       .css({
-                                                               'left'  : ((ctrlObj.embedObj.playerPixelWidth() - this.w)/2),
-                                                               'top'   : ((ctrlObj.embedObj.playerPixelHeight() - this.h)/2)
-                                                       })                                                      
-                                                       .wrap('<div/>').parent().html();
+                                                       } )
+                                                       .css( {
+                                                               'left'  : ( ( ctrlObj.embedObj.playerPixelWidth() - this.w ) / 2 ),
+                                                               'top'   : ( ( ctrlObj.embedObj.playerPixelHeight() - this.h ) / 2 )
+                                                       } )
+                                                       .wrap( '<div/>' ).parent().html();
                        }
                },
-               'mv_embedded_options':{
+               'mv_embedded_options': {
                        'w':0,
-                       'o':function( ctrlObj ){
-                               var o= '<div id="mv_vid_options_'+ctrlObj.id+'" class="videoOptions">'+
-                               '<div class="videoOptionsTop"></div>'+
-                               '<div class="videoOptionsBox">'+
-                               '<div class="block">'+
-                                       '<h6>Video Options</h6>'+
-                               '</div>'+
-                                       '<div class="block">'+
-                                               '<p class="short_match vo_selection"><a href="#"><span>'+gM('mwe-chose_player')+'</span></a></p>'+
-                                               '<p class="short_match vo_download"><a href="#"><span>'+gM('mwe-download')+'</span></a></p>'+
-                                               '<p class="short_match vo_showcode"><a href="#"><span>'+gM('mwe-share')+'</span></a></p>';
+                       'o':function( ctrlObj ) {
+                               var o = '<div id="mv_vid_options_' + ctrlObj.id + '" class="videoOptions">' +
+                               '<div class="videoOptionsTop"></div>' +
+                               '<div class="videoOptionsBox">' +
+                               '<div class="block">' +
+                                       '<h6>Video Options</h6>' +
+                               '</div>' +
+                                       '<div class="block">' +
+                                               '<p class="short_match vo_selection"><a href="#"><span>' + gM( 'mwe-chose_player' ) + '</span></a></p>' +
+                                               '<p class="short_match vo_download"><a href="#"><span>' + gM( 'mwe-download' ) + '</span></a></p>' +
+                                               '<p class="short_match vo_showcode"><a href="#"><span>' + gM( 'mwe-share' ) + '</span></a></p>';
 
-                                       //link to the stream page if we are not already there:
-                                       if( ( ctrlObj.embedObj.roe || ctrlObj.embedObj.linkback ) && typeof mv_stream_interface == 'undefined' )
-                                               o+='<p class="short_match"><a href="javascript:$j(\'#'+ctrlObj.id+'\').get(0).doLinkBack()"><span><strong>Source Page</strong></span></a></p>';
+                                       // link to the stream page if we are not already there:
+                                       if ( ( ctrlObj.embedObj.roe || ctrlObj.embedObj.linkback ) && typeof mv_stream_interface == 'undefined' )
+                                               o += '<p class="short_match"><a href="javascript:$j(\'#' + ctrlObj.id + '\').get(0).doLinkBack()"><span><strong>Source Page</strong></span></a></p>';
 
-                               o+='</div>'+
+                               o += '</div>' +
                                '</div><!--videoOptionsInner-->' +
                                        '<div class="videoOptionsBot"></div>' +
                                '</div><!--videoOptions-->';
                                return o;
                        }
                },
-               'fullscreen':{
+               'fullscreen': {
                        'w':20,
-                       'o':function( ctrlObj ){
-                               return '<div title="' + gM('mwe-player_fullscreen') + '" class="ui-state-default ui-corner-all ui-icon_link rButton fullscreen-btn">'+                          
-                                                       '<span class="ui-icon ui-icon-arrow-4-diag"></span>'+
+                       'o':function( ctrlObj ) {
+                               return '<div title="' + gM( 'mwe-player_fullscreen' ) + '" class="ui-state-default ui-corner-all ui-icon_link rButton fullscreen-btn">' +
+                                                       '<span class="ui-icon ui-icon-arrow-4-diag"></span>' +
                                                '</div>'
                        }
                },
-               'options':{
+               'options': {
                        'w':26,
-                       'o':function( ctrlObj ){
-                               return '<div title="' + gM('mwe-player_options') + '" class="ui-state-default ui-corner-all ui-icon_link rButton options-btn">' +
-                                                       '<span class="ui-icon ui-icon-wrench"></span>' +                                                        
+                       'o':function( ctrlObj ) {
+                               return '<div title="' + gM( 'mwe-player_options' ) + '" class="ui-state-default ui-corner-all ui-icon_link rButton options-btn">' +
+                                                       '<span class="ui-icon ui-icon-wrench"></span>' +
                                                '</div>';
                        }
                },
-               'pause':{
+               'pause': {
                        'w':24,
-                       'o':function( ctrlObj ){                                
-                               return '<div title="' + gM('mwe-play_clip') + '" class="ui-state-default ui-corner-all ui-icon_link lButton play-btn">'+
-                                                       '<span class="ui-icon ui-icon-play"/>'+
+                       'o':function( ctrlObj ) {
+                               return '<div title="' + gM( 'mwe-play_clip' ) + '" class="ui-state-default ui-corner-all ui-icon_link lButton play-btn">' +
+                                                       '<span class="ui-icon ui-icon-play"/>' +
                                                '</div>';
                        }
                },
-               'closed_captions':{
+               'closed_captions': {
                        'w':23,
-                       'o':function( ctrlObj ){
-                               return '<div title="' + gM('mwe-closed_captions') + '" class="ui-state-default ui-corner-all ui-icon_link rButton timed-text">'+
-                                                       '<span class="ui-icon ui-icon-comment"></span>'+
+                       'o':function( ctrlObj ) {
+                               return '<div title="' + gM( 'mwe-closed_captions' ) + '" class="ui-state-default ui-corner-all ui-icon_link rButton timed-text">' +
+                                                       '<span class="ui-icon ui-icon-comment"></span>' +
                                                '</div>'
                        }
                },
-               'volume_control':{
+               'volume_control': {
                        'w':23,
-                       'o':function( ctrlObj ){                                        
-                               var o='';
+                       'o':function( ctrlObj ) {
+                               var o = '';
                                if ( ctrlObj.volume_layout == 'horizontal' )
-                                       o+='<div class="ui-slider ui-slider-horizontal rButton volume-slider"></div>';  
+                                       o += '<div class="ui-slider ui-slider-horizontal rButton volume-slider"></div>';
                                        
-                               o+= '<div title="' + gM('mwe-volume_control') + '" class="ui-state-default ui-corner-all ui-icon_link rButton volume_control">' +
+                               o += '<div title="' + gM( 'mwe-volume_control' ) + '" class="ui-state-default ui-corner-all ui-icon_link rButton volume_control">' +
                                                '<span class="ui-icon ui-icon-volume-on"></span>';
                                                
-                               if( ctrlObj.volume_layout == 'vertical'){
-                                       o+='<div style="position:absolute;display:none;left:0px;" class="vol_container ui-corner-all">' +
+                               if ( ctrlObj.volume_layout == 'vertical' ) {
+                                       o += '<div style="position:absolute;display:none;left:0px;" class="vol_container ui-corner-all">' +
                                                        '<div class="volume-slider" ></div>' +
                                                '</div>';
                                }
-                               o+= '</div>';                                                                           
+                               o += '</div>';
                                return o;
                        }
                },
-               'time_display':{
+               'time_display': {
                        'w':90,
-                       'o':function( ctrlObj ){
+                       'o':function( ctrlObj ) {
                                return '<div class="ui-widget time-disp">' + ctrlObj.embedObj.getTimeReq() + '</div>';
                        }
                },
-               'play_head':{
-                       'w':0, //special case (takes up remaining space)
-                       'o':function( ctrlObj ){
+               'play_head': {
+                       'w':0, // special case (takes up remaining space)
+                       'o':function( ctrlObj ) {
                                return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 30 ) + 'px;"></div>';
                        }
                }
index 22d9149..808d483 100644 (file)
 
 var kskinConfig = {
        pClass: 'k-player',
-       //display time progress
+       // display time progress
        long_time_disp: false,
        body_options: false,
        volume_layout: 'horizontal',
-       components:{
-               'play-btn-large' : { 
+       components: {
+               'play-btn-large' : {
                        'h' : 55
                },
-               'options':{
+               'options': {
                        'w':50,
-                       'o':function(){
-                               return '<div class="ui-state-default ui-corner-bl rButton k-options" title="'+ gM('mwe-player_options') + '" >' +
-                                                       '<span>' + gM('mwe-menu_btn') + '</span>' +
+                       'o':function() {
+                               return '<div class="ui-state-default ui-corner-bl rButton k-options" title="' + gM( 'mwe-player_options' ) + '" >' +
+                                                       '<span>' + gM( 'mwe-menu_btn' ) + '</span>' +
                                                '</div>'
                        }
-               },              
-               'time_display':{
+               },
+               'time_display': {
                        'w':70
                },
-               'mv_embedded_options':{
+               'mv_embedded_options': {
                        'w':0,
-                       'o':function( ctrlObj ){
-                               var embedObj = ctrlObj.embedObj;                                
-                               var o= '' +
+                       'o':function( ctrlObj ) {
+                               var embedObj = ctrlObj.embedObj;
+                               var o = '' +
                                '<div class="k-menu ui-widget-content" ' +
                                        'style="width:' + embedObj.playerPixelWidth() + 'px; height:' + embedObj.playerPixelHeight() + 'px;">' +
-                                               '<ul class="k-menu-bar">';                                              
-                                                       //output menu item containers: 
-                                                       for(i=0; i < ctrlObj.menu_items.length; i++){           
-                                                               var mk = ctrlObj.menu_items[i];                         
-                                                               o+= '<li class="k-' + mk + '-btn" rel="' + mk + '">' +
-                                                                               '<a href="#" title="' + gM( 'mwe-' + mk ) +'">' + gM( 'mwe-' + mk ) +'</a></li>';
-                                                       }                                                       
-                                               o+='</ul>' +
+                                               '<ul class="k-menu-bar">';
+                                                       // output menu item containers: 
+                                                       for ( i = 0; i < ctrlObj.menu_items.length; i++ ) {
+                                                               var mk = ctrlObj.menu_items[i];
+                                                               o += '<li class="k-' + mk + '-btn" rel="' + mk + '">' +
+                                                                               '<a href="#" title="' + gM( 'mwe-' + mk ) + '">' + gM( 'mwe-' + mk ) + '</a></li>';
+                                                       }
+                                               o += '</ul>' +
                                                // We have to subtract the width of the k-menu-bar
-                                               '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() -75) +
-                                                       'px; height:' + (embedObj.playerPixelHeight() - ctrlBuilder.height) + 'px;">';
+                                               '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() - 75 ) +
+                                                       'px; height:' + ( embedObj.playerPixelHeight() - ctrlBuilder.height ) + 'px;">';
                                                
                                                // Output menu item containers: 
-                                               for(i=0; i < ctrlObj.menu_items.length; i++){                                                   
-                                                       o+= '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>';
-                                               }                                                                                                                                       
+                                               for ( i = 0; i < ctrlObj.menu_items.length; i++ ) {
+                                                       o += '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>';
+                                               }
                                                '</div>' +
                                        '</div>';
                                return o;
                        }
                }
        },
-       addSkinControlHooks: function(){
+       addSkinControlHooks: function() {
                var embedObj = this.embedObj;
                var _this = this;
-               var $tp=$j('#' + embedObj.id);
+               var $tp = $j( '#' + embedObj.id );
                
                // Adds options and bindings: (we do this onClick )  
-               var addMvOptions = function(){
-                       if( $j('#' + embedObj.id + ' .k-menu').length != 0 )
+               var addMvOptions = function() {
+                       if ( $j( '#' + embedObj.id + ' .k-menu' ).length != 0 )
                                return false;
                                
-                       $j('#' + embedObj.id + ' .' + _this.pClass).prepend(
-                               _this.components['mv_embedded_options'].o( $tp.get(0).ctrlBuilder )
+                       $j( '#' + embedObj.id + ' .' + _this.pClass ).prepend(
+                               _this.components['mv_embedded_options'].o( $tp.get( 0 ).ctrlBuilder )
                        );
                        
                        // By default its hidden:
-                       $tp.find('.k-menu').hide();
+                       $tp.find( '.k-menu' ).hide();
                        
                        // Output menu-items: 
-                       for(i=0; i < _this.menu_items.length ; i++){                            
-                       $tp.find('.k-' +  _this.menu_items[i] + '-btn').click(function(){ 
-                               var mk = $j(this).attr('rel');
-                               $target = $j('#' + embedObj.id  + ' .menu-'+mk).hide();                         
+                       for ( i = 0; i < _this.menu_items.length ; i++ ) {
+                       $tp.find( '.k-' +  _this.menu_items[i] + '-btn' ).click( function() {
+                               var mk = $j( this ).attr( 'rel' );
+                               $target = $j( '#' + embedObj.id  + ' .menu-' + mk ).hide();
                                // Generate the menu html not already done:
-                               if( $target.children().length == 0 ){
-                                               //call the function show{Menuitem} with target:                         
-                                               embedObj['show' + mk.charAt(0).toUpperCase() + mk.substring(1)](
-                                                       $j('#' + embedObj.id + ' .menu-'+mk)
+                               if ( $target.children().length == 0 ) {
+                                               // call the function show{Menuitem} with target:                                
+                                               embedObj['show' + mk.charAt( 0 ).toUpperCase() + mk.substring( 1 )](
+                                                       $j( '#' + embedObj.id + ' .menu-' + mk )
                                                );
-                               }                                                       
+                               }
                                // Slide out the others 
-                                $j('#' + embedObj.id  + ' .menu-screen').hide();
-                                $target.fadeIn("fast");
-                                       //don't follow the # link                                                               
+                                $j( '#' + embedObj.id  + ' .menu-screen' ).hide();
+                                $target.fadeIn( "fast" );
+                                       // don't follow the # link                                                              
                            return false;
-                               });     
-                       }                       
-               }  
+                               } );
+                       }
+               }
                                
                // Options menu display:                        
-               $tp.find('.k-options').click(function(){                           
-                       if($j('#' + embedObj.id + ' .k-menu').length == 0 ){
-                               //stop the player if it does not support overlays: 
-                               if(!embedObj.supports['overlays'])
-                                       $tp.get(0).stop();
+               $tp.find( '.k-options' ).click( function() {
+                       if ( $j( '#' + embedObj.id + ' .k-menu' ).length == 0 ) {
+                               // stop the player if it does not support overlays: 
+                               if ( !embedObj.supports['overlays'] )
+                                       $tp.get( 0 ).stop();
                        // Add the options                                      
                                addMvOptions();
                        }
                        // Set up the text and menu:                                                                    
-                       var $ktxt = $j(this);
-                       var $kmenu = $tp.find('.k-menu');
-                       if( $kmenu.is(':visible') ){
-                               $kmenu.fadeOut("fast",function(){
-                                       $ktxt.find('span').html ( gM('mwe-menu_btn') );
-                               });
-                               $tp.find('.play-btn-large').fadeIn('fast');
-                       }else{
-                               $kmenu.fadeIn("fast", function(){
-                                       $ktxt.find('span').html ( gM('mwe-close_btn') );
-                               });
-                               $tp.find('.play-btn-large').fadeOut('fast');
+                       var $ktxt = $j( this );
+                       var $kmenu = $tp.find( '.k-menu' );
+                       if ( $kmenu.is( ':visible' ) ) {
+                               $kmenu.fadeOut( "fast", function() {
+                                       $ktxt.find( 'span' ).html ( gM( 'mwe-menu_btn' ) );
+                               } );
+                               $tp.find( '.play-btn-large' ).fadeIn( 'fast' );
+                       } else {
+                               $kmenu.fadeIn( "fast", function() {
+                                       $ktxt.find( 'span' ).html ( gM( 'mwe-close_btn' ) );
+                               } );
+                               $tp.find( '.play-btn-large' ).fadeOut( 'fast' );
                        }
-               });                                     
+               } );
        
        }
 }
\ No newline at end of file
index 0c1797c..17c61ec 100644 (file)
@@ -1,15 +1,15 @@
 /* a simple language tester replacements
  */
 
-loadGM({       
+loadGM( {
        "undelete_short"  : "Undelete {{PLURAL:$1|one edit|$1 edits}}",
        "category-subcat-count" : "{{PLURAL:$2|This category has only the following subcategory.|This category has the following {{PLURAL:$1|subcategory|$1 subcategories}}, out of $2 total.}}",
-       "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}"  
-});
+       "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}"
+} );
 
-mw.lang.loadRS({
-       'PLURAL' : { "one" : 1 }        
-});
+mw.lang.loadRS( {
+       'PLURAL' : { "one" : 1 }
+} );
 
-//define a class by the name of this file:  
-mw.testLang = {};
\ No newline at end of file
+// define a class by the name of this file:  
+mw.testLang = { };
\ No newline at end of file
index aeb3b01..19f5f72 100644 (file)
@@ -8,65 +8,65 @@ var mwEmbedHostPath = urlparts[0];
 var mwRemoteVersion = '1.06';
 var mwUseScriptLoader = true;
 
-//setup up request Params: 
-var reqParts = urlparts[1].substring(1).split('&');
-var mwReqParam={};
-for(var i=0;i< reqParts.length; i++){
-       var p = reqParts[i].split('=');
-       if( p.length == 2 )
+// setup up request Params: 
+var reqParts = urlparts[1].substring( 1 ).split( '&' );
+var mwReqParam = { };
+for ( var i = 0; i < reqParts.length; i++ ) {
+       var p = reqParts[i].split( '=' );
+       if ( p.length == 2 )
                mwReqParam[ p[0] ] = p[1];
 }
 
-addOnloadHook( function(){
+addOnloadHook( function() {
        // Only do rewrites if MV_EMBED / js2 is "off"
-       if( typeof MV_EMBED_VERSION == 'undefined' ) {
+       if ( typeof MV_EMBED_VERSION == 'undefined' ) {
                doPageSpecificRewrite();
        }
-});
+} );
 
 function doPageSpecificRewrite() {
        // Add media wizard
-       if( wgAction == 'edit' || wgAction == 'submit' ) {
-               load_mv_embed( function() {     
+       if ( wgAction == 'edit' || wgAction == 'submit' ) {
+               load_mv_embed( function() {
                        loadExternalJs( mwEmbedHostPath + '/editPage.js?' + mwGetReqArgs() );
-               });
+               } );
        }
        
        // Timed text display:
-       if(wgPageName.indexOf("TimedText") === 0){              
-               load_mv_embed(function(){
+       if ( wgPageName.indexOf( "TimedText" ) === 0 ) {
+               load_mv_embed( function() {
                        // Load with mw loader to get localized interface:
-                       mw.load( ['mvTimeTextEdit'],function(){
-                               //could run init here (but mvTimeTextEdit included onLoad actions)
-                       });
-               });
+                       mw.load( ['mvTimeTextEdit'], function() {
+                               // could run init here (but mvTimeTextEdit included onLoad actions)
+                       } );
+               } );
        }
        
        // Firefogg integration
-       if( wgPageName == "Special:Upload" ){           
+       if ( wgPageName == "Special:Upload" ) {
                load_mv_embed( function() {
                        loadExternalJs( mwEmbedHostPath + '/uploadPage.js?' + mwGetReqArgs() );
                } );
        }
        
        // Special api proxy page
-       if( wgPageName == 'MediaWiki:ApiProxy' ){               
+       if ( wgPageName == 'MediaWiki:ApiProxy' ) {
                var wgEnableIframeApiProxy = true;
                load_mv_embed( function() {
-                       js_log("Wiki:ApiProxy::");
+                       js_log( "Wiki:ApiProxy::" );
                        loadExternalJs( mwEmbedHostPath + '/apiProxyPage.js?' + mwGetReqArgs() );
-               });
+               } );
        }
        
        // OggHandler rewrite for view pages:
        var vidIdList = [];
        var divs = document.getElementsByTagName( 'div' );
-       for( var i = 0; i < divs.length; i++ ) {
-               if( divs[i].id && divs[i].id.substring( 0, 11 ) == 'ogg_player_' ) {
+       for ( var i = 0; i < divs.length; i++ ) {
+               if ( divs[i].id && divs[i].id.substring( 0, 11 ) == 'ogg_player_' ) {
                        vidIdList.push( divs[i].getAttribute( "id" ) );
                }
        }
-       if( vidIdList.length > 0 ) {
+       if ( vidIdList.length > 0 ) {
                load_mv_embed( function() {
                        mvJsLoader.embedVideoCheck( function() {
                                // Do utility rewrite of OggHandler content:
@@ -76,85 +76,85 @@ function doPageSpecificRewrite() {
        }
 }
 // This will be depreciated in favour of updates to OggHandler
-function rewrite_for_OggHandler( vidIdList ){
-       function procVidId( vidId ){
-               //don't process empty vids
-               if(!vidId)
+function rewrite_for_OggHandler( vidIdList ) {
+       function procVidId( vidId ) {
+               // don't process empty vids
+               if ( !vidId )
                        return ;
-               js_log('vidIdList on: ' + vidId +' length: ' + vidIdList.length + ' left in the set: ' + vidIdList );
+               js_log( 'vidIdList on: ' + vidId + ' length: ' + vidIdList.length + ' left in the set: ' + vidIdList );
                
                // Grab the thumbnail and src of the video
                var pimg = $j( '#' + vidId + ' img' );
                var poster_attr = 'poster = "' + pimg.attr( 'src' ) + '" ';
-               var pwidth = $j( '#' + vidId).width();
-               var pheight = $j( '#' + vidId + ' img').height();
+               var pwidth = $j( '#' + vidId ).width();
+               var pheight = $j( '#' + vidId + ' img' ).height();
                var tag_type = 'video';
                                
                // Check for audio
-               if( pheight == '22' || pheight == '52') {
-                       //set width to parent width:                    
+               if ( pheight == '22' || pheight == '52' ) {
+                       // set width to parent width:                   
                        tag_type = 'audio';
                        poster_attr = '';
                }
 
                // Parsed values:
                var src = '';
-               var duration_attr = ''; 
-               var wikiTitleKey = $j( '#'+vidId + ' img').filter(':first').attr('src').split('/');
+               var duration_attr = '';
+               var wikiTitleKey = $j( '#' + vidId + ' img' ).filter( ':first' ).attr( 'src' ).split( '/' );
                wikiTitleKey = unescape( wikiTitleKey[ wikiTitleKey.length - 2 ] );
                var re = new RegExp( /videoUrl(&quot;:?\s*)*([^&]*)/ );
-               src = re.exec( $j( '#'+vidId ).html() )[2];
+               src = re.exec( $j( '#' + vidId ).html() )[2];
 
                var re = new RegExp( /length(&quot;:?\s*)*([^,]*)/ );
-               var dv = re.exec( $j( '#'+vidId ).html() )[2];
-               if( dv ){
-                       duration_attr = 'durationHint="'+ dv +'" ';
+               var dv = re.exec( $j( '#' + vidId ).html() )[2];
+               if ( dv ) {
+                       duration_attr = 'durationHint="' + dv + '" ';
                }
 
                var re = new RegExp( /offset(&quot;:?\s*)*([^&]*)/ );
-               offset = re.exec( $j( '#'+vidId ).html() )[2];
+               offset = re.exec( $j( '#' + vidId ).html() )[2];
                var offset_attr = offset ? 'startOffset="' + offset + '"' : '';
 
-               if( src ) {
+               if ( src ) {
                        var html_out = '';
                        
-                       var common_attr = ' id="mwe_' + vidId +'" '+
+                       var common_attr = ' id="mwe_' + vidId + '" ' +
                                        'wikiTitleKey="' + wikiTitleKey + '" ' +
                                        'src="' + src + '" ' +
                                        duration_attr +
                                        offset_attr + ' ';
                                        
-                       if( tag_type == 'audio' ){
-                               html_out='<audio' + common_attr + ' style="width:' + pwidth + 'px;"></audio>';
-                       }else{
-                               html_out='<video' + common_attr +
+                       if ( tag_type == 'audio' ) {
+                               html_out = '<audio' + common_attr + ' style="width:' + pwidth + 'px;"></audio>';
+                       } else {
+                               html_out = '<video' + common_attr +
                                poster_attr + ' ' +
                                'style="width:' + pwidth + 'px;height:' + pheight + 'px;">' +
                                '</video>';
-                       }       
-                       //set the video tag inner html and update the height
+                       }
+                       // set the video tag inner html and update the height
                        $j( '#' + vidId ).html( html_out )
-                               .css('height', pheight + 30);
+                               .css( 'height', pheight + 30 );
 
-               }                               
-               rewrite_by_id( 'mwe_' + vidId, function(){
-                       if( vidIdList.length != 0 ){
-                               setTimeout( function(){
+               }
+               rewrite_by_id( 'mwe_' + vidId, function() {
+                       if ( vidIdList.length != 0 ) {
+                               setTimeout( function() {
                                        procVidId( vidIdList.pop() )
-                               }, 10);
+                               }, 10 );
                        }
-               });
+               } );
        };
-       //process each item in the vidIdList (with setTimeout to avoid locking)
+       // process each item in the vidIdList (with setTimeout to avoid locking)
        procVidId( vidIdList.pop() );
 }
 function getRemoteEmbedPath() {
-       for( var i = 0; i < document.getElementsByTagName( 'script' ).length; i++ ) {
+       for ( var i = 0; i < document.getElementsByTagName( 'script' ).length; i++ ) {
                var s = document.getElementsByTagName( 'script' )[i];
-               if( s.src.indexOf( '/remoteMwEmbed.js' ) != -1 ) {
+               if ( s.src.indexOf( '/remoteMwEmbed.js' ) != - 1 ) {
                        var reqStr = '';
                        var scriptPath = '';
-                       if( s.src.indexOf( '?' ) != -1) {
+                       if ( s.src.indexOf( '?' ) != - 1 ) {
                                reqStr = s.src.substr( s.src.indexOf( '?' ) );
                                scriptPath = s.src.substr( 0,  s.src.indexOf( '?' ) ).replace( '/remoteMwEmbed.js', '' );
                        } else {
@@ -165,17 +165,17 @@ function getRemoteEmbedPath() {
                }
        }
 }
-function mwGetReqArgs(){
+function mwGetReqArgs() {
        var rurl = '';
-       if(mwReqParam['debug'])
+       if ( mwReqParam['debug'] )
                rurl += 'debug=true&';
 
-       if(mwReqParam['uselang'] )
+       if ( mwReqParam['uselang'] )
                rurl += 'uselang=' + mwReqParam['uselang'] + '&';
 
-       if( mwReqParam['urid'] ){
+       if ( mwReqParam['urid'] ) {
                rurl += 'urid=' + mwReqParam['urid'];
-       }else{
+       } else {
                // Make sure to use an urid 
                // This way remoteMwEmbed can control version of code being requested
                rurl += 'urid=' + mwRemoteVersion;
@@ -184,17 +184,17 @@ function mwGetReqArgs(){
 }
 function load_mv_embed( callback ) {
        // Inject mv_embed if needed
-       if( typeof mw == 'undefined' ) {        
-               if( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader){
+       if ( typeof mw == 'undefined' ) {
+               if ( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader ) {
                        var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mv_embed';
                        // Add jQuery too if we need it: 
-                       if(typeof window.jQuery == 'undefined'){
+                       if ( typeof window.jQuery == 'undefined' ) {
                                rurl += ',window.jQuery';
-                       }       
-                       rurl += '&' + mwGetReqArgs();                                                           
+                       }
+                       rurl += '&' + mwGetReqArgs();
                                                        
-                       importScriptURI( rurl ); 
-               }else{
+                       importScriptURI( rurl );
+               } else {
                        importScriptURI( mwEmbedHostPath + '/mwEmbed/mv_embed.js?' + mwGetReqArgs() );
                }
        }
@@ -202,8 +202,8 @@ function load_mv_embed( callback ) {
 }
 
 function check_for_mv_embed( callback ) {
-       if( typeof mw == 'undefined' ) {
-               setTimeout( function(){
+       if ( typeof mw == 'undefined' ) {
+               setTimeout( function() {
                        check_for_mv_embed( callback );
                }, 25 );
        } else {
index 4eb54b6..eba8680 100644 (file)
@@ -5,7 +5,7 @@
 
 js2AddOnloadHook( function() {
        mwUploadHelper.init();
-});
+} );
 
 var mwUploadFormTarget = '#mw-upload-form';
 // Set up the upload form bindings once all DOM manipulation is done
@@ -13,19 +13,19 @@ var mwUploadHelper = {
        init: function() {
                var _this = this;
                // If wgEnableFirefogg is not boolean false, set to true
-               if( typeof wgEnableFirefogg == 'undefined' )
+               if ( typeof wgEnableFirefogg == 'undefined' )
                wgEnableFirefogg = true;
 
-               if( wgEnableFirefogg ) {
+               if ( wgEnableFirefogg ) {
                        // Set up the upload handler to Firefogg. Should work with the HTTP uploads too.
                        $j( '#wpUploadFile' ).firefogg( {
                                // An API URL (we won't submit directly to action of the form)
                                'api_url': wgServer + wgScriptPath + '/api.php',
                                'form_rewrite': true,
                                'target_edit_from': mwUploadFormTarget,
-                               'new_source_cb': function( orgFilename, oggName ) {                                     
+                               'new_source_cb': function( orgFilename, oggName ) {
                                        $j( '#wpDestFile' ).val( oggName );
-                                       $j( '#wpDestFile' ).doDestCheck({
+                                       $j( '#wpDestFile' ).doDestCheck( {
                                                'warn_target': '#wpDestFile-warning'
                                        } );
                                }
@@ -33,7 +33,7 @@ var mwUploadHelper = {
                } else {
                        // Add basic upload profile support ( http status monitoring, progress box for
                        // browsers that support it, etc.)
-                       if( $j( '#wpUploadFileURL' ).length != 0 ) {
+                       if ( $j( '#wpUploadFileURL' ).length != 0 ) {
                                $j( '#wpUploadFileURL' ).baseUploadInterface( {
                                        'api_url': wgServer + wgScriptPath + '/api.php',
                                        'target_edit_from': mwUploadFormTarget
@@ -41,17 +41,17 @@ var mwUploadHelper = {
                        }
                }
 
-               if( wgAjaxUploadDestCheck ) {
+               if ( wgAjaxUploadDestCheck ) {
                        // Do destination check
                        $j( '#wpDestFile' ).change( function() {
-                               $j( '#wpDestFile' ).doDestCheck({
+                               $j( '#wpDestFile' ).doDestCheck( {
                                        'warn_target':'#wpDestFile-warning'
                                } );
                        } );
                }
 
                // Check if we have HTTP enabled & setup enable/disable toggle:
-               if( $j( '#wpUploadFileURL' ).length != 0 ) {
+               if ( $j( '#wpUploadFileURL' ).length != 0 ) {
                        // Set the initial toggleUpType
                        _this.toggleUpType( true );
 
@@ -62,7 +62,7 @@ var mwUploadHelper = {
                $j( '#wpUploadFile,#wpUploadFileURL' )
                .focus( function() {
                        _this.toggleUpType( this.id == 'wpUploadFile' );
-               })
+               } )
                // Also setup the onChange event binding:
                .change( function() {
                        if ( wgUploadAutoFill ) {
@@ -83,8 +83,8 @@ var mwUploadHelper = {
                $j( '#wpUploadFileURL' ).attr( 'disabled', set );
 
                // If Firefogg is enabled, toggle action according to wpSourceTypeFile selection
-               if( wgEnableFirefogg ) {                        
-                       $j( '#wpUploadFile' ).firefogg({
+               if ( wgEnableFirefogg ) {
+                       $j( '#wpUploadFile' ).firefogg( {
                                'firefogg_form_action': $j( '#wpSourceTypeFile' ).attr( 'checked' )
                        } );
                }
@@ -102,24 +102,24 @@ var mwUploadHelper = {
                var slash = path.lastIndexOf( '/' );
                var backslash = path.lastIndexOf( '\\' );
                var fname;
-               if ( slash == -1 && backslash == -1 ) {
+               if ( slash == - 1 && backslash == - 1 ) {
                        fname = path;
                } else if ( slash > backslash ) {
-                       fname = path.substring( slash+1, 10000 );
+                       fname = path.substring( slash + 1, 10000 );
                } else {
-                       fname = path.substring( backslash+1, 10000 );
+                       fname = path.substring( backslash + 1, 10000 );
                }
                // URLs are less likely to have a useful extension. Don't include them in the extension check.
-               if( wgFileExtensions && $j( targetElm ).attr( 'id' ) != 'wpUploadFileURL' ) {
+               if ( wgFileExtensions && $j( targetElm ).attr( 'id' ) != 'wpUploadFileURL' ) {
                        var found = false;
-                       if( fname.lastIndexOf( '.' ) != -1 ) {
+                       if ( fname.lastIndexOf( '.' ) != - 1 ) {
                                var ext = fname.substr( fname.lastIndexOf( '.' ) + 1 );
-                               for( var i = 0; i < wgFileExtensions.length; i++ ) {
-                                       if( wgFileExtensions[i].toLowerCase() == ext.toLowerCase() )
+                               for ( var i = 0; i < wgFileExtensions.length; i++ ) {
+                                       if ( wgFileExtensions[i].toLowerCase() == ext.toLowerCase() )
                                        found = true;
                                }
                        }
-                       if( !found ) {
+                       if ( !found ) {
                                // Clear the upload. Set mw-upload-permitted to error.
                                $j( targetElm ).val( '' );
                                $j( '#mw-upload-permitted,#mw-upload-prohibited' ).show().addClass( 'error' );
@@ -128,12 +128,12 @@ var mwUploadHelper = {
                        }
                }
                // Capitalise first letter and replace spaces by underscores
-               fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / /g, '_' );
+               fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / / g, '_' );
                // Output result
                $j( '#wpDestFile' ).val( fname );
 
                // Do a destination check
-               $j( '#wpDestFile' ).doDestCheck({
+               $j( '#wpDestFile' ).doDestCheck( {
                        'warn_target': '#wpDestFile-warning'
                } );
        }