User:Gryllida/js/showPagePreviewWhenDeleting.js

/* Author : Svetlana Tkachenko svetlana@members.fsf.org This file is a part of deleteLinkInRc. Licence: GPLv3+ Description: [beta] shows page contents preview when deleting a page Recommends: User:Gryllida/js/deleteLinkInRc.js See also . mw.loader.using(['mediawiki.api'], function {	"use strict";	// == Quit if this is not main namespace ==	 var thisPageTitle = mw.config.get( 'wgPageName' );	// == Check whether we are deleting a page ==	if ($('.deletepage-wrapper').length > 0){		// == Create an API object ==		var api = new mw.Api;		// == Query the wiki API to get HTML of the page contents ==		api.get( { action: 'parse', page: mw.config.get( 'wgPageName' ) } ).done( function ( data ) { // == Add the HTML at the end of current page == $('#content').append($(' ', {text: 'Page Contents Preview'})); $('#content').append(data.parse.text['*']); });	} });