User:Nakohdo/common.js

// Anything in this function wrapper will be executed when the page is ready for action jQuery( document ).ready( function( $ ) {       // Put your snippets in here        // Paste as many as you like, only one "jQuery document ready" wrapper is needed! /** * Make recent changes and watchlist options collapsible * * @source: http://www.mediawiki.org/wiki/Snippets/Collapsible_ChangesList_options * @rev: 2 */ if ( $.inArray( mw.config.get( 'wgCanonicalSpecialPageName' ), ['Watchlist', 'Recentchanges']) != -1 ) {        var     $options = $( '#mw-watchlist-options, .rcoptions' ),                $legend = $options.find( 'legend' );        if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {                $options.contents.filter( function { // Keep text-nodes, filter out the rest return this.nodeType == 3; } )                       // Wrap the second text node (intro paragraph) in a tag so we can easily exempt it later when toggling the options                        .eq(1).wrap( '' );        }        $options.wrapInner( ' ' );

$legend.wrapInner( '' ) .click( function( e ) {                       e.preventDefault; // avoid jumping to the top (href=#)

$( '#mw-options-wrapper' ).toggle( 'fast' );

} )               .add( '#mw-watchlist-options-intro' )                .prependTo( $options ); // Put the legend and intro outside the wrapper        $( '#mw-options-wrapper' ).hide; // Hide by default }

/** * Make file upload description and options collapsible * * @source: http://www.mediawiki.org/wiki/Snippets/Collapsible_Upload_options * @rev: 1 */ if ( $.inArray( mw.config.get( 'wgCanonicalSpecialPageName' ), ['Upload']) != -1 ) { $('legend:nth(1)').wrapInner( '' ) .click( function( e ) {           e.preventDefault; // avoid jumping to the top (href=#)            $( '#mw-htmlform-description'  ).toggle( 'fast' );        } ) /*   $( '#specialchars' ).css( 'max-width', '607px' );  */ /*  $( '#specialchars' ).delay(500).width( '596px' );  */ $( '#mw-htmlform-description' ).delay(500).hide('slow' ); // Hide by default

$('legend:nth(2)').wrapInner( '' ) .click( function( e ) {           e.preventDefault; // avoid jumping to the top (href=#)            $( '#mw-htmlform-options').toggle( 'fast' );        } ) $( '#mw-htmlform-options' ).hide; // Hide by default }

} );