Difference between revisions of "MediaWiki:Common.js"

From SacredWiki
Jump to navigation Jump to search
Line 133: Line 133:
 
'type': 'encapsulate',
 
'type': 'encapsulate',
 
'options': {
 
'options': {
'pre': "{{S2 Dialogue",
+
'pre': "{{subst:S2 Dialogue",
'|NPC NAME=',
 
'|PORTRAIT FILE NAME=',
 
'|DIALOGUE=',
 
 
'post': "}}"
 
'post': "}}"
 
}
 
}

Revision as of 07:02, 23 October 2013

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


 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/align_center.png",
     "speedTip": "Will center highlighted text.",
     "tagOpen": "<center>",
     "tagClose": "</center>",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/S1internallink.jpg",
     "speedTip": "Make a Sacred Underworld Internal Link",
     "tagOpen": "[[Sacred:",
     "tagClose": "|]]",
     "sampleText": "Page Name you are linking to"};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/S2internallink.jpg",
     "speedTip": "Make a Sacred 2:Fallen Angel Internal Link",
     "tagOpen": "[[Sacred 2:",
     "tagClose": "|]]",
     "sampleText": "Type here what you want the link to be read as..."};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/questbutton.jpg",
     "speedTip": "Quest Template.  Push the preview to see results.",
     "tagOpen": "{{subst:Quest",
     "tagClose": "}}",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/chainquest.jpg",
     "speedTip": "ChainQuest Template.  Push the preview to see results.",
     "tagOpen": "{{subst:ChainQuest",
     "tagClose": "}}",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/place.jpg",
     "speedTip": "Place Template.  Push the preview to see results.",
     "tagOpen": "{{subst:Place",
     "tagClose": "}}",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/npc.jpg",
     "speedTip": "NPC Template.  Push the preview to see results.",
     "tagOpen": "{{subst:NPC",
     "tagClose": "}}",
     "sampleText": ""};
  }

var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
                'S1link': {
                        label: 'Sacred 1 Link', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'S1link.jpg',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "[[Sacred:",
					'periMsg': 'Page Name you want to link to',
					'post': "|]]"
				}
			}
          },
                'S2link': {
                        label: 'Sacred 2 Link', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'S2link.jpg',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "[[Sacred 2:",
					'periMsg': 'Page Name you want to link to',
					'post': "|]]"
					}
				}
			},
                'Quest': {
                        label: 'Quest Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'quest.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:Quest",
					'post': "}}"
					}
				}
			},
                'ChainQuest': {
                        label: 'Chain Quest Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'chainquest.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:ChainQuest",
					'post': "}}"
					}
				}
			},
                'Place': {
                        label: 'Place Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'place.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:Place",
					'post': "}}"
					}
				}
			},
                'NPC': {
                        label: 'NPC Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'NPC.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:NPC",
					'post': "}}"
					}
				}
			},
                'Dialogue': {
                        label: 'S2 Dialogue Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'dialogue.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:S2 Dialogue",
					'post': "}}"
					}
				}
			}
        }
} );
};
 
/* 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 () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor.toolbar', function () {
                                $(document).ready( customizeToolbar );
                        } );
                }
        } );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );