* fixed audio vs video display height in remoteMwEmbed rewrite
authorMichael Dale <dale@users.mediawiki.org>
Sat, 21 Nov 2009 18:45:30 +0000 (18:45 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Sat, 21 Nov 2009 18:45:30 +0000 (18:45 +0000)
* added kskin "credits" page.
* set "kskin" to default skin for remoteMwEmbed rewrite
* setup global config inheritance for mv_embed.js
* finished Tim's renaming of bObj to buttons
* some refactoring, function naming updates, and comment clarity improvements

21 files changed:
js2/mwEmbed/example_usage/Player_RelatedVideos.html
js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
js2/mwEmbed/libAddMedia/mvFirefogg.js
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
js2/mwEmbed/libEmbedVideo/embedVideo.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/mv_embed.js
js2/mwEmbed/php/languages/mwEmbed.i18n.php
js2/mwEmbed/skins/ctrlBuilder.js
js2/mwEmbed/skins/kskin/kskin.js
js2/mwEmbed/skins/kskin/playerSkin.css
js2/mwEmbed/tests/testLang.html
js2/remoteMwEmbed.js

index f365225..26f5180 100644 (file)
@@ -6,16 +6,16 @@
        <script type="text/javascript" src="../mv_embed.js?debug=true"></script>
 </head>
 <body>
-<h3> Simple Video Relational Audio and Video the Commons </h3>
-This Example search primitive video in the Wikimedia Commons
+<h3> Related Videos </h3>
+
 <span id="default_attr">
 </span> <br />
 <br />
   <table border="1" cellpadding="6" width="600">
                    <tr>
              <td valign="top"> 
-             <video wikiTitleKey="File:B-36_bomber.ogg" durationHint="2" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg&size=400x300" src="http://upload.wikimedia.org/wikipedia/commons/0/0d/B-36_bomber.ogg"></video></td>
-             <td valign="top"><b>Sample Relational Video And Audio</b><br />
+             <video wikiTitleKey="B-36_bomber.ogg" durationHint="2" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg&size=400x300" src="http://upload.wikimedia.org/wikipedia/commons/0/0d/B-36_bomber.ogg"></video></td>
+             <td valign="top"><b>Sample Related Videos</b><br />
                <pre>The Example Code ::: </pre>
                &lt;video wikiTitleKey="File:B-36_bomber.ogg" durationHint="2"
                     poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg&size=400x300"
index d9c01d7..9833d54 100644 (file)
@@ -734,7 +734,7 @@ mvBaseUploadInterface.prototype = {
                                }
                        };
                        // Create the "return to form" button
-                       bObj[ gM( 'mwe-return-to-form' ) ] = function() {
+                       buttons[ gM( 'mwe-return-to-form' ) ] = function() {
                                $j( this ).dialog( 'close' );
                                _this.form_post_override = false;
                        }
@@ -742,7 +742,7 @@ mvBaseUploadInterface.prototype = {
                        _this.updateProgressWin(
                                gM( 'mwe-uploadwarning' ),
                                '<h3>' + gM( 'mwe-uploadwarning' ) + '</h3>' + wmsg + '<p>',
-                               bObj );
+                               buttons );
                        return false;
                }
                // No error!
@@ -783,21 +783,21 @@ mvBaseUploadInterface.prototype = {
                                return false;
                        }
 
-                       var bObj = {};
+                       var buttons = {};
                        // "Return" button
-                       bObj[ gM( 'mwe-return-to-form' ) ] = function() {
+                       buttons[ gM( 'mwe-return-to-form' ) ] = function() {
                                $j( this ).dialog( 'close' );
                                _this.form_post_override = false;
                        }
                        // "Go to resource" button
-                       bObj[ gM('mwe-go-to-resource') ] = function() {
+                       buttons[ gM('mwe-go-to-resource') ] = function() {
                                window.location = url;
                        };
                        _this.action_done = true;
                        _this.updateProgressWin(
                                        gM( 'mwe-successfulupload' ),
                                        gM( 'mwe-upload_done', url),
-                                       bObj );
+                                       buttons );
                        js_log( 'apiRes.upload.imageinfo::' + url );
                        return true;
                }
index 3d532bd..4149093 100644 (file)
@@ -282,13 +282,15 @@ mvFirefogg.prototype = { // extends mvBaseUploadInterface
                                return;
                        }
 
-                       // Otherwise show the "install Firefogg" message
-                       // FIXME: getFirefoggInstallUrl() may return false, this is not handled
+                       // Otherwise show the "install Firefogg" message                        
                        var upMsg = ( _this.form_type == 'upload' ) ? gM( 'fogg-for_improved_uploads' ) : '';
-                       $j( _this.target_please_install )
-                               .html( upMsg + gM( 'fogg-please_install', _this.getFirefoggInstallUrl() ) )
-                               .css( 'padding', '10px' )
-                               .show();
+                       var firefoggUrl = _this.getFirefoggInstallUrl();
+                       if( firefoggUrl ){
+                               $j( _this.target_please_install )
+                                       .html( upMsg + gM( 'fogg-please_install', firefoggUrl ) )
+                                       .css( 'padding', '10px' )
+                                       .show();
+                       }
                }
 
                // Set up the click handler for the "save local file" button
