r59320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59319‎ | r59320 | r59321 >
Date:18:45, 21 November 2009
Author:dale
Status:deferred
Tags:
Comment:
* fixed audio vs video display height in remoteMwEmbed rewrite
* 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
Modified paths:
  • /trunk/phase3/js2/mwEmbed/example_usage/Player_RelatedVideos.html (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libMwApi/mw.proxy.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libSequencer/mvFirefoggRender.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libSequencer/mvPlayList.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libSequencer/mvSequencer.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/kskin/kskin.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/kskin/playerSkin.css (modified) (history)
  • /trunk/phase3/js2/mwEmbed/tests/testLang.html (modified) (history)
  • /trunk/phase3/js2/remoteMwEmbed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libMwApi/mw.proxy.js
@@ -2,11 +2,10 @@
33 *
44 * Api proxy system
55 *
6 -* Built to support cross domain uploading, and api actions for a approved set of domains.
7 -* mwProxy enables a system for fluid contributions across wikis domains for which your logged in.
 6+* Supports cross domain uploading, and api actions for a approved set of domains.
87 *
9 -* The framework support a request approval system for per-user domain approval
10 -* and a central blacklisting of domains controlled by site or system administrators.
 8+* The framework /will/ support a request approval system for per-user domain approval
 9+* and a central blacklisting of domains controlled by the site
1110 *
1211 * Flow outline below:
1312 *
@@ -56,34 +55,38 @@
5756 */
5857 $.proxy.client = function( pConf, conf ) {
5958 var _this = this;
60 - // do setup:
 59+ // Do client setup:
6160 if ( pConf.server_frame )
6261 $.proxy.server_frame = pConf.server_frame;
6362
6463 if ( pConf.client_frame_path ) {
6564 $.proxy.client_frame_path = pConf.client_frame_path;
6665 } else {
67 - // guess the client frame path:
 66+ // Set to default mwEmbed iframe path:
6867 $.proxy.client_frame_path = wgScriptPath + '/js2/mwEmbed/libMwApi/NestedCallbackIframe.html';
6968 }
7069
7170 if ( mw.parseUri( $.proxy.server_frame ).host == mw.parseUri( document.URL ).host ) {
72 - js_log( "Error: why are you trying to proxy yourself? " );
 71+ js_log( "Error: trying to proxy local domain? " );
7372 return false;
7473 }
7574 return true;
7675 }
77 - // set the frameProxy Flag:
 76+ // Set the frameProxy Flag:
7877 var frameProxyOk = false;
79 - /* setup a iframe request hash */
80 - $.proxy.doFrameProxy = function( reqObj ) {
 78+
 79+ /**
 80+ * doFrameProxy
 81+ * Writes an iframe with a hashed value of the requestQuery
 82+ */
 83+ $.proxy.doFrameProxy = function( requestQuery ) {
8184 var hashPack = {
8285 'cd': mw.parseUri( document.URL ).host,
8386 'cfp': $.proxy.client_frame_path,
84 - 'req': reqObj
 87+ 'req': requestQuery
8588 }
8689 js_log( "Do frame proxy request on src: \n" + $.proxy.server_frame + "\n" +
87 - JSON.stringify( reqObj ) );
 90+ JSON.stringify( requestQuery ) );
8891 // we can't update src's so we have to remove and add all the time :(
8992 // @@todo we should support frame msg system
9093 $j( '#frame_proxy' ).remove();
@@ -106,57 +109,70 @@
107110 }
108111 var lastApiReq = { };
109112 $.proxy.proxyNotReadyDialog = function() {
110 - var btn = { };
111 - btn[ gM( 'mwe-re-try' ) ] = function() {
 113+ var buttons = { };
 114+ buttons[ gM( 'mwe-re-try' ) ] = function() {
112115 $j.addLoaderDialog( gM( 'mwe-re-trying' ) );
113116 $.proxy.doFrameProxy( lastApiReq );
114117 }
115 - btn[ gM( 'mwe-cancel' ) ] = function() {
 118+ buttons[ gM( 'mwe-cancel' ) ] = function() {
116119 $j.closeLoaderDialog();
117120 }
118121 var pUri = mw.parseUri( $.proxy.server_frame );
119 - // this is sort of a temporary hack if we change the MediaWiki:ApiProxy key
120 - // we will have to deal with that here as well:
121 - var login_url = pUri.protocol + '://' + pUri.host +
122 - pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin' );
123 - $j.addDialog( gM( 'mwe-proxy-not-ready' ), gM( 'mwe-please-login', [ login_url, pUri.host] ) +
124 - '<p style="font-size:small">' + gM( 'mwe-remember-loging' ) + '</p>',
125 - btn
 122+
 123+ // FIXME we should have a Hosted iframe once we deploy mwEmbed on the servers.
 124+ // A hosted iframe would be much faster since than a normal page view
 125+
 126+ var login_url = pUri.protocol + '://' + pUri.host;
 127+ login_url += pUri.path.replace( 'MediaWiki:ApiProxy', 'Special:UserLogin' );
 128+
 129+ $j.addDialog(
 130+ gM( 'mwe-proxy-not-ready' ),
 131+ gM( 'mwe-please-login', [ login_url, pUri.host] ) +
 132+ '<p style="font-size:small">' +
 133+ gM( 'mwe-remember-loging' ) +
 134+ '</p>',
 135+ buttons
126136 )
127137 }
128 - /* the do_api_request with callback: */
129 - $.proxy.doRequest = function( reqObj, callback ) {
 138+ /*
 139+ * doRequest
 140+ * Takes a requestQuery, executes the query and then calls the callback
 141+ */
 142+ $.proxy.doRequest = function( requestQuery, callback ) {
130143 js_log( "doRequest:: " + JSON.stringify( reqObj ) );
131144 lastApiReq = reqObj;
132145 // setup the callback:
133146 $.proxy.callback = callback;
134147 // do the proxy req:
135 - $.proxy.doFrameProxy( reqObj );
 148+ $.proxy.doFrameProxy( requestQuery );
136149 }
137150 /**
138 - * The nested iframe action that passes its msg back up to the top instance
 151+ * The nested iframe action that passes its result back up to the top frame instance
139152 */
140153 $.proxy.nested = function( hashResult ) {
141 - // close the loader if present:
 154+ // Close the loader if present:
142155 $j.closeLoaderDialog();
143156 js_log( '$.proxy.nested callback :: ' + unescape( hashResult ) );
144157 frameProxyOk = true;
145 - // try to parse the hash result:
 158+
 159+ // Try to parse the hash result:
146160 try {
147161 var rObj = JSON.parse( unescape( hashResult ) );
148162 } catch ( e ) {
149163 js_log( "Error could not parse hashResult" );
150164 }
151 - // special callback to frameProxyOk flag (not an api result, don't call callback)
 165+
 166+ // Special callback to frameProxyOk flag
 167+ // (only used to test the proxy connection)
152168 if ( rObj.state == 'ok' )
153169 return ;
154170
155 - // if all good pass it to the callback:
 171+ // Pass the callback:
156172 $.proxy.callback( rObj );
157173 }
158174 /**
159 - * The serverApiProxy handles the actual proxy
160 - * and child frames pointing to the parent "blank" frames
 175+ * The server handles the actual proxy
 176+ * it adds child frames pointing to the parent "blank" frames
161177 *
162178 * This is (Domain B) in the above described setup
163179 */
@@ -180,30 +196,30 @@
181197 ' client from: ' + aObj.cd +
182198 ' to nested target: ' + aObj.cfp );
183199
184 - // make sure we are logged in
 200+ // Make sure we are logged in
185201 // (its a normal mediaWiki page so all site vars should be defined)
186202 if ( !wgUserName ) {
187 - js_log( 'error Not logged in' );
 203+ js_log( 'Error Not logged in' );
188204 return false;
189205 }
190206
191207 var domain = aObj.cd;
192208 var nested_frame_src = 'http://' + aObj.cd + aObj.cfp;
193 - // check the master whitelist
 209+ // Check the master whitelist
194210 for ( var i in pConf.master_whitelist ) {
195211 if ( domain == pConf.master_whitelist[ i ] ) {
196 - // do the request:
 212+ // Do the request:
197213 return doNestedProxy( aObj.req );
198214 }
199215 }
200 - // check master blacklist
 216+ // Check master blacklist
201217 for ( var i in pConf.master_blacklist ) {
202218 if ( domain == pConf.master_blacklist ) {
203219 js_log( 'domain: ' + domain + ' is blacklisted' );
204220 return false;
205221 }
206222 }
207 - // @@todo grab the users whitelist for our current domain
 223+ // FIXME grab the users whitelist for our current domain
208224 /*var local_api = wgScriptPath + '/index' + wgScriptExtension + '?title=' +
209225 'User:' + wgUserName + '/apiProxyDomainList.js' +
210226 '&action=raw&smaxage=0&gen=js';
@@ -214,31 +230,34 @@
215231 // if still not found:
216232 js_log( "domain " + domain + " not approved" );
217233
218 - // offer the user the ability to "approve" requested domain save to their user page
 234+ // FIXME :: offer the user the ability to "approve" requested domain save to
 235+ // their user/ apiProxyDomainList.js page
219236
220237 function doNestedProxy( reqObj ) {
221238 js_log( "doNestedProxy to: " + nested_frame_src );
222 - // output iframe prior to running api request
223 - // (so we can fail faster / cache the nested page / simotaniusly load things)
 239+
 240+ // Do a quick response to establish the proxy is working
 241+ // ( before we actually run the api-request )
224242 doNestedFrame ( 'nested_ok' , { 'state':'ok' } );
225243
226244 var outputhash = escape( JSON.stringify( reqObj ) );
227 - // add some api stuff:
228 - reqObj['format'] = 'json';
229 - // process the api request
 245+
 246+ // Add some api stuff:
 247+ reqObj[ 'format' ] = 'json';
 248+
 249+ // Process the api request
230250 $j.post( wgScriptPath + '/api' + wgScriptExtension,
231251 reqObj,
232 - function( data ) {
233 - // js_log("Proxy GOT Res: " + data );
234 - // put it into the nested frame hash string:
 252+ function( data ) {
 253+ // Put it into the nested frame hash string:
235254 doNestedFrame( 'nested_push', JSON.parse( data ) );
236255 }
237256 );
238257 }
239 - // add the doNestedFrame iframe:
 258+ // Add the doNestedFrame iframe:
240259 function doNestedFrame( nestname, resultObj ) {
241260 $j( '#nested_push' ).remove();
242 - // setup the nested proxy that points back to top domain:
 261+ // Setup the nested proxy that points back to top domain:
243262 $j( 'body' ).append( '<iframe id="nested_push" name="nested_push" ' +
244263 'src="' + nested_frame_src +
245264 '#' + escape( JSON.stringify( resultObj ) ) +
Index: trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php
@@ -388,6 +388,11 @@
389389 'mwe-related_videos' => 'Related videos',
390390 'mwe-seeking' => 'seeking',
391391 'mwe-copy-code' => 'Copy code',
 392+
 393+ /*
 394+ * File: /skins/kskin/kskin.js
 395+ */
 396+ 'mwe-credit-title' => 'Title: $1',
392397 );
393398
394399 /** Message documentation (Message documentation)
Index: trunk/phase3/js2/mwEmbed/skins/kskin/kskin.js
@@ -2,12 +2,22 @@
33 * skin js allows you to override contrlBuilder html/class output
44 */
55
 6+loadGM( {
 7+ "mwe-credit-title" : "Title: $1"
 8+} );
 9+
610 var kskinConfig = {
711 pClass: 'k-player',
812 // display time progress
913 long_time_disp: false,
1014 body_options: false,
1115 volume_layout: 'horizontal',
 16+ menu_items:[
 17+ 'playerselect',
 18+ 'download',
 19+ 'share',
 20+ 'credits',
 21+ ],
1222 components: {
1323 'play-btn-large' : {
1424 'h' : 55
@@ -76,10 +86,8 @@
7787 $target = $j( '#' + embedObj.id + ' .menu-' + mk ).hide();
7888 // Generate the menu html not already done:
7989 if ( $target.children().length == 0 ) {
80 - // call the function show{Menuitem} with target:
81 - embedObj['show' + mk.charAt( 0 ).toUpperCase() + mk.substring( 1 )](
82 - $j( '#' + embedObj.id + ' .menu-' + mk )
83 - );
 90+ // call the function show{Menuitem} with target:
 91+ _this.showMenuItem( mk );
8492 }
8593 // Slide out the others
8694 $j( '#' + embedObj.id + ' .menu-screen' ).hide();
@@ -93,10 +101,10 @@
94102 // Options menu display:
95103 $tp.find( '.k-options' ).click( function() {
96104 if ( $j( '#' + embedObj.id + ' .k-menu' ).length == 0 ) {
97 - // stop the player if it does not support overlays:
98 - if ( !embedObj.supports['overlays'] )
 105+ // Stop the player if it does not support overlays:
 106+ if ( !embedObj.supports['overlay'] )
99107 $tp.get( 0 ).stop();
100 - // Add the options
 108+ // Add the options
101109 addMvOptions();
102110 }
103111 // Set up the text and menu:
@@ -115,5 +123,104 @@
116124 }
117125 } );
118126
 127+ },
 128+ showMenuItem:function( menu_item ) {
 129+ //handle special k-skin specific display;
 130+ if( menu_item == 'credits'){
 131+ this.showCredits();
 132+ }else{
 133+ //call the base embedObj "show{Item}"
 134+ this.embedObj['show' + menu_item.charAt( 0 ).toUpperCase() + menu_item.substring( 1 )](
 135+ $j( '#' + this.embedObj.id + ' .menu-' + menu_item )
 136+ );
 137+ }
 138+ },
 139+ // Do the credit screen (presently specific to kaltura skin:)
 140+ showCredits:function() {
 141+ //set up the shortcuts:
 142+ embedObj = this.embedObj;
 143+ var _this = this;
 144+ $target = $j( '#' + embedObj.id + ' .menu-credits' );
 145+ $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' +
 146+ '<div class="credits_box ui-corner-all">' +
 147+ mv_get_loading_img() +
 148+ '</div>'
 149+ );
 150+
 151+ if( mw.conf.k_attribution == true ){
 152+ $target.append(
 153+ $j('<div/>').addClass( 'k-attribution')
 154+ );
 155+ }
 156+
 157+ if( !embedObj.wikiTitleKey ){
 158+ $target.find('.credits_box').text(
 159+ 'Error: no title key to grab credits with'
 160+ );
 161+ return ;
 162+ }
 163+ // Do the api request to populate the credits via the wikiTitleKey ( tied to "commons" )
 164+ var reqObj = {
 165+ 'action' : 'query',
 166+ // Normalize the File NS (ie sometimes its present in wikiTitleKey other times not
 167+ 'titles' : 'File:' + embedObj.wikiTitleKey.replace(/File:|Image:/, '' ),
 168+ 'prop' : 'revisions',
 169+ 'rvprop' : 'content'
 170+ };
 171+ var req_categories = new Array();
 172+ do_api_req( {
 173+ 'url' : mw.commons_api_url,
 174+ 'data' : reqObj
 175+ }, function( data ) {
 176+ if( !data || !data.query || !data.query.pages ){
 177+ $target.find('.credits_box').text(
 178+ 'Error: title key: ' + embedObj.wikiTitleKey + ' not found'
 179+ );
 180+ return false;
 181+ }
 182+ var pages = data.query.pages;
 183+ for(var i in pages){
 184+ page = pages[ i ];
 185+ if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ){
 186+ $target.find('.credits_box').html(
 187+ _this.doCreditLineFromWikiText( page[ 'revisions' ][0]['*'] )
 188+ );
 189+ }
 190+ }
 191+ } );
 192+ },
 193+ doCreditLineFromWikiText:function ( wikiText ){
 194+ var embedObj = this.embedObj;
 195+
 196+ // Get the title str
 197+ var titleStr = embedObj.wikiTitleKey.replace(/_/g, ' ');
 198+ var titleLink = 'http://commons.wikimedia.org/wiki/File:' + embedObj.wikiTitleKey;
 199+
 200+ // @@FIXME Do a quick check for source line:
 201+ return $j( '<div/>' ).addClass( 'creditline' )
 202+ .append(
 203+ $j('<a/>').attr({
 204+ 'href' : titleLink,
 205+ 'title' : titleStr
 206+ }).html(
 207+ $j('<img/>').attr( {
 208+ 'border': 0,
 209+ 'src' : embedObj.thumbnail,
 210+ } )
 211+ )
 212+ )
 213+ .append(
 214+ $j('<span>').html(
 215+ gM( 'mwe-credit-title' ,
 216+ // We use a div container to easialy get at the built out link
 217+ $j('<div>').html(
 218+ $j('<a/>').attr({
 219+ 'href' : titleLink,
 220+ 'title' : titleStr
 221+ }).text( titleStr )
 222+ ).html()
 223+ )
 224+ )
 225+ );
119226 }
120227 }
\ No newline at end of file
Index: trunk/phase3/js2/mwEmbed/skins/kskin/playerSkin.css
@@ -36,6 +36,14 @@
3737 background-position: -16px -48px;
3838 }
3939
 40+/* cc icon */
 41+.k-player .ui-state-default .ui-icon-comment {
 42+ background-position: 0px -65px;
 43+}
 44+.k-player .ui-state-hover .ui-icon-comment {
 45+ background-position: -17px -65px;
 46+}
 47+
