Benutzer:Darthmaim/common.js

Aus Guild Wars 2 Wiki
Zur Navigation springen Zur Suche springen

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
/* alle Tabellen auf einer Seite gleich breit machen */
function fixedTableWidth( selector ) {
  var cols = [ ];
  var width;
  var tables = ( selector instanceof jQuery ) ? selector : $( selector );

  tables.each( function( _, t ) { 
    $( "thead th", t ).each( function( i, th ) { 
      width = $( th ).width();
      if( width > ( cols[i] || 0 ) )
        cols[i] = width;
    }); 
  });
  tables.each( function( _, t ) { 
    $( "thead th", t ).each( function( i, th ) {
      $( th ).width( cols[i] );
    }); 
  });
}


/* Navigation erweitern */
function extendNavigation( url, text ) {
  $( '#p-navigation ul' ).append( 
    $( '<li>' ).append( 
      $( '<a>' ).attr( 'href', url ).text( text )
    )
  );
}


/* alles ausführen */
addOnloadHook(function() {
  extendNavigation( "http://wiki-de.guildwars2.com/wiki/GW2Wiki:Formatierung", "Formatierung" );
  fixedTableWidth( ".tabelle-rezeptliste" );
  fixedTableWidth( ".tabelle-rezept" );
});