r59526 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59525‎ | r59526 | r59527 >
Date:19:57, 28 November 2009
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: Cache browser compat check, combine some forgotten stuff for r59521
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -80,7 +80,7 @@
8181 ) {
8282 UsabilityInitiativeHooks::initialize();
8383 // Messages
84 - if ( isset( self::$modules[$module]['i18n'], self::$modules[$module]['messages'] ) ) {
 84+ if ( isset( self::$modules[$module]['i18n'], self::$modules[$module]['messages'] ) ) {
8585 wfLoadExtensionMessages( self::$modules[$module]['i18n'] );
8686 UsabilityInitiativeHooks::addMessages( self::$modules[$module]['messages'] );
8787 }
@@ -96,7 +96,7 @@
9797 // Preferences
9898 if ( isset( self::$modules[$module]['preferences'] ) ) {
9999 foreach ( self::$modules[$module]['preferences'] as $name => $preference ) {
100 - if ( !isset( $preferences[$module] ) ) {
 100+ if ( !isset( $preferences[$module] ) ) {
101101 $preferences[$module] = array();
102102 }
103103 $preferences[$module][$name] = $wgUser->getOption( $preference['key'] );
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -70,7 +70,7 @@
7171 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7272 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ),
7373 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 20 ),
74 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 21 ),
 74+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 22 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 33 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
@@ -79,10 +79,10 @@
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ),
8181 ),
8282 'combined' => array(
83 - array( 'src' => 'js/plugins.combined.js', 'version' => 90 ),
 83+ array( 'src' => 'js/plugins.combined.js', 'version' => 91 ),
8484 ),
8585 'minified' => array(
86 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 90 ),
 86+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 91 ),
8787 ),
8888 ),
8989 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -58,9 +58,13 @@
5959 return $.browser.name in $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'];
6060 },
6161 'isSupported': function() {
 62+ // Cache the return value
 63+ if ( $.wikiEditor.supported != undefined )
 64+ return $.wikiEditor.supported;
 65+
6266 if ( !$.wikiEditor.isSupportKnown ) {
6367 // Assume good faith :)
64 - return true;
 68+ return $.wikiEditor.supported = true;
6569 }
6670 var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name];
6771 for ( condition in browser ) {
@@ -68,15 +72,15 @@
6973 var val = browser[condition][1];
7074 if ( typeof val == 'string' ) {
7175 if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) {
72 - return false;
 76+ return $.wikiEditor.supported = false;
7377 }
7478 } else if ( typeof val == 'number' ) {
7579 if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) {
76 - return false;
 80+ return $.wikiEditor.supported = false;
7781 }
7882 }
7983 }
80 - return true;
 84+ return $.wikiEditor.supported = true;
