r73648 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73647‎ | r73648 | r73649 >
Date:23:44, 23 September 2010
Author:dale
Status:deferred
Tags:
Comment:
fixes to adding timed text interface
Modified paths:
  • /branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/TimedText/mw.TimedTextEdit.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js
@@ -23,15 +23,14 @@
2424 // Add the swarm source
2525 mw.log(" SwarmTransport :: checkPlayerSourcesEvent " + swapedPlayerId);
2626 _this.addSwarmSource( embedPlayer, callback );
27 - } else {
28 - // No swarm support just directly issue the callback
29 - callback();
30 - }
 27+ }
 28+ // Don't block on swarm request, directly do the callback
 29+ callback();
3130 } );
3231
3332 // Check if we have a "recommend" binding and provide an xpi install link
3433 mw.log('SwarmTransport::bind:addControlBindingsEvent');
35 - $j( embedPlayer ).bind( 'addControlBindingsEvent', function(){
 34+ $j( embedPlayer ).bind( 'addControlBindingsEvent', function(){
3635 if( mw.getConfig( 'SwarmTransport.Recommend' ) &&
3736 typeof window['swarmTransport'] == 'undefined' &&
3837 $j.browser.mozilla )
@@ -87,14 +86,14 @@
8887 callback();
8988 return ;
9089 }
91 - mw.log( 'SwarmTransport: addSwarmSource for: ' + source.getSrc() + "\n\nGot:" + data.torrent );
 90+ mw.log( 'SwarmTransport: addSwarmSource for: ' + source.getSrc() + "\n\nGot:" + data.torrent );
 91+ // XXX need to update prefrence
9292 embedPlayer.mediaElement.tryAddSource(
9393 $j('<source />')
9494 .attr( {
9595 'type' : 'video/swarmTransport',
9696 'title': gM('mwe-swarmtransport-stream-ogg'),
97 - 'src': 'tribe://' + data.torrent,
98 - 'default' : true // Mark as default source
 97+ 'src': 'tribe://' + data.torrent
9998 } )
10099 .get( 0 )
101100 );
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedTextEdit.js
@@ -185,7 +185,7 @@
186186 $j('#timed-text-file-preview')
187187 .css({
188188 'width':'100%',
189 - 'height': ( $target.find( '.rightcolumn' ).height() - $j('#timed-text-rightcolum-desc').height() ) + 'px'
 189+ 'height': '300px'
190190 });
191191
192192 // Add Select file:
@@ -215,9 +215,9 @@
216216 } )
217217 .change(function() {
218218 var langKey = $j(this).val();
219 - if( mw.languages[ langKey ] ) {
 219+ if( mw.Language.names[ langKey ] ) {
220220 $buttonTarget.find('.btnText').text(
221 - unescape( mw.languages[ langKey ] )
 221+ unescape( mw.Language.names[ langKey ] )
222222 );
223223 }
224224 }),
@@ -233,6 +233,7 @@
234234
235235
236236 var $buttonTarget = $target.find('.language-select-btn');
 237+
237238 // Add menu container:
238239 var loc = $buttonTarget.position();
239240 $target.append(
@@ -241,10 +242,8 @@
242243 .attr( 'id', 'upload-language-select' )
243244 .loadingSpinner()
244245 .css( {
245 - 'position' : 'absolute',
246 - 'z-index' : 10,
247 - 'top' : ( loc.top + 40 ) + 'px',
248 - 'left' : parseInt( loc.left ) + 'px',
 246+ 'position' : 'relative',
 247+ 'z-index' : 10,
249248 'height' : '180px',
250249 'width' : '180px',
251250 'overflow' : 'auto',
@@ -254,11 +253,16 @@
255254 .hide()
256255 );
257256 // Add menu binding to button target
258 - $buttonTarget.menu( {
259 - 'content' : _this.getLanguageList(),
260 - 'backLinkText' : gM( 'mwe-timedtext-back-btn' ),
261 - 'targetMenuContainer': '#upload-language-select'
262 - } );
 257+ setTimeout(function(){
 258+ $buttonTarget.menu( {
 259+ 'content' : _this.getLanguageList(),
 260+ 'backLinkText' : gM( 'mwe-timedtext-back-btn' ),
 261+ 'targetMenuContainer': '#upload-language-select',
 262+ 'keepPosition' : true
 263+ } );
 264+ // force the layout ( menu binding does strange things )
 265+ $j('#upload-language-select').css( {'left': '315px', 'top' : '87px', 'position' : 'absolute'});
 266+ },10);
263267
264268
265269 //Add upload input bindings:
@@ -279,9 +283,9 @@
280284 var langKey = $j(this).val().split( '.' );
281285 var extension = langKey.pop();
282286 langKey = langKey.pop();
283 - if( mw.languages[ langKey ] ) {
 287+ if( mw.Language.names[ langKey ] ) {
284288 $buttonTarget.find('.btnText').text(
285 - unescape( mw.languages[ langKey ] )
 289+ unescape( mw.Language.names[ langKey ] )
286290 );
287291 // Update the key code
288292 $j('#timed-text-langKey-input').val( langKey );
@@ -338,22 +342,29 @@
339343 buttons[ gM("mwe-timedtext-upload-text-another")] = function() {
340344 // just close the current dialog:
341345 $j( this ).dialog('close');
342 - }
 346+ };
343347 buttons[ gM( "mwe-timedtext-upload-text-done-uploading" ) ] = function() {
344348 window.location.reload();
345 - }
 349+ };
346350 //Edit success
347 - mw.addDialog( {
348 - 'title' : gM( "mwe-timedtext-upload-text-done"),
349 - 'content' : gM("mwe-timedtext-upload-text-success"),
350 - 'buttons' : buttons
351 - })
 351+ setTimeout(function(){
 352+ mw.addDialog( {
 353+ 'width' : '400px',
 354+ 'title' : gM( "mwe-timedtext-upload-text-done"),
 355+ 'content' : gM("mwe-timedtext-upload-text-success"),
 356+ 'buttons' : buttons
 357+ });
 358+ },10 );
352359 }else{
353 - mw.addDialog({
354 - 'title' : gM( "mwe-timedtext-upload-text-fail-title"),
355 - 'content' :gM( "mwe-timedtext-upload-text-fail-desc"),
356 - 'buttons' : gM( 'mwe-ok' )
357 - })
 360+ //Edit fail
 361+ setTimeout(function(){
 362+ mw.addDialog({
 363+ 'width' : '400px',
 364+ 'title' : gM( "mwe-timedtext-upload-text-fail-title"),
 365+ 'content' :gM( "mwe-timedtext-upload-text-fail-desc"),
 366+ 'buttons' : gM( 'mwe-ok' )
 367+ });
 368+ },10 );
358369 }
359370 });
360371 })
@@ -374,8 +385,8 @@
375386 var _this = this;
376387 var $langMenu = $j( '<ul>' );
377388 // Loop through all supported languages:
378 - for ( var langKey in mw.languages ) {
379 - var language = mw.languages [ langKey ];
 389+ for ( var langKey in mw.Language.names ) {
 390+ var language = mw.Language.names [ langKey ];
380391 var source_icon = 'radio-on';
381392 //check if the key is in the _this.parentTimedText source array
382393 for( var i in _this.parentTimedText.textSources ) {
@@ -393,15 +404,16 @@
394405 },
395406 getLangMenuItem: function( langKey , source_icon) {
396407 return $j.getLineItem(
397 - langKey + ' - ' + unescape( mw.languages[ langKey ] ),
 408+ langKey + ' - ' + unescape( mw.Language.names[ langKey ] ),
398409 source_icon,
399 - function() {
 410+ function() {
400411 mw.log( "Selected: " + langKey );
401412 // Update the input box text
402413 $j('#timed-text-langKey-input').val( langKey );
403 - // Update the menu item:
404 - $j( '#language-select' ).val( unescape( mw.languages[ langKey ] ) )
405 - } );
 414+ // Update the menu item:
 415+ $j('#language-select').find('.btnText').text( unescape( mw.Language.names[ langKey ] ) )
 416+ }
 417+ );
406418 },
407419 /**
408420 * Creates the interface dialog container
@@ -430,18 +442,23 @@
431443 $j( _this.target_container ).dialog( {
432444 bgiframe: true,
433445 autoOpen: true,
 446+ width: $j(window).width()-50,
 447+ height: $j(window).height()-50,
 448+ position : 'center',
434449 modal: true,
435450 draggable: false,
436451 resizable: false,
437452 buttons: cancelButton,
438453 close: function() {
439 - // if we are 'editing' we should confirm they want to exist:
 454+ // @@TODO if we are 'editing' we should confirm they want to exist:
440455 $j( this ).parents( '.ui-dialog' ).fadeOut( 'slow' );
441456 }
442457 } );
 458+ // set a non-blocking fit window request
 459+ setTimeout(function(){
 460+ $j( _this.target_container ).dialogFitWindow();
 461+ },10);
443462
444 - $j( _this.target_container ).dialogFitWindow();
445 -
446463 // Add the window resize hook to keep dialog layout
447464 $j( window ).resize( function() {
448465 $j( _this.target_container ).dialogFitWindow();
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
@@ -73,7 +73,7 @@
7474
7575 }
7676 if( this.isConfigured() ){
77 - mw.log("Error: Sequencer server needs a full serverConfig to be initialized")
 77+ mw.log("Error: Sequencer server needs a full serverConfig to be initialized");
7878 return false;
7979 }
8080 },
@@ -107,7 +107,7 @@
108108 var _this = this;
109109 mw.getTitleText( this.getApiUrl(), this.getTitleKey(), function( smilPage ){
110110 // Check for remote payload wrapper
111 - // XXX need to support multipe pages in single context
 111+ // XXX need to support multiple pages in single context
112112 _this.currentSequencePage = _this.parseSequencerPage( smilPage );
113113 // Cache the latest serverSmil ( for local change checks )
114114 // ( save requests automatically respond with warnings on other user updates )
@@ -164,7 +164,7 @@
165165 'pageEnd' : $j.trim(
166166 pageText.substring( pageText.indexOf(endKey) + endKey.length )
167167 )
168 - }
 168+ };
169169 },
170170
171171
@@ -185,7 +185,7 @@
186186 },
187187 // Check if the sequence was saved in this edit session
188188 hasSequenceBeenSavedOrPublished: function(){
189 - return this.sequenceSaved || this.sequencePublished
 189+ return ( this.sequenceSaved || this.sequencePublished );
190190 },
191191 // Get a save token, if unable to do so return false
192192 getSaveToken: function( callback ){
@@ -196,7 +196,7 @@
197197 }
198198 mw.getToken( this.getApiUrl(), this.getTitleKey(), function( saveToken ){
199199 _this.saveToken = saveToken;
200 - callback ( _this.saveToken )
 200+ callback ( _this.saveToken );
201201 });
202202 },
203203
Index: branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js
@@ -166,8 +166,12 @@
167167 if (options.flyOutOnState) { container.find('li a').removeClass(options.flyOutOnState); };
168168 if (options.callerOnState) { caller.removeClass(options.callerOnState); };
169169 if (container.is('.fg-menu-ipod')) { menu.resetDrilldownMenu(); };
170 - if (container.is('.fg-menu-flyout')) { menu.resetFlyoutMenu(); };
171 - container.parent().hide();
 170+ if (container.is('.fg-menu-flyout')) { menu.resetFlyoutMenu(); };
 171+ if( ! options.keepPosition ){
 172+ container.parent().hide();
 173+ } else {
 174+ container.hide();
 175+ }
172176 menu.menuOpen = false;
173177 $(document).unbind('click', killAllMenus);
174178 $(document).unbind('keydown');
@@ -283,14 +287,18 @@
284288
285289 this.create = function() {
286290 mw.log( "jquery.menu.create ");
 291+
287292 container.css({
288293 'width' : options.width
289294 })
290 - .appendTo('body')
291295 .find( 'ul:first' )
292296 .not( '.fg-menu-breadcrumb' )
293297 .addClass('fg-menu');
294298
 299+ if(!options.keepPosition){
 300+ container.appendTo('body')
 301+ }
 302+
295303
296304 container.find('ul, li a').addClass('ui-corner-all');
297305
@@ -345,8 +353,9 @@
346354 function() { $(this).removeClass(options.linkHoverSecondary); }
347355 );
348356 };
349 -
350 - menu.setPosition(container, caller, options);
 357+ if( !options.keepPosition ){
 358+ menu.setPosition(container, caller, options);
 359+ }
351360 menu.menuExists = true;
352361
353362 if( typeof options.createMenuCallback == 'function' ){

Status & tagging log