4048 .k-player .ui-state-default .ui-icon-play {
4149 background: url(images/ksprite.png) no-repeat 0 0;
4250 }
@@ -337,7 +345,7 @@
338346 border: 1px solid #000000;
339347 color: #000000;
340348 float: right;
341 - height: 24px;
 349+ height: 34px;
342350 padding: 0 5px 3px;
343351 width: 84px;
344352 font-size: 1em;
@@ -385,4 +393,24 @@
386394 margin: -3px 5px 0 -1px;
387395 position: absolute;
388396 width: 8px;
 397+}
 398+
 399+.k-player .credits_box {
 400+ background-attachment:scroll;
 401+ background-color:white;
 402+ background-image:none;
 403+ background-position:0 0;
 404+ bottom:30px;
 405+ left:15px;
 406+ position:absolute;
 407+ right:61px;
 408+ top:48px;
 409+}
 410+.k-player .credits_box a{
 411+ color:#666;
 412+}
 413+.k-player .creditline img {
 414+ float: left;
 415+ width: 90px;
 416+ margin: 4px;
389417 }
\ No newline at end of file
Index: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js
@@ -39,12 +39,6 @@
4040 'options':true,
4141 'borders':true
4242 },
43 - menu_items:[
44 - 'playerselect',
45 - 'download',
46 - 'share',
47 - 'credits',
48 - ],
4943 getControls:function() {
5044 // set up local pointer to the embedObj
5145 var embedObj = this.embedObj;
@@ -432,7 +426,7 @@
433427 'play_head': {
434428 'w':0, // special case (takes up remaining space)
435429 'o':function( ctrlObj ) {
436 - return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 30 ) + 'px;"></div>';
 430+ return '<div class="play_head" style="width: ' + ( ctrlObj.available_width - 34 ) + 'px;"></div>';
437431 }
438432 }
439433 }
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -172,6 +172,23 @@
173173 window['mw'] = { }
174174 }
175175
 176+
 177+// Inherit the default global config
 178+var mwDefaultConf = {
 179+ 'skin_name' : 'mvpcf',
 180+ 'jui_skin' : 'redmond',
 181+ 'video_size' : '400x300',
 182+ 'k_attribution' : true
 183+}
 184+if( !mw.conf )
 185+ mw.conf = { }
 186+
 187+for(var i in mwDefaultConf){
 188+ if( typeof mw.conf[ i ] == 'undefined' )
 189+ mw.conf[ i ] = mwDefaultConf[ i ];
 190+}
 191+
 192+
