User:Gokudera ElPsyCongroo.reading.desktop/vector-2022.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
importScript('User:Anomie/linkclassifier.js');
// <nowiki>
// Open image links in a new tab (disable Media Viewer to use it)
$('a.image').attr('target', '_blank')

/* {{Projet:JavaScript/Script|FlecheHaut}} */

/*
 * Ajoute à chaque titre de section un lien de retour en haut de page
 * Auteur : Marc Mongenet
 * Mise à jour mediawiki 1.19 : Lgd
 * Dernière révision : 25 septembre 2018
 */

mw.loader.using( 'user', function () {
    $( function ( $ ) {
        'use strict';

        var options = {
            text: '↑',
            title: 'Haut de page',
            animate: false,
            animate_duration: 1000,
        };

        if ( typeof FlecheHaut_options !== 'undefined' ) {
            $.extend( options, FlecheHaut_options );
        }

        var callback = function ( e ) {
            e.preventDefault();
            if ( options.animate ) {
                // c'est bien sur les deux éléments, refs https://stackoverflow.com/a/5580397
                $( 'html, body' ).animate( { scrollTop: 0 }, options.animate_duration );
            } else {
                window.scrollTo( 0, 0 );
            }
        };

        var $lien = $( '<a href="#" class="noprint">' )
            .text( options.text)
            .attr( 'title', options.title)
            .css( {
                'margin-left': '0.3em',
                'user-select': 'none' // jQuery se charge d'ajouter un vendor prefix si nécessaire
            } )
            .click( callback );

        $( '#mw-content-text' ).find( 'h2, h3, h4, h5, h6' ).append( $lien );

    } );
} );

/* Fait un overflow autour des table pour ne pas mettre de scroll horizontal sur petit écran */
$('.wikitable').wrap('<div style="overflow-x:auto;"></div>');
// </nowiki>