User:KyleH/global.js

if (wgAction == 'edit' || wgAction == 'submit') { SummaryResize = function { jQuery.noConflict; /* No idea what this does ... it was used in the other function */ TotalWidth = 0;

/* Changing wpSummary ID because we can't override !important in CSS */ jQuery('#wpSummary').attr('id','wpNewSummary'); /* Calculate the width of each of the items inside #edit_enhancements_toolbar */ jQuery('#edit_enhancements_toolbar ul li').each(function         {               TotalWidth += jQuery(this).outerWidth(true);          });

/* Subtract the current summary box width */ TotalWidth -= jQuery('#wpNewSummary').width;

/* Calculate the new width that will be necessary to fill the box. I have no idea why I end up 1 pixel too big, so I subtract 1 */ wpSummaryWidth = jQuery('#edit_enhancements_toolbar ul').innerWidth - TotalWidth - 1;

/* ... but only if it's between 200 and 500 pixels wide */ wpSummaryWidth = wpSummaryWidth > 200 ? wpSummaryWidth : 200; wpSummaryWidth = wpSummaryWidth < 500 ? wpSummaryWidth : 500;

/* ... then actually set the width */ jQuery('#wpNewSummary').width(wpSummaryWidth); }

ChangeButton = function { jQuery('#wpDiff').remove; jQuery('div.editButtons').prepend('(Show changes)'); jQuery('#wpDiff').click(function         {               jQuery('div.editButtons').prepend('');               document.editform.submit;          }); }

YAHOO.util.Event.on(window, 'load',  SummaryResize); YAHOO.util.Event.on(window, 'load',  ChangeButton);

/* We need to delay when this code executes, so we'll add the listener after the page loads */ OnLoadResize = function { YAHOO.util.Event.on(window, 'resize', SummaryResize); } YAHOO.util.Event.on(window, 'load',  OnLoadResize); }