MediaWiki:Gadget-global-execute.js: Unterschied zwischen den Versionen

Aus Stupidedia, der sinnfreien Enzyklopädie!
Wechseln zu: Navigation, Suche
 
Zeile 24: Zeile 24:
  
 
// SocialSherryPrivacy
 
// SocialSherryPrivacy
mw.loader.using( 'jquery.socialshareprivacy', function() {
+
// mw.loader.using( 'jquery.socialshareprivacy', function() {
    $( '<div id="socialshareprivacy" />' ).appendTo( '#content' ).socialSharePrivacy();
+
//    $( '<div id="socialshareprivacy" />' ).appendTo( '#content' ).socialSharePrivacy();
} );
+
// } );
  
 
// Tabs
 
// Tabs

Aktuelle Version vom 8. März 2018, 19:25 Uhr

/**
 * Grundlegende Ausführung von diversem Kram
 *
 * <nowiki>
 */

// Externe Links in einem neuen Tab öffnen
$( '.external' ).each( function( i, e ) {
    var href = e.getAttribute( 'href' ) || '';
    if ( href.match( /^https?:\/\/(?:(?:www|forum|schnaps)\.)?stupidedia\.(?:org|at|localhost)(?:(?:\/|\?|#).*)?$/ ) === null ) {
        e.setAttribute( 'target', '_blank' );
    }
} );

// Conteststern anblinken
if ( navigator.appName == 'Netscape' || navigator.appName == 'Opera' ) {
    $( '.contestflash img, img.contestflash' ).each( function() {
        var img = $( this );
        if ( img.attr( 'src' ).match( /\/\d+px-Symbol-contest_-_gold\.svg\.png$/ ) !== null ) {
            img.attr( 'src', '/images/5/5c/Symbol-contest_-_flash.svg' );
        }
    } );
}

// SocialSherryPrivacy
// mw.loader.using( 'jquery.socialshareprivacy', function() {
//    $( '<div id="socialshareprivacy" />' ).appendTo( '#content' ).socialSharePrivacy();
// } );

// Tabs
// Ajax-Links entfernen
$( '.jq-tabs' ).each( function() {
    var list = $( this ).find( 'ol, ul' ).eq( 0 );
    $( 'li a:not( [href^="#"] )', list ).remove();
} );
// Tabs initiieren
$( '.jq-tabs' ).tabs( {
    select: function( event, ui ) {
        // Laden von Ajax-Tabs deaktivieren (nach https://groups.google.com/forum/?fromgroups=#!topic/jquery-ui/F2SVgD0jNEY)
        if ( $.data( ui.tab, 'load.tabs' )) {
            return false;
        }
    },
    activate: function( event, ui ) {
        location.hash = $( 'a', ui.newTab ).attr( 'href' );
    }
} ).removeClass( 'ui-widget ui-widget-content' );
// TOC aus den Tabs entfernen
$( '.jq-tabs #toc' ).remove();
// Überschriften entfernen, wenn nicht anders angegeben
$( '.jq-tabs:not( .jq-tabs-headings ) .ui-tabs-panel:not( .jq-tabs-headings ) > *:first-child' ).each( function() {
    var element = $( this );
    if ( element.is( 'h1, h2, h3, h4, h5, h6' )) {
        element.hide();
    }
} );
// Tableiste anzeigen
$( '.jq-tabs > ol:first-child, .jq-tabs > ul:first-child' ).show();
// Tableiste bei Bedarf zentrieren
$( '.jq-tabs-center' ).each( function() {
    var list = $( this ).find( 'ol, ul' ).eq( 0 );
    list.wrapInner( '<td style="padding: 0px;" />' ).wrapInner( '<tr />' ).wrapInner( '<table style="margin: auto; border-spacing: 0px;" />' );
} );
// Dumme Style-Klassen entfernen
$( '.jq-tabs .ui-tabs-panel' ).removeClass( 'ui-widget-content ui-tabs-panel' );

// Navigationsbox fixieren
$( '#mw-panel > .portal#p-Navigation' ).addClass( 'first persistent' );

// Auszeichnungsschutz nicht automatisch „chainen“
if ( window.ProtectionForm ) {
    $( '#mwProtect-level-award' ).attr( 'id', '' ).prop( 'disabled', false );
    $( '#mwProtectExpirySelection-award' ).attr( 'id', '' ).prop( 'disabled', false );
    $( '#mwProtect-award-expires' ).attr( 'id', '' ).prop( 'disabled', false );
}

// Sichtbar und unsichtbar
$( '.js-hidden' ).hide();
$( '.js-shown' ).show();

Linktipps: Faditiva und 3DPresso