8185 },
8286 // Wraps gM from js2, but allows raw text to supercede
8387 'autoMsg': function( object, property ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1364,9 +1364,13 @@
13651365 return $.browser.name in $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'];
13661366 },
13671367 'isSupported': function() {
 1368+ // Cache the return value
 1369+ if ( $.wikiEditor.supported != undefined )
 1370+ return $.wikiEditor.supported;
 1371+
13681372 if ( !$.wikiEditor.isSupportKnown ) {
13691373 // Assume good faith :)
1370 - return true;
 1374+ return $.wikiEditor.supported = true;
13711375 }
13721376 var browser = $.wikiEditor.browsers[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$.browser.name];
13731377 for ( condition in browser ) {
@@ -1374,15 +1378,15 @@
13751379 var val = browser[condition][1];
13761380 if ( typeof val == 'string' ) {
13771381 if ( !( eval( '$.browser.version' + op + '"' + val + '"' ) ) ) {
1378 - return false;
 1382+ return $.wikiEditor.supported = false;
13791383 }
13801384 } else if ( typeof val == 'number' ) {
13811385 if ( !( eval( '$.browser.versionNumber' + op + val ) ) ) {
1382 - return false;
 1386+ return $.wikiEditor.supported = false;
13831387 }
13841388 }
13851389 }
1386 - return true;
 1390+ return $.wikiEditor.supported = true;
13871391 },
13881392 // Wraps gM from js2, but allows raw text to supercede
13891393 'autoMsg': function( object, property ) {
@@ -2186,50 +2190,50 @@
21872191 */
21882192 create: function( context, config ) {
21892193 // Build the dialog behind the Publish button
2190 - var dialogID = 'wikiEditor-' + context.instance + '-savedialog';
 2194+ var dialogID = 'wikiEditor-' + context.instance + '-dialog';
21912195 $.wikiEditor.modules.dialogs.fn.create(
21922196 context,
21932197 {
21942198 previewsave: {
21952199 id: dialogID,
2196 - titleMsg: 'wikieditor-publish-savedialog-title',
 2200+ titleMsg: 'wikieditor-publish-dialog-title',
21972201 html: '\
2198 - <div class="wikiEditor-savedialog-copywarn"></div>\
2199 - <div class="wikiEditor-savedialog-editoptions">\
 2202+ <div class="wikiEditor-dialog-copywarn"></div>\
 2203+ <div class="wikiEditor-dialog-editoptions">\
22002204 <form>\
2201 - <label for="wikiEditor-' + context.instance + '-savedialog-summary"\
2202 - rel="wikieditor-publish-savedialog-summary"></label>\
 2205+ <label for="wikiEditor-' + context.instance + '-dialog-summary"\
 2206+ rel="wikieditor-publish-dialog-summary"></label>\
22032207 <br />\
2204 - <input type="text" id="wikiEditor-' + context.instance + '-savedialog-summary"\
 2208+ <input type="text" id="wikiEditor-' + context.instance + '-dialog-summary"\
22052209 style="width: 100%;" />\
22062210 <br />\
22072211 <input type="checkbox"\
2208 - id="wikiEditor-' + context.instance + '-savedialog-minor" />\
2209 - <label for="wikiEditor-' + context.instance + '-savedialog-minor"\
2210 - rel="wikieditor-publish-savedialog-minor"></label>\
 2212+ id="wikiEditor-' + context.instance + '-dialog-minor" />\
 2213+ <label for="wikiEditor-' + context.instance + '-dialog-minor"\
 2214+ rel="wikieditor-publish-dialog-minor"></label>\
22112215 <br />\
22122216 <input type="checkbox"\
2213 - id="wikiEditor-' + context.instance + '-savedialog-watch" />\
2214 - <label for="wikiEditor-' + context.instance + '-savedialog-watch"\
2215 - rel="wikieditor-publish-savedialog-watch"></label>\
 2217+ id="wikiEditor-' + context.instance + '-dialog-watch" />\
 2218+ <label for="wikiEditor-' + context.instance + '-dialog-watch"\
 2219+ rel="wikieditor-publish-dialog-watch"></label>\
22162220 </form>\
22172221 </div>',
22182222 init: function() {
22192223 $(this).find( '[rel]' ).each( function() {
22202224 $(this).text( gM( $(this).attr( 'rel' ) ) );
22212225 });
2222 - $(this).find( '.wikiEditor-savedialog-copywarn' )
 2226+ $(this).find( '.wikiEditor-dialog-copywarn' )
22232227 .html( $( '#editpage-copywarn' ).html() );
22242228
22252229 if ( $( '#wpMinoredit' ).size() == 0 )
2226 - $( '#wikiEditor-' + context.instance + '-savedialog-minor' ).hide();
 2230+ $( '#wikiEditor-' + context.instance + '-dialog-minor' ).hide();
22272231 else if ( $( '#wpMinoredit' ).is( ':checked' ) )
2228 - $( '#wikiEditor-' + context.instance + '-savedialog-minor' )
 2232+ $( '#wikiEditor-' + context.instance + '-dialog-minor' )
22292233 .attr( 'checked', 'checked' );
22302234 if ( $( '#wpWatchthis' ).size() == 0 )
2231 - $( '#wikiEditor-' + context.instance + '-savedialog-watch' ).hide();
 2235+ $( '#wikiEditor-' + context.instance + '-dialog-watch' ).hide();
22322236 else if ( $( '#wpWatchthis' ).is( ':checked' ) )
2233 - $( '#wikiEditor-' + context.instance + '-savedialog-watch' )
 2237+ $( '#wikiEditor-' + context.instance + '-dialog-watch' )
22342238 .attr( 'checked', 'checked' );
22352239
22362240 $(this).find( 'form' ).submit( function( e ) {
@@ -2239,25 +2243,25 @@
22402244 },
22412245 dialog: {
22422246 buttons: {
2243 - 'wikieditor-publish-savedialog-publish': function() {
 2247+ 'wikieditor-publish-dialog-publish': function() {
22442248 var minorChecked = $( '#wikiEditor-' + context.instance +
2245 - '-savedialog-minor' ).is( ':checked' ) ?
 2249+ '-dialog-minor' ).is( ':checked' ) ?
22462250 'checked' : '';
22472251 var watchChecked = $( '#wikiEditor-' + context.instance +
2248 - '-savedialog-watch' ).is( ':checked' ) ?
 2252+ '-dialog-watch' ).is( ':checked' ) ?
22492253 'checked' : '';
22502254 $( '#wpMinoredit' ).attr( 'checked', minorChecked );
22512255 $( '#wpWatchthis' ).attr( 'checked', watchChecked );
22522256 $( '#wpSummary' ).val( $j( '#wikiEditor-' + context.instance +
2253 - '-savedialog-summary' ).val() );
 2257+ '-dialog-summary' ).val() );
22542258 $( '#editform' ).submit();
22552259 },
2256 - 'wikieditor-publish-savedialog-goback': function() {
 2260+ 'wikieditor-publish-dialog-goback': function() {
22572261 $(this).dialog( 'close' );
22582262 }
22592263 },
22602264 open: function() {
2261 - $( '#wikiEditor-' + context.instance + '-savedialog-summary' ).focus();
 2265+ $( '#wikiEditor-' + context.instance + '-dialog-summary' ).focus();
22622266 },
22632267 width: 500
22642268 },
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -81,9 +81,10 @@
8282 this.scrollTop+=range.offsetTop;else if(options.force){range.move('character',-1);range.select();}}
8383 $(this).trigger('scrollToPosition');});}};switch(command){case'encapsulateSelection':options=$.extend({'pre':'','peri':'','post':'','ownline':false,'replace':false},options);break;case'getCaretPosition':options=$.extend({'startAndEnd':false,},options);break;case'setSelection':options=$.extend({'start':undefined,'end':undefined},options);if(options.end===undefined)
8484 options.end=options.start;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;}
85 -var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;return(hasIframe?context.fn:fn)[command].call(this,options);};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupportKnown':function(){return $.browser.name in $.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'];},'isSupported':function(){if(!$.wikiEditor.isSupportKnown){return true;}
86 -var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return false;}}}
87 -return true;},'autoMsg':function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
 85+var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;return(hasIframe?context.fn:fn)[command].call(this,options);};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3.1]]}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupportKnown':function(){return $.browser.name in $.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'];},'isSupported':function(){if($.wikiEditor.supported!=undefined)
 86+return $.wikiEditor.supported;if(!$.wikiEditor.isSupportKnown){return $.wikiEditor.supported=true;}
 87+var browser=$.wikiEditor.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];for(condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return $.wikiEditor.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return $.wikiEditor.supported=false;}}}
 88+return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
