ميدياويكي:Gadget-CollapsibleChangesListOptions.js

من كوبتيكبيديا
اذهب إلى التنقلاذهب الى البحث
لم تعد النسخة القابلة للطباعة مدعومة وقد تحتوي على أخطاء في العرض. يرجى تحديث علامات متصفحك المرجعية واستخدام وظيفة الطباعة الافتراضية في متصفحك بدلا منها.

ملاحظة: بعد النشر، أنت قد تحتاج إلى إفراغ الكاش الخاص بمتصفحك لرؤية التغييرات.

  • فايرفوكس / سافاري: أمسك Shift أثناء ضغط Reload، أو اضغط على إما Ctrl-F5 أو Ctrl-R (⌘-R على ماك)
  • جوجل كروم: اضغط Ctrl-Shift-R (⌘-Shift-R على ماك)
  • إنترنت إكسبلورر/إيدج: أمسك Ctrl أثناء ضغط Refresh، أو اضغط Ctrl-F5
  • أوبرا: اضغط Ctrl-F5.
/**
 * 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( '<p id="mw-watchlist-options-intro" />' );
        }
        $options.wrapInner( '<div id="mw-options-wrapper" />' );

        $legend.wrapInner( '<a href="#" />' )
                .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
}