r74202 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74201‎ | r74202 | r74203 >
Date:14:06, 3 October 2010
Author:dale
Status:deferred
Tags:
Comment:
* improved font resize
* added help button in sequence menu
* other minor code clean up
Modified paths:
  • /branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
@@ -50,7 +50,7 @@
5151 },
5252 'condition': function( _this ){
5353 // Only display if no server is defined:
54 - return !( _this.sequencer.getServer().isConfigured() )
 54+ return !( _this.sequencer.getServer().isConfigured() );
5555 }
5656 },
5757 'publish': {
@@ -60,22 +60,19 @@
6161 },
6262 'condition': function( _this ){
6363 // Only display if publishing server is present
64 - return ( _this.sequencer.getServer().isConfigured() )
 64+ return ( _this.sequencer.getServer().isConfigured() );
6565 }
6666 },
6767 'help_divider': 'divider',
6868 'help': {
6969 'icon' : 'info',
70 - 'action' : function(){
71 - // follow link to
72 - //$j( this ).attr('href', )
73 - }
 70+ 'href' : 'http://commons.wikimedia.org/wiki/Commons:Sequencer'
7471 },
7572 'exit_divider': 'divider',
7673 'exit' : {
7774 'icon' : 'power',
7875 'action' : function( _this ){
79 - mw.log( 'check for save')
 76+ mw.log( 'check for save');
8077 _this.sequencer.getActionsSequence().exit();
8178 }
8279 }
@@ -157,10 +154,10 @@
158155 showSpeed: 100,
159156 createMenuCallback: function(){
160157 // Sync the disabled enabled state to menu
161 - _this.syncMenuState( menuKey )
 158+ _this.syncMenuState( menuKey );
162159 }
163160 })
164 - )
 161+ );
165162 }
166163 drawTopMenu( menuKey );
167164 }
@@ -202,7 +199,7 @@
203200 'http://wikimedia.org'
204201 )
205202 )
206 - )
 203+ );
207204 }
208205 },
209206 /**
@@ -217,7 +214,7 @@
218215 mw.log('sync: ' + menuItemKey + ' in-dom:' + $menuItem.length + ' isd:' + isDisabled);
219216 if( $menuItem.hasClass( 'disabled') ){
220217 if( ! isDisabled ){
221 - $menuItem.removeClass( 'disabled' )
 218+ $menuItem.removeClass( 'disabled' );
222219 }
223220 } else {
224221 if( isDisabled ){
@@ -226,7 +223,9 @@
227224 }
228225 }
229226 },
230 - /* return a top menuItem with all its associated menuItems */
 227+ /**
 228+ * Return a top menuItem with all its associated menuItems
 229+ */
231230 getMenuSet: function( menuKey ){
232231 var _this = this;
233232 var menuConfig = this.menuConfig;
@@ -261,7 +260,7 @@
262261 // Do a normal menu item include:
263262 $menu.append(
264263 _this.getMenuItem( menuKey, menuItemKey )
265 - )
 264+ );
266265 }
267266 return $menu;
268267 },
@@ -275,23 +274,27 @@
276275 menuItem.icon,
277276 function(){
278277 if( typeof menuItem.action == 'function'){
279 - menuItem.action( _this );
280 - return ;
 278+ return menuItem.action( _this );
281279 }
282 - mw.log( "Error:: SequencerMenu:: no action item for " + menuKey + '-' + menuItemKey );
 280+ return true;
283281 }
284282 );
285283
 284+ // Check if the menu item has a direct link:
 285+ if( menuItem.href ) {
 286+ $li.find('a').attr({ 'href' : menuItem.href, 'target' : '_new' } );
 287+ }
 288+
286289 if( menuItem.disabled === true ){
287290 $li.addClass( 'disabled' );
288291 }
289292
290293 // Set the ID for easy reference
291 - $li.attr( 'id', _this.getMenuItemId( menuKey, menuItemKey ) )
 294+ $li.attr( 'id', _this.getMenuItemId( menuKey, menuItemKey ) );
292295
293296 // Set the tooltip / title if provided
294297 if( mw.Language.isMsgKeyDefined( 'mwe-sequencer-menu-' + menuKey + '-' + menuItemKey + '-desc' ) ){
295 - $li.attr( 'title', gM('mwe-sequencer-menu-' + menuKey + '-' + menuItemKey + '-desc') )
 298+ $li.attr( 'title', gM('mwe-sequencer-menu-' + menuKey + '-' + menuItemKey + '-desc') );
296299 }
297300
298301 return $li;
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
@@ -4,7 +4,7 @@
55
66 mw.includeAllModuleMessages();
77
8 -/*
 8+/**
99 * Setup the sequencer jQuery binding:
1010 */
1111
@@ -17,7 +17,7 @@
1818 }
1919 var seqContainer = $j( this.selector ).get(0);
2020
21 - // Support jquery ui style 'destroy' call
 21+ // Support jQuery ui style 'destroy' call
2222 if( options == 'destroy' ){
2323 if( seqContainer['sequencer'] )
2424 delete seqContainer['sequencer'];
@@ -41,10 +41,10 @@
4242 // Draw the sequencer UI
4343 seqContainer['sequencer'].drawUI();
4444
45 - // Return the sequence jquery object
 45+ // Return the sequence jQuery object
4646 return this;
4747
48 - }
 48+ };
4949 } )( jQuery );
5050
5151 //Wrap in mw closure to avoid global leakage
@@ -62,7 +62,7 @@
6363 'addMedia': null,
6464 'onExitCallback' : null,
6565 'videoAspect' : '4:3'
66 -}
 66+};
