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.
Known Issue: Xatheral has been temporarily disabled while we investigate a bug with Year of the Dragon gift delivery.DDO Forums 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-codeAnchors.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
//<nowiki>

 $( 'div.mw-highlight > pre' ).find( 'span.c:contains(/*):contains(*/)' ).not( ':contains( "\\n" )' ).each( function() {
  if ( $( this ).html().indexOf( '/*/' ) !== 0 ) {
    var rawAnchorID = $( this ).html().slice( 2, $( this ).html().lastIndexOf( '*/' ) );
    anchorID = $.trim( rawAnchorID ).replace( / /g, '_' );
    if ( anchorID.length !== 0 ) {
      var linkURL = encodeURIComponent( anchorID ).replace( /%/g,  '.' );
      var domA = document.createElement( 'a' );
      domA.innerHTML = $.trim( rawAnchorID );
      domA.classList = 'codeAnchor-link';
      domA.href = window.location.toString().replace( window.location.hash, '' ) + '#' + linkURL;
      var newSpan = document.createElement( 'span' );
      newSpan.id = linkURL;
      newSpan.classList = 'c';
      newSpan.style.backgroundColor = '#FFDDDD';
      newSpan.append( document.createTextNode( '/* ' ) );
      newSpan.append( domA );
      newSpan.append( document.createTextNode( ' */' ) );console.log( 'newSpan: %o', newSpan );
      $( this ).replaceWith( newSpan );
    }
  }
} );

//</nowiki>[[Category:Gadgets]]