User talk:Robinr78/common.js

From Robin's SM-201 Website
Jump to navigation Jump to search
var customizeToolbar = function () {

/* Stable as of 2019-1007-2230 */

var customizeToolbar = function () {

/* ======================================Add SM-201 & category Sections */

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'SM-201': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'SM-201'
	}
	}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'sections': {
		'Cats': {
			'type': 'toolbar', // Can also be 'booklet'
			'label': 'Cats'
	}
	}
} );


/* ===============================================================Add groups */

/* -------------------add Format group ------------------- */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'SM-201',
	'groups': {
		'Format': {
			'label': 'Format' 
		}
	}
} );

/* ------------------- add <inc> group ----------------------*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'SM-201',
	'groups': {
		'Inc': {
			'label': 'Inc' 
		}
	}
} );

/* ------------------- add footers group ----------------------*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'SM-201',
	'groups': {
		'Footer': {
			'label': 'Footer' 
		}
	}
} );

/* ------------------- add Categories group -----------------*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'Cats',
	'groups': {
		'Cats': {
			'label': 'Cats'
		}
	}
} );




/* Add <Inc> buttons ============================================================ */

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Inc',
	tools: {
		"Incl": {
			label: 'Incl',
			type: 'button',
   icon: 'http://www.sm-201.org/a/images/3/3b/Button_in.jpg', 
			action: {
				type: 'encapsulate',
				options: {
					pre: "<includeonly>",
                                        post:"</includeonly>"
				}
			}
		}
	}
});


$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Inc',
	tools: {
		"Noinclude": {
			label: 'Noinclude',
			type: 'button',
      icon: 'http://www.sm-201.org/a/images/1/1b/Button_no.jpg', 
			action: {
				type: 'encapsulate',
				options: {
					pre: "<noinclude>",
                                        post:"</noinclude>"
				}
			}
		}
	}
});

/*  Add footer buttons ============================================================*/
/* Add Footers */

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Footer": {
			label: 'Footer',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/3/31/Editor_f.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Header}}<br>",
                                        post:"{{Footer}}<br>"
				}
			}
		}
	}
});


/* Add Biofooters - Biographies */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Biofooter": {
			label: 'Biofooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/b/b4/Editor_b.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Bioheader}}<br>",
                                        post:"{{Biofooter}}<br>"
				}
			}
		}
	}
});

/* Add Historyfooter */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Historyfooter": {
			label: 'History footer',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/e/e4/Editor_h.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "{{Historyheader}}<br>",
                                        post: "{{Historyfooter}}<br>"
				}
			}
		}
	}
});

/* Add Libfooter Library*/
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Libraryfooter": {
			label: 'Libraryfooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/e/e0/Editor_book.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "{{Libheader}}<br>",
                                        post: "{{Libfooter}}<br>"
				}
			}
		}
	}
});

/* Add Lifefooter */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Life Lessons footer": {
			label: 'Lifefooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/1/16/Editor_l.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "{{Lifeheader}}<br>",
                                        post: "{{Lifefooter}}<br>"
				}
			}
		}
	}
});


/* Add Macrofooter */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Life Lessons footer": {
			label: 'Macrofooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/f/fc/Editor_mac.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "{{Macroheader}}",
                                        post: "{{Macrofooter}}"
				}
			}
		}
	}
});


/* Add Microfooter */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Micropedia footers": {
			label: 'Microfooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/9/95/Editor_mic.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "{{Microheader}}",
                                        post: "{{Microfooter}}"
				}
			}
		}
	}
});


/* Add PMfooters */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Robins Personal memories": {
			label: 'Robin Mem',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/b/bf/Editor_p.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "{{Pmheader}}",
                                        post: "{{Pmfooter}}"
				}
			}
		}
	}
});

/* Add Storyfooters */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Storyfooter": {
			label: 'Storyfooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/6/60/Editor_s.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Storyheader}}<br>",
                                        post:"{{Storyfooter}}<br>"
				}
			}
		}
	}
});

/* Add Timefooters */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Footer',
	tools: {
		"Timefooter": {
			label: 'Timefooter',
			type: 'button',
  icon: 'http://www.sm-201.org/a/images/1/19/Editor_t.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{Timeheader}}<br>",
                                        post:"{{Timefooter}}<br>"
				}
			}
		}
	}
});

/*=====================Format Buttons====================================*/

/* Toolbar <Comment Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Comment": {
			label: 'Comment',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/6/66/Editor_!.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '<!-- ',
					post: ' -->'
				}
			}
		}
	}
} );

/* Toolbar Apostrophe Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Apostrope": {
			label: 'Apostrphe',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/3/39/Editor_apos.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  "'",
					post: "'"
				}
			}
		}
	}
} );

/* Add  'clear'  =====================*/

