/***********************************************************************************
* *
* [[Help:Substitution|Substituted]] from [[Template:Deltab]], which *
* was apparently based on code by [[User:Raylu|Raylu]]. *
* *
* This script adds an "anime and manga deletion" tab to the bottom *
* of XfD pages when in edit mode. *
* *
* Generalization of this script is being attempted at *
* [[User:Dinoguy1000/delsort.js]] based on [[User:Pb30/Delsort tab/delsort.js]]. *
* *
***********************************************************************************/
// Does the main config struct exist?
if( typeof( dgDelSort ) == "undefined" ) {
dgDelSort = {};
}
/*
dgDelSort.summary (string)
customize the edit summary
*/
if( typeof( dgDelSort.summary ) == "undefined" ) {
dgDelSort.summary = "Tagged as an anime- and manga-related XfD discussion ([[User:Dinoguy1000/scripts/amdelsort.js|script-assisted]]).";
}
/*
dgDelSort.signatureDash (string)
customize the dash inserted before your signature, defaults to "-- "
*/
if( typeof( dgDelSort.signatureDash ) == "undefined" ) {
dgDelSort.signatureDash = "-- ";
}
/*
dgDelSort.markAsMinor (boolean)
mark the notification as a minor edit, defaults to true
*/
if( typeof( dgDelSort.markAsMinor ) == "undefined" ) {
dgDelSort.markAsMinor = true;
}
/*
dgDelSort.autoSubmit (boolean)
automatically save the edit after inserting the notification and edit summary, defaults to false
*/
if( typeof( dgDelSort.autoSubmit ) == "undefined" ) {
dgDelSort.autoSubmit = false;
}
var textToAdd = "\n\{\{subst:deletion sorting|Anime and manga|" + dgDelSort.signatureDash + "\~\~\~\~\}\}\n";
function addDelsortMessage() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.rtrim();
document.editform.wpTextbox1.value += textToAdd;
if( document.editform.wpSummary.value.length !== 0 ){ document.editform.wpSummary.value += ' | '; }
document.editform.wpSummary.value += dgDelSort.summary;
if( dgDelSort.markAsMinor ){ document.editform.wpMinoredit.checked = true; }
if( dgDelSort.autoSubmit ){ document.editform.submit(); }
}
$( function() {
if( mw.config.get( "wgNamespaceNumber" ) == 4 && mw.config.get( "wgTitle" ).match( / for d(elet|iscuss)ion/ ) && ( mw.config.get( "wgAction" ) == "edit" || mw.config.get( "wgAction" ) == "submit" ) ) {
mw.util.addPortletLink( "p-cactions", "javascript:addDelsortMessage()", "Anime and manga deletion", "ca-Anime_and_mangadeletion", "Anime and manga Deletion", "" );
}
});