MediaWiki:Common.js

From AGI Wiki
Revision as of 23:06, 2 February 2023 by Andrew Branscom (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.

/* Any JavaScript here will be loaded for all users on every page load. */

	// Underscore
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Underscore: {
                label: 'Underscore',
				type: 'button',
				icon: '/buttons/FormatUnderscore.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<u>',
						post: '</u>'
					}
				}
			}
		}
	} );

	// Strikethrough
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Strikethrough: {
                label: 'Strikethrough',
				type: 'button',
				icon: '/buttons/FormatStrike.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<strike>',
						post: '</strike>'
					}
				}
			}
		}
	} );

	// Align Left
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			AlignLeft: {
                label: 'Align Left',
				type: 'button',
				icon: '/buttons/AlignLeft.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div align=\"left\">',
						post: '</div>'
					}
				}
			}
		}
	} );

	// Align Center
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			AlignCenter: {
                label: 'Align Center',
				type: 'button',
				icon: '/buttons/AlignCenter.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div align=\"center\">',
						post: '</div>'
					}
				}
			}
		}
	} );

	// Align Right
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			AlignRight: {
                label: 'Align Right',
				type: 'button',
				icon: '/buttons/AlignRight.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div align=\"right\">',
						post: '</div>'
					}
				}
			}
		}
	} );

	// Justify
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Justify: {
                label: 'Justify',
				type: 'button',
				icon: '/buttons/AlignJustify.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div align=\"justify\">',
						post: '</div>'
					}
				}
			}
		}
	} );

	// Indent
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Indent: {
                label: 'Indent',
				type: 'button',
				icon: '/buttons/Indent.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<blockquote>',
						post: '</blockquote>'
					}
				}
			}
		}
	} );

	// Offset
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Offset: {
                label: 'Offset',
				type: 'button',
				icon: '/buttons/Offset.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<blockquote class=\"offset\">',
						post: '</blockquote>'
					}
				}
			}
		}
	} );

	// Quote
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Quote: {
                label: 'Quote',
				type: 'button',
				icon: 'http://wiki.sierrahelp.com/buttons/Quote.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div class=\"Quote\">\n{{Quote|Attrib = \n}}\n',
						post: '\n</div>'
					}
				}
			}
		}
	} );

	// Alert
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Alert: {
                label: 'Alert',
				type: 'button',
				icon: '/buttons/Red.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<span class=\"Alert\">',
						post: '</span>'
					}
				}
			}
		}
	} );

	// Inactive
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Inactive: {
                label: 'Inactive',
				type: 'button',
				icon: '/buttons/Gray.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<span class=\"Inactive\">',
						post: '</span>'
					}
				}
			}
		}
	} );

	// Add Reference
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Reference: {
                label: 'Add Reference',
				type: 'button',
				icon: '/buttons/Reference.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<ref>',
						post: '</ref>'
					}
				}
			}
		}
	} );

	// Add Citation Required Notice
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			CitationWarning: {
                label: 'Add Reference',
				type: 'button',
				icon: '/buttons/CitationWarning.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '{{CitationReq}}',
						post: ''
					}
				}
			}
		}
	} );

	// Wikipedia Link
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			xxx: {
                label: 'Wikipedia',
				type: 'button',
				icon: '/buttons/Wikipedia.png',


                label: 'Wikipedia Link',
				action: {
					type: 'encapsulate',
					options: {
						pre: '[[w:|',
						post: ']]'
					}
				}
			}
		}
	} );

	// Redirect
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Redirect: {
                label: 'Redirect',
				type: 'button',
				icon: '/buttons/Redirect.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '#REDIRECT [[',
						post: ']]'
					}
				}
			}
		}
	} );

	// Superscript
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Superscript: {
                label: 'Superscript',
				type: 'button',
				icon: '/buttons/Superscript.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<sup>',
						post: '</sup>'
					}
				}
			}
		}
	} );

	// Subscript
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Subscript: {
                label: 'Subscript',
				type: 'button',
				icon: '/buttons/Subscript.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<sub>',
						post: '</sub>'
					}
				}
			}
		}
	} );

	// Half
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Half: {
                label: 'Half',
				type: 'button',
				icon: '/buttons/Half.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '½',
						post: ''
					}
				}
			}
		}
	} );

	// Quarter
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Quarter: {
                label: 'Quarter',
				type: 'button',
				icon: '/buttons/Quarter.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '¼',
						post: ''
					}
				}
			}
		}
	} );

	// Copyright
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Copyright: {
                label: 'Copyright',
				type: 'button',
				icon: '/buttons/Copyright.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '©',
						post: ''
					}
				}
			}
		}
	} );

	// Comment
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Comment: {
		
                label: 'Comment',
				type: 'button',
				icon: '/buttons/Comment.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<!-- ',
						post: ' -->'
					}
				}
			}
		}
	} );

	// Non-breaking space
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			NoBreak: {
                label: 'Non-breaking Space',
				type: 'button',
				icon: '/buttons/NoBreak.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '&nbsp;',
						post: ''
					}
				}
			}
		}
	} );

	// New Line
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			NewLine: {
                label: 'New Line',
				type: 'button',
				icon: '/buttons/NewLine.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '',
						post: '<br />\n'
					}
				}
			}
		}
	} );

	// Table
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Table: {
                label: 'Table',
				type: 'button',
				icon: '/buttons/Table.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '{| cellpadding=\"10\" align=\"center\" width=\"85%\"\n|- \n|align=\"center\"| ',
						post: '\n|}'
					}
				}
			}
		}
	} );

	// Add template
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			NewTemplate: {
                label: 'Add template',
				type: 'button',
				icon: '/buttons/Template.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '{{',
						post: '}}'
					}
				}
			}
		}
	} );
 
	// AGI Code
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			AGICode: {
                label: 'AGI Code',
				type: 'button',
				icon: '/buttons/AGI.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div class=\"CodeBlockHeader\">AGI Code:</div>\n<syntaxhighlight lang=\"agi\">\n',
						post: '</syntaxhighlight>'
					}
				}
			}
		}
	} );

	// SCI Code
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			scicode: {
                label: 'SCI Code',
				type: 'button',
				icon: '/buttons/SCI.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div class=\"CodeBlockHeader\">SCI Code:</div>\n<syntaxhighlight lang=\"sci\">\n',
						post: '</syntaxhighlight>'
					}
				}
			}
		}
	} );

	// Code
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Code: {
                label: 'Code',
				type: 'button',
				icon: '/buttons/code.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<code>',
						post: '</code>'
					}
				}
			}
		}
	} );

	// Preformatted
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Pre: {
                label: 'Preformatted',
				type: 'button',
				icon: '/buttons/pre.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<pre>',
						post: '</pre>'
					}
				}
			}
		}
	} );

	// Clear
	$textarea.wikiEditor( 'addToToolbar', {
			section: 'advanced',
			group: 'format',
			tools: {
			Clear: {
                label: 'Clear',
				type: 'button',
				icon: '/buttons/Clear.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<div>',
						post: '</div>'
					}
				}
			}
		}
	} );