$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Clear": {
			label: 'Clear',
			type: 'button',
icon: 'http://sm-201.org/a/images/b/be/Editor_c.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: '<br clear="all"> ',
					post: '' 
				}
			}
		}
	}
});


/* Toolbar gallery button =======================*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Gallery": {
			label: 'Gallery',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/3/35/Editor_g.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '<gallery mode="packed> ',
					post: '</gallery>'
				}
			}
		}
	}
} );





/* Toolbar [[ ]] Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Template": {
			label: 'Link',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/c/c0/Button_link.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[',
					post: ']]'
				}
			}
		}
	}
} );

/* Toolbar double curly brackets Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'SM-201',
	group: 'format',
	tools: {
		"Template": {
			label: 'Template',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/5/5f/Button_temp.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{",
					post: "}}"
				}
			}
		}
	}
} );

/* Quotes */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Quotes": {
			label: 'Quotes',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/7/7d/Button_quot.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '"',
					post: '"',
				}
			}
		}
	}
});


/* Center */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Center": {
			label: 'Center',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/5/5f/Button_center.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '<center>',
					post: '</center>',
				}
			}
		}
	}
});


/* Justify */
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'SM-201',
	group: 'Format',
	tools: {
		"Justify": {
			label: 'Justify',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/0/0f/Button_just.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '<p align="justify">',
					post: '</p>',
				}
			}
		}
	}
});

/*  ============================================= Category Buttons =================================== */

/* Add buttons ======================================= */

/* Artist Category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Cats": {
			label: 'Artist',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/3/32/Button-art.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Artist]]',
					post: ''
				}
			}
		}
	}
} );


/* Author Category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Cats": {
			label: 'Author',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/1/15/Button-quil.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Author]]',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Cats": {
			label: 'Category',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/d/d0/Button_Cat.Png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:',
					post: ']]'
				}
			}
		}
	}
} );

/* Toolbar Anatomy category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Template": {
			label: 'Human anatomy',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/e/e0/Editor_a.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '{{Human anatomy}}',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Anatomy category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Template": {
			label: 'Book',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/b/b4/Editor_b.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '{{book}}',
					post: ''
				}
			}
		}
	}
} );
/* Toolbar "Classes" category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Template": {
			label: 'Classes',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/b/be/Editor_c.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Classes]]',
					post: ''
				}
			}
		}
	}
} );


/* Toolbar "Club" category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Template": {
			label: '{{Club}}',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/b/be/Editor_c.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Club]]',
					post: ''
				}
			}
		}
	}
} );


/* Toolbar "Events" category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Events": {
			label: 'Events',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/e/e3/Editor_e.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Events]]',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Film category button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Film": {
			label: 'Film',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/3/31/Editor_f.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Cateory:Film]]',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Health category button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Health": {
			label: 'Health',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/e/e4/Editor_h.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Cateory:Health]]',
					post: ''
				}
			}
		}
	}
} );
/* Toolbar Icon category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Icon": {
			label: 'Icon',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/5/5e/Editor_i.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Icon]]',
					post: ''
				}
			}
		}
	}
} );


/* Toolbar Link category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Link": {
			label: 'Link',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/1/16/Editor_l.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Link]]',
					post: ''
				}
			}
		}
	}
} );


/* Toolbar N=Info Box category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Info box": {
			label: 'Info box',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/0/0e/Editor_n.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Info box]]',
					post: ''
				}
			}
		}
	}
} );


/* Toolbar Magazine category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Magazine": {
			label: 'Magazine',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/6/6d/Editor_m_.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '<includeonly>[[Category:Magazine]]</includeonly>',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Places category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Places": {
			label: 'Places',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/b/bf/Editor_p.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Places]]',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Stories by Robin category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Robin": {
			label: 'Robin',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/d/d5/Editor_r.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Stories by Robin]]',
					post: ''
				}
			}
		}
	}
} );


/* Toolbar Sessions category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Sessions": {
			label: 'Sessions',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/6/60/Editor_s.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Sessions]]',
					post: ''
				}
			}
		}
	}
} );

/* Toolbar Toy box category Button  */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'Cats',
	group: 'Cats',
	tools: {
		"Toy box": {
			label: 'Toy box',
			type: 'button',
icon: 'http://www.sm-201.org/a/images/1/19/Editor_t.png',
			action: {
				type: 'encapsulate',
				options: {
					pre:  '[[Category:Sex toys]]',
					post: ''
				}
			}
		}
	}
} );



/* Leave everything below this line alone ===================== */
};

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