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. 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-unWatch.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
$( '#ca-watch' ).click( function ( ew ) {
  ew.preventDefault();
  ( new mw.Api ).postWithToken( 'watch', {
    action: 'watch',
    titles: mw.config.get( 'wgPageName' )
  } ).done( function( wResult ) {
    if ( wResult.watch[ 0 ].watched !== undefined ) {
      $( '#ca-watch' ).find( 'a' ).parents( 'span' ).html( $( '#ca-watch' ).find( 'a' ).parents().html().replace( 'action=watch', 'action=unwatch' ) );
      $( '#ca-watch' ).find( 'a' ).attr( 'title', $( '#ca-watch' ).find( 'a' ).attr( 'title' ).replace( 'Add this page to', 'Remove this page from' ) );
      $( '#ca-watch' ).find( 'a' ).text( 'Unwatch' );
      $( '#ca-watch' ).attr( 'id', 'ca-unwatch' );
    }
    setTimeout( function() { location.reload( true ) }, 1 );
  } );
} );

$( '#ca-unwatch' ).click( function ( euw ) {
  euw.preventDefault();
  ( new mw.Api ).postWithToken( 'watch', {
    action: 'watch',
    unwatch: true,
    titles: mw.config.get( 'wgPageName' )
  } ).done( function( uwResult ) {
    if ( uwResult.watch[ 0 ].unwatched !== undefined ) {
      $( '#ca-unwatch' ).find( 'a' ).attr( 'href', $( '#ca-unwatch' ).find( 'a' ).attr( 'href' ).replace( 'action=unwatch', 'action=watch' ) );
      $( '#ca-unwatch' ).find( 'a' ).attr( 'title', $( '#ca-unwatch' ).find( 'a' ).attr( 'title' ).replace( 'Remove this page from', 'Add this page to' ) );
      $( '#ca-unwatch' ).find( 'a' ).text( 'Watch' );
      $( '#ca-unwatch' ).attr( 'id', 'ca-watch' );
    }
    setTimeout( function() { location.reload( true ) }, 1 );
  } );
} );