8889 if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}},'fixOperaBrokenness':function(s){return s;}};$.fn.wikiEditor=function(){if($j.wikiEditor.isSupportKnown()&&!$j.wikiEditor.isSupported()){return $(this);}
8990 var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);context.api={'addModule':function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
9091 if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}
@@ -115,31 +116,31 @@
116117 $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('preview'in context.modules){return;}
117118 context.modules.preview={'previousText':null};context.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previousText==wikitext){return;}
118119 context.$preview.find('.wikiEditor-preview-contents').empty();context.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(data.parse==undefined||data.parse.text==undefined||data.parse.text['*']==undefined){return;}
119 -context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']);},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-savedialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-savedialog-title',html:'\
120 - <div class="wikiEditor-savedialog-copywarn"></div>\
121 - <div class="wikiEditor-savedialog-editoptions">\
 120+context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']);},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\
 121+ <div class="wikiEditor-dialog-copywarn"></div>\
 122+ <div class="wikiEditor-dialog-editoptions">\
122123 <form>\
123 - <label for="wikiEditor-'+context.instance+'-savedialog-summary"\
124 - rel="wikieditor-publish-savedialog-summary"></label>\
 124+ <label for="wikiEditor-'+context.instance+'-dialog-summary"\
 125+ rel="wikieditor-publish-dialog-summary"></label>\