176193 // @@todo move these into mw
177194 var global_req_cb = new Array(); // The global request callback array
178195
@@ -181,15 +198,7 @@
182199 * Any global functions/classes that are not jQuery plugins should make
183200 * there way into the mw namespace
184201 */
185 -( function( $ ) {
186 - /*
187 - * global config
188 - */
189 - $.conf = {
190 - 'skin_name' : 'mvpcf',
191 - 'jui_skin' : 'redmond',
192 - 'video_size' : '400x300'
193 - }
 202+( function( $ ) {
194203 // list valid skins here:
195204 $.valid_skins = ['mvpcf', 'kskin'];
196205 // the version of mwEmbed
@@ -343,8 +352,7 @@
344353 * Plural matchRuleTest
345354 */
346355 function matchRuleTest( cRule, val ) {
347 - // js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
348 -
 356+ js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
349357 function checkValue( compare, val ) {
350358 if ( typeof compare == 'string' ) {
351359 range = compare.split( '-' );
@@ -412,12 +420,13 @@
413421 for ( var ruleInx in rs ) {
414422 cRule = rs[ruleInx];
415423 if ( matchRuleTest( cRule, tObj.arg ) ) {
416 - // js_log("matched rule: " + ruleInx );
 424+ js_log("matched rule: " + ruleInx );
417425 return getTempParamFromRuleInx( tObj, rCount );
418426 }
419427 rCount ++;
420428 }
421 - // js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] );
 429+ js_log('no match found for: ' + tObj.arg + ' using last/other : ' + tObj.param [ tObj.param.length -1 ] );
 430+ //debugger;
422431 // return the last /"other" template param
423432 return tObj.param [ tObj.param.length - 1 ];
424433 }
@@ -691,34 +700,7 @@
692701 // do the recursive magic swap text:
693702 this.pOut = recurse_magic_swap( this.pNode );
694703
695 - },
696 - /**
697 - * getTemplateVars special function to grab template paramaters
698 - * from template text
699 - *
700 - * @returns {Array} template vars names
701 - */
702 - getTemplateVars:function() {
703 - // do a regular ex to get the ~likely~ template values
704 - // (of course this sucks)
705 - // but maybe this will make its way into the api sometime soon to support wysiwyg type editors
706 - // ideally it would expose a good deal of info about the template params
707 - js_log( 'matching against: ' + this.wikiText );
708 - var tempVars = this.wikiText.match( /\{\{\{([^\}]*)\}\}\}/gi );
709 - // clean up results:
710 - var tVars = new Array();
711 - for ( var i = 0; i < tempVars.length; i++ ) {
712 - var tvar = tempVars[i].replace( '{{{', '' ).replace( '}}}', '' );
713 - // Strip anything after a |
714 - if ( tvar.indexOf( '|' ) != -1 ) {
715 - tvar = tvar.substr( 0, tvar.indexOf( '|' ) );
716 - }
717 - // Add if not already there
718 - if ( $j.inArray( tvar, tVars ) == -1 )
719 - tVars.push( tvar );
720 - }
721 - return tVars;
722 - },
 704+ },
723705 /*
724706 * parsed template api ~loosely based off of ~POM~
725707 * http://www.mediawiki.org/wiki/Extension:Page_Object_Model
@@ -953,6 +935,7 @@
954936 callback();
955937 return;
956938 }
 939+
957940 // Do a check for any CSS we may need and get it
958941 for ( var i = 0; i < loadLibs.length; i++ ) {
959942 if ( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) {
@@ -961,6 +944,7 @@
962945 }
963946
964947 // Check if we should use the script loader to combine all the requests into one
 948+ // ( the scriptloader defines the mwSlScript global )
965949 if ( typeof mwSlScript != 'undefined' ) {
966950 var class_set = '';
967951 var last_class = '';
@@ -1100,13 +1084,8 @@
11011085 jQueryCheck: function( callback ) {
11021086 // js_log( 'jQueryCheck::' + this.jQuerySetupFlag);
11031087 var _this = this;
1104 - // Skip stuff if $j is already loaded:
1105 - if ( _global['$j'] ) {
1106 - callback(); // call the callback now
1107 - callback = null;
1108 - // This is tricky because js2stopgap registers $j without doing the "setup"
1109 - if ( _this.jQuerySetupFlag )
1110 - return ;
 1088+ if ( _global['$j'] && _this.jQuerySetupFlag ) {
 1089+ callback(); // call the callback now
11111090 }
11121091 // Load jQuery
11131092 _this.doLoad( [
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js
@@ -4,8 +4,9 @@
55 * assume version > 0.8.5.1
66 */
77 var vlcEmbed = {
8 - instanceOf:'vlcEmbed',
9 - supports: { 'play_head':true,
 8+ instanceOf : 'vlcEmbed',
 9+ supports : {
 10+ 'play_head':true,
1011 'pause':true,
1112 'stop':true,
1213 'fullscreen':true,
@@ -260,7 +261,7 @@
261262 this.parent_stop();
262263 },
263264 pause : function() {
264 - this.parent_pause(); // update the inteface if paused via native control
 265+ this.parent_pause(); // update the interface if paused via native control
265266 if ( this.vlc ) {
266267 this.vlc.playlist.togglePause();
267268 }
@@ -271,13 +272,13 @@
272273 if ( this.vlc )
273274 this.vlc.audio.toggleMute();
274275 },
275 - // @@ Suport UpDateVolumen
 276+ // @@ Support UpDateVolumen
276277 updateVolumen:function( perc ) {
277278 this.getVLC();
278279 if ( this.vlc )
279280 this.vlc.audio.volume = perc * 100;
280281 },
281 - // @@ Get Volumen
 282+ // @@ Get Volumen
282283 getVolumen:function() {
283284 this.getVLC();
284285 if ( this.vlc )
@@ -288,19 +289,7 @@
289290 if ( this.vlc.video )
290291 this.vlc.video.toggleFullscreen();
291292 }
292 - },
293 - /* returns current time in float seconds
294 - * as per html5 we should just have an attribute by name of CurrentTime
295 - * http://www.whatwg.org/specs/web-apps/current-work/#currenttime
296 - currentTime : function(){
297 - if(typeof this.vlc != 'undefined' ){
298 - if(typeof this.vlc.input != 'undefined' ){
299 - return this.vlc.input.time/1000;
300 - }
301 - }
302 - return '0';
303 - },
304 - */
 293+ },
305294 // get the embed vlc object
306295 getVLC : function() {
307296 this.vlc = this.getPluginEmbed();
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -909,8 +909,11 @@
910910 var dcss = parseInt( $j(element).css( dim ).replace( 'px' , '' ) );
911911 var dattr = parseInt( $j(element).attr( dim ) );
912912 this[ dim ] = ( dcss )? dcss : dattr;
913 - if(!this[ dim ]){
914 - // Grab width/height from default value
 913+ if( !this[ dim ] ){
 914+ //special height default for audio tag:
 915+ if( element.tagName.toLowerCase() == 'audio' && dim == 'height' )
 916+ return this[ dim ] = 0;
 917+ // Grab width/height from default value (for video)
915918 var dwh = mw.conf['video_size'].split( 'x' );
916919 this[ dim ] = ( dim == 'width' )? dwh[0] : dwh[1];
917920 }
@@ -1868,7 +1871,7 @@
18691872 } );
18701873 return false; // onclick action return false
18711874 },
1872 - showPlayerselect:function( $target ) {
 1875+ showPlayerselect:function( $target ) {
18731876 // Get id (in case where we have a parent container)
18741877 var this_id = ( this.pc != null ) ? this.pc.pp.id:this.id;
18751878 var _this = this;
@@ -1949,9 +1952,9 @@
19501953 } );
19511954
19521955 if ( dl_list != '' )
1953 - out += gM( 'mwe-download_full' ) + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
 1956+ out += '<h2>' + gM( 'mwe-download_full' ) + '</h2><ul>' + dl_list + '</ul>';
19541957 if ( dl_txt_list != '' )
1955 - out += gM( 'mwe-download_text' ) + '<blockquote style="background:#000">' + dl_txt_list + '</blockquote>';
 1958+ out += '<h2>' +gM( 'mwe-download_text' ) + '</h2><ul>' + dl_txt_list + '</ul>';
19561959 out += '</div>';
19571960 return out;
19581961 }
@@ -1967,9 +1970,6 @@
19681971 $target.html( getShowVideoDownload() );
19691972 }
19701973 },
1971 - showCredits:function( $target ) {
1972 - $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' );
1973 - },
19741974 /*
19751975 * Base embed controls
19761976 * The Play Action:
@@ -2332,10 +2332,11 @@
23332333 {
23342334 return gM( 'mwe-ogg-player-' + this.id );
23352335 },
2336 - load : function( callback ) {
 2336+ load : function( callback ) {
23372337 mvJsLoader.doLoad( [
23382338 this.library + 'Embed'
2339 - ], function() {
 2339+ ], function() {
 2340+ js_log("wtf: " + typeof( vlcEmbed ) );
23402341 callback();
23412342 } );
23422343 }
Index: trunk/phase3/js2/mwEmbed/example_usage/Player_RelatedVideos.html
@@ -6,16 +6,16 @@
77 <script type="text/javascript" src="../mv_embed.js?debug=true"></script>
88 </head>
99 <body>
10 -<h3> Simple Video Relational Audio and Video the Commons </h3>
11 -This Example search primitive video in the Wikimedia Commons
 10+<h3> Related Videos </h3>
 11+
1212 <span id="default_attr">
1313 </span> <br />
1414 <br />
1515 <table border="1" cellpadding="6" width="600">
1616 <tr>
1717 <td valign="top">
18 - <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>
19 - <td valign="top"><b>Sample Relational Video And Audio</b><br />
 18+ <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>
 19+ <td valign="top"><b>Sample Related Videos</b><br />
2020 <pre>The Example Code ::: </pre>
2121 &lt;video wikiTitleKey="File:B-36_bomber.ogg" durationHint="2"
2222 poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg&size=400x300"
Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -734,7 +734,7 @@
735735 }
736736 };
737737 // Create the "return to form" button
738 - bObj[ gM( 'mwe-return-to-form' ) ] = function() {
 738+ buttons[ gM( 'mwe-return-to-form' ) ] = function() {
739739 $j( this ).dialog( 'close' );
740740 _this.form_post_override = false;
741741 }
@@ -742,7 +742,7 @@
743743 _this.updateProgressWin(
744744 gM( 'mwe-uploadwarning' ),
745745 '<h3>' + gM( 'mwe-uploadwarning' ) + '</h3>' + wmsg + '<p>',
746 - bObj );
 746+ buttons );
747747 return false;
748748 }
749749 // No error!
@@ -783,21 +783,21 @@
784784 return false;
785785 }
786786
787 - var bObj = {};
 787+ var buttons = {};
788788 // "Return" button
789 - bObj[ gM( 'mwe-return-to-form' ) ] = function() {
 789+ buttons[ gM( 'mwe-return-to-form' ) ] = function() {
790790 $j( this ).dialog( 'close' );
791791 _this.form_post_override = false;
792792 }
793793 // "Go to resource" button
794 - bObj[ gM('mwe-go-to-resource') ] = function() {
 794+ buttons[ gM('mwe-go-to-resource') ] = function() {
795795 window.location = url;
796796 };
797797 _this.action_done = true;
798798 _this.updateProgressWin(
799799 gM( 'mwe-successfulupload' ),
800800 gM( 'mwe-upload_done', url),
801 - bObj );
 801+ buttons );
802802 js_log( 'apiRes.upload.imageinfo::' + url );
803803 return true;
804804 }
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
@@ -1,16 +1,26 @@
2 -// base remote search obj
3 -
 2+/*
 3+* Base remote search Object.
 4+* provies the base class for the other search system to extend.
 5+*/
46 loadGM( {
57 "mwe-imported_from" : "$1 imported from [$2 $3]. See the original [$4 resource page] for more information."
68 } )
7 -// @key is name of rObj variable
8 -// @value is where to find the value in the item xml
9 -//
10 -// *format:*
11 -// . indicates multiple tags @ separates the tag from attribute list
12 -// {.}tag_name@{attribute1|attribute12}
139
14 -// @@todo should probably switch this over to something like Xpath if we end up parsing a lot of rss formats
 10+/*
 11+* rsd_default_rss_item_mapping
 12+*
 13+* @key is name of rObj variable
 14+* @value is where to find the value in the item xml
 15+*
 16+* *value format:*
 17+* . indicates multiple tags
 18+* @ separates the tag from attribute list
 19+* {.}tag_name@{attribute1|attribute2}
 20+*
 21+* Also see mapAttributeToResource function bellow
 22+*
 23+* FIXME should switch this over to something like Xpath if we end up parsing a lot of rss formats
 24+*/
