Jump to content

User:I9606/swl editor.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>
// User scripts
 
//for use with the semantic wiki link (SWL) template
//based on ... importScript('User:NerdyScienceDude/Scripts/extratoolbarbuttons.js')
 
if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {
	$(document).ready( function() {
 
		$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
			'section': 'advanced',
			'group': 'format',
			'tools': {
				'transclude': {
					label: 'Add Semantic Wiki Link',
					type: 'button',
					icon: 'http://upload.wikimedia.org/wikipedia/en/6/67/Swl_green_edit_button.png',
					action: {
						type: 'encapsulate',
						options: {
							pre: "{{SWL|target=",
							post: "|type=associated_with}}"
						}
					}
				}
			}
		} );
	} );
}
// </nowiki>