index 0154c62..49f1771 100644 (file)
@@ -1271,7 +1271,7 @@ remoteSearchDriver.prototype = {
                        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.addResourceInfoCallback( rObj, function() {
                                // Make sure we have the embedVideo libs:
                                var runFlag = false;
                                mvJsLoader.embedVideoCheck( function() {
@@ -1292,13 +1292,14 @@ remoteSearchDriver.prototype = {
                                        js_log( "about to call rewrite_by_id::embed_vid" );
                                        // Rewrite by id
                                        rewrite_by_id( 'embed_vid', function() {                                                
-                                               // Grab any information that we got from the ROE xml or parsed from the media file
-                                               rObj.pSobj.getEmbedObjParsedInfo( rObj, 'embed_vid' );
+                                               // Grab information avaliable from the embed instance
+                                               rObj.pSobj.addResourceInfoFromEmbedInstance( rObj, 'embed_vid' );
+                                               
                                                // Add the re-sizable to the doLoad request:
                                                clibs.push( '$j.ui.resizable' );
-                                               clibs.push( '$j.fn.hoverIntent' );
+                                               clibs.push( '$j.fn.hoverIntent' );                                              
                                                mvJsLoader.doLoad( clibs, function() {
-                                                       // Make sure the rsd_edit_img is hidden:
+                                                       // Make sure the rsd_edit_img is removed:
                                                        $j( '#rsd_edit_img' ).remove();
                                                        // Run the image clip tools
                                                        _this.cEdit = new mvClipEdit( mvClipInit );
@@ -1390,9 +1391,7 @@ remoteSearchDriver.prototype = {
        },
        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 );
+               js_log( "doImportInterface:: update:" + _this.cFileNS + ':' + rObj.target_resource_title );             
 
                // setup the resource description from resource description:
                var wt = '{{Information ' + "\n";
index ab17900..78ceee1 100644 (file)
@@ -1,17 +1,24 @@
-// archive.org uses solr engine: 
-// more about solr here:  
-// http://lucene.apache.org/solr/
+/*
+* Archive.org Search
+* 
+* archive.org uses the solr engine: 
+* more about solr here:  
+* http://lucene.apache.org/solr/
+*/
 
 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 base class and inherit: 
-               var baseSearch = new baseRemoteSearch( iObj );
+       downloadUrl : 'http://www.archive.org/download/',
+       detailsUrl : 'http://www.archive.org/details/',
+       /*
+       * Inititalize the archiveOrgSearch class.
+       * archiveOrgSearch inherits the baseSearch class 
+       */
+       init:function( options ) {              
+               var baseSearch = new baseRemoteSearch( options );
                for ( var i in baseSearch ) {
                        if ( typeof this[i] == 'undefined' ) {
                                this[i] = baseSearch[i];
@@ -19,8 +26,10 @@ archiveOrgSearch.prototype = {
                                this['parent_' + i] =  baseSearch[i];
                        }
                }
-               // Inherit the cp settings for 
        },
+       /**
+       * Gets the search results from the api query
+       */
        getSearchResults:function() {
                // call parent: 
                this.parent_getSearchResults();
@@ -49,10 +58,13 @@ archiveOrgSearch.prototype = {
                        }
                );
        },
+       /**
+       * Adds the search results to the local resultsObj
+       */
        addResults:function( data ) {
                var _this = this;
                if ( data.response && data.response.docs ) {
-                       // set result info: 
+                       // Set result info: 
                        this.num_results = data.response.numFound;
                
                        for ( var resource_id in data.response.docs ) {
@@ -61,17 +73,17 @@ archiveOrgSearch.prototype = {
                                        // @@todo we should add .ogv or oga if video or audio:
                                        'titleKey'       :  resource.identifier + '.ogg',
                                        'resourceKey':  resource.identifier,
-                                       'link'           : _this.dtUrl + resource.identifier,
+                                       'link'           : _this.detailsUrl + resource.identifier,
                                        'title'          : resource.title,
-                                       'poster'         : _this.dnUrl + resource.identifier + '/format=thumbnail',
-                                       'poster_ani' : _this.dnUrl + resource.identifier + '/format=Animated+Gif',
+                                       'poster'         : _this.downloadUrl + resource.identifier + '/format=thumbnail',
+                                       'poster_ani' : _this.downloadUrl + resource.identifier + '/format=Animated+Gif',
                                        'thumbwidth' : 160,
                                        'thumbheight': 110,
                                        'desc'           : resource.description,
-                                       'src'             : _this.dnUrl + resource.identifier + '/format=Ogg+video',
-                                       'mime'            : 'application/ogg',
-                                       // set the license: (rsd is a pointer to the parent remoteSearchDriver )                 
-                                       'license'         : this.rsd.getLicenceFromUrl( resource.licenseurl ),
+                                       'src'            : _this.downloadUrl + resource.identifier + '/format=Ogg+video',
+                                       'mime'           : 'application/ogg',
+                                       // Set the license: (rsd is a pointer to the parent remoteSearchDriver )                 
+                                       'license'        : this.rsd.getLicenceFromUrl( resource.licenseurl ),
                                        'pSobj'          :_this
                                        
                                };
@@ -79,14 +91,14 @@ archiveOrgSearch.prototype = {
                        }
                }
        },
-       // getTitleKey:function(rObj){
-       //      return rObj['stream_name'] + '__' + rObj['start_time'].replace(/:/g,'.') + '_to_' + rObj['end_time'].replace(/:/g,'.') + '.ogg';;
-       // }
-       getEmbedTimeMeta:function( rObj, callback ) {
+       /**
+       * Gets some media metadata via a archive.org special entry point "avinfo"
+       */ 
+       addResourceInfoCallback:function( rObj, callback ) {
                var _this = this;
                do_api_req( {
-                       'data': { 'avinfo':1 },
-                       'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'
+                       'data': { 'avinfo' : 1 },
+                       'url':_this.downloadUrl + rObj.resourceKey + '/format=Ogg+video'
                }, function( data ) {
                        if ( data['length'] )
                                rObj.duration = data['length'];
@@ -98,6 +110,9 @@ archiveOrgSearch.prototype = {
                        callback();
                } );
        },
+       /*
+       * Returns html to embed a given result Object ( rObj ) 
+       */      
        getEmbedHTML: function( rObj , options ) {
                js_log( 'getEmbedHTML:: ' + rObj.poster );
                if ( !options )
index 969ab76..24398b5 100644 (file)
@@ -1,16 +1,26 @@
-// base remote search obj
-
+/*
+* Base remote search Object. 
+* provies the base class for the other search system to extend. 
+*/
 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
-//
-// *format:*
-// . indicates multiple tags @ separates the tag from attribute list
-// {.}tag_name@{attribute1|attribute12}
 
-// @@todo should probably switch this over to something like Xpath if we end up parsing a lot of rss formats
+/*
+* rsd_default_rss_item_mapping
+* 
+*  @key is name of rObj variable
+*  @value is where to find the value in the item xml
+* 
+*  *value format:*
+*  . indicates multiple tags 
+*  @ separates the tag from attribute list
+*  {.}tag_name@{attribute1|attribute2}
+*
+* Also see mapAttributeToResource function bellow 
+*
+* FIXME should switch this over to something like Xpath if we end up parsing a lot of rss formats
+*/
 var rsd_default_rss_item_mapping = {
        'poster'        : 'media:thumbnail@url',
        'roe_url'       : 'media:roe_embed@url',
@@ -31,36 +41,41 @@ baseRemoteSearch.prototype = {
 
        completed_req:0,
        num_req:0,
-
+       
+       // ResultsObj holds the array of results
        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 ) {
+       /**
+       * Initialise the baseRemoteSearch 
+       */
+       init: function( options ) {
                js_log( 'mvBaseRemoteSearch:init' );
-               for ( var i in iObj ) {
-                       this[i] = iObj[i];
+               for ( var i in options ) {
+                       this[i] = options[i];
                }
                return this;
        },
        getSearchResults:function() {
-               // empty out the current results before issuing a request
+               // Empty out the current results before issuing a request
                this.resultsObj = { };
-               // do global getSearchResults bindings
+               
+               // Do global getSearchResults bindings
                this.last_query = $j( '#rsd_q' ).val();
                this.last_offset = this.cp.offset;
-               // set the loading flag:                
+               
+               // 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)
+       * @param {XML Nodes} data the data to be parsed
+       * @param {String} provider_url the source url (used to generate absolute links)
        */
        addRSSData:function( data , provider_url ) {
                js_log( 'f:addRSSData' );
@@ -102,7 +117,15 @@ baseRemoteSearch.prototype = {
                        _this.num_results++;
                } );
        },
-       mapAttributeToResource: function(rObj, item, attr){             
+       /*
+       * Maps a given attribute to a resource object per mapping defined in 
+       * rsd_default_rss_item_mapping
+       *
+       * @param {Object} rObj the resource object
+       * @param {XML Node} the xml result node
+       * @param {attr} the name attribute we are maping to the resource object 
+       */
+       mapAttributeToResource: function( rObj, item, attr ){           
                var selector = rsd_default_rss_item_mapping[ attr ].split( '@' );
                var flag_multiple = (  selector[0].substr( 0, 1 ) == '.' ) ? true : false;
                if ( flag_multiple ) {
@@ -147,6 +170,10 @@ baseRemoteSearch.prototype = {
                } );
                // Nothing to return we update the "rObj" directly
        }, 
+       
+       /**
+       * Get the html representation of the resource Object paramater
+       */
        getEmbedHTML: function( rObj , options ) {
                if ( !options )
                        options = { };
@@ -185,6 +212,9 @@ baseRemoteSearch.prototype = {
                js_log( "ERROR:: no embed code for mime type: " + rObj.mime );  
                return 'Error missing embed code for: ' + escape( rObj.mime );
        },
+       /**
+       * Get the embed html specificaly for an image type resource Object. 
+       */
        getImageEmbedHTML:function( rObj, options ) {
                // if crop is null do base output: 
                var imgHtml = '<img ' + options.id_attr + ' src="' + rObj.edit_url  + '"' + options.style_attr + ' ></img>';
@@ -197,13 +227,22 @@ baseRemoteSearch.prototype = {
                                                '</div>' +
                                        '</div>';
        },
-       // by default just return the existing image with callback
+       /**
+       * Gets an image object from a requested transformation via callback
+       * ( letting api search implementations query the remote server for a 
+       *  given transformation )  
+       * 
+       * By default just return the existing image.
+       */
        getImageObj:function( rObj, size, callback ) {
                callback( { 
                        'url' : rObj.poster 
                } );
        },
-       // by default just return the rObj.desc
+       /*
+       * Gets the inline wikiText description of the resource Object
+       * By default just return the rObj description value 
+       */
        getInlineDescWiki:function( rObj ) {
                // return striped html  & trim white space
                if ( rObj.desc )
@@ -211,11 +250,21 @@ baseRemoteSearch.prototype = {
                // no desc avaliable:
                return '';
        },
-       // default license permission wiki text is cc based template mapping (does not confirm the templates actually exist)
+       /**
+       * Get the licence wikiText tag for a given resource Object.
+       *
+       * By 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:
+                       
+               // First check if we have a special license template tag already set: 
+               if( rObj.license_template_tag )
+                       return '{{' + rObj.license_template_tag + '}}';
+                       
+               // Check that its a defined creative commons license key:
                if (  this.rsd.licenses.cc.licenses[ rObj.license.key ] != 'undefined' ) {
                        return '{{Cc-' + rObj.license.key + '}}';
                } else if ( rObj.license.lurl ) {
@@ -223,23 +272,51 @@ baseRemoteSearch.prototype = {
                }
 
        },
+       /**
+       * Gets the resource import description text
+       */
        getImportResourceDescWiki:function( rObj ) {
                return gM( 'mwe-imported_from', [rObj.title,  this.cp.homepage, gM('rsd-' + this.cp.id + '-title'), rObj.link] );
        },
-       // for thigns like categories and the like
+       /**
+       * Get any extra wikitext description for the given resource object. 
+       * For content outside of the main template description, 
+       * like categories or additional wikitext notes. 
+       *
+       * By default its an empty string. 
+       */
        getExtraResourceDescWiki:function( rObj ) {
                return '';
        },
-       // by default just return the poster (clients can override)
+       
+       /** 
+       * Gets a image transformation 
+       * by default it just return the poster
+       */
        getImageTransform:function( rObj, opt ) {
                return rObj.poster;
        },
-       getEmbedObjParsedInfo:function( rObj, eb_id ) {
+       
+       /**
+       * Adds additional resource information post clip embedding. 
+       */
+       addResourceInfoFromEmbedInstance : function( rObj, eb_id ) {
                return rObj;
        },
-       getEmbedTimeMeta:function( rObj, callback ) {
+       
+       /**
+       * Adds resource info with a callback function
+       *
+       * Usefull for grabbing extra info that is not avaliable in the innitial
+       * search results api request.
+       */
+       addResourceInfoCallback:function( rObj, callback ) {
                callback();
        },
+       
+       /**
+       * Get the wiki embed code for a given resource object
+       */
        getEmbedWikiCode:function( rObj ) {
                var layout = ( rObj.layout ) ? rObj.layout:"right"
                var o = '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|' + layout;
@@ -257,11 +334,11 @@ baseRemoteSearch.prototype = {
                o += ']]';
                return o;
        },
+       /**
+       * Updates / normalizes the target_resource_title
+       */
        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 ) {
-               return rObj;
        }
 }
index 7de90cd..583fbc8 100644 (file)
@@ -110,15 +110,15 @@ mediaWikiSearch.prototype = {
                } );
        },
        getSearchResults:function() {
-               // call parent: 
+               // 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:
+               // Do two queries against the Image / File / MVD namespace:
 
-               // build the image request object: 
+               // Build the image request object: 
                var reqObj = {
                        'action':'query',
                        'generator':'search',
@@ -132,11 +132,11 @@ mediaWikiSearch.prototype = {
                        'iiurlwidth': parseInt( this.rsd.thumb_width ),
                        'rvprop':'content'
                };
-               // set up the number of request: 
+               // 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) 
+               // 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,
@@ -161,24 +161,24 @@ mediaWikiSearch.prototype = {
                        if ( typeof data['query-continue'].search != 'undefined' )
                                this.more_results = true;
                }
-               // make sure we have pages to idorate:  
+               // 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)
+                               // 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
+                               // 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: 
+                               // Skip if its an empty or missing imageinfo: 
                                if ( !page.imageinfo )
                                        continue;
                                var rObj =      {
@@ -204,10 +204,11 @@ mediaWikiSearch.prototype = {
                                 //to use once we get the wiki-text parser in shape
                                var pObj = mw.parser.pNew( rObj.desc );
                                //structured data on commons is based on the "information" template: 
-                               var tmplInfo = pObj.templates( 'information' );                         
+                               var tmplInfo = pObj.templates( 'information' );         
+                               rObj.desc = tmplInfo.description                
                                */
                                
-                               // attempt to parse out the description current user desc from the commons template: 
+                               // 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 );
@@ -231,15 +232,15 @@ mediaWikiSearch.prototype = {
                                        }
                                }
                                                                                
-                               // likely a audio clip if no poster and type 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 flag:
                                if ( returnFirst )
                                        return this.resultsObj[page_id];
                                
@@ -253,9 +254,9 @@ mediaWikiSearch.prototype = {
                        js_log( 'no results:' + data );
                }
        },
-       // check request done used for when we have multiple requests to check before formating results. 
+       // Check request done used for when we have multiple requests to check before formating results. 
        checkRequestDone:function() {
-               // display output if done: 
+               // Display output if done: 
                this.completed_req++;
                if ( this.completed_req == this.num_req ) {
                        this.loading = 0;
@@ -265,7 +266,7 @@ mediaWikiSearch.prototype = {
                if ( rObj.mime == 'application/ogg' )
                        return callback( { 'url':rObj.src, 'poster' : rObj.url } );
                
-               // his could be depreciated if thumb.php improves
+               // This could be depreciated if thumb.php support is standard
                var reqObj = {
                        'action':'query',
                        'format':'json',
@@ -273,7 +274,7 @@ mediaWikiSearch.prototype = {
                        'prop':'imageinfo',
                        'iiprop':'url|size|mime'
                }
-               // set the width: 
+               // Set the width: 
                if ( size.width )
                        reqObj['iiurlwidth'] = size.width;
                 js_log( 'going to do req: ' + this.cp.api_url + ' ' + reqObj );
@@ -310,10 +311,10 @@ mediaWikiSearch.prototype = {
        getInlineDescWiki:function( rObj ) {
                var desc = this.parent_getInlineDescWiki( rObj );
                
-               // strip categories for inline Desc: (should strip license tags too but not as easy)
+               // Strip categories for inline Desc: (should strip license tags too but not as easy)
                desc = desc.replace( /\[\[Category\:[^\]]*\]\]/gi, '' );
                
-               // just grab the description tag for inline desc:
+               // Just grab the description tag for inline desc:
                var descMatch = new RegExp( /Description=(\{\{en\|)?([^|]*|)/ );
                var dparts = desc.match( descMatch );
                                
@@ -333,14 +334,14 @@ mediaWikiSearch.prototype = {
                js_log( 'Error: No Description Tag, Using::' + desc );
                return desc;
        },
-       // returns the inline wikitext for insertion (template based crops for now) 
+       // Returns the inline wikitext for insertion (template based crops for now) 
        getEmbedWikiCode: function( rObj ) {
-                       // set default layout to right justified
+                       // 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
+                       // 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" +
index 2f141d8..135ca55 100644 (file)
@@ -73,6 +73,15 @@ metavidSearch.prototype = {
 
                                // Default width of metavid clips:
                                rObj['target_width'] = 400;
+                                                               
+                               rObj['author'] = 'US Government';
+                               
+                               // Add in the date as UTC "toDateString" : 
+                               var d = _this.getDateFromLink( rObj.link );
+                               rObj['date'] =   d.toDateString();
+                               
+                               // Set the license_template_tag ( all metavid content is PD-USGov )
+                               rObj['license_template_tag'] = 'PD-USGov';
                        }
                        // done loading:
                        _this.loading = 0;
@@ -89,10 +98,6 @@ metavidSearch.prototype = {
                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 ) {
-               return '{{PD-USGov}}';
-       },
        getExtraResourceDescWiki:function( rObj ) {
                var o = "\n";
                // check for person
@@ -180,8 +185,8 @@ metavidSearch.prototype = {
                        return getURLParamReplace( rObj.poster, { 'size' : 'full' } )
                }
        },
-       getEmbedObjParsedInfo:function( rObj, eb_id ) {
-               var sources = $j( '#' + eb_id ).get( 0 ).media_element.getSources();
+       addResourceInfoFromEmbedInstance : function( rObj, embed_id ) {
+               var sources = $j( '#' + embed_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];
@@ -192,18 +197,6 @@ metavidSearch.prototype = {
                // 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:
-               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 );
-
-               return rObj;
-       },
        getDateFromLink:function( link ) {
                var dateExp = new RegExp( /_([0-9]+)\-([0-9]+)\-([0-9]+)/ );
                var dParts = link.match ( dateExp );
index 12b88f9..a4df8a7 100644 (file)
@@ -909,8 +909,11 @@ embedVideo.prototype = {
                var dcss = parseInt( $j(element).css( dim ).replace( 'px' , '' ) );
                var dattr = parseInt( $j(element).attr( dim ) );
                this[ dim ] = ( dcss )? dcss : dattr;           
-               if(!this[ dim ]){
-                       // Grab width/height from default value
+               if( !this[ dim ] ){
+                       //special height default for audio tag:  
+                       if( element.tagName.toLowerCase() == 'audio' &&  dim == 'height' )
+                               return this[ dim ] = 0;
+                       // Grab width/height from default value (for video) 
                        var dwh = mw.conf['video_size'].split( 'x' );
                        this[ dim ] = ( dim == 'width' )? dwh[0] : dwh[1];
                 }
@@ -1868,7 +1871,7 @@ embedVideo.prototype = {
                 } );
                 return false; // onclick action return false
        },
-       showPlayerselect:function( $target ) {
+       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;
@@ -1949,9 +1952,9 @@ embedVideo.prototype = {
                        } );
                        
                        if ( dl_list != '' )
-                               out += gM( 'mwe-download_full' ) + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
+                               out += '<h2>' + gM( 'mwe-download_full' ) + '</h2><ul>' + dl_list + '</ul>';
                        if ( dl_txt_list != '' )
-                               out += gM( 'mwe-download_text' ) + '<blockquote style="background:#000">' + dl_txt_list + '</blockquote>';
+                               out += '<h2>' +gM( 'mwe-download_text' ) + '</h2><ul>' + dl_txt_list + '</ul>';
                        out += '</div>';
                        return out;
                }
@@ -1967,9 +1970,6 @@ embedVideo.prototype = {
                        $target.html( getShowVideoDownload() );
                }
        },
-       showCredits:function( $target ) {
-               $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' );
-       },
        /*
        *  Base embed controls
        *  The Play Action:
@@ -2332,10 +2332,11 @@ mediaPlayer.prototype =
        {
                return gM( 'mwe-ogg-player-' + this.id );
        },
-       load : function( callback ) {
+       load : function( callback ) {   
                mvJsLoader.doLoad( [
                        this.library + 'Embed'
-               ], function() {
+               ], function() {                 
+                       js_log("wtf: " + typeof( vlcEmbed ) );
                        callback();
                } );
        }
index af20394..6c1fd24 100644 (file)
@@ -4,8 +4,9 @@
 *  assume version > 0.8.5.1
 */
 var vlcEmbed = {
-       instanceOf:'vlcEmbed',
-       supports: { 'play_head':true,
+       instanceOf : 'vlcEmbed',
+       supports : { 
+               'play_head':true,
                'pause':true,
                'stop':true,
                'fullscreen':true,
@@ -260,7 +261,7 @@ var vlcEmbed = {
                this.parent_stop();
        },
        pause : function() {
-               this.parent_pause(); // update the inteface if paused via native control
+               this.parent_pause(); // update the interface if paused via native control
                if ( this.vlc ) {
                        this.vlc.playlist.togglePause();
                }
@@ -271,13 +272,13 @@ var vlcEmbed = {
                if ( this.vlc )
                        this.vlc.audio.toggleMute();
        },
-       // @@ Suport UpDateVolumen 
+       // @@ Support UpDateVolumen 
        updateVolumen:function( perc ) {
                this.getVLC();
                if ( this.vlc )
                        this.vlc.audio.volume = perc * 100;
        },
-       // @@ Get Volumen
+       // @@ Get Volumen 
        getVolumen:function() {
                this.getVLC();
                if ( this.vlc )
@@ -288,19 +289,7 @@ var vlcEmbed = {
                        if ( this.vlc.video )
                                this.vlc.video.toggleFullscreen();
                }
-       },
-       /* returns current time in float seconds 
-        * as per html5 we should just have an attribute by name of CurrentTime
-        * http://www.whatwg.org/specs/web-apps/current-work/#currenttime
-       currentTime : function(){
-               if(typeof this.vlc != 'undefined' ){
-                       if(typeof this.vlc.input != 'undefined' ){
-                               return this.vlc.input.time/1000;        
-                       }
-               }
-               return '0';
-       },
-       */
+       },      
        // get the embed vlc object 
        getVLC : function() {
                this.vlc = this.getPluginEmbed();
index e513b5b..c3cd6da 100644 (file)
@@ -2,11 +2,10 @@
 * 
 * Api proxy system
 *
-* Built to support cross domain uploading, and api actions for a approved set of domains.
-* mwProxy enables a system for fluid contributions across wikis domains for which your logged in.
+* Supports cross domain uploading, and api actions for a approved set of domains.
 *
-* The framework support a request approval system for per-user domain approval
-* and a central blacklisting of domains controlled by site or system administrators. 
+* The framework /will/ support a request approval system for per-user domain approval
+* and a central blacklisting of domains controlled by the site 
 *
 *  Flow outline below:  
 * 
@@ -56,34 +55,38 @@ loadGM( {
         */
        $.proxy.client = function( pConf, conf ) {
                var _this = this;
-               // do setup: 
+               // Do client setup: 
                if ( pConf.server_frame )
                        $.proxy.server_frame = pConf.server_frame;
                
                if ( pConf.client_frame_path ) {
                        $.proxy.client_frame_path = pConf.client_frame_path;
                } else {
-                       // guess the client frame path:
+                       // Set to default mwEmbed iframe path:
                        $.proxy.client_frame_path =  wgScriptPath + '/js2/mwEmbed/libMwApi/NestedCallbackIframe.html';
                }
                                
                if ( mw.parseUri( $.proxy.server_frame ).host ==  mw.parseUri( document.URL ).host ) {
-                       js_log( "Error: why are you trying to proxy yourself? " );
+                       js_log( "Error: trying to proxy local domain? " );
                        return false;
                }
                return true;
        }
-       // set the frameProxy Flag: 
+       // Set the frameProxy Flag: 
        var frameProxyOk = false;
-       /* setup a iframe request hash */
-       $.proxy.doFrameProxy = function( reqObj ) {
+       
+       /** 
+       * doFrameProxy
+       *       Writes an iframe with a hashed value of the requestQuery
+       */
+       $.proxy.doFrameProxy = function( requestQuery ) {
                var hashPack = {
                        'cd': mw.parseUri( document.URL ).host,
                        'cfp': $.proxy.client_frame_path,
-                       'req': reqObj
+                       'req': requestQuery
                }
                js_log( "Do frame proxy request on src: \n" + $.proxy.server_frame + "\n" +
-                                       JSON.stringify(  reqObj ) );
+                                       JSON.stringify(  requestQuery ) );
                // 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();
@@ -106,57 +109,70 @@ loadGM( {
        }
        var lastApiReq = { };
        $.proxy.proxyNotReadyDialog = function() {
-               var btn = { };
-               btn[ gM( 'mwe-re-try' ) ] = function() {
+               var buttons = { };
+               buttons[ gM( 'mwe-re-try' ) ] = function() {
                        $j.addLoaderDialog( gM( 'mwe-re-trying' ) );
                        $.proxy.doFrameProxy( lastApiReq );
                }
-               btn[ gM( 'mwe-cancel' ) ] = function() {
+               buttons[ gM( 'mwe-cancel' ) ] = function() {
                        $j.closeLoaderDialog();
                }
                var pUri =  mw.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
+               
+               // FIXME we should have a Hosted iframe once we deploy mwEmbed on the servers.
+               // A hosted iframe would be much faster since than a normal page view 
+               
+               var login_url = pUri.protocol + '://' + pUri.host;
+               login_url += 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>',
+                       buttons
                )
        }
-       /* the do_api_request with callback: */
-       $.proxy.doRequest = function( reqObj, callback ) {
+       /* 
+       * doRequest 
+       * Takes a requestQuery, executes the query and then calls the callback
+       */
+       $.proxy.doRequest = function( requestQuery, callback ) {
                js_log( "doRequest:: " + JSON.stringify( reqObj ) );
                lastApiReq = reqObj;
                // setup the callback:
                $.proxy.callback = callback;
                // do the proxy req:
-               $.proxy.doFrameProxy( reqObj );
+               $.proxy.doFrameProxy( requestQuery );
        }
        /**
-        * The nested iframe action that passes its msg back up to the top instance      
+        * The nested iframe action that passes its result back up to the top frame instance     
         */
        $.proxy.nested = function( hashResult ) {
-               // close the loader if present: 
+               // Close the loader if present: 
                $j.closeLoaderDialog();
                js_log( '$.proxy.nested callback :: ' + unescape( hashResult ) );
                frameProxyOk = true;
-               // try to parse the hash result: 
+               
+               // 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)   
+               
+               // Special callback to frameProxyOk flag 
+               // (only used to test the proxy connection)   
                if ( rObj.state == 'ok' )
                        return ;
                
-               // if all good pass it to the callback:
+               // Pass the callback:
                $.proxy.callback( rObj );
        }
        /**
-        * The serverApiProxy handles the actual proxy 
-        * and child frames pointing to the parent "blank" frames
+        * The server handles the actual proxy 
+        * it adds child frames pointing to the parent "blank" frames
         * 
         * This is (Domain B) in the above described setup
         */
@@ -180,30 +196,30 @@ loadGM( {
                        ' client from: ' + aObj.cd +
                        ' to nested target: ' + aObj.cfp );
                
-               // make sure we are logged in 
+               // 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' );
+                       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
+               // Check the master whitelist
                for ( var i in pConf.master_whitelist ) {
                        if ( domain ==  pConf.master_whitelist[ i ] ) {
-                               // do the request:                      
+                               // Do the request:                      
                                return doNestedProxy( aObj.req );
                        }
                }
-               // check master blacklist
+               // 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                               
+               // FIXME 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';
@@ -214,31 +230,34 @@ loadGM( {
                // if still not found: 
                js_log( "domain " + domain + " not approved" );
                
-               // offer the user the ability to "approve" requested domain save to their user page             
+               // FIXME :: offer the user the ability to "approve" requested domain save to
+               // their user/ apiProxyDomainList.js 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) 
+
+                       // Do a quick response to establish the proxy is working
+                       // ( before we actually run the api-request )  
                        doNestedFrame ( 'nested_ok' , { 'state':'ok' } );
                        
                        var outputhash = escape( JSON.stringify( reqObj ) );
-                       // add some api stuff: 
-                       reqObj['format'] = 'json';
-                       // process the api request
+
+                       // 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 ) {                                      
+                                       // Put it into the nested frame hash string: 
                                        doNestedFrame( 'nested_push', JSON.parse( data ) );
                                }
                        );
                }
-               // add the doNestedFrame iframe: 
+               // Add the doNestedFrame iframe: 
                function doNestedFrame( nestname, resultObj ) {
                        $j( '#nested_push' ).remove();
-                       // setup the nested proxy that points back to top domain:                       
+                       // 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 ) ) +
index b752407..0725c33 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Handles driving the firefogg render system 
 */
-var mvFirefoggRender = function( iObj ) {
-       return this.init( iObj );
+var mvFirefoggRender = function( options ) {
+       return this.init( options );
 };
 var default_render_options = {
        "videoQuality" : 10,
@@ -18,7 +18,7 @@ mvFirefoggRender.prototype = {
        // default empty render options: 
        renderOptions: { },
        continue_rendering:false,
-       init:function( iObj ) {
+       init:function( options ) {
                var _this = this;
                
                // grab the mvFirefogg object to do basic tests
@@ -38,12 +38,12 @@ mvFirefoggRender.prototype = {
                this.fogg = this.myFogg.fogg;
                
                // setup player instance
-               this.player = $j( iObj.player_target ).get( 0 );
-               this.player_target = iObj.player_target;
+               this.player = $j( options.player_target ).get( 0 );
+               this.player_target = options.player_target;
                
                // Extend the render options with any provided details
-               if( iObj['render_options'] )
-                       $j.extend(this.renderOptions, iObj['render_options']);
+               if( options['render_options'] )
+                       $j.extend(this.renderOptions, options['render_options']);
                
                // If no height width provided use target DOM width/height
                if( !this.renderOptions.width && !this.renderOptions.height ){
@@ -54,28 +54,28 @@ mvFirefoggRender.prototype = {
                
                // Setup the application options (with defaults) 
                for ( var i in default_FirefoggRender_options ) {
-                       if ( iObj[ i ] ) {
-                               this[ i ] = iObj[ i ];
+                       if ( options[ i ] ) {
+                               this[ i ] = options[ i ];
                        } else {
                                this[ i ] = default_FirefoggRender_options[i];
                        }
                }
-               // Should be exteranlly controlled              
-               if ( iObj.target_startRender ) {
-                       $j( iObj.target_startRender ).click( function() {
+               // Should be externally controlled              
+               if ( options.target_startRender ) {
+                       $j( options.target_startRender ).click( function() {
                                js_log( "Start render" );
                                _this.startRender();
                        } )
-                       this.target_startRender = iObj.target_startRender;
+                       this.target_startRender = options.target_startRender;
                }
-               if ( iObj.target_stopRender ) {
-                       $j( iObj.target_stopRender ).click( function() {
+               if ( options.target_stopRender ) {
+                       $j( options.target_stopRender ).click( function() {
                                _this.stopRender();
                        } )
-                       this.target_stopRender = iObj.target_stopRender;
+                       this.target_stopRender = options.target_stopRender;
                }
-               if ( iObj.target_timeStatus ) {
-                       this.target_timeStatus = iObj.target_timeStatus;
+               if ( options.target_timeStatus ) {
+                       this.target_timeStatus = options.target_timeStatus;
                }
        },
        startRender:function() {
index c50e17a..204d9e8 100644 (file)
@@ -259,11 +259,11 @@ mvPlayList.prototype = {
                        this.doWhenClipLoadDone();
                } 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 );
+                               setTimeout( function(){
+                                       _this.doWhenParseDone();
+                                       //debugger;
+                               }, 100 );
                }
        },
        doWhenClipLoadDone:function() {
index 57d2243..7bc4314 100644 (file)
@@ -76,53 +76,61 @@ 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
+       // In pixel to second ratio ie 100pixles for every ~30seconds
+       timeline_scale:.06, 
+       
+       // Default timeline duration in seconds
+       timeline_duration:500, 
+       
        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
+       // How large are the i-movie type clips
+       track_clipThumb_height:80, 
 
-       base_adj_duration:.5, // default time to subtract or add when adjusting clips.
+       // Default time to subtract or add when adjusting clips.
+       base_adj_duration:.5, 
 
-       // 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: { },
 
-
-       // 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
+       
+       inline_playlist:'null',
        inline_playlist_id:'null',
        mv_pl_src:'null',
-       // the edit stack:
+       
+       // The edit stack (so that you can "undo" edits)
        edit_stack:new Array(),
        disp_menu_item:null,
-       // trackObj used to payload playlist Track Object (when inline not present)
+       
+       // Track Object 
        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': {
-                       'd':0,
+                       'default':0,
                        'html':'',
                        'js': function( this_seq ) {
                                this_seq.doEditSelectedClip();
@@ -132,21 +140,21 @@ mvSequencer.prototype = {
                        }
                },
                'transition': {
-                       'd':0,
+                       'default':0,
                        '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:
+                               // Highlight the transition of the selected clip:
                                this_seq.doEditTransitionSelectedClip();
                        }
                },
                'cliplib': {
-                       'd':0,
+                       'default':0,
                        'html': gM( 'mwe-loading_txt' ),
                        'js':function( this_seq ) {
-                               // load the search interface with sequence tool targets
+                               // Load the search interface with sequence tool targets
                                mvJsLoader.doLoad( [
                                        'remoteSearchDriver',
                                        'seqRemoteSearchDriver'
@@ -157,7 +165,7 @@ mvSequencer.prototype = {
                        }
                },
                'options': {
-                       'd':0,
+                       'default':0,
                        'html' : '<h3>' + gM( 'mwe-menu_options' ) + '</h3>' +
                                gM( 'mwe-editor_mode' ) + '<br> ' +
                                '<blockquote><input type="radio" value="simple_editor" name="opt_editor">' +
@@ -351,7 +359,7 @@ mvSequencer.prototype = {
                        if ( !dispCall )
                                $j( "#seq_menu" ).tabs( 'select', this.menu_items[item].inx );
 
-                       this.menu_items[item].d = 1;
+                       this.menu_items[item].default = 1;
                        // do any click_js actions:getInsertControl
                        if ( this.menu_items[item].click_js )
                                this.menu_items[item].click_js( this );
@@ -541,7 +549,7 @@ mvSequencer.prototype = {
                }
 
 
-               // render the menu tabs::
+               // Render the menu tabs::
                var item_containers = '';
                var inx = 0;
                var selected_tab = 0;
@@ -551,14 +559,14 @@ mvSequencer.prototype = {
                for ( var tab_id in this.menu_items ) {
                        menu_item = this.menu_items[tab_id];
                        menu_item.inx = inx;
-                       if ( menu_item.d ) {
+                       if ( menu_item.default ) {
                                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>' +
-                       '</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>';
@@ -575,20 +583,20 @@ mvSequencer.prototype = {
                        select: function( event, ui ) {
                                _this.disp( $j( ui.tab ).attr( 'id' ).replace( 'mv_menu_item_', '' ), true );
                        }
-               // add sorting
+               // 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 initial content into containers
                this.setupMenuItems();
 
                this.doFocusBindings();
 
-               // set up key bidnings
+               // Set up key bidnings
                $j( window ).keydown( function( e ) {
                        js_log( 'pushed down on:' + e.which );
                        if ( e.which == 16 )
@@ -603,32 +611,33 @@ mvSequencer.prototype = {
                        if ( ( e.which == 88 && _this.key_ctrl_down ) && !_this.inputFocus )
                                _this.cutSelectedClips();
 
-                       // paste cips on v + ctrl while not focused on a text area:
+                       // 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
+                       // User let go of "shift" turn off multi-select
                        if ( e.which == 16 )
                                _this.key_shift_down = false;
 
                        if ( e.which == 17 )
                                _this.key_ctrl_down = false;
 
-                       // escape key (for now deselect)
+                       // Escape key ( deselect )
                        if ( e.which == 27 )
                                _this.deselectClip();
 
 
-                       // backspace or delete key while not focused on a text area:
+                       // 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
+       /**
+       * Check all text nodes for focus
+       */
        doFocusBindings:function() {
                var _this = this;
                // if an input or text area has focus disable delete key binding
@@ -641,22 +650,34 @@ mvSequencer.prototype = {
                        _this.inputFocus = false;
                } )
        },
+       /*
+       * Update the timeline hook
+       */
        update_tl_hook:function( jh_time_ms ) {
-               // put into seconds scale:
+               // 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' );
+               // Render playline at given time
+               $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 */
+       /*
+       * Returns a xml or json representation of the current sequence 
+       */
        getSeqOutputJSON:function() {
                js_log( 'json output:' );
        },
+       /*
+       * Gets the Sequence as a formated high level resource description xml string
+       * @returns {xml} 
+       */
        getSeqOutputHLRDXML:function() {
                var o = '<sequence_hlrd>' + "\n";
                o += "\t<head>\n";
-               // get transitions
+               // Get transitions
                for ( var i in this.plObj.transitions ) {
                        if ( this.plObj.transitions[i] ) {
                                var tObj = this.plObj.transitions[i].getAttributeObj();
@@ -669,9 +690,9 @@ mvSequencer.prototype = {
                }
                o += "\t</head>\n";
 
-               // get clips
+               // Get clips
                o += "\t<body>\n";
-               // output each track:
+               // Output each track:
                for ( var i in this.plObj.tracks ) {
                        var curTrack = this.plObj.tracks[i];
                        o += "\t<seq";
@@ -700,15 +721,39 @@ mvSequencer.prototype = {
                        o += "\n</seq>\n";
                }
                o += "\t</body>\n";
-               // close the tag
+               // Close the tag
                o += '</sequence_hlrd>';
 
                return o;
        },
+       /**
+       * Takes a track index and a clip index, to get a clip Object.
+       * It then calls doEditClip with that clip Object. 
+       */
        editClip:function( track_inx, clip_inx ) {
                var cObj = this.plObj.tracks[ track_inx ].clips[ clip_inx ];
                this.doEditClip( cObj );
        },
+       /**
+       * Calls the doEditClip interface on the selected clip
+       * Handles cases where no clips are selected or multiple clips are selected.  
+       */
+       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' ) );
+               }
+       },
+       /**
+       * Pulls up the edit transition interface for the selected clip
+       */
        doEditTransitionSelectedClip:function() {
                var _this = this;
                js_log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length );
@@ -722,28 +767,21 @@ mvSequencer.prototype = {
                        $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' ) );
-               }
-       },
+       /**
+       * Loads the transition edit javascript libs and 
+       * displays the transition edit interface. 
+       */
        doEditTransition:function( cObj ) {
                js_log( "sequence:doEditTransition" );
                var _this = this;
+               // Add a loading image
                mv_get_loading_img( '#transitions_ic' );
                mvJsLoader.doLoad( [
                        '$j.fn.ColorPicker',
                        'mvTimedEffectsEdit'
                ], function() {
-                       // no idea why this works / is needed.
+                       // For some reason we lose scope in the options passed to mvTimedEffectsEdit
+                       // so we re refrence the sequence here: 
                        var localSeqRef = _this;
                        _this.myEffectEdit = new mvTimedEffectsEdit( {
                                'rObj'           : cObj,
@@ -752,22 +790,25 @@ mvSequencer.prototype = {
                        } );
                } )
        },
-       // updates the clip details div if edit resource is set
+       /*
+       * 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
                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: 
+                       // Zero out the current editor:                         
                        _this.myClipEditor = { };
-                       // setup the cliploader
+                       // Setup the cliploader options
                        _this.myClipEditor = new mvClipEdit( {
                                'rObj'                  : cObj,
                                'control_ct'    : 'clipedit_ic',
@@ -778,46 +819,58 @@ mvSequencer.prototype = {
                        } );
                } );
        },
-       // save new clip segment
+       
+       /*
+       * Save new clip segment
+       * FIXME this is just a stub
+       */
        saveClipEdit:function() {
                // saves the clip updates
        },
+       
+       /**
+       * Closes the sequence and dereferences the global instance. 
+       */ 
        closeModEditor:function() {
                // unset the sequencer
                _global['mvSeq'] = null;
                $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"
-               this.addClips( this.clipboard, this.plObj.cur_clip.order );
-       },
+       
+       /**
+       * Copies the selected clips to the server hosted "clipboard"
+       * 
+       * FIXME need to support local clipboard for stand alone editing.  
+       * FIXME this does not really work at all right now
+       */
        copySelectedClips:function() {
                var this_seq = this;
                // set all the selected clips
                this.clipboard = new Array();
                $j( '.mv_selected_clip' ).each( function() {
-                       // add each clip to the clip board:
+
+                       // 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)
+               
+               // Upload clipboard to the server (if possible)
                if ( mw.parseUri(  document.URL ).host != mw.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"
+                       // FIXME we need to add an api entry point to store a "clipboard"
+                       // right now this is dependent on a custom hook:                        
                        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,
+                                       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 ) );
                                        }
                                } );
@@ -826,13 +879,30 @@ mvSequencer.prototype = {
                        }
                }
        },
+       /*
+       * Paste the clipboard clips into the sequence
+       */
+       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 );
+       },
+       
+       /** 
+       * Cut selected clips from the timeline
+       */
        cutSelectedClips:function() {
                this.copySelectedClips();
                this.removeSelectedClips();
        },
+       
+       /**
+       * Remove selected clips from the timeline
+       */ 
        removeSelectedClips:function() {
                var remove_clip_ary = new Array();
-               // remove selected clips from display
+               // 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( '_' ) );
@@ -844,11 +914,16 @@ mvSequencer.prototype = {
                // @@todo refresh menu of current
                this.doEditSelectedClip();
        },
+       /*
+       * Add a clip to the timeline
+       */      
        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
+       /** 
+       * 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;
 
@@ -874,6 +949,10 @@ mvSequencer.prototype = {
                // debugger;
                this.do_refresh_timeline();
        },
+       
+       /**
+       * Removes Clips listed in the remove_clip_ary paramater
+       */
        removeClips:function( remove_clip_ary ) {
                var this_seq = this;
                var jselect = coma = '';
index 2a2aaf2..9c29c4c 100644 (file)
@@ -172,6 +172,23 @@ if ( !window['mw'] ) {
        window['mw'] = { }
 }
 
+
+// Inherit the default global config
+var mwDefaultConf = {
+       'skin_name' : 'mvpcf',
+       'jui_skin' : 'redmond',
+       'video_size' : '400x300',
+       'k_attribution' : true          
+}
+if( !mw.conf )
+       mw.conf = { }
+       
+for(var i in mwDefaultConf){
+       if( typeof mw.conf[ i ] == 'undefined' )
+               mw.conf[ i ] = mwDefaultConf[ i ];
+}
+
+
 // @@todo move these into mw
 var global_req_cb = new Array(); // The global request callback array
 
@@ -181,15 +198,7 @@ var global_req_cb = new Array(); // The global request callback array
 * Any global functions/classes that are not jQuery plugins should make
 * there way into the mw namespace
 */
-( function( $ ) {
-       /*
-        * global config
-        */
-       $.conf = {
-               'skin_name' : 'mvpcf',
-               'jui_skin' : 'redmond',
-               'video_size' : '400x300'
-       }
+( function( $ ) {      
        // list valid skins here:
        $.valid_skins = ['mvpcf', 'kskin'];
        // the version of mwEmbed
@@ -343,8 +352,7 @@ var global_req_cb = new Array(); // The global request callback array
                 * Plural matchRuleTest
                 */
                function matchRuleTest( cRule, val ) {
-                       // js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
-
+                       js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
                        function checkValue( compare, val ) {
                                if ( typeof compare == 'string' ) {
                                        range = compare.split( '-' );
@@ -412,12 +420,13 @@ var global_req_cb = new Array(); // The global request callback array
                for ( var ruleInx in rs ) {
                        cRule = rs[ruleInx];
                        if ( matchRuleTest( cRule, tObj.arg ) ) {
-                               // js_log("matched rule: " + ruleInx );
+                               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 ] );
+               js_log('no match found for: ' + tObj.arg + ' using last/other : ' +  tObj.param [ tObj.param.length -1 ] );
+               //debugger;
                // return the last /"other" template param
                return tObj.param [ tObj.param.length - 1 ];
        }
@@ -691,34 +700,7 @@ var global_req_cb = new Array(); // The global request callback array
                                // do the recursive magic swap text:
                                this.pOut = recurse_magic_swap( this.pNode );
 
-                       },
-                       /**
-                       * getTemplateVars special function to grab template paramaters 
-                       * from template text
-                       * 
-                       * @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:
-                               var tVars = new Array();
-                               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( '|' ) );
-                                       }
-                                       // Add if not already there
-                                       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
@@ -953,6 +935,7 @@ var mvJsLoader = {
                                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' ) {
@@ -961,6 +944,7 @@ var mvJsLoader = {
                        }
 
                        // Check if we should use the script loader to combine all the requests into one
+                       // ( the scriptloader defines the mwSlScript global )
                        if ( typeof mwSlScript != 'undefined' ) {
                                var class_set = '';
                                var last_class = '';
@@ -1100,13 +1084,8 @@ var mvJsLoader = {
        jQueryCheck: function( callback ) {
                // 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;
-                       // This is tricky because js2stopgap registers $j without doing the "setup" 
-                       if ( _this.jQuerySetupFlag )
-                               return ;
+               if ( _global['$j'] && _this.jQuerySetupFlag ) {                 
+                       callback(); // call the callback now                    
                }
                // Load jQuery
                _this.doLoad( [
index 9da5236..7dbee97 100644 (file)
@@ -388,6 +388,11 @@ $messages['en'] = array(
        'mwe-related_videos' => 'Related videos',
        'mwe-seeking' => 'seeking',
        'mwe-copy-code' => 'Copy code',
+
+       /*
+        * File: /skins/kskin/kskin.js
+        */
+       'mwe-credit-title' => 'Title: $1',
 );
 
 /** Message documentation (Message documentation)
index 9f85bea..85c2891 100644 (file)
@@ -39,12 +39,6 @@ ctrlBuilder.prototype = {
                  'options':true,
                  'borders':true
        },
-       menu_items:[
-               'playerselect',
-               'download',
-               'share',
-               'credits',
-       ],
        getControls:function() {
                // set up local pointer to the embedObj
                var embedObj = this.embedObj;
@@ -432,7 +426,7 @@ ctrlBuilder.prototype = {
                '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>';
+                               return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 34 ) + 'px;"></div>';
                        }
                }
        }
index 808d483..ab5f7b9 100644 (file)
@@ -2,12 +2,22 @@
 * skin js allows you to override contrlBuilder html/class output
 */
 
+loadGM( {
+       "mwe-credit-title" : "Title: $1"
+} );
+
 var kskinConfig = {
        pClass: 'k-player',
        // display time progress
        long_time_disp: false,
        body_options: false,
        volume_layout: 'horizontal',
+       menu_items:[
+               'playerselect',
+               'download',
+               'share',
+               'credits',
+       ],
        components: {
                'play-btn-large' : {
                        'h' : 55
@@ -76,10 +86,8 @@ var kskinConfig = {
                                $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 )
-                                               );
+                                               // call the function show{Menuitem} with target:
+                                               _this.showMenuItem(     mk );                                                                   
                                }
                                // Slide out the others 
                                 $j( '#' + embedObj.id  + ' .menu-screen' ).hide();
@@ -93,10 +101,10 @@ var kskinConfig = {
                // 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'] )
+                               // Stop the player if it does not support overlays:
+                               if ( !embedObj.supports['overlay'] )
                                        $tp.get( 0 ).stop();
-                       // Add the options                                      
+                               // Add the options                                      
                                addMvOptions();
                        }
                        // Set up the text and menu:                                                                    
@@ -115,5 +123,104 @@ var kskinConfig = {
                        }
                } );
        
+       }, 
+       showMenuItem:function( menu_item ) {
+               //handle special k-skin specific display; 
+               if( menu_item == 'credits'){
+                       this.showCredits(); 
+               }else{
+                       //call the base embedObj "show{Item}"
+                       this.embedObj['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )](
+                               $j( '#' + this.embedObj.id + ' .menu-' + menu_item )
+                       );
+               }
+       },      
+       // Do the credit screen (presently specific to kaltura skin:)  
+       showCredits:function() {
+               //set up the shortcuts: 
+               embedObj = this.embedObj;
+               var _this = this;       
+               $target = $j( '#' + embedObj.id + ' .menu-credits' );
+               $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>'  +
+                       '<div class="credits_box ui-corner-all">' +
+                               mv_get_loading_img() + 
+                       '</div>'                                                                
+               );
+               
+               if( mw.conf.k_attribution == true ){
+                       $target.append( 
+                               $j('<div/>').addClass( 'k-attribution')
+                       );
+               }
+               
+               if( !embedObj.wikiTitleKey ){
+                       $target.find('.credits_box').text(
+                               'Error: no title key to grab credits with' 
+                       );
+                       return ;
+               }               
+               // Do the api request to populate the credits via the wikiTitleKey ( tied to "commons" )
+               var reqObj = {
+                       'action' : 'query',
+                       // Normalize the File NS (ie sometimes its present in wikiTitleKey other times not
+                       'titles' : 'File:' + embedObj.wikiTitleKey.replace(/File:|Image:/, '' ),
+                   'prop' : 'revisions',
+                   'rvprop' : 'content'
+               };
+               var req_categories = new Array();
+           do_api_req( {
+               'url'   : mw.commons_api_url,
+                       'data'  : reqObj                        
+           }, function( data ) {
+                       if( !data || !data.query || !data.query.pages ){
+                               $target.find('.credits_box').text(
+                                       'Error: title key: ' + embedObj.wikiTitleKey + ' not found' 
+                               );
+                               return false;
+                       }
+                       var pages = data.query.pages;                   
+                       for(var i in pages){
+                               page = pages[ i ];
+                               if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ){
+                                       $target.find('.credits_box').html(
+                                               _this.doCreditLineFromWikiText( page[ 'revisions' ][0]['*'] )
+                                       );
+                               }
+                       }
+           } );
+       },
+       doCreditLineFromWikiText:function ( wikiText ){
+               var embedObj = this.embedObj;
+               
+               // Get the title str 
+               var titleStr = embedObj.wikiTitleKey.replace(/_/g, ' ');
+               var titleLink = 'http://commons.wikimedia.org/wiki/File:' + embedObj.wikiTitleKey;
+               
+               // @@FIXME Do a quick check for source line:
+               return $j( '<div/>' ).addClass( 'creditline' )
+                       .append(
+                               $j('<a/>').attr({
+                                       'href' : titleLink,
+                                       'title' :  titleStr
+                               }).html( 
+                                       $j('<img/>').attr( {
+                                               'border': 0, 
+                                               'src' : embedObj.thumbnail, 
+                                       } )
+                               )
+                       )
+                       .append(                        
+                               $j('<span>').html( 
+                                       gM( 'mwe-credit-title' ,  
+                                               // We use a div container to easialy get at the built out link
+                                               $j('<div>').html( 
+                                                       $j('<a/>').attr({
+                                                               'href' : titleLink,
+                                                               'title' :  titleStr
+                                                       }).text( titleStr )
+                                               ).html()
+                                       )
+                               )
+                       );
        }
 }
\ No newline at end of file
index 970d868..30b9eab 100644 (file)
        background-position: -16px -48px;
 }
 
+/* cc icon */
+.k-player .ui-state-default .ui-icon-comment {
+       background-position: 0px -65px;
+}
+.k-player .ui-state-hover .ui-icon-comment {
+       background-position: -17px -65px;
+}
+
 .k-player .ui-state-default .ui-icon-play {
        background: url(images/ksprite.png) no-repeat 0 0;
 }
        border: 1px solid #000000;
        color: #000000;
        float: right;
-       height: 24px;
+       height: 34px;
        padding: 0 5px 3px;
        width: 84px;
        font-size: 1em;
        margin: -3px 5px 0 -1px;
        position: absolute;
        width: 8px;
+}
+
+.k-player .credits_box { 
+       background-attachment:scroll;
+       background-color:white;
+       background-image:none;
+       background-position:0 0;
+       bottom:30px;
+       left:15px;
+       position:absolute;
+       right:61px;
+       top:48px;               
+}
+.k-player .credits_box a{
+       color:#666;
+}
+.k-player .creditline img {
+       float: left;
+       width: 90px;
+       margin: 4px;
 }
\ No newline at end of file
index afbb91e..95d8edd 100644 (file)
@@ -8,7 +8,7 @@ td{
 }
 </style>
 <script type="text/javascript" >
-var scriptLoaderURID = 't14';
+var scriptLoaderURID = 't15';
 //for just setting one or two to test at a time for debug
 //var langKeyDebug = ['sl']; //pl
 var langKeyDebug = [ 'az', 'da', 'pt', 'fr', 'lv', 'en'];
@@ -195,7 +195,7 @@ js2AddOnloadHook( function(){
                                        
                //do a manual call to the script-lodaer:
                function doProcLangKey(langKey){                        
-                       $j.getScript('../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){                 
+                       $j.getScript('../../../mwScriptLoader.php?class=mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){                  
                                var o='';
                                o+='<tr><td colspan="6" height="20" style="font-size:large"><b>Lang:' + langKey + '</b></td></tr>';             
                                //now for each langage msg: 
@@ -217,8 +217,8 @@ js2AddOnloadHook( function(){
                                                o+='<tr>'+
                                                                '<td>' + numVal + '</td>' + 
                                                                '<td>' + mKey + '</td>' + 
-                                                               '<td>' + $mw.lang.gMsgNoTrans( mKey ) + '</td>' + 
-                                                               '<td id="' + tkey + '_js">' + $mw.lang.gM( mKey, numVal ) + '</td>';
+                                                               '<td>' + mw.lang.gMsgNoTrans( mKey ) + '</td>' + 
+                                                               '<td id="' + tkey + '_js">' + mw.lang.gM( mKey, numVal ) + '</td>';
                                                //show mw col:                                          
                                                if( mKey.substr(0, 5) == 'test_' ){
                                                        o+='<td> (test msg) </td>';
index 8f2b896..6f91a68 100644 (file)
@@ -5,7 +5,7 @@
  
 var urlparts = getRemoteEmbedPath();
 var mwEmbedHostPath = urlparts[0];
-var mwRemoteVersion = '1.09';
+var mwRemoteVersion = '1.10';
 var mwUseScriptLoader = true;
 
 // setup up request Params: 
@@ -68,10 +68,8 @@ function doPageSpecificRewrite() {
                        vidIdList.push( divs[i].getAttribute( "id" ) );
                }
        }
-       if ( vidIdList.length > 0 ) {
-       
-               var jsSetVideo = [ 'embedVideo', '$j.ui', 'ctrlBuilder', '$j.cookie', '$j.ui.slider' ];
-               
+       if ( vidIdList.length > 0 ) {   
+               var jsSetVideo = [ 'embedVideo', '$j.ui', 'ctrlBuilder', '$j.cookie', '$j.ui.slider', 'kskinConfig' ];          
                // Quick sniff use java if IE and native if firefox 
                // ( other browsers will run detect and get on-demand )         
                if (navigator.userAgent.indexOf("MSIE") != -1)
@@ -96,22 +94,20 @@ function rewrite_for_OggHandler( vidIdList ) {
                        return ;
                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' ) + '" ';
+               tag_type = 'video';
+               // Check type:
                var pwidth = $j( '#' + vidId ).width();
-               var pheight = $j( '#' + vidId + ' img :first' ).attr( 'height' );
-               if(!pheight)
-                       pheight = parseInt( pwidth * .75 );
-               var tag_type = 'video';         
-                               
-               // Check for audio
-               if ( pheight == '22' || pheight == '52' ) {
-                       // set width to parent width:                   
+               var $pimg = $j( '#' + vidId + ' img:first' );           
+               if( $pimg.attr('src').split('/').pop() == 'play.png'){
                        tag_type = 'audio';
-                       poster_attr = '';
+                       poster_attr = '';               
+                       pheight = 0;
+               }else{
+                       var poster_attr = 'poster = "' + $pimg.attr( 'src' ) + '" ';                    
+                       var pheight = $pimg.attr( 'height' );                           
                }
 
+
                // Parsed values:
                var src = '';
                var duration_attr = '';
@@ -137,8 +133,9 @@ function rewrite_for_OggHandler( vidIdList ) {
                                        'wikiTitleKey="' + wikiTitleKey + '" ' +
                                        'src="' + src + '" ' +
                                        duration_attr +
-                                       offset_attr + ' ';
-                                       
+                                       offset_attr + ' ' +
+                                       'class="kskin" ';
+                                                               
                        if ( tag_type == 'audio' ) {
                                html_out = '<audio' + common_attr + ' style="width:' + pwidth + 'px;"></audio>';
                        } else {
@@ -147,18 +144,20 @@ function rewrite_for_OggHandler( vidIdList ) {
                                '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 );
 
-               }
-               rewrite_by_id( 'mwe_' + vidId, function() {
-                       if ( vidIdList.length != 0 ) {
-                               setTimeout( function() {
-                                       procVidId( vidIdList.pop() )
-                               }, 10 );
-                       }
-               } );
+                       // Do the actual rewrite                                
+                       rewrite_by_id( 'mwe_' + vidId, function() {
+                               if ( vidIdList.length != 0 ) {
+                                       setTimeout( function() {
+                                               procVidId( vidIdList.pop() )
+                                       }, 10 );
+                               }
+                       } );
+
+               }               
        };
        // process each item in the vidIdList (with setTimeout to avoid locking)
        procVidId( vidIdList.pop() );