User:The Quixotic Potato/common.js

// importScript( 'User:Cumbril/RefConsolidate_start.js' ); // Backlink: User:Cumbril/RefConsolidate_start.js

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript');

var customizeToolbar = function { /* Your code goes here */ $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Welcome', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',			action: {				type: 'encapsulate',				options: {					pre: "== Welcome! ==\n\n\n" // text to be inserted				}			}		}	} } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'External link', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/8/86/External_small.svg',			action: {				type: 'encapsulate',				options: {					pre: "== External link(s) ==\n " + "\n\n" // text to be inserted				}			}		}	} } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Unexplained removal of content', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/3/35/VisualEditor_-_Icon_-_Remove.svg',			action: {				type: 'encapsulate',				options: {					pre: "== Unexplained removal of content ==\n " + "\n\n" // text to be inserted				}			}		}	} } );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Unsigned talkpage post', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/7/7b/Tilde_button.PNG',			action: {				type: 'encapsulate',				options: {					pre: "== Four tildes ==\n " + "\n\n" // text to be inserted				}			}		}	} } );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Copyright violation', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/9/94/Toolbar_copyright.png',			action: {				type: 'encapsulate',				options: {					pre: "== Copyright ==\n " + "\n\n" // text to be inserted				}			}		}	} } );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Dead links', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/0/05/Gatunek_trujący.svg',			action: {				type: 'encapsulate',				options: {					pre: "== Dead links ==\n " + "\n\n" // text to be inserted				}			}		}	} } );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Vandalism level 1', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/5/5b/Twemoji_31-20e3.svg',			action: {				type: 'encapsulate',				options: {					pre: " " + "\n\n" // text to be inserted				}			}		}	} } ); $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Vandalism level 2', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Twemoji_32-20e3.svg',			action: {				type: 'encapsulate',				options: {					pre: " " + "\n\n" // text to be inserted				}			}		}	} } );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Vandalism level 3', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/d/d8/Twemoji_33-20e3.svg',			action: {				type: 'encapsulate',				options: {					pre: " " + "\n\n" // text to be inserted				}			}		}	} } );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {	'section': 'main',	'group': 'format',	'tools': {		'smile': {			label: 'Vandalism level 4', // or use labelMsg for a localized label, see above			filters: [ 'body.ns-3' ],			type: 'button',			icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Twemoji_34-20e3.svg',			action: {				type: 'encapsulate',				options: {					pre: " " + "\n\n" // text to be inserted				}			}		}	} } ); };

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) { mw.loader.using( 'user.options', function {		// This can be the string "0" if the user disabled the preference (T54542)		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {			$.when( mw.loader.using( 'ext.wikiEditor' ), $.ready ).then( customizeToolbar );		}	} ); }

/* User:Equazcion/CustomSummaryPresets.js */

// This is a modified version of User:ErrantX/defaultsummaries.js and User:MC10/defaultsummaries.js. // // This version displays a single menu of custom edit summaries across all namespaces. // // See User:Equazcion/CustomSummaryPresets for full instructions. // // Define custom edit summary presets by adding this after the importScript line: //    var customsum1 = "My first custom edit summary"; //    var customsum2 = "My second custom edit summary"; // // Up to 20 custom summaries can be defined this way.

var editsummOriginalSummary = ""; function editsummAddOptionToDropdown(dropdown, optionText) { var option = document.createElement("option"); var optionTextNode = document.createTextNode(optionText); option.appendChild(optionTextNode); dropdown.appendChild(option); }   function editsummAddCatToDropdown(dropdown, catText) { var option = document.createElement("option"); option.disabled = true; option.selected = true; var optionTextNode = document.createTextNode(catText); option.appendChild(optionTextNode); dropdown.appendChild(option); }   function editsummOnCannedSummarySelected { // Save the original value of the edit summary field editsummOriginalSummary = document.getElementById("wpSummary"); if (editsummOriginalSummary) { editsummOriginalSummary = editsummOriginalSummary.value; } else { editsummOriginalSummary = ""; }       var idx = this.selectedIndex; var canned = this.options[idx].text; var newSummary = editsummOriginalSummary; // Append old edit summary with space, if exists, // and last character != space if (newSummary.length !== 0 && newSummary.charAt(newSummary.length - 1) !== " ") { newSummary += " "; }       newSummary += canned; document.getElementById("wpSummary").value = newSummary; }   $(function  {        var insertBeforeThis = document.getElementById("wpSummary");        // Loop through siblings, looking for editCheckboxes class        while (insertBeforeThis) {            if (insertBeforeThis.className === "editCheckboxes") {                break;            }            insertBeforeThis = insertBeforeThis.nextSibling;        }        // If we failed to find the editCheckboxes class, or insertBeforeThis is null        if (!insertBeforeThis || insertBeforeThis.className !== "editCheckboxes") {            return;        }        editsummOriginalSummary = editsummOriginalSummary.value;        // For convenience, add a dropdown box with some canned edit        // summaries to the form.        var dropdown = document.createElement("select");        dropdown.style.width = "38%";        dropdown.style.margin = "0 4px 0 0";        dropdown.onchange = editsummOnCannedSummarySelected; editsummAddCatToDropdown(dropdown, "Custom edit summary presets");

if (typeof customsum1 != "undefined") editsummAddOptionToDropdown(dropdown, customsum1); if (typeof customsum2 != "undefined") editsummAddOptionToDropdown(dropdown, customsum2); if (typeof customsum3 != "undefined") editsummAddOptionToDropdown(dropdown, customsum3); if (typeof customsum4 != "undefined") editsummAddOptionToDropdown(dropdown, customsum4); if (typeof customsum5 != "undefined") editsummAddOptionToDropdown(dropdown, customsum5); if (typeof customsum6 != "undefined") editsummAddOptionToDropdown(dropdown, customsum6); if (typeof customsum7 != "undefined") editsummAddOptionToDropdown(dropdown, customsum7); if (typeof customsum8 != "undefined") editsummAddOptionToDropdown(dropdown, customsum8); if (typeof customsum9 != "undefined") editsummAddOptionToDropdown(dropdown, customsum9); if (typeof customsum10 != "undefined") editsummAddOptionToDropdown(dropdown, customsum10); if (typeof customsum11 != "undefined") editsummAddOptionToDropdown(dropdown, customsum11); if (typeof customsum12 != "undefined") editsummAddOptionToDropdown(dropdown, customsum12); if (typeof customsum13 != "undefined") editsummAddOptionToDropdown(dropdown, customsum13); if (typeof customsum14 != "undefined") editsummAddOptionToDropdown(dropdown, customsum14); if (typeof customsum15 != "undefined") editsummAddOptionToDropdown(dropdown, customsum15); if (typeof customsum16 != "undefined") editsummAddOptionToDropdown(dropdown, customsum16); if (typeof customsum17 != "undefined") editsummAddOptionToDropdown(dropdown, customsum17); if (typeof customsum18 != "undefined") editsummAddOptionToDropdown(dropdown, customsum18); if (typeof customsum19 != "undefined") editsummAddOptionToDropdown(dropdown, customsum19); if (typeof customsum20 != "undefined") editsummAddOptionToDropdown(dropdown, customsum20); var theParent = insertBeforeThis.parentNode; theParent.insertBefore(dropdown, insertBeforeThis); theParent.insertBefore(document.createElement("br"), dropdown); });

var customsum1 = "-spam User:The_Quixotic_Potato/genius"; var customsum2 = "Typo"; var customsum3 = "Reverting vandalism"; //