125126 <br />\
126 - <input type="text" id="wikiEditor-'+context.instance+'-savedialog-summary"\
 127+ <input type="text" id="wikiEditor-'+context.instance+'-dialog-summary"\
127128 style="width: 100%;" />\
128129 <br />\
129130 <input type="checkbox"\
130 - id="wikiEditor-'+context.instance+'-savedialog-minor" />\
131 - <label for="wikiEditor-'+context.instance+'-savedialog-minor"\
132 - rel="wikieditor-publish-savedialog-minor"></label>\
 131+ id="wikiEditor-'+context.instance+'-dialog-minor" />\
 132+ <label for="wikiEditor-'+context.instance+'-dialog-minor"\
 133+ rel="wikieditor-publish-dialog-minor"></label>\
133134 <br />\
134135 <input type="checkbox"\
135 - id="wikiEditor-'+context.instance+'-savedialog-watch" />\
136 - <label for="wikiEditor-'+context.instance+'-savedialog-watch"\
137 - rel="wikieditor-publish-savedialog-watch"></label>\
 136+ id="wikiEditor-'+context.instance+'-dialog-watch" />\
 137+ <label for="wikiEditor-'+context.instance+'-dialog-watch"\
 138+ rel="wikieditor-publish-dialog-watch"></label>\
138139 </form>\
139 - </div>',init:function(){$(this).find('[rel]').each(function(){$(this).text(gM($(this).attr('rel')));});$(this).find('.wikiEditor-savedialog-copywarn').html($('#editpage-copywarn').html());if($('#wpMinoredit').size()==0)
140 -$('#wikiEditor-'+context.instance+'-savedialog-minor').hide();else if($('#wpMinoredit').is(':checked'))
141 -$('#wikiEditor-'+context.instance+'-savedialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0)
142 -$('#wikiEditor-'+context.instance+'-savedialog-watch').hide();else if($('#wpWatchthis').is(':checked'))
143 -$('#wikiEditor-'+context.instance+'-savedialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-savedialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-savedialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-savedialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-savedialog-summary').val());$('#editform').submit();},'wikieditor-publish-savedialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-savedialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'166px',minimumWidth:'70px',fn:{create:function(context,config){if('$toc'in context.modules){return;}
 140+ </div>',init:function(){$(this).find('[rel]').each(function(){$(this).text(gM($(this).attr('rel')));});$(this).find('.wikiEditor-dialog-copywarn').html($('#editpage-copywarn').html());if($('#wpMinoredit').size()==0)
 141+$('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked'))
 142+$('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0)
 143+$('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked'))
 144+$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'166px',minimumWidth:'70px',fn:{create:function(context,config){if('$toc'in context.modules){return;}
144145 var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);$.wikiEditor.modules.toc.fn.build(context,config);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
145146 section=Math.max(0,section);}
146147 var sectionLink=context.modules.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0)

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59521UsabilityInitiative: Make publish module workcatrope18:59, 28 November 2009

Status & tagging log