Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes.
(Please note: Due to bugs with the distribution system, this reward is temporarily unavailable.)edit

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!

MediaWiki:Gadget-SpecialPages.js/DoubleRedirects.js

From DDO wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes, you can click here or try one of the methods below..

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+r ( Command+r on a Mac)
  • Google Chrome: Press Ctrl+ Shift+R ( Command+ Shift+R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
  • Konqueror: Click Reload or press F5
  • Opera: Clear the cache in Tools ‣ Preferences
//  [[Special:DoubleRedirects]]
//<nowiki>
//( function ( mw, $ ) {
  if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'DoubleRedirects' ) {
    function fixDoublesRedirects( index, doubleRedirect, redirectTarget ) {
      var writeRedirect = '#REDIRECT [[' + redirectTarget + ']]';
      new mw.Api().postWithToken( 'edit', {
      action: 'edit',
      title: doubleRedirect,
      minor: true,
      recreate: true,
      text: writeRedirect,
      summary: editSummary
      } ).done( function ( fixed ) { 
        if ( fixed.edit.result === 'Success' ) {
          $( '#row-' + index ).html( $( '#row-' + index ).html().replace( 'Fix this redirect!', 'Fixed!' ) );
          $( '#row-' + index ).attr( { href: '#reload', title: 'Reload the page!', onclick: 'setTimeout( function() { location.reload(); }, 500 );' } );
        } else {
          $( '#row-' + index ).html( $( '#row-' + index ).html().replace( 'Fix this redirect!', 'Something failed! Try again?' ) );
        }
      } );
    }
    var nextLink = $( '.mw-nextlink' ).html();
    var limit = document.location.href.slice( document.location.href.search( 'limit=' ) + 6, document.location.href.search( '&' ) );
    var editSummary = 'Fixing [[Special:DoubleRedirects]] using [[MediaWiki:Gadget-SpecialPages.js/DoubleRedirects.js|Double redirect fixer]]';
    if ( nextLink !== null && ( !$.isNumeric( limit ) || limit === '' ) ) {
      limit = document.location.href.slice( document.location.href.search( 'limit=' ) + 6 );
    } else if ( nextLink !== null && limit !== 1000 ) {
      setTimeout( function() { location = '?limit=1000' }, 1 );
    }
    $( 'ol.special' ).find( 'li' ).each( function( i ) {
      var doubleRedirect = $( this ).find( 'a:first' ).attr( 'title' ).replace( /'/g, '\\\'' );
      var redirectTarget = $( this ).find( 'a:last' ).attr( 'title' ).replace( /'/g, '\\\'' );
      $( this ).append( ' (- <a href="#' + redirectTarget + '" id="row-' + i + '" onClick="fixDoublesRedirects( ' + i + ', \'' + doubleRedirect + '\', \'' + redirectTarget + '\' )">Fix this redirect!</a> -)' );
    } );
  }
//} )( mediaWiki, jQuery );
//</nowiki>[[Category:Gadgets]]