User:LilDice/Flexitags

Introduction
Flexitags is a script that allows editors to add frequently used templates to articles. It's built to be easily customizable so that you may add as many tabs and template tags as you want. I created it because I thought customizing tags was too clumsy.

Installing
To install Flexitags, just copy the following lines to your monobook.js file (if you're using a different skin you probably know what to do).

importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css'); importScript('User:LilDice/flexitags.js');

If you already have the first two lines in your user Javascript file, you don't need to add them again to use Flexitags.

General options

 * FlexiTagConfig.autosubmit : true/false, submit after inserting tag, default false;
 * FlexiTagConfig.minoredit: true/false, check the minor edit box, default false;
 * FlexiTagConfig.summarySuffix: string to append to edit summary.

Tabs
Each tab you want to use on your page should be added to the FlexiTabConfig.tabs array.

A tab is an object with the following properties
 * name:Display name.(required)
 * namespace:Array of namespaces to display, if none given, displayed on all pages with edit box. (optional)
 * tagset:Multi-dimensional array of template tags and edit summaries. (required).

Tag sets
Tag sets are simply an array with a two element array for each element. The first element is the template tag (with out the curly braces). The second element is the edit summary to use.

Tag sets have some special strings that are available.
 * %date: To substitute the Month and Year.
 * %prompt(Prompt Text): Opens a javascript prompt box when tag is inserted.

Example of creating a tagset (note you must add to a tab before it will be displayed) var mytagset = %date','Adding external-links';

Example Configuration
//create Config object, you only have to do this once. var FlexiTagConfig = {}; FlexiTagConfig.minoredit = true;

//The tabs field stores an array of all our tabsets. //so initialize the array, (again only once). FlexiTagConfig.tabs = new Array;

//Push a new tagset on our tabs array //this tagset will have have the name flexitags //it will show up in the Main and User_talk namespaces. //The tagset contains external-links template, the trivia template and th FlexiTagConfig.tabs.push( { name:'flexitags',  namespace:['Main','User_talk'],   tagset:%date','See [[WP:EL'],          ['trivia','Adding Trivia Section'],          ['Autobio-warn|%prompt(Article Name)'],          ['cleanup','Adding Cleanup Tag']] } );

FlexiTagConfig.tabs.push({name:'userwarnings', namespace:['User_talk'], tagset:%date','See [[WP:EL'], ['cleanup','Adding Cleanup Tag']] });