User:Jack Phoenix/monobook.js

/** * Fix social tools for Monobook. * This is a dirty hack! * With apologies to Wikimedia; but this is the only way we can use the most * current, up-to-date CSS files. * @author Jack Phoenix  * @date 16 March 2010 */

// Load UserProfile.css for pages in the User: (2) or User_profile: (202) namespaces // and also for Special:UpdateProfile function fixSocialProfiles { if (		typeof( wgNamespaceNumber ) != 'undefined' &&		( wgNamespaceNumber == 2 || wgNamespaceNumber == 202 ) ||		typeof( wgPageName ) != 'undefined' && wgPageName == 'Special:UpdateProfile'	) {		importStylesheetURI( 'http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SocialProfile/UserProfile/UserProfile.css' ); } }

// Fix UserWelcome extension (&lt;welcomeUser /&gt; tag on the main page) function fixUserWelcome { if ( typeof( wgPageName ) != 'undefined' && wgPageName == 'Main Page' ) { importStylesheetURI( 'http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SocialProfile/UserWelcome/UserWelcome.css' ); } }

// Fix Comments extension (&lt;comments /&gt; tag) function fixComments { if ( typeof( _COMMENT_VOTED ) != 'undefined' ) { // Please contact me if you want a human-readable version of this CSS appendCSS(			'.full { width: 530px; }' +			'.reply { margin-left: 70px !important; width: 460px; }' +			'.c-item { position: relative; border-bottom: 1px solid #dcdcdc; padding: 0px 0px 35px 0px; margin: 0px 0px 15px 0px; }' +			'.c-avatar { position: absolute; top: 0px; left: 0px; }' +			'.c-avatar img { padding: 3px; border: 1px solid #dcdcdc; background-color: #fff; }' +			'.c-container { position: relative; top: 0px; top: 0px; margin: 0px 0px 0px 70px; }' +			'.c-user { font-weight: bold; position: relative; margin: 0px 0px 6px 0px; }' +			'.c-user a { font-size: 14px; text-decoration: none; }' +			'.c-time { font-size: 10px; color: #888; line-height: 11px !important; font-weight: normal !important; }' +			'.c-user-level { color: #666; font-size: 11px; margin: 0px 5px 0px 5px; }' +			'.c-comment { overflow: auto; }' +			'.c-ignored { color: #666; font-size: 11px; padding: 5px 0px 10px 0px; margin: 0px 0px 15px 0px; border-bottom: 1px solid #dcdcdc; }' + '.f-message { width: 460px; }' + '.r-message { width: 360px; }' + '.c-score { position: absolute; top: -2px; right: 0px; font-size: 11px; padding-top: 6px; font-weight: bold; z-index: 4; }' + '.c-score-title { margin: 0px 10px 0px 0px; }' + '.c-actions { float: right; font-size: 10px; margin: 10px 0px 0px 0px; }' + '.c-delete a { color: red !important; }' + '.c-score img { vertical-align: middle; margin: -5px 0px 0px 2px }' + '.c-form-title { color: #333; font-weight: bold; font-size: 17px; margin: 0px 0px 5px 0px; }' + '.c-form-message { font-size: 11px; width: 400px; line-height: 13px; color: #666; padding: 5px 0px 10px 0px; }' + 'textarea#comment { width: 530px; }' + '.c-form-button { padding: 10px 0px 0px; }' + '.c-order { padding: 20px 0px; }' + '.c-spy { float: left; font-size: 10px; margin: 0px 0px 0px 10px; }' + '.c-order-select { float: left; }' );	} }

// Fix Vote extension (&lt;vote /&gt; tag/Template:Ratings) function fixVote { if ( typeof( _VOTE_LINK ) != 'undefined' ) { // Please contact me if you want a human-readable version of this CSS appendCSS(			'.vote-box { background-color: #68BD46; height: 30px; padding: 13px 0px 0px; text-align: center; width: 43px; }' +			'.vote-number { color: #FFF; font-size: 16px; font-weight: bold; }' +			'.vote-action { text-align: center; width: 43px; }' +			'.vote-action a { font-weight: bold; font-size: 11px; text-decoration: none; }' +			'.rating-score { background-color: #68BD46; color: #FFF; float: left; font-size: 14px; font-weight: bold; padding: 1px 8px 0px; margin: 1px 7px 0px 0px; text-align: center; }' +			'.ratings-top { position: absolute; top: 37px !important; right: 0px !important; width: 100%; }' +			'.rating-section img { vertical-align: text-bottom; }' +			'.rating-voted { color: #666666; line-height: 10px; font-size: 9px; position: absolute; right: 0px; }' +			'.rating-total { color: #666; font-weight: bold; font-size: 11px; margin: 3px 0px 0px 0px; }'		); } }

// Load all the fixes function loadSocialToolsFixes { fixSocialProfiles; fixUserWelcome; fixComments; fixVote; }

addOnloadHook( loadSocialToolsFixes );