1525 var rsd_default_rss_item_mapping = {
1626 'poster' : 'media:thumbnail@url',
1727 'roe_url' : 'media:roe_embed@url',
@@ -31,36 +41,41 @@
3242
3343 completed_req:0,
3444 num_req:0,
35 -
 45+
 46+ // ResultsObj holds the array of results
3647 resultsObj: { },
3748
38 - // default search result values for paging:
 49+ // Default search result values for paging:
3950 offset :0,
4051 limit : 30,
4152 more_results : false,
4253 num_results : 0,
4354
44 - // init the object:
45 - init: function( iObj ) {
 55+ /**
 56+ * Initialise the baseRemoteSearch
 57+ */
 58+ init: function( options ) {
4659 js_log( 'mvBaseRemoteSearch:init' );
47 - for ( var i in iObj ) {
48 - this[i] = iObj[i];
 60+ for ( var i in options ) {
 61+ this[i] = options[i];
4962 }
5063 return this;
5164 },
5265 getSearchResults:function() {
53 - // empty out the current results before issuing a request
 66+ // Empty out the current results before issuing a request
5467 this.resultsObj = { };
55 - // do global getSearchResults bindings
 68+
 69+ // Do global getSearchResults bindings
5670 this.last_query = $j( '#rsd_q' ).val();
5771 this.last_offset = this.cp.offset;
58 - // set the loading flag:
 72+
 73+ // Set the loading flag:
5974 this.loading = true;
6075 },
6176 /*
6277 * Parses and adds video rss based input format
63 - * @param $data XML data to parse
64 - * @param provider_url the source url (used to generate absolute links)
 78+ * @param {XML Nodes} data the data to be parsed
 79+ * @param {String} provider_url the source url (used to generate absolute links)
6580 */
6681 addRSSData:function( data , provider_url ) {
6782 js_log( 'f:addRSSData' );
@@ -102,7 +117,15 @@
103118 _this.num_results++;
104119 } );
105120 },
106 - mapAttributeToResource: function(rObj, item, attr){
 121+ /*
 122+ * Maps a given attribute to a resource object per mapping defined in
 123+ * rsd_default_rss_item_mapping
 124+ *
 125+ * @param {Object} rObj the resource object
 126+ * @param {XML Node} the xml result node
 127+ * @param {attr} the name attribute we are maping to the resource object
 128+ */
 129+ mapAttributeToResource: function( rObj, item, attr ){
107130 var selector = rsd_default_rss_item_mapping[ attr ].split( '@' );
108131 var flag_multiple = ( selector[0].substr( 0, 1 ) == '.' ) ? true : false;
109132 if ( flag_multiple ) {
@@ -147,6 +170,10 @@
148171 } );
149172 // Nothing to return we update the "rObj" directly
150173 },
 174+
 175+ /**
 176+ * Get the html representation of the resource Object paramater
 177+ */
151178 getEmbedHTML: function( rObj , options ) {
152179 if ( !options )
153180 options = { };
@@ -185,6 +212,9 @@
186213 js_log( "ERROR:: no embed code for mime type: " + rObj.mime );
187214 return 'Error missing embed code for: ' + escape( rObj.mime );
188215 },
 216+ /**
 217+ * Get the embed html specificaly for an image type resource Object.
 218+ */
189219 getImageEmbedHTML:function( rObj, options ) {
190220 // if crop is null do base output:
191221 var imgHtml = '<img ' + options.id_attr + ' src="' + rObj.edit_url + '"' + options.style_attr + ' ></img>';
@@ -197,13 +227,22 @@
198228 '</div>' +
199229 '</div>';
200230 },
201 - // by default just return the existing image with callback
 231+ /**
 232+ * Gets an image object from a requested transformation via callback
 233+ * ( letting api search implementations query the remote server for a
 234+ * given transformation )
 235+ *
 236+ * By default just return the existing image.
 237+ */
202238 getImageObj:function( rObj, size, callback ) {
203239 callback( {
204240 'url' : rObj.poster
205241 } );
206242 },
207 - // by default just return the rObj.desc
 243+ /*
 244+ * Gets the inline wikiText description of the resource Object
 245+ * By default just return the rObj description value
 246+ */
208247 getInlineDescWiki:function( rObj ) {
209248 // return striped html & trim white space
210249 if ( rObj.desc )
@@ -211,11 +250,21 @@
212251 // no desc avaliable:
213252 return '';
214253 },
215 - // default license permission wiki text is cc based template mapping (does not confirm the templates actually exist)
 254+ /**
 255+ * Get the licence wikiText tag for a given resource Object.
 256+ *
 257+ * By default license permission wiki text is cc based template mapping
 258+ * (does not confirm the templates actually exist)
 259+ */
216260 getPermissionWikiTag: function( rObj ) {
217261 if ( !rObj.license )
218262 return '';// no license info
219 - // check that its a defined creative commons licnese key:
 263+
 264+ // First check if we have a special license template tag already set:
 265+ if( rObj.license_template_tag )
 266+ return '{{' + rObj.license_template_tag + '}}';
 267+
 268+ // Check that its a defined creative commons license key:
220269 if ( this.rsd.licenses.cc.licenses[ rObj.license.key ] != 'undefined' ) {
221270 return '{{Cc-' + rObj.license.key + '}}';
222271 } else if ( rObj.license.lurl ) {
@@ -223,23 +272,51 @@
224273 }
225274
226275 },
 276+ /**
 277+ * Gets the resource import description text
 278+ */
227279 getImportResourceDescWiki:function( rObj ) {
228280 return gM( 'mwe-imported_from', [rObj.title, this.cp.homepage, gM('rsd-' + this.cp.id + '-title'), rObj.link] );
229281 },
230 - // for thigns like categories and the like
 282+ /**
 283+ * Get any extra wikitext description for the given resource object.
 284+ * For content outside of the main template description,
 285+ * like categories or additional wikitext notes.
 286+ *
 287+ * By default its an empty string.
 288+ */
231289 getExtraResourceDescWiki:function( rObj ) {
232290 return '';
233291 },
234 - // by default just return the poster (clients can override)
 292+
 293+ /**
 294+ * Gets a image transformation
 295+ * by default it just return the poster
 296+ */
235297 getImageTransform:function( rObj, opt ) {
236298 return rObj.poster;
237299 },
238 - getEmbedObjParsedInfo:function( rObj, eb_id ) {
 300+
 301+ /**
 302+ * Adds additional resource information post clip embedding.
 303+ */
 304+ addResourceInfoFromEmbedInstance : function( rObj, eb_id ) {
239305 return rObj;
240306 },
241 - getEmbedTimeMeta:function( rObj, callback ) {
 307+
 308+ /**
 309+ * Adds resource info with a callback function
 310+ *
 311+ * Usefull for grabbing extra info that is not avaliable in the innitial
 312+ * search results api request.
 313+ */
 314+ addResourceInfoCallback:function( rObj, callback ) {
242315 callback();
243316 },
 317+
 318+ /**
 319+ * Get the wiki embed code for a given resource object
 320+ */
244321 getEmbedWikiCode:function( rObj ) {
245322 var layout = ( rObj.layout ) ? rObj.layout:"right"
246323 var o = '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|' + layout;
@@ -257,11 +334,11 @@
258335 o += ']]';
259336 return o;
260337 },
 338+ /**
 339+ * Updates / normalizes the target_resource_title
 340+ */
261341 updateTargetResourceTitle:function( rObj ) {
262342 rObj.target_resource_title = rObj.titleKey.replace( / File: | Image: / , '' );
263343 rObj.target_resource_title = this.cp.resource_prefix + rObj.target_resource_title;
264 - },
265 - updateDataForImport:function( rObj ) {
266 - return rObj;
267344 }
268345 }
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
@@ -1,17 +1,24 @@
2 -// archive.org uses solr engine:
3 -// more about solr here:
4 -// http://lucene.apache.org/solr/
 2+/*
 3+* Archive.org Search
 4+*
 5+* archive.org uses the solr engine:
 6+* more about solr here:
 7+* http://lucene.apache.org/solr/
 8+*/
59
610 var archiveOrgSearch = function ( iObj ) {
711 return this.init( iObj );
812 }
913 archiveOrgSearch.prototype = {
1014 // Archive.org constants:
11 - dnUrl:'http://www.archive.org/download/',
12 - dtUrl:'http://www.archive.org/details/',
13 - init:function( iObj ) {
14 - // Init base class and inherit:
15 - var baseSearch = new baseRemoteSearch( iObj );
 15+ downloadUrl : 'http://www.archive.org/download/',
 16+ detailsUrl : 'http://www.archive.org/details/',
 17+ /*
 18+ * Inititalize the archiveOrgSearch class.
 19+ * archiveOrgSearch inherits the baseSearch class
 20+ */
 21+ init:function( options ) {
 22+ var baseSearch = new baseRemoteSearch( options );
1623 for ( var i in baseSearch ) {
1724 if ( typeof this[i] == 'undefined' ) {
1825 this[i] = baseSearch[i];
@@ -19,8 +26,10 @@
2027 this['parent_' + i] = baseSearch[i];
2128 }
2229 }
23 - // Inherit the cp settings for
2430 },
 31+ /**
 32+ * Gets the search results from the api query
 33+ */
2534 getSearchResults:function() {
2635 // call parent:
2736 this.parent_getSearchResults();
@@ -49,10 +58,13 @@
5059 }
5160 );
5261 },
 62+ /**
 63+ * Adds the search results to the local resultsObj
 64+ */
5365 addResults:function( data ) {
5466 var _this = this;
5567 if ( data.response && data.response.docs ) {
56 - // set result info:
 68+ // Set result info:
5769 this.num_results = data.response.numFound;
5870
5971 for ( var resource_id in data.response.docs ) {
@@ -61,17 +73,17 @@
6274 // @@todo we should add .ogv or oga if video or audio:
6375 'titleKey' : resource.identifier + '.ogg',
6476 'resourceKey': resource.identifier,
65 - 'link' : _this.dtUrl + resource.identifier,
 77+ 'link' : _this.detailsUrl + resource.identifier,
6678 'title' : resource.title,
67 - 'poster' : _this.dnUrl + resource.identifier + '/format=thumbnail',
68 - 'poster_ani' : _this.dnUrl + resource.identifier + '/format=Animated+Gif',
 79+ 'poster' : _this.downloadUrl + resource.identifier + '/format=thumbnail',
 80+ 'poster_ani' : _this.downloadUrl + resource.identifier + '/format=Animated+Gif',
6981 'thumbwidth' : 160,
7082 'thumbheight': 110,
7183 'desc' : resource.description,
72 - 'src' : _this.dnUrl + resource.identifier + '/format=Ogg+video',
73 - 'mime' : 'application/ogg',
74 - // set the license: (rsd is a pointer to the parent remoteSearchDriver )
75 - 'license' : this.rsd.getLicenceFromUrl( resource.licenseurl ),
 84+ 'src' : _this.downloadUrl + resource.identifier + '/format=Ogg+video',
 85+ 'mime' : 'application/ogg',
 86+ // Set the license: (rsd is a pointer to the parent remoteSearchDriver )
 87+ 'license' : this.rsd.getLicenceFromUrl( resource.licenseurl ),
7688 'pSobj' :_this
7789
7890 };
@@ -79,14 +91,14 @@
8092 }
8193 }
8294 },
83 - // getTitleKey:function(rObj){
84 - // return rObj['stream_name'] + '__' + rObj['start_time'].replace(/:/g,'.') + '_to_' + rObj['end_time'].replace(/:/g,'.') + '.ogg';;
85 - // }
86 - getEmbedTimeMeta:function( rObj, callback ) {
 95+ /**
 96+ * Gets some media metadata via a archive.org special entry point "avinfo"
 97+ */
 98+ addResourceInfoCallback:function( rObj, callback ) {
8799 var _this = this;
88100 do_api_req( {
89 - 'data': { 'avinfo':1 },
90 - 'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'
 101+ 'data': { 'avinfo' : 1 },
 102+ 'url':_this.downloadUrl + rObj.resourceKey + '/format=Ogg+video'
91103 }, function( data ) {
92104 if ( data['length'] )
93105 rObj.duration = data['length'];
@@ -98,6 +110,9 @@
99111 callback();
100112 } );
101113 },
 114+ /*
 115+ * Returns html to embed a given result Object ( rObj )
 116+ */
102117 getEmbedHTML: function( rObj , options ) {
103118 js_log( 'getEmbedHTML:: ' + rObj.poster );
104119 if ( !options )
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
@@ -73,6 +73,15 @@
7474
7575 // Default width of metavid clips:
7676 rObj['target_width'] = 400;
 77+
 78+ rObj['author'] = 'US Government';
 79+
 80+ // Add in the date as UTC "toDateString" :
 81+ var d = _this.getDateFromLink( rObj.link );
 82+ rObj['date'] = d.toDateString();
 83+
 84+ // Set the license_template_tag ( all metavid content is PD-USGov )
 85+ rObj['license_template_tag'] = 'PD-USGov';
7786 }
7887 // done loading:
7988 _this.loading = 0;
@@ -89,10 +98,6 @@
9099 sn = sn.charAt( 0 ).toUpperCase() + sn.substr( 1 );
91100 return gM( 'mwe-stream_title', [ sn, rObj.start_time, rObj.end_time ] );
92101 },
93 - // metavid descption tied to public domain license key (government produced content)
94 - getPermissionWikiTag:function( rObj ) {
95 - return '{{PD-USGov}}';
96 - },
97102 getExtraResourceDescWiki:function( rObj ) {
98103 var o = "\n";
99104 // check for person
@@ -180,8 +185,8 @@
181186 return getURLParamReplace( rObj.poster, { 'size' : 'full' } )
182187 }
183188 },
184 - getEmbedObjParsedInfo:function( rObj, eb_id ) {
185 - var sources = $j( '#' + eb_id ).get( 0 ).media_element.getSources();
 189+ addResourceInfoFromEmbedInstance : function( rObj, embed_id ) {
 190+ var sources = $j( '#' + embed_id ).get( 0 ).media_element.getSources();
186191 rObj.other_versions = '*[' + rObj['roe_url'] + ' XML of all Video Formats and Timed Text]' + "\n";
187192 for ( var i in sources ) {
188193 var cur_source = sources[i];
@@ -192,18 +197,6 @@
193198 // js_log('set url to: ' + rObj['url']);
194199 return rObj;
195200 },
196 - // update rObj for import:
197 - updateDataForImport:function( rObj ) {
198 - rObj['author'] = 'US Government';
199 - // convert data to UTC type date:
200 - var d = this.getDateFromLink( rObj.link );
201 - rObj['date'] = d.toDateString();
202 - rObj['license_template_tag'] = 'PD-USGov';
203 - // update based on new start time:
204 - js_log( 'url is: ' + rObj.src + ' ns: ' + rObj.start_time + ' ne:' + rObj.end_time );
205 -
206 - return rObj;
207 - },
208201 getDateFromLink:function( link ) {
209202 var dateExp = new RegExp( /_([0-9]+)\-([0-9]+)\-([0-9]+)/ );
210203 var dParts = link.match ( dateExp );
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -110,15 +110,15 @@
111111 } );
112112 },
113113 getSearchResults:function() {
114 - // call parent:
 114+ // Call parent:
115115 this.parent_getSearchResults();
116 - // set local ref:
 116+ // Set local ref:
117117 var _this = this;
118118
119119 js_log( 'f:getSearchResults for:' + $j( '#rsd_q' ).val() );
120 - // do two queries against the Image / File / MVD namespace:
 120+ // Do two queries against the Image / File / MVD namespace:
121121
122 - // build the image request object:
 122+ // Build the image request object:
123123 var reqObj = {
124124 'action':'query',
125125 'generator':'search',
@@ -132,11 +132,11 @@
133133 'iiurlwidth': parseInt( this.rsd.thumb_width ),
134134 'rvprop':'content'
135135 };
136 - // set up the number of request:
 136+ // Set up the number of request:
137137 this.completed_req = 0;
138138 this.num_req = 1;
139 - // setup the number of requests result flag:
140 - // also do a request for page titles (would be nice if api could query both at the same time)
 139+ // Setup the number of requests result flag:
 140+ // Also do a request for page titles (would be nice if api could query both at the same time)
141141 reqObj['gsrwhat'] = 'text';
142142 do_api_req( {
143143 'data':reqObj,
@@ -161,24 +161,24 @@
162162 if ( typeof data['query-continue'].search != 'undefined' )
163163 this.more_results = true;
164164 }
165 - // make sure we have pages to idorate:
 165+ // Make sure we have pages to idorate:
166166 if ( data.query && data.query.pages ) {
167167 for ( var page_id in data.query.pages ) {
168168 var page = data.query.pages[ page_id ];
169169
170 - // make sure the reop is shared (don't show for now it confusing things)
 170+ // Make sure the reop is shared (don't show for now it confusing things)
171171 // @@todo support remote repository better
172172 if ( page.imagerepository == 'shared' ) {
173173 continue;
174174 }
175175
176 - // make sure the page is not a redirect
 176+ // Make sure the page is not a redirect
177177 if ( page.revisions && page.revisions[0] &&
178178 page.revisions[0]['*'] && page.revisions[0]['*'].indexOf( '#REDIRECT' ) === 0 ) {
179179 // skip page is redirect
180180 continue;
181181 }
182 - // skip if its an empty or missing imageinfo:
 182+ // Skip if its an empty or missing imageinfo:
183183 if ( !page.imageinfo )
184184 continue;
185185 var rObj = {
@@ -204,10 +204,11 @@
205205 //to use once we get the wiki-text parser in shape
206206 var pObj = mw.parser.pNew( rObj.desc );
207207 //structured data on commons is based on the "information" template:
208 - var tmplInfo = pObj.templates( 'information' );
 208+ var tmplInfo = pObj.templates( 'information' );
 209+ rObj.desc = tmplInfo.description
209210 */
210211
211 - // attempt to parse out the description current user desc from the commons template:
 212+ // Attempt to parse out the description current user desc from the commons template:
212213 // @@todo these could be combined to a single regEx
213214 // or better improve the wiki-text parsing and use above
214215 var desc = rObj.desc.match( /\|\s*description\s*=\s*(([^\n]*\n)*)\|\s*source=/i );
@@ -231,15 +232,15 @@
232233 }
233234 }
234235
235 - // likely a audio clip if no poster and type application/ogg
 236+ // Likely a audio clip if no poster and type application/ogg
236237 // @@todo we should return audio/ogg for the mime type or some other way to specify its "audio"
237238 if ( ! rObj.poster && rObj.mime == 'application/ogg' ) {
238239 rObj.mime = 'audio/ogg';
239240 }
240 - // add to the resultObj
 241+ // Add to the resultObj
241242 this.resultsObj[page_id] = rObj;
242243
243 - // if returnFirst flag:
 244+ // If returnFirst flag:
244245 if ( returnFirst )
245246 return this.resultsObj[page_id];
246247
@@ -253,9 +254,9 @@
254255 js_log( 'no results:' + data );
255256 }
256257 },
257 - // check request done used for when we have multiple requests to check before formating results.
 258+ // Check request done used for when we have multiple requests to check before formating results.
258259 checkRequestDone:function() {
259 - // display output if done:
 260+ // Display output if done:
260261 this.completed_req++;
261262 if ( this.completed_req == this.num_req ) {
262263 this.loading = 0;
@@ -265,7 +266,7 @@
266267 if ( rObj.mime == 'application/ogg' )
267268 return callback( { 'url':rObj.src, 'poster' : rObj.url } );
268269
269 - // his could be depreciated if thumb.php improves
 270+ // This could be depreciated if thumb.php support is standard
270271 var reqObj = {
271272 'action':'query',
272273 'format':'json',
@@ -273,7 +274,7 @@
274275 'prop':'imageinfo',
275276 'iiprop':'url|size|mime'
276277 }
277 - // set the width:
 278+ // Set the width:
278279 if ( size.width )
279280 reqObj['iiurlwidth'] = size.width;
280281 js_log( 'going to do req: ' + this.cp.api_url + ' ' + reqObj );
@@ -310,10 +311,10 @@
311312 getInlineDescWiki:function( rObj ) {
312313 var desc = this.parent_getInlineDescWiki( rObj );
313314
314 - // strip categories for inline Desc: (should strip license tags too but not as easy)
 315+ // Strip categories for inline Desc: (should strip license tags too but not as easy)
315316 desc = desc.replace( /\[\[Category\:[^\]]*\]\]/gi, '' );
316317
317 - // just grab the description tag for inline desc:
 318+ // Just grab the description tag for inline desc:
318319 var descMatch = new RegExp( /Description=(\{\{en\|)?([^|]*|)/ );
319320 var dparts = desc.match( descMatch );
320321
@@ -333,14 +334,14 @@
334335 js_log( 'Error: No Description Tag, Using::' + desc );
335336 return desc;
336337 },
337 - // returns the inline wikitext for insertion (template based crops for now)
 338+ // Returns the inline wikitext for insertion (template based crops for now)
338339 getEmbedWikiCode: function( rObj ) {
339 - // set default layout to right justified
 340+ // Set default layout to right justified
340341 var layout = ( rObj.layout ) ? rObj.layout:"right"
341342 // if crop is null do base output:
342343 if ( rObj.crop == null )
343344 return this.parent_getEmbedWikiCode( rObj );
344 - // using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop
 345+ // Using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop
345346 // @@todo should be replaced with server side cropping
346347 return '{{Preview Crop ' + "\n" +
347348 '|Image = ' + rObj.target_resource_title + "\n" +
Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
@@ -282,13 +282,15 @@
283283 return;
284284 }
285285
286 - // Otherwise show the "install Firefogg" message
287 - // FIXME: getFirefoggInstallUrl() may return false, this is not handled
 286+ // Otherwise show the "install Firefogg" message
288287 var upMsg = ( _this.form_type == 'upload' ) ? gM( 'fogg-for_improved_uploads' ) : '';
289 - $j( _this.target_please_install )
290 - .html( upMsg + gM( 'fogg-please_install', _this.getFirefoggInstallUrl() ) )
291 - .css( 'padding', '10px' )
292 - .show();
 288+ var firefoggUrl = _this.getFirefoggInstallUrl();
 289+ if( firefoggUrl ){
 290+ $j( _this.target_please_install )
 291+ .html( upMsg + gM( 'fogg-please_install', firefoggUrl ) )
 292+ .css( 'padding', '10px' )
 293+ .show();
 294+ }
293295 }
294296
295297 // Set up the click handler for the "save local file" button
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -1271,7 +1271,7 @@
12721272 js_log( 'media type:: ' + mediaType );
12731273 // Get any additional embedding helper meta data prior to doing the actual embed
12741274 // normally this meta should be provided in the search result (but archive.org has another query for more media meta)
1275 - rObj.pSobj.getEmbedTimeMeta( rObj, function() {
 1275+ rObj.pSobj.addResourceInfoCallback( rObj, function() {
12761276 // Make sure we have the embedVideo libs:
12771277 var runFlag = false;
12781278 mvJsLoader.embedVideoCheck( function() {
@@ -1292,13 +1292,14 @@
12931293 js_log( "about to call rewrite_by_id::embed_vid" );
12941294 // Rewrite by id
12951295 rewrite_by_id( 'embed_vid', function() {
1296 - // Grab any information that we got from the ROE xml or parsed from the media file
1297 - rObj.pSobj.getEmbedObjParsedInfo( rObj, 'embed_vid' );
 1296+ // Grab information avaliable from the embed instance
 1297+ rObj.pSobj.addResourceInfoFromEmbedInstance( rObj, 'embed_vid' );
 1298+
12981299 // Add the re-sizable to the doLoad request:
12991300 clibs.push( '$j.ui.resizable' );
1300 - clibs.push( '$j.fn.hoverIntent' );
 1301+ clibs.push( '$j.fn.hoverIntent' );
13011302 mvJsLoader.doLoad( clibs, function() {
1302 - // Make sure the rsd_edit_img is hidden:
 1303+ // Make sure the rsd_edit_img is removed:
13031304 $j( '#rsd_edit_img' ).remove();
13041305 // Run the image clip tools
13051306 _this.cEdit = new mvClipEdit( mvClipInit );
@@ -1390,9 +1391,7 @@
13911392 },
13921393 doImportInterface : function( rObj, callback ) {
13931394 var _this = this;
1394 - js_log( "doImportInterface:: update:" + _this.cFileNS + ':' + rObj.target_resource_title );
1395 - // update the rObj with import info
1396 - rObj.pSobj.updateDataForImport( rObj );
 1395+ js_log( "doImportInterface:: update:" + _this.cFileNS + ':' + rObj.target_resource_title );
13971396
13981397 // setup the resource description from resource description:
13991398 var wt = '{{Information ' + "\n";
Index: trunk/phase3/js2/mwEmbed/libSequencer/mvPlayList.js
@@ -259,11 +259,11 @@
260260 this.doWhenClipLoadDone();
261261 } else {
262262 js_log( "only " + _this.clip_ready_count + " clips done, scheduling callback:" );
263 - var doParseDoneCheck = function() {
264 - _this.doWhenParseDone();
265 - }
266263 if ( !mvJsLoader.load_error ) // re-issue request if no load error:
267 - setTimeout( doParseDoneCheck, 100 );
 264+ setTimeout( function(){
 265+ _this.doWhenParseDone();
 266+ //debugger;
 267+ }, 100 );
268268 }
269269 },
270270 doWhenClipLoadDone:function() {
Index: trunk/phase3/js2/mwEmbed/libSequencer/mvFirefoggRender.js
@@ -1,8 +1,8 @@
22 /*
33 * Handles driving the firefogg render system
44 */
5 -var mvFirefoggRender = function( iObj ) {
6 - return this.init( iObj );
 5+var mvFirefoggRender = function( options ) {
 6+ return this.init( options );
77 };
88 var default_render_options = {
99 "videoQuality" : 10,
@@ -18,7 +18,7 @@
1919 // default empty render options:
2020 renderOptions: { },
2121 continue_rendering:false,
22 - init:function( iObj ) {
 22+ init:function( options ) {
2323 var _this = this;
2424
2525 // grab the mvFirefogg object to do basic tests
@@ -38,12 +38,12 @@
3939 this.fogg = this.myFogg.fogg;
4040
4141 // setup player instance
42 - this.player = $j( iObj.player_target ).get( 0 );
43 - this.player_target = iObj.player_target;
 42+ this.player = $j( options.player_target ).get( 0 );
 43+ this.player_target = options.player_target;
4444
4545 // Extend the render options with any provided details
46 - if( iObj['render_options'] )
47 - $j.extend(this.renderOptions, iObj['render_options']);
 46+ if( options['render_options'] )
 47+ $j.extend(this.renderOptions, options['render_options']);
4848
4949 // If no height width provided use target DOM width/height
5050 if( !this.renderOptions.width && !this.renderOptions.height ){
@@ -54,28 +54,28 @@
5555
5656 // Setup the application options (with defaults)
5757 for ( var i in default_FirefoggRender_options ) {
58 - if ( iObj[ i ] ) {
59 - this[ i ] = iObj[ i ];
 58+ if ( options[ i ] ) {
 59+ this[ i ] = options[ i ];
6060 } else {
6161 this[ i ] = default_FirefoggRender_options[i];
6262 }
6363 }
64 - // Should be exteranlly controlled
65 - if ( iObj.target_startRender ) {
66 - $j( iObj.target_startRender ).click( function() {
 64+ // Should be externally controlled
 65+ if ( options.target_startRender ) {
 66+ $j( options.target_startRender ).click( function() {
6767 js_log( "Start render" );
6868 _this.startRender();
6969 } )
70 - this.target_startRender = iObj.target_startRender;
 70+ this.target_startRender = options.target_startRender;
7171 }
72 - if ( iObj.target_stopRender ) {
73 - $j( iObj.target_stopRender ).click( function() {
 72+ if ( options.target_stopRender ) {
 73+ $j( options.target_stopRender ).click( function() {
7474 _this.stopRender();
7575 } )
76 - this.target_stopRender = iObj.target_stopRender;
 76+ this.target_stopRender = options.target_stopRender;
7777 }
78 - if ( iObj.target_timeStatus ) {
79 - this.target_timeStatus = iObj.target_timeStatus;
 78+ if ( options.target_timeStatus ) {
 79+ this.target_timeStatus = options.target_timeStatus;
8080 }
8181 },
8282 startRender:function() {
Index: trunk/phase3/js2/mwEmbed/libSequencer/mvSequencer.js
@@ -76,53 +76,61 @@
7777 plObj_id:'seq_pl',
7878 plObj:'null',
7979
80 - timeline_scale:.06, // in pixel to second ratio ie 100pixles for every ~30seconds
81 - timeline_duration:500, // default timeline length in seconds
 80+ // In pixel to second ratio ie 100pixles for every ~30seconds
 81+ timeline_scale:.06,
 82+
 83+ // Default timeline duration in seconds
 84+ timeline_duration:500,
 85+
8286 playline_time:0,
8387 track_thumb_height:60,
8488 track_text_height:20,
8589
86 - // default timeline mode: "story" (i-movie like) or "time" (finalCut like)
 90+ // Default timeline mode: "story" (i-movie like) or "time" (finalCut like)
8791 timeline_mode:'storyboard',
8892
89 - track_clipThumb_height:80, // how large are the i-movie type clips
 93+ // How large are the i-movie type clips
 94+ track_clipThumb_height:80,
9095
91 - base_adj_duration:.5, // default time to subtract or add when adjusting clips.
 96+ // Default time to subtract or add when adjusting clips.
 97+ base_adj_duration:.5,
9298
93 - // default clipboard is empty:
 99+ // Default clipboard is empty:
94100 clipboard:new Array(),
95 - // stores the clipboard edit token (if user has rights to edit their User page)
 101+
 102+ // Stores the clipboard edit token (if user has rights to edit their User page)
96103 clipboardEditToken:null,
97 - // stores the sequence edit token (if user has rights to edit the current sequence)
 104+
 105+ // Stores the sequence edit token (if user has rights to edit the current sequence)
98106 sequenceEditToken:null,
99 - // the time the sequence was last touched (grabbed at time of startup)
 107+
 108+ // The time the sequence was last touched (grabbed at time of startup)
100109 sequenceTouchedTime:null,
101110
102111 // the default config for the add media wizard
103112 amw_conf: { },
104113
105 -
106 - // Msg are all the language specific values ...
107 - // (@@todo overwrite by msg values preloaded in the page)
108 - // tack/clips can be pushed via json or inline playlist format
109 - inline_playlist:'null', // text value so its a valid property
 114+
 115+ inline_playlist:'null',
110116 inline_playlist_id:'null',
111117 mv_pl_src:'null',
112 - // the edit stack:
 118+
 119+ // The edit stack (so that you can "undo" edits)
113120 edit_stack:new Array(),
114121 disp_menu_item:null,
115 - // trackObj used to payload playlist Track Object (when inline not present)
 122+
 123+ // Track Object
116124 tracks: { }
117125 }
118126 var mvSequencer = function( iObj ) {
119127 return this.init( iObj );
120128 };
121 -// set up the mvSequencer object
 129+// Set up the mvSequencer object
122130 mvSequencer.prototype = {
123 - // the menu_items Object contains: default html, js setup/loader functions
 131+ // The menu_items Object contains: default html, js setup/loader functions
124132 menu_items : {
125133 'clipedit': {
126 - 'd':0,
 134+ 'default':0,
127135 'html':'',
128136 'js': function( this_seq ) {
129137 this_seq.doEditSelectedClip();
@@ -132,21 +140,21 @@
133141 }
134142 },
135143 'transition': {
136 - 'd':0,
 144+ 'default':0,
137145 'html' : '<h3>' + gM( 'mwe-menu_transition' ) + '</h3>',
138146 'js':function( this_seq ) {
139147 this_seq.doEditTransitionSelectedClip();
140148 },
141149 'click_js':function( this_seq ) {
142 - // highlight the transition of the selected clip:
 150+ // Highlight the transition of the selected clip:
143151 this_seq.doEditTransitionSelectedClip();
144152 }
145153 },
146154 'cliplib': {
147 - 'd':0,
 155+ 'default':0,
148156 'html': gM( 'mwe-loading_txt' ),
149157 'js':function( this_seq ) {
150 - // load the search interface with sequence tool targets
 158+ // Load the search interface with sequence tool targets
151159 mvJsLoader.doLoad( [
152160 'remoteSearchDriver',
153161 'seqRemoteSearchDriver'
@@ -157,7 +165,7 @@
158166 }
159167 },
160168 'options': {
161 - 'd':0,
 169+ 'default':0,
162170 'html' : '<h3>' + gM( 'mwe-menu_options' ) + '</h3>' +
163171 gM( 'mwe-editor_mode' ) + '<br> ' +
164172 '<blockquote><input type="radio" value="simple_editor" name="opt_editor">' +
@@ -351,7 +359,7 @@
352360 if ( !dispCall )
353361 $j( "#seq_menu" ).tabs( 'select', this.menu_items[item].inx );
354362
355 - this.menu_items[item].d = 1;
 363+ this.menu_items[item].default = 1;
356364 // do any click_js actions:getInsertControl
357365 if ( this.menu_items[item].click_js )
358366 this.menu_items[item].click_js( this );
@@ -541,7 +549,7 @@
542550 }
543551
544552
545 - // render the menu tabs::
 553+ // Render the menu tabs::
546554 var item_containers = '';
547555 var inx = 0;
548556 var selected_tab = 0;
@@ -551,14 +559,14 @@
552560 for ( var tab_id in this.menu_items ) {
553561 menu_item = this.menu_items[tab_id];
554562 menu_item.inx = inx;
555 - if ( menu_item.d ) {
 563+ if ( menu_item.default ) {
556564 selected_tab = inx;
557565 _this.disp_menu_item = tab_id;
558566 }
559567
560568 o += '<li>' +
561 - '<a id="mv_menu_item_' + tab_id + '" href="#' + tab_id + '_ic">' + gM( 'mwe-menu_' + tab_id ) + '</a>' +
562 - '</li>';
 569+ '<a id="mv_menu_item_' + tab_id + '" href="#' + tab_id + '_ic">' + gM( 'mwe-menu_' + tab_id ) + '</a>' +
 570+ '</li>';
563571
564572 tabc += '<div id="' + tab_id + '_ic" style="overflow:auto;height:268px;" >';
565573 tabc += ( menu_item.html ) ? menu_item.html : '<h3>' + gM( 'mwe-menu_' + tab_id ) + '</h3>';
@@ -575,20 +583,20 @@
576584 select: function( event, ui ) {
577585 _this.disp( $j( ui.tab ).attr( 'id' ).replace( 'mv_menu_item_', '' ), true );
578586 }
579 - // add sorting
 587+ // Add sorting
580588 } ).find( ".ui-tabs-nav" ).sortable( { axis : 'x' } );
581589
582590
583 - // render the timeline
 591+ // Render the timeline
584592 this.renderTimeLine();
585593 this.do_refresh_timeline();
586594
587 - // load init content into containers
 595+ // Load initial content into containers
588596 this.setupMenuItems();
589597
590598 this.doFocusBindings();
591599
592 - // set up key bidnings
 600+ // Set up key bidnings
593601 $j( window ).keydown( function( e ) {
594602 js_log( 'pushed down on:' + e.which );
595603 if ( e.which == 16 )
@@ -603,32 +611,33 @@
604612 if ( ( e.which == 88 && _this.key_ctrl_down ) && !_this.inputFocus )
605613 _this.cutSelectedClips();
606614
607 - // paste cips on v + ctrl while not focused on a text area:
 615+ // Paste cips on v + ctrl while not focused on a text area:
608616 if ( ( e.which == 86 && _this.key_ctrl_down ) && !_this.inputFocus )
609617 _this.pasteClipBoardClips();
610618
611619 } );
612620 $j( window ).keyup( function( e ) {
613621 js_log( 'key up on ' + e.which );
614 - // user let go of "shift" turn off multi-select
 622+ // User let go of "shift" turn off multi-select
615623 if ( e.which == 16 )
616624 _this.key_shift_down = false;
617625
618626 if ( e.which == 17 )
619627 _this.key_ctrl_down = false;
620628
621 - // escape key (for now deselect)
 629+ // Escape key ( deselect )
622630 if ( e.which == 27 )
623631 _this.deselectClip();
624632
625633
626 - // backspace or delete key while not focused on a text area:
 634+ // Backspace or Delete key while not focused on a text area:
627635 if ( ( e.which == 8 || e.which == 46 ) && !_this.inputFocus )
628636 _this.removeSelectedClips();
629637 } );
630638 },
631 - // check all nodes for focus
632 - // @@todo it would probably be faster to search a given subnode instead of all text
 639+ /**
 640+ * Check all text nodes for focus
 641+ */
633642 doFocusBindings:function() {
634643 var _this = this;
635644 // if an input or text area has focus disable delete key binding
@@ -641,22 +650,34 @@
642651 _this.inputFocus = false;
643652 } )
644653 },
 654+ /*
 655+ * Update the timeline hook
 656+ */
645657 update_tl_hook:function( jh_time_ms ) {
646 - // put into seconds scale:
 658+ // Put into seconds scale:
647659 var jh_time_sec_float = jh_time_ms / 1000;
648 - // render playline at given time
649 - // js_log('tl scale: '+this.timeline_scale);
650 - $j( '#' + this.timeline_id + '_playline' ).css( 'left', Math.round( jh_time_sec_float / this.timeline_scale ) + 'px' );
 660+ // Render playline at given time
 661+ $j( '#' + this.timeline_id + '_playline' )
 662+ .css(
 663+ 'left',
 664+ Math.round( jh_time_sec_float / this.timeline_scale ) + 'px'
 665+ );
651666 // js_log('at time:'+ jh_time_sec + ' px:'+ Math.round(jh_time_sec_float/this.timeline_scale));
652667 },
653 - /*returns a xml or json representation of the current sequence */
 668+ /*
 669+ * Returns a xml or json representation of the current sequence
 670+ */
654671 getSeqOutputJSON:function() {
655672 js_log( 'json output:' );
656673 },
 674+ /*
 675+ * Gets the Sequence as a formated high level resource description xml string
 676+ * @returns {xml}
 677+ */
657678 getSeqOutputHLRDXML:function() {
658679 var o = '<sequence_hlrd>' + "\n";
659680 o += "\t<head>\n";
660 - // get transitions
 681+ // Get transitions
661682 for ( var i in this.plObj.transitions ) {
662683 if ( this.plObj.transitions[i] ) {
663684 var tObj = this.plObj.transitions[i].getAttributeObj();
@@ -669,9 +690,9 @@
670691 }
671692 o += "\t</head>\n";
672693
673 - // get clips
 694+ // Get clips
674695 o += "\t<body>\n";
675 - // output each track:
 696+ // Output each track:
676697 for ( var i in this.plObj.tracks ) {
677698 var curTrack = this.plObj.tracks[i];
678699 o += "\t<seq";
@@ -700,15 +721,39 @@
701722 o += "\n</seq>\n";
702723 }
703724 o += "\t</body>\n";
704 - // close the tag
 725+ // Close the tag
705726 o += '</sequence_hlrd>';
706727
707728 return o;
708729 },
 730+ /**
 731+ * Takes a track index and a clip index, to get a clip Object.
 732+ * It then calls doEditClip with that clip Object.
 733+ */
709734 editClip:function( track_inx, clip_inx ) {
710735 var cObj = this.plObj.tracks[ track_inx ].clips[ clip_inx ];
711736 this.doEditClip( cObj );
712737 },
 738+ /**
 739+ * Calls the doEditClip interface on the selected clip
 740+ * Handles cases where no clips are selected or multiple clips are selected.
 741+ */
 742+ doEditSelectedClip:function() {
 743+ js_log( "f:doEditSelectedClip:" );
 744+ // And only one clip selected
 745+ if ( $j( '.mv_selected_clip' ).length == 1 ) {
 746+ this.doEditClip( this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) );
 747+ } else if ( $j( '.mv_selected_clip' ).length === 0 ) {
 748+ // No clip selected warning:
 749+ $j( '#clipedit_ic' ).html( gM( 'mwe-no_selected_resource' ) );
 750+ } else {
 751+ // Multiple clip selected warning:
 752+ $j( '#clipedit_ic' ).html( gM( 'mwe-error_edit_multiple' ) );
 753+ }
 754+ },
 755+ /**
 756+ * Pulls up the edit transition interface for the selected clip
 757+ */
713758 doEditTransitionSelectedClip:function() {
714759 var _this = this;
715760 js_log( "f:doEditTransitionSelectedClip:" + $j( '.mv_selected_clip' ).length );
@@ -722,28 +767,21 @@
723768 $j( '#transition_ic' ).html( gM( 'mwe-error_edit_multiple' ) );
724769 }
725770 },
726 - doEditSelectedClip:function() {
727 - js_log( "f:doEditSelectedClip:" );
728 - // and only one clip selected
729 - if ( $j( '.mv_selected_clip' ).length == 1 ) {
730 - this.doEditClip( this.getClipFromSeqID( $j( '.mv_selected_clip' ).parent().attr( 'id' ) ) );
731 - } else if ( $j( '.mv_selected_clip' ).length === 0 ) {
732 - // no clip selected warning:
733 - $j( '#clipedit_ic' ).html( gM( 'mwe-no_selected_resource' ) );
734 - } else {
735 - // multiple clip selected warning:
736 - $j( '#clipedit_ic' ).html( gM( 'mwe-error_edit_multiple' ) );
737 - }
738 - },
 771+ /**
 772+ * Loads the transition edit javascript libs and
 773+ * displays the transition edit interface.
 774+ */
739775 doEditTransition:function( cObj ) {
740776 js_log( "sequence:doEditTransition" );
741777 var _this = this;
 778+ // Add a loading image
742779 mv_get_loading_img( '#transitions_ic' );
743780 mvJsLoader.doLoad( [
744781 '$j.fn.ColorPicker',
745782 'mvTimedEffectsEdit'
746783 ], function() {
747 - // no idea why this works / is needed.
 784+ // For some reason we lose scope in the options passed to mvTimedEffectsEdit
 785+ // so we re refrence the sequence here:
748786 var localSeqRef = _this;
749787 _this.myEffectEdit = new mvTimedEffectsEdit( {
750788 'rObj' : cObj,
@@ -752,22 +790,25 @@
753791 } );
754792 } )
755793 },
756 - // updates the clip details div if edit resource is set
 794+ /*
 795+ * Updates the clip details div if edit resource is set
 796+ */
757797 doEditClip:function( cObj ) {
758798 js_log( 'seq:doEditClip' );
759799 var _this = this;
760800
761 - // set default edit action (maybe edit_action can be sent via by context click)
 801+ // Set default edit action
762802 var edit_action = 'fileopts';
763803
764804 mv_get_loading_img( '#clipedit_ic' );
765 - // load the clipEdit library if not already loaded:
 805+
 806+ // Load the clipEdit library if not already loaded:
766807 mvJsLoader.doLoad( [
767808 'mvClipEdit'
768809 ], function() {
769 - // zero out the current editor:
 810+ // Zero out the current editor:
770811 _this.myClipEditor = { };
771 - // setup the cliploader
 812+ // Setup the cliploader options
772813 _this.myClipEditor = new mvClipEdit( {
773814 'rObj' : cObj,
774815 'control_ct' : 'clipedit_ic',
@@ -778,46 +819,58 @@
779820 } );
780821 } );
781822 },
782 - // save new clip segment
 823+
 824+ /*
 825+ * Save new clip segment
 826+ * FIXME this is just a stub
 827+ */
783828 saveClipEdit:function() {
784829 // saves the clip updates
785830 },
 831+
 832+ /**
 833+ * Closes the sequence and dereferences the global instance.
 834+ */
786835 closeModEditor:function() {
787836 // unset the sequencer
788837 _global['mvSeq'] = null;
789838 $j( this.target_sequence_container + ',.ui-widget-overlay' ).remove();
790839 },
791 - pasteClipBoardClips:function() {
792 - js_log( 'f:pasteClipBoardClips' );
793 - // @@todo query the server for updated clipboard
794 - // paste before the "current clip"
795 - this.addClips( this.clipboard, this.plObj.cur_clip.order );
796 - },
 840+
 841+ /**
 842+ * Copies the selected clips to the server hosted "clipboard"
 843+ *
 844+ * FIXME need to support local clipboard for stand alone editing.
 845+ * FIXME this does not really work at all right now
 846+ */
797847 copySelectedClips:function() {
798848 var this_seq = this;
799849 // set all the selected clips
800850 this.clipboard = new Array();
801851 $j( '.mv_selected_clip' ).each( function() {
802 - // add each clip to the clip board:
 852+
 853+ // Add each clip to the clip board:
803854 var cur_clip = this_seq.getClipFromSeqID( $j( this ).parent().attr( 'id' ) );
804855 this_seq.clipboard.push( cur_clip.getAttributeObj() );
 856+
805857 } );
806 - // upload clipboard to the server (if possible)
 858+
 859+ // Upload clipboard to the server (if possible)
807860 if ( mw.parseUri( document.URL ).host != mw.parseUri( this_seq.plObj.interface_url ).host ) {
808861 js_log( 'error: presently we can\'t copy clips across domains' );
809862 } else {
810 - // @@we need a api entry point to store a "clipboard"
 863+ // FIXME we need to add an api entry point to store a "clipboard"
 864+ // right now this is dependent on a custom hook:
811865 if ( this_seq.clipboardEditToken && this_seq.plObj.interface_url ) {
812866 var req_url = this_seq.plObj.interface_url.replace( /api.php/, 'index.php' ) + '?action=ajax&rs=mv_seqtool_clipboard&rsargs[]=copy';
813867 $j.ajax( {
814868 type: "POST",
815 - url:req_url,
 869+ url : req_url,
816870 data: $j.param( {
817871 "clipboard_data": $j.toJSON( this_seq.clipboard ),
818872 "clipboardEditToken": this_seq.clipboardEditToken
819873 } ),
820874 success:function( data ) {
821 - // callback( data );
822875 js_log( 'did clipboard push ' + $j.toJSON( this_seq.clipboard ) );
823876 }
824877 } );
@@ -826,13 +879,30 @@
827880 }
828881 }
829882 },
 883+ /*
 884+ * Paste the clipboard clips into the sequence
 885+ */
 886+ pasteClipBoardClips:function() {
 887+ js_log( 'f:pasteClipBoardClips' );
 888+ // @@todo query the server for updated clipboard
 889+ // paste before the "current clip"
 890+ this.addClips( this.clipboard, this.plObj.cur_clip.order );
 891+ },
 892+
 893+ /**
 894+ * Cut selected clips from the timeline
 895+ */
830896 cutSelectedClips:function() {
831897 this.copySelectedClips();
832898 this.removeSelectedClips();
833899 },
 900+
 901+ /**
 902+ * Remove selected clips from the timeline
 903+ */
834904 removeSelectedClips:function() {
835905 var remove_clip_ary = new Array();
836 - // remove selected clips from display
 906+ // Remove selected clips from display
837907 $j( '.container_track .mv_selected_clip' ).each( function() {
838908 // grab the track index from the id (assumes track_#_clip_#
839909 remove_clip_ary.push ( $j( this ).parent().attr( 'id' ).replace( 'track_', '' ).replace( 'clip_', '' ).split( '_' ) );
@@ -844,11 +914,16 @@
845915 // @@todo refresh menu of current
846916 this.doEditSelectedClip();
847917 },
 918+ /*
 919+ * Add a clip to the timeline
 920+ */
848921 addClip:function( clip, before_clip_pos, track_inx ) {
849922 this.addClips( [clip], before_clip_pos, track_inx )
850923 },
851 - // add a single or set of clips
852 - // to a given position and track_inx
 924+ /**
 925+ * add a single or set of clips
 926+ * to a given position and track_inx
 927+ */
853928 addClips:function( clipSet, before_clip_pos, track_inx ) {
854929 this_seq = this;
855930
@@ -874,6 +949,10 @@
875950 // debugger;
876951 this.do_refresh_timeline();
877952 },
 953+
 954+ /**
 955+ * Removes Clips listed in the remove_clip_ary paramater
 956+ */
878957 removeClips:function( remove_clip_ary ) {
879958 var this_seq = this;
880959 var jselect = coma = '';
Index: trunk/phase3/js2/mwEmbed/tests/testLang.html
@@ -8,7 +8,7 @@
99 }
1010 </style>
1111 <script type="text/javascript" >
12 -var scriptLoaderURID = 't14';
 12+var scriptLoaderURID = 't15';
1313 //for just setting one or two to test at a time for debug
1414 //var langKeyDebug = ['sl']; //pl
1515 var langKeyDebug = [ 'az', 'da', 'pt', 'fr', 'lv', 'en'];
@@ -195,7 +195,7 @@
196196
197197 //do a manual call to the script-lodaer:
198198 function doProcLangKey(langKey){
199 - $j.getScript('../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){
 199+ $j.getScript('../../../mwScriptLoader.php?class=mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){
200200 var o='';
201201 o+='<tr><td colspan="6" height="20" style="font-size:large"><b>Lang:' + langKey + '</b></td></tr>';
202202 //now for each langage msg:
@@ -217,8 +217,8 @@
218218 o+='<tr>'+
219219 '<td>' + numVal + '</td>' +
220220 '<td>' + mKey + '</td>' +
221 - '<td>' + $mw.lang.gMsgNoTrans( mKey ) + '</td>' +
222 - '<td id="' + tkey + '_js">' + $mw.lang.gM( mKey, numVal ) + '</td>';
 221+ '<td>' + mw.lang.gMsgNoTrans( mKey ) + '</td>' +
 222+ '<td id="' + tkey + '_js">' + mw.lang.gM( mKey, numVal ) + '</td>';
223223 //show mw col:
224224 if( mKey.substr(0, 5) == 'test_' ){
225225 o+='<td> (test msg) </td>';
Index: trunk/phase3/js2/remoteMwEmbed.js
@@ -5,7 +5,7 @@
66
77 var urlparts = getRemoteEmbedPath();
88 var mwEmbedHostPath = urlparts[0];
9 -var mwRemoteVersion = '1.09';
 9+var mwRemoteVersion = '1.10';
1010 var mwUseScriptLoader = true;
1111
1212 // setup up request Params:
@@ -68,10 +68,8 @@
6969 vidIdList.push( divs[i].getAttribute( "id" ) );
7070 }
7171 }
72 - if ( vidIdList.length > 0 ) {
73 -
74 - var jsSetVideo = [ 'embedVideo', '$j.ui', 'ctrlBuilder', '$j.cookie', '$j.ui.slider' ];
75 -
 72+ if ( vidIdList.length > 0 ) {
 73+ var jsSetVideo = [ 'embedVideo', '$j.ui', 'ctrlBuilder', '$j.cookie', '$j.ui.slider', 'kskinConfig' ];
7674 // Quick sniff use java if IE and native if firefox
7775 // ( other browsers will run detect and get on-demand )
7876 if (navigator.userAgent.indexOf("MSIE") != -1)
@@ -96,22 +94,20 @@
9795 return ;
9896 js_log( 'vidIdList on: ' + vidId + ' length: ' + vidIdList.length + ' left in the set: ' + vidIdList );
9997
100 - // Grab the thumbnail and src of the video
101 - var pimg = $j( '#' + vidId + ' img' );
102 - var poster_attr = 'poster = "' + pimg.attr( 'src' ) + '" ';
 98+ tag_type = 'video';
 99+ // Check type:
103100 var pwidth = $j( '#' + vidId ).width();
104 - var pheight = $j( '#' + vidId + ' img :first' ).attr( 'height' );
105 - if(!pheight)
106 - pheight = parseInt( pwidth * .75 );
107 - var tag_type = 'video';
108 -
109 - // Check for audio
110 - if ( pheight == '22' || pheight == '52' ) {
111 - // set width to parent width:
 101+ var $pimg = $j( '#' + vidId + ' img:first' );
 102+ if( $pimg.attr('src').split('/').pop() == 'play.png'){
112103 tag_type = 'audio';
113 - poster_attr = '';
 104+ poster_attr = '';
 105+ pheight = 0;
 106+ }else{
 107+ var poster_attr = 'poster = "' + $pimg.attr( 'src' ) + '" ';
 108+ var pheight = $pimg.attr( 'height' );
114109 }
115110
 111+
116112 // Parsed values:
117113 var src = '';
118114 var duration_attr = '';
@@ -137,8 +133,9 @@
138134 'wikiTitleKey="' + wikiTitleKey + '" ' +
139135 'src="' + src + '" ' +
140136 duration_attr +
141 - offset_attr + ' ';
142 -
 137+ offset_attr + ' ' +
 138+ 'class="kskin" ';
 139+
143140 if ( tag_type == 'audio' ) {
144141 html_out = '<audio' + common_attr + ' style="width:' + pwidth + 'px;"></audio>';
145142 } else {
@@ -147,18 +144,20 @@
148145 'style="width:' + pwidth + 'px;height:' + pheight + 'px;">' +
149146 '</video>';
150147 }
151 - // set the video tag inner html and update the height
 148+ // Set the video tag inner html and update the height
152149 $j( '#' + vidId ).html( html_out )
153150 .css( 'height', pheight + 30 );
154151
155 - }
156 - rewrite_by_id( 'mwe_' + vidId, function() {
157 - if ( vidIdList.length != 0 ) {
158 - setTimeout( function() {
159 - procVidId( vidIdList.pop() )
160 - }, 10 );
161 - }
162 - } );
 152+ // Do the actual rewrite
 153+ rewrite_by_id( 'mwe_' + vidId, function() {
 154+ if ( vidIdList.length != 0 ) {
 155+ setTimeout( function() {
 156+ procVidId( vidIdList.pop() )
 157+ }, 10 );
 158+ }
 159+ } );
 160+
 161+ }
163162 };
164163 // process each item in the vidIdList (with setTimeout to avoid locking)
165164 procVidId( vidIdList.pop() );

Follow-up revisions

RevisionCommit summaryAuthorDate
r59431* restored basic non-firefogg upload functionality per r59320 breakagedale19:02, 25 November 2009
r59433* restored basic firefogg upload functionality per r59320 breakage...dale19:34, 25 November 2009
r59435* restored copy-by-url uploads in add-media-wizard per r59320 changesdale20:15, 25 November 2009

Status & tagging log