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

Thank you for your patience while we continue to upgrade DDOwiki to the latest MediaWiki LTS version. If you find any errors on the site, please visit the Discord chat server and let us know.

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


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

MediaWiki:Gadget-delete.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>
// This script tags pages using [[T:Delete]]
// Which adds them to [[C:Flagged for deletion]]
var pageid = mw.config.get( 'wgArticleId' );
var editSummary = 'Tagging page as {{[[T:Delete|Delete]]}} using [[MediaWiki:Gadget-delete.js|Deletion tagger]]';
var pageContent = '';
new mw.Api().get( {
  action: 'query',
  prop: 'revisions|info',
  rvprop: 'content',
  pageids: pageid,
  indexpageids: 1
} ).done( function ( pageResponse ) {
  pageContent = pageResponse.query.pages[ pageid ].revisions[ 0 ][ '*' ];
} );
mw.util.addPortletLink(
  'p-cactions',
  '#',
  'Delete',
  'ca-mark-delete',
  'Mark this page for deletion',
  null,
  null
);
$( '#ca-mark-delete' ).click( function ( e ) {
  e.preventDefault();
  var tagReason = prompt( 'Why do you want this page deleted?\n\n\tFailure to provide a reasonable answer will result in request being denied.', 'TEST!!!' );
  if ( !mw.config.get( 'wgIsRedirect' ) ) {
    pageContent = '{{Delete|reason=' + tagReason + '}}\n' + pageContent;// put it on the top of the page
  } else {
    pageContent += '\n\n{{Delete|reason=' + tagReason + '}}';// put it on the bottom of the page
  }
  new mw.Api().postWithToken( 'edit', {
    action: 'edit',
    pageid: pageid,
    text: pageContent,
    summary: editSummary
  } ).done( function ( tagged ) { 
    if ( tagged.edit.result === 'Success' ) {
      alert( 'Page was tagged!' );
      location.reload();
    } else {
      alert( 'Page was NOT tagged!' );
    }
  } );
} );
//</nowiki> [[Category:Gadgets]]