6767 mw.Sequencer = function( options ) {
6868 return this.init( options );
6969 };
@@ -83,7 +83,7 @@
8484 if( typeof options[ optionName] != 'undefined'){
8585 this.options[optionName] = options[ optionName] ;
8686 } else {
87 - this.options[optionName] = mw_sequenceedit_default_options[ optionName ]
 87+ this.options[optionName] = mw_sequenceedit_default_options[ optionName ];
8888 }
8989 }
9090
@@ -92,7 +92,7 @@
9393 this.smilSource = options.smilSource;
9494 }
9595 if( this.options.interfaceContainer ){
96 - this.interfaceContainer = this.options.interfaceContainer
 96+ this.interfaceContainer = this.options.interfaceContainer;
9797 }
9898
9999 // For style properties assign top level mwe-sequencer class
@@ -102,7 +102,7 @@
103103
104104 getOption: function( optionName ){
105105 if( this.options[ optionName ]){
106 - return this.options[ optionName ]
 106+ return this.options[ optionName ];
107107 }
108108 return false;
109109 },
@@ -148,7 +148,7 @@
149149 // Add the ui layout
150150 this.getContainer().html(
151151 this.getUiLayout()
152 - )
 152+ );
153153
154154 // Once the layout is in the dom setup resizableLayout "layout" options
155155 this.applyLayoutBindings();
@@ -180,7 +180,7 @@
181181 if( _this.getOption( 'newSequence' ) ){
182182 _this.smilSource = _this.getDataUrl( _this.getNewSmilXML() );
183183 } else {
184 - mw.log( "Load smil source from server" )
 184+ mw.log( "Load smil source from server" );
185185 // Load from the server
186186 _this.getServer().getSmilXml( function( smilXml ){
187187 // xxx should parse the sequence data
@@ -188,14 +188,14 @@
189189 smilXml = _this.getNewSmilXML();
190190 }
191191 _this.smilSource = _this.getDataUrl( smilXml );
192 - callback( _this.smilSource )
193 - })
 192+ callback( _this.smilSource );
 193+ });
194194 // Wait for server to return smil source
195195 return ;
196196 }
197197 }
198198 // return the smilSource
199 - callback( _this.smilSource )
 199+ callback( _this.smilSource );
200200 },
201201 getDataUrl: function( xmlString ){
202202 if( ! xmlString ){
@@ -292,7 +292,7 @@
293293 if( ! this.addByUri ){
294294 this.addByUri = new mw.SequencerAddByUri( this );
295295 }
296 - return this.addByUri
 296+ return this.addByUri;
297297 },
298298 getKeyBindings:function(){
299299 if( ! this.keyBindings ){
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
@@ -108,6 +108,10 @@
109109 'mwe-sequencer-menu-sequence-publish' => 'Publish',
110110 'mwe-sequencer-menu-sequence-publish-desc' => 'Publish sequence',
111111 'mwe-sequencer-menu-sequence-renderdisk' => 'Render to disk',
 112+
 113+ 'mwe-sequencer-menu-sequence-help' => 'Help',
 114+ 'mwe-sequencer-menu-sequence-help-desc' => 'Sequencer help page',
 115+
112116 'mwe-sequencer-menu-sequence-exit' => 'Exit',
113117 'mwe-sequencer-menu-sequence-exit-desc' => 'Exit the sequencer',
114118 'mwe-sequencer-confirm-exit' => 'Are you sure you want to exit?',
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
@@ -522,30 +522,23 @@
523523 });
524524 });
525525 // Switch any named font-size attribute to em
526 - /*$htmlLayout.find('[style]').each( function(inx, node){
527 - if( $j(node).css('font-size') ){
 526+ $htmlLayout.find('[style]').each( function(inx, node){
 527+ if( $j(node).css('font-size') ){
528528 if( _this.emFontSizeMap[ $j(node).css('font-size') ] ){
529529 $j(node).css('font-size', _this.emFontSizeMap[ $j(node).css('font-size') ] );
530 - } else {
531 - //@@ todo translate absolute pixle size to relative
 530+ } else if( $j(node).css('font-size').indexOf('px') != -1 ) {
 531+ // Translate absolute pixel size to relative
 532+ $j(node).css('font-size',
 533+ ( ( fontScalePercent * .5 ) * parseFloat( $j(node).css('font-size') ) ) + 'px'
 534+ );
532535 }
533536 }
534 - });*/
535 - // Switch any named font-size attribute to relative pixle size
536 - $htmlLayout.find('[style]').each( function(inx, node){
537 - if( $j(node).css('font-size') ){
538 - $j(node).css('font-size',
539 - ( fontScalePercent * parseFloat( $j(node).css('font-size') ) ) + 'px'
540 - );
541 - }
542 - })
 537+ });
543538
544539 // Strip any links for thumbs of player
545540 $htmlLayout.find('a').attr('href', '#');
546541 }
547 -
548 -
549 -
 542+
550543 // Return the cdata
551544 return $j('<div />')
552545 // Wrap in font-size percentage relative to virtual size
Index: branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js
@@ -35,13 +35,13 @@
3636 var $li = $j( '<li>' ).append(
3737 $j('<a>')
3838 .attr('href', '#')
39 - .click( callback )
40 - )
 39+ .click( callback )
 40+ );
4141 if( icon ) {
4242 $li.find( 'a' ).append(
4343 $j('<span style="float:left;"></span>')
4444 .addClass( 'ui-icon ui-icon-' + icon )
45 - )
 45+ );
4646 }
4747 $li.find( 'a' ).append( $j('<span>').text( string ) );
4848 //mw.log(' li html: ' + $j('<div>').append( $li ).html() );